diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-01-07 08:21:00 -0800 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-01-07 10:20:28 -0800 |
commit | 464f4d3497617fadb9d7752868f1175849cfa6d2 (patch) | |
tree | 0771bd935b30971bf2c244b6f158ed7496b644e5 /index.php | |
parent | 3d64793a1ee45857856be1cd71c3a0a040a3e869 (diff) |
Refactor to separate the framework from the app; drop message stuff, this app is just user management. Add a json view for individual usersHEADmaster
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 35 |
1 files changed, 29 insertions, 6 deletions
@@ -11,13 +11,34 @@ if (file_exists($xss_file)) { exit(); } } +unset($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'); +$app_path = glob(BASEPATH.'/apps/*'); +array_unshift($app_path, BASEPATH.'/lpf'); + +$libpath = array(); +$modelpath = array(); +$viewpath = array(); +$controllerpath = array(); +$pluginpath = array(); + +foreach ($app_path as $dir) { + if (is_dir($dir.'/lib' )) { $libpath[] = $dir.'/lib'; } + if (is_dir($dir.'/ext' )) { $libpath[] = $dir.'/ext'; } + if (is_dir($dir.'/models' )) { $modelpath[] = $dir.'/models'; } + if (is_dir($dir.'/views' )) { $viewpath[] = $dir.'/views'; } + if (is_dir($dir.'/controllers')) { $controllerpath[] = $dir.'/controllers'; } + if (is_dir($dir.'/plugins' )) { $controllerpath[] = $dir.'/plugins'; } +} +unset($app_path); + +define('LIBPATH', implode(PATH_SEPARATOR, $libpath )); unset($libpath); +define('MODELPATH', implode(PATH_SEPARATOR, $modelpath )); unset($modelpath); +/*define('VIEWPATH', implode(PATH_SEPARATOR, $viewpath ));*/ unset($viewpath); +define('VIEWPATH', BASEPATH.'/apps/um/views'); +define('CONTROLLERPATH',implode(PATH_SEPARATOR, $controllerpath)); unset($controllerpath); +define('PLUGINPATH', implode(PATH_SEPARATOR, $pluginpath )); unset($pluginpath); set_include_path(get_include_path() .PATH_SEPARATOR.LIBPATH @@ -29,7 +50,6 @@ set_include_path(get_include_path() // 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); @@ -42,6 +62,8 @@ if (preg_match($regex, $FILE, $matches)) { } else { $PAGE = $PAGE_RAW; } +unset($PAGE_RAW); unset($PAGE_PARTS); unset($FILE); unset($regex); + if ($PAGE=='') $PAGE = 'index'; define('PAGE', $PAGE); unset($PAGE); define('PAGE_EXT', $EXT); unset($EXT); @@ -62,6 +84,7 @@ if (file_exists($conf_file)) { $view->show(array()); exit(); } +unset($conf_file); // Kludgy ugly hacky hack ////////////////////////////////////////////////////// require_once('ContactMethod.class.php'); |