diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-01-08 17:45:50 -0800 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-01-08 17:45:50 -0800 |
commit | 4c58c41d818918b1690b56f05876d9af642354c0 (patch) | |
tree | b07c0f2925a5753ab3c34379db5c90c5dc38bad1 /stub.php | |
parent | 83e460cdc3fc09867a3adb48c3d0894579dd3050 (diff) | |
parent | 3d64793a1ee45857856be1cd71c3a0a040a3e869 (diff) |
Diffstat (limited to 'stub.php')
-rw-r--r-- | stub.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/stub.php b/stub.php new file mode 100644 index 0000000..2771fec --- /dev/null +++ b/stub.php @@ -0,0 +1,55 @@ +<?php +// What directory are we in on the server? ///////////////////////////////////// +define('BASEPATH', dirname(__FILE__)); + +// Decide where to look for things. //////////////////////////////////////////// +$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 + .PATH_SEPARATOR.MODELPATH + .PATH_SEPARATOR.CONTROLLERPATH + .PATH_SEPARATOR.PLUGINPATH + ); + +// Include base MVC classes //////////////////////////////////////////////////// +require_once('Model.class.php'); +require_once('View.class.php'); +require_once('Controller.class.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(); +} +unset($conf_file); |