diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 51 |
1 files changed, 31 insertions, 20 deletions
@@ -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); |