Allow flagging to controllerbase that a controller is single or multi project
Allow flagging to controllerbase that a controller is single or multi project

--- a/include/controller/ControllerBase.class.php
+++ b/include/controller/ControllerBase.class.php
@@ -39,6 +39,15 @@
 	protected $project;
 
 	/**
+	 * multiProject
+	 *
+	 * Flag if this is a multi project controller
+	 *
+	 * @access protected
+	 */
+	protected $multiProject;
+
+	/**
 	 * params
 	 *
 	 * Parameters
@@ -101,6 +110,10 @@
 				throw new GitPHP_MessageException(sprintf(__('Invalid project %1$s'), $_GET['p']), true);
 			}
 			$this->project = $project->GetProject();
+		}
+
+		if (!($this->project || $this->multiProject)) {
+			throw new GitPHP_MessageException(__('Project is required'), true);
 		}
 
 		if (isset($_GET['s']))

--- a/include/controller/Controller_Blame.class.php
+++ b/include/controller/Controller_Blame.class.php
@@ -18,22 +18,6 @@
  */
 class GitPHP_Controller_Blame extends GitPHP_ControllerBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_Blob.class.php
+++ b/include/controller/Controller_Blob.class.php
@@ -18,22 +18,6 @@
  */
 class GitPHP_Controller_Blob extends GitPHP_ControllerBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_Blobdiff.class.php
+++ b/include/controller/Controller_Blobdiff.class.php
@@ -20,22 +20,6 @@
  */
 class GitPHP_Controller_Blobdiff extends GitPHP_Controller_DiffBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_Commit.class.php
+++ b/include/controller/Controller_Commit.class.php
@@ -18,22 +18,6 @@
  */
 class GitPHP_Controller_Commit extends GitPHP_ControllerBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_Commitdiff.class.php
+++ b/include/controller/Controller_Commitdiff.class.php
@@ -20,22 +20,6 @@
  */
 class GitPHP_Controller_Commitdiff extends GitPHP_Controller_DiffBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_Feed.class.php
+++ b/include/controller/Controller_Feed.class.php
@@ -41,9 +41,6 @@
 	public function __construct()
 	{
 		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
 		$this->preserveWhitespace = true;
 	}
 

--- a/include/controller/Controller_Heads.class.php
+++ b/include/controller/Controller_Heads.class.php
@@ -18,22 +18,6 @@
  */
 class GitPHP_Controller_Heads extends GitPHP_ControllerBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_History.class.php
+++ b/include/controller/Controller_History.class.php
@@ -18,22 +18,6 @@
  */
 class GitPHP_Controller_History extends GitPHP_ControllerBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_Log.class.php
+++ b/include/controller/Controller_Log.class.php
@@ -18,22 +18,6 @@
  */
 class GitPHP_Controller_Log extends GitPHP_ControllerBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_Message.class.php
+++ b/include/controller/Controller_Message.class.php
@@ -28,6 +28,7 @@
 	 */
 	public function __construct()
 	{
+		$this->multiProject = true;
 		try {
 			parent::__construct();
 		} catch (Exception $e) {

--- a/include/controller/Controller_Project.class.php
+++ b/include/controller/Controller_Project.class.php
@@ -18,21 +18,6 @@
  */
 class GitPHP_Controller_Project extends GitPHP_ControllerBase
 {
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_ProjectList.class.php
+++ b/include/controller/Controller_ProjectList.class.php
@@ -29,6 +29,7 @@
 	 */
 	public function __construct()
 	{
+		$this->multiProject = true;
 		parent::__construct();
 	}
 

--- a/include/controller/Controller_Search.class.php
+++ b/include/controller/Controller_Search.class.php
@@ -42,11 +42,6 @@
 		}
 
 		parent::__construct();
-
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-
 	}
 
 	/**

--- a/include/controller/Controller_Tag.class.php
+++ b/include/controller/Controller_Tag.class.php
@@ -18,22 +18,6 @@
  */
 class GitPHP_Controller_Tag extends GitPHP_ControllerBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_Tags.class.php
+++ b/include/controller/Controller_Tags.class.php
@@ -18,22 +18,6 @@
  */
 class GitPHP_Controller_Tags extends GitPHP_ControllerBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

--- a/include/controller/Controller_Tree.class.php
+++ b/include/controller/Controller_Tree.class.php
@@ -18,22 +18,6 @@
  */
 class GitPHP_Controller_Tree extends GitPHP_ControllerBase
 {
-
-	/**
-	 * __construct
-	 *
-	 * Constructor
-	 *
-	 * @access public
-	 * @return controller
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		if (!$this->project) {
-			throw new GitPHP_MessageException(__('Project is required'), true);
-		}
-	}
 
 	/**
 	 * GetTemplate

comments