diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-09-04 20:40:45 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-09-04 20:40:45 -0400 |
commit | 103332a30f8976fcc224c8f55dc23aba7b99e578 (patch) | |
tree | 32337915884fb6217007d569636f418130757df3 /index.php | |
parent | bca1b20b4fc6dca04368f8c03b5e1faeec5af7d3 (diff) |
New router and view selector engine magic coolness.
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -7,28 +7,34 @@ 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 .PATH_SEPARATOR.CONTROLLERPATH + .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. @$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"; +$PAGE_PARTS = explode('/', $PAGE_RAW); +$FILE = array_pop($PAGE_PARTS); +$regex = '@([^.]*)\\.(.*)@'; +if (preg_match($regex, $FILE, $matches)) { + @$FILE = $matches[1]; + @$EXT = $matches[2]; + array_push($PAGE_PARTS, $FILE); + $PAGE = implode('/', $PAGE_PARTS); +} else { + $PAGE = $PAGE_RAW; +} +if ($PAGE=='') $PAGE = 'index'; define('PAGE', $PAGE); unset($PAGE); -define('ACCEPT', $ACCEPT); unset($ACCEPT); +define('PAGE_EXT', $EXT); unset($EXT); // Get ready require_once('Model.class.php'); |