Use autoloading to load class files
Use autoloading to load class files

--- /dev/null
+++ b/include/AutoLoader.class.php
@@ -1,1 +1,91 @@
+<?php
+/**
+ * GitPHP AutoLoader
+ *
+ * Class to handle autoloading other classes
+ *
+ * @author Christopher Han <xiphux@gmail.com>
+ * @copyright Copyright (c) 2012 Christopher Han
+ * @package GitPHP
+ */
 
+/**
+ * AutoLoader class
+ *
+ * @package GitPHP
+ */
+class GitPHP_AutoLoader
+{
+	/**
+	 * AutoLoad
+	 *
+	 * Autoload a class
+	 *
+	 * @access public
+	 * @static
+	 * @param string $classname class name
+	 */
+	public static function AutoLoad($classname)
+	{
+		$filename = GitPHP_AutoLoader::ClassFilename($classname);
+
+		if (empty($filename))
+			return;
+
+		$path = __DIR__ . '/' . $filename;
+
+		if (is_readable($path))
+			require($path);
+	}
+
+	/**
+	 * ClassPath
+	 *
+	 * Gets the path a class
+	 *
+	 * @access public
+	 * @static
+	 * @param string $classname class name
+	 * @return string path
+	 */
+	public static function ClassFilename($classname)
+	{
+		if (empty($classname))
+			return null;
+
+		if (strncmp($classname, 'GitPHP_', 7) !== 0)
+			return null;
+
+		$classname = substr($classname, 7);
+
+		$path = '';
+		if (strncmp($classname, 'Controller', 10) === 0) {
+			$path = 'controller/';
+		} else if (strncmp($classname, 'ProjectList', 11) === 0) {
+			$path = 'git/projectlist/';
+		} else if (strpos($classname, 'Cache') !== false) {
+			$path = 'cache/';
+		} else if (in_array($classname, array(
+				'Config',
+				'DebugLog',
+				'MessageException',
+				'Resource',
+				'Util'
+			))) {
+			$path = '';
+		} else {
+			$path = 'git/';
+		}
+
+		if ((strlen($classname) > 10) && (substr_compare($classname, '_Interface', -10, 10) === 0)) {
+			$classname = substr($classname, 0, -10);
+			$path .= $classname . '.interface.php';
+		} else {
+			$path .= $classname . '.class.php';
+		}
+
+		return $path;
+	}
+
+}
+

--- a/include/Resource.class.php
+++ b/include/Resource.class.php
@@ -13,22 +13,30 @@
 require_once(GITPHP_BASEDIR . 'lib/php-gettext/gettext.php');
 
 /**
- * Constant of the locale cookie in the user's browser
- */
-define('GITPHP_LOCALE_COOKIE', 'GitPHPLocale');
-
-/**
- * Locale cookie lifetime
- */
-define('GITPHP_LOCALE_COOKIE_LIFETIME', 60*60*24*365);		// 1 year
-
-/**
  * Resource factory class
  *
  * @package GitPHP
  */
 class GitPHP_Resource
 {
+
+	/**
+	 * LocaleCookie
+	 *
+	 * Constant of the locale cookie in the user's browser
+	 *
+	 * @const
+	 */
+	const LocaleCookie = 'GitPHPLocale';
+
+	/**
+	 * LocaleCookieLifetime
+	 *
+	 * Locale cookie lifetime
+	 *
+	 * @const
+	 */
+	const LocaleCookieLifetime = 31536000;	// 1 year
 	
 	/**
 	 * instance

--- a/include/controller/Controller.class.php
+++ b/include/controller/Controller.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Controller
  */
-
-require_once(GITPHP_CONTROLLERDIR . 'ControllerBase.class.php');
 
 /**
  * Controller
@@ -37,68 +35,55 @@
 
 		switch ($action) {
 			case 'search':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Search.class.php');
 				$controller = new GitPHP_Controller_Search();
 				break;
 			case 'commitdiff':
 			case 'commitdiff_plain':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Commitdiff.class.php');
 				$controller = new GitPHP_Controller_Commitdiff();
 				if ($action === 'commitdiff_plain')
 					$controller->SetParam('plain', true);
 				break;
 			case 'blobdiff':
 			case 'blobdiff_plain':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Blobdiff.class.php');
 				$controller = new GitPHP_Controller_Blobdiff();
 				if ($action === 'blobdiff_plain')
 					$controller->SetParam('plain', true);
 				break;
 			case 'history':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_History.class.php');
 				$controller = new GitPHP_Controller_History();
 				break;
 			case 'shortlog':
 			case 'log':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Log.class.php');
 				$controller = new GitPHP_Controller_Log();
 				if ($action === 'shortlog')
 					$controller->SetParam('short', true);
 				break;
 			case 'snapshot':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Snapshot.class.php');
 				$controller = new GitPHP_Controller_Snapshot();
 				break;
 			case 'tree':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Tree.class.php');
 				$controller = new GitPHP_Controller_Tree();
 				break;
 			case 'tag':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Tag.class.php');
 				$controller = new GitPHP_Controller_Tag();
 				break;
 			case 'tags':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Tags.class.php');
 				$controller = new GitPHP_Controller_Tags();
 				break;
 			case 'heads':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Heads.class.php');
 				$controller = new GitPHP_Controller_Heads();
 				break;
 			case 'blame':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Blame.class.php');
 				$controller = new GitPHP_Controller_Blame();
 				break;
 			case 'blob':
 			case 'blob_plain':	
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Blob.class.php');
 				$controller = new GitPHP_Controller_Blob();
 				if ($action === 'blob_plain')
 					$controller->SetParam('plain', true);
 				break;
 			case 'atom':
 			case 'rss':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Feed.class.php');
 				$controller = new GitPHP_Controller_Feed();
 				if ($action == 'rss')
 					$controller->SetParam('format', GITPHP_FEED_FORMAT_RSS);
@@ -106,29 +91,23 @@
 					$controller->SetParam('format', GITPHP_FEED_FORMAT_ATOM);
 				break;
 			case 'commit':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Commit.class.php');
 				$controller = new GitPHP_Controller_Commit();
 				break;
 			case 'summary':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_Project.class.php');
 				$controller = new GitPHP_Controller_Project();
 				break;
 			case 'project_index':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_ProjectList.class.php');
 				$controller = new GitPHP_Controller_ProjectList();
 				$controller->SetParam('txt', true);
 				break;
 			case 'opml':
-				require_once(GITPHP_CONTROLLERDIR . 'Controller_ProjectList.class.php');
 				$controller = new GitPHP_Controller_ProjectList();
 				$controller->SetParam('opml', true);
 				break;
 			default:
 				if (isset($_GET['p'])) {
-					require_once(GITPHP_CONTROLLERDIR . 'Controller_Project.class.php');
 					$controller = new GitPHP_Controller_Project();
 				} else {
-					require_once(GITPHP_CONTROLLERDIR . 'Controller_ProjectList.class.php');
 					$controller = new GitPHP_Controller_ProjectList();
 				}
 		}

--- a/include/controller/ControllerBase.class.php
+++ b/include/controller/ControllerBase.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Controller
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'Archive.class.php');
 
 /**
  * ControllerBase class

--- a/include/controller/Controller_Blame.class.php
+++ b/include/controller/Controller_Blame.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Controller
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'FileBlame.class.php');
 
 /**
  * Blame controller class

--- a/include/controller/Controller_Blobdiff.class.php
+++ b/include/controller/Controller_Blobdiff.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Controller
  */
-
-require_once(GITPHP_CONTROLLERDIR . 'Controller_DiffBase.class.php');
 
 /**
  * Blobdiff controller class

--- a/include/controller/Controller_Commitdiff.class.php
+++ b/include/controller/Controller_Commitdiff.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Controller
  */
-
-require_once(GITPHP_CONTROLLERDIR . 'Controller_DiffBase.class.php');
 
 /**
  * Commitdiff controller class

--- a/include/controller/Controller_Feed.class.php
+++ b/include/controller/Controller_Feed.class.php
@@ -10,8 +10,6 @@
  * @package GitPHP
  * @subpackage Controller
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'Log.class.php');
 
 /**
  * Constant for the number of items to load into the feed

--- a/include/controller/Controller_History.class.php
+++ b/include/controller/Controller_History.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Controller
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'FileHistory.class.php');
 
 /**
  * History controller class

--- a/include/controller/Controller_Log.class.php
+++ b/include/controller/Controller_Log.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Controller
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'Log.class.php');
 
 /**
  * Log controller class

--- a/include/controller/Controller_Project.class.php
+++ b/include/controller/Controller_Project.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Controller
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'Log.class.php');
 
 /**
  * Project controller class

--- a/include/controller/Controller_Search.class.php
+++ b/include/controller/Controller_Search.class.php
@@ -9,9 +9,6 @@
  * @package GitPHP
  * @subpackage Controller
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'CommitSearch.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'FileSearch.class.php');
 
 /**
  * Constants for the various search types

--- a/include/git/Archive.class.php
+++ b/include/git/Archive.class.php
@@ -9,9 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'GitExe.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Commit.class.php');
 
 /**
  * Archive class

--- a/include/git/Blob.class.php
+++ b/include/git/Blob.class.php
@@ -9,9 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'FilesystemObject.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'GitExe.class.php');
 
 /**
  * Commit class

--- a/include/git/Commit.class.php
+++ b/include/git/Commit.class.php
@@ -9,11 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'GitExe.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'GitObject.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Tree.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'TreeDiff.class.php');
 
 /**
  * Commit class

--- a/include/git/CommitSearch.class.php
+++ b/include/git/CommitSearch.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'RevList.class.php');
 
 /**
  * CommitSearch class

--- a/include/git/FileDiff.class.php
+++ b/include/git/FileDiff.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'Blob.class.php');
 
 require_once(GITPHP_BASEDIR . 'lib/php-diff/lib/Diff.php');
 require_once(GITPHP_BASEDIR . 'lib/php-diff/lib/Diff/Renderer/Text/Unified.php');

--- a/include/git/FileSearch.class.php
+++ b/include/git/FileSearch.class.php
@@ -9,10 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'Pagination.interface.php');
-require_once(GITPHP_GITOBJECTDIR . 'Project.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'FileSearchResult.class.php');
 
 /**
  * FileSearch class

--- a/include/git/GitConfig.class.php
+++ b/include/git/GitConfig.class.php
@@ -10,8 +10,6 @@
  * @subpackage Git
  */
 
-require_once(GITPHP_GITOBJECTDIR . 'GitExe.class.php');
-
 /**
  * GitConfig class
  *

--- a/include/git/Head.class.php
+++ b/include/git/Head.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'Ref.class.php');
 
 /**
  * Head class

--- a/include/git/HeadList.class.php
+++ b/include/git/HeadList.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'RefList.class.php');
 
 /**
  * HeadList

--- a/include/git/Log.class.php
+++ b/include/git/Log.class.php
@@ -9,9 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'RevList.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Commit.class.php');
 
 /**
  * Log class

--- a/include/git/Project.class.php
+++ b/include/git/Project.class.php
@@ -10,15 +10,6 @@
  * @subpackage Git
  */
 
-require_once(GITPHP_GITOBJECTDIR . 'GitExe.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Commit.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Head.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Tag.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Pack.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'HeadList.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'TagList.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'GitObjectLoader.class.php');
-
 define('GITPHP_ABBREV_HASH_MIN', 7);
 
 /**

--- a/include/git/Ref.class.php
+++ b/include/git/Ref.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'GitObject.class.php');
 
 /**
  * Git Ref class

--- a/include/git/RevList.class.php
+++ b/include/git/RevList.class.php
@@ -10,9 +10,6 @@
  * @subpackage Git
  */
 
-require_once(GITPHP_GITOBJECTDIR . 'Pagination.interface.php');
-require_once(GITPHP_GITOBJECTDIR . 'Project.class.php');
-
 /**
  * RevList class
  *

--- a/include/git/Tag.class.php
+++ b/include/git/Tag.class.php
@@ -9,9 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'GitExe.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Ref.class.php');
 
 /**
  * Tag class

--- a/include/git/TagList.class.php
+++ b/include/git/TagList.class.php
@@ -9,8 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'RefList.class.php');
 
 /**
  * TagList

--- a/include/git/Tree.class.php
+++ b/include/git/Tree.class.php
@@ -9,9 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'FilesystemObject.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'GitExe.class.php');
 
 /**
  * Tree class

--- a/include/git/TreeDiff.class.php
+++ b/include/git/TreeDiff.class.php
@@ -10,8 +10,6 @@
  * @subpackage Git
  */
 
-require_once(GITPHP_GITOBJECTDIR . 'FileDiff.class.php');
-
 /**
  * TreeDiff class
  *

--- a/include/git/projectlist/ProjectList.class.php
+++ b/include/git/projectlist/ProjectList.class.php
@@ -9,12 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectListDirectory.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectListFile.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectListArray.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectListArrayLegacy.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectListScmManager.class.php');
 
 /**
  * ProjectList class

--- a/include/git/projectlist/ProjectListArray.class.php
+++ b/include/git/projectlist/ProjectListArray.class.php
@@ -9,9 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectListBase.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Project.class.php');
 
 /**
  * ProjectListArray class

--- a/include/git/projectlist/ProjectListArrayLegacy.class.php
+++ b/include/git/projectlist/ProjectListArrayLegacy.class.php
@@ -10,9 +10,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectListBase.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Project.class.php');
 
 define('GITPHP_NO_CATEGORY', 'none');
 

--- a/include/git/projectlist/ProjectListBase.class.php
+++ b/include/git/projectlist/ProjectListBase.class.php
@@ -9,9 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_GITOBJECTDIR . 'Project.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'GitConfig.class.php');
 
 define('GITPHP_SORT_PROJECT', 'project');
 define('GITPHP_SORT_DESCRIPTION', 'descr');

--- a/include/git/projectlist/ProjectListDirectory.class.php
+++ b/include/git/projectlist/ProjectListDirectory.class.php
@@ -9,10 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_INCLUDEDIR . 'Config.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectListBase.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Project.class.php');
 
 /**
  * ProjectListDirectory class

--- a/include/git/projectlist/ProjectListFile.class.php
+++ b/include/git/projectlist/ProjectListFile.class.php
@@ -9,10 +9,6 @@
  * @package GitPHP
  * @subpackage Git
  */
-
-require_once(GITPHP_INCLUDEDIR . 'Config.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectListBase.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Project.class.php');
 
 /**
  * ProjectListFile class

--- a/include/git/projectlist/ProjectListScmManager.class.php
+++ b/include/git/projectlist/ProjectListScmManager.class.php
@@ -10,10 +10,6 @@
  * @subpackage Git
  */
 
-require_once(GITPHP_INCLUDEDIR . 'Config.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectListBase.class.php');
-require_once(GITPHP_GITOBJECTDIR . 'Project.class.php');
-
 /**
  * ProjectListScmManager class
  *

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -37,25 +37,9 @@
 
 include(GITPHP_INCLUDEDIR . 'version.php');
 
-require_once(GITPHP_INCLUDEDIR . 'Util.class.php');
+require(GITPHP_INCLUDEDIR . 'AutoLoader.class.php');
 
-require_once(GITPHP_INCLUDEDIR . 'Config.class.php');
-
-require_once(GITPHP_INCLUDEDIR . 'Resource.class.php');
-
-require_once(GITPHP_INCLUDEDIR . 'DebugLog.class.php');
-
-require_once(GITPHP_GITOBJECTDIR . 'projectlist/ProjectList.class.php');
-
-require_once(GITPHP_INCLUDEDIR . 'MessageException.class.php');
-
-require_once(GITPHP_CONTROLLERDIR . 'Controller.class.php');
-
-require_once(GITPHP_CACHEDIR . 'Cache.class.php');
-require_once(GITPHP_CACHEDIR . 'MemoryCache.class.php');
-
-// Test these executables early
-require_once(GITPHP_GITOBJECTDIR . 'GitExe.class.php');
+spl_autoload_register(array('GitPHP_AutoLoader', 'AutoLoad'));
 
 date_default_timezone_set('UTC');
 
@@ -63,7 +47,7 @@
 /*
  * Set the locale based on the user's preference
  */
-if ((!isset($_COOKIE[GITPHP_LOCALE_COOKIE])) || empty($_COOKIE[GITPHP_LOCALE_COOKIE])) {
+if ((!isset($_COOKIE[GitPHP_Resource::LocaleCookie])) || empty($_COOKIE[GitPHP_Resource::LocaleCookie])) {
 
 	/*
 	 * User's first time here, try by HTTP_ACCEPT_LANGUAGE
@@ -72,7 +56,7 @@
 		$httpAcceptLang = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
 		$preferredLocale = GitPHP_Resource::FindPreferredLocale($_SERVER['HTTP_ACCEPT_LANGUAGE']);
 		if (!empty($preferredLocale)) {
-			setcookie(GITPHP_LOCALE_COOKIE, $preferredLocale, time()+GITPHP_LOCALE_COOKIE_LIFETIME);
+			setcookie(GitPHP_Resource::LocaleCookie, $preferredLocale, time()+GitPHP_Resource::LocaleCookieLifetime);
 			GitPHP_Resource::Instantiate($preferredLocale);
 		}
 	}
@@ -81,7 +65,7 @@
 		/*
 		 * Create a dummy cookie to prevent browser delay
 		 */
-		setcookie(GITPHP_LOCALE_COOKIE, 0, time()+GITPHP_LOCALE_COOKIE_LIFETIME);
+		setcookie(GitPHP_Resource::LocaleCookie, 0, time()+GitPHP_Resource::LocaleCookieLifetime);
 	}
 
 } else if (isset($_GET['l']) && !empty($_GET['l'])) {
@@ -89,15 +73,15 @@
 	/*
 	 * User picked something
 	 */
-	setcookie(GITPHP_LOCALE_COOKIE, $_GET['l'], time()+GITPHP_LOCALE_COOKIE_LIFETIME);
+	setcookie(GitPHP_Resource::LocaleCookie, $_GET['l'], time()+GitPHP_Resource::LocaleCookieLifetime);
 	GitPHP_Resource::Instantiate($_GET['l']);
 
-} else if (isset($_COOKIE[GITPHP_LOCALE_COOKIE]) && !empty($_COOKIE[GITPHP_LOCALE_COOKIE])) {
+} else if (isset($_COOKIE[GitPHP_Resource::LocaleCookie]) && !empty($_COOKIE[GitPHP_Resource::LocaleCookie])) {
 
 	/*
 	 * Returning visitor with a preference
 	 */
-	GitPHP_Resource::Instantiate($_COOKIE[GITPHP_LOCALE_COOKIE]);
+	GitPHP_Resource::Instantiate($_COOKIE[GitPHP_Resource::LocaleCookie]);
 
 }
 
@@ -162,7 +146,6 @@
 		GitPHP_Resource::Instantiate('en_US');
 	}
 
-	require_once(GITPHP_CONTROLLERDIR . 'Controller_Message.class.php');
 	$controller = new GitPHP_Controller_Message();
 	$controller->SetParam('message', $e->getMessage());
 	if ($e instanceof GitPHP_MessageException) {

comments