summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-10-27 19:51:48 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-10-27 19:51:48 -0400
commit2d7a47a99be783c1933af0b24978dc2bbdfe9350 (patch)
tree8eefffd8cf1f3db2ce6efcb8e50846c943e6df61 /index.php
parentdb4376c0c1d5d2ea72696e6d73b469cb2dc30b91 (diff)
parent29a3ffb99435827d5a7ea6886ac22bd2ee18d593 (diff)
Merge branch 'master' into multiuser-viewmultiuser-view
Conflicts: src/controllers/Users.class.php
Diffstat (limited to 'index.php')
-rw-r--r--index.php51
1 files changed, 31 insertions, 20 deletions
diff --git a/index.php b/index.php
index ad16995..6c17d47 100644
--- a/index.php
+++ b/index.php
@@ -1,7 +1,8 @@
<?php
-// What directory are we in on the server.
+// What directory are we in on the server? /////////////////////////////////////
define('BASEPATH', dirname(__FILE__));
+// Check for xss attacks. //////////////////////////////////////////////////////
$xss_file = BASEPATH.'/xss-check.php';
if (file_exists($xss_file)) {
require($xss_file);
@@ -11,14 +12,13 @@ if (file_exists($xss_file)) {
}
}
-// Decide where to look for things
-define('LIBPATH', BASEPATH.'/src/lib'.PATH_SEPARATOR.BASEPATH.'/src/ext');
-define('MODELPATH', BASEPATH.'/src/models');
-define('VIEWPATH', BASEPATH.'/src/views');// views are not objects
-define('CONTROLLERPATH', BASEPATH.'/src/controllers');
-define('PLUGINPATH', BASEPATH.'/src/plugins');
+// Decide where to look for things. ////////////////////////////////////////////
+define('LIBPATH', BASEPATH.'/src/lib'.PATH_SEPARATOR.BASEPATH.'/src/ext');
+define('MODELPATH', BASEPATH.'/src/models');
+define('VIEWPATH', BASEPATH.'/src/views');// views are not objects
+define('CONTROLLERPATH',BASEPATH.'/src/controllers');
+define('PLUGINPATH', BASEPATH.'/src/plugins');
-// Modify our include path to catch our class files.
set_include_path(get_include_path()
.PATH_SEPARATOR.LIBPATH
.PATH_SEPARATOR.MODELPATH
@@ -26,9 +26,10 @@ set_include_path(get_include_path()
.PATH_SEPARATOR.PLUGINPATH
);
-// Figure what page is trying to be loaded. Don't worry if we're
-// looking for a real file, if the requested page exists as a real
-// file, .htaccess won't even let us load this file.
+// Figure what page is trying to be loaded. ////////////////////////////////////
+// We don't have to do any check if it's a real file being looked for, if the
+// requested page exists as a real file, .htaccess won't even let us load
+// thisfile.
@$PAGE_RAW = $_GET['p'];
$PAGE_PARTS = explode('/', $PAGE_RAW);
$FILE = array_pop($PAGE_PARTS);
@@ -45,18 +46,28 @@ if ($PAGE=='') $PAGE = 'index';
define('PAGE', $PAGE); unset($PAGE);
define('PAGE_EXT', $EXT); unset($EXT);
-// Get ready
-//require_once('Model.class.php');
+// Include base MVC classes ////////////////////////////////////////////////////
+require_once('Model.class.php');
+require_once('View.class.php');
require_once('Controller.class.php');
-require_once('Router.class.php');
-require_once('ContactMethod.class.php');
-require('conf-contacts.php');
+// Check if we have a database configuration ///////////////////////////////////
+$conf_file = BASEPATH.'/conf.php';
+if (file_exists($conf_file)) {
+ require_once('Database.class.php');
+ new Database($conf_file);
+ session_start();
+} else {
+ $view = new View('no-conf');
+ $view->show(array());
+ exit();
+}
-global $mm;
-require_once('MessageManager.class.php');
-$mm = new MessageManager(BASEPATH.'/conf.php');
+// Kludgy ugly hacky hack //////////////////////////////////////////////////////
+require_once('ContactMethod.class.php');
+require(BASEPATH.'/conf-contacts.php');
-// Actually do stuff
+// Business ////////////////////////////////////////////////////////////////////
+require_once('Router.class.php');
$router = new Router(CONTROLLERPATH);
$router->route(PAGE);