summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-08-01 01:22:36 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-08-01 01:22:36 -0400
commit09dfe32eb6b538225686fd6ed0220240010bc574 (patch)
tree29c1afc5e79519ba8689a3d5d170c312d3cf5033 /index.php
initial commit.
Partway through a rewrite. I have some old files I didn't want to entirely delete.
Diffstat (limited to 'index.php')
-rw-r--r--index.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..c8f72a6
--- /dev/null
+++ b/index.php
@@ -0,0 +1,44 @@
+<?php
+// What directory are we in on the server.
+define('BASEPATH', dirname(__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');
+
+// Modify our include path to catch our class files.
+set_include_path(get_include_path()
+ .PATH_SEPARATOR.LIBPATH
+ .PATH_SEPARATOR.MODELPATH
+ .PATH_SEPARATOR.CONTROLLERPATH
+ );
+
+// 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.
+@$PAGE_RAW = $_GET['p'];
+preg_match('@(.*)(\.([^./]))?@', $PAGE_RAW, $matches);
+@$PAGE = $matches[1];
+@$EXT = $matches[3];
+@$ACCEPT = $_SERVER['HTTP_ACCEPT'];
+if ($PAGE=='')
+ $PAGE = 'index';
+if ($EXT!='')
+ $ACCEPT = "$EXT, $ACCEPT";
+define('PAGE', $PAGE); unset($PAGE);
+define('ACCEPT', $ACCEPT); unset($ACCEPT);
+
+// Get ready
+require_once('Model.class.php');
+require_once('Controller.class.php');
+require_once('Router.class.php');
+
+global $mm;
+require_once('MessageManager.class.php');
+$mm = new MessageManager(BASEPATH.'/conf.php');
+
+// Actually do stuff
+$router = new Router(CONTROLLERPATH);
+$router->route(PAGE);