// revert to defaults if necessary if (empty($runtime['controller'])) { $runtime['controller'] = $defaults['controller']; } if (empty($runtime['action'])) { $runtime['action'] = 'index'; } // this will be included from wrapper.php $runtime['view'] = PATH_TO_VIEWS . "{$runtime['format']}/{$runtime['controller']}/{$runtime['action']}.php"; $runtime['layout'] = PATH_TO_VIEWS . "{$runtime['format']}/layout.php"; // FIXME: this next line is ugly... if ($runtime['action'] == 'list') { $runtime['action'] = 'all'; } // 'list' is already a php function // load, initialize the main class (if it's there and it's not a crazy url) $controller_path = PATH_TO_CONTROLLERS . "{$runtime['controller']}-controller.php"; if (file_exists($controller_path)) { include $controller_path; eval("\$main_controller = new {$runtime['controller']}" . "_controller();"); eval("\$main_controller -> {$runtime['action']}();"); } else { $runtime['notfound'] = true; } // get the show on the road if ($runtime['layout']) { include $runtime['layout']; } // finish up do_hooks('absolute_end');
define('PATH_TO_MODELS', 'app/models'); define('PATH_TO_VIEWS', 'app/views/'); define('PATH_TO_CONTROLLERS', 'app/controllers/'); define('PATH_TO_APP_HELPERS', 'app/helpers/'); // system paths define('ROOT', realpath(dirname(__FILE__) . "/../") . '/'); define('PATH_TO_CORE', 'core/'); define('PATH_TO_SCHEMA_CACHE', 'core/db/logs/schema-cache.txt'); define('PATH_TO_LOG', 'core/log.txt'); define('PATH_TO_HELPERS', 'helpers/'); define('PATH_TO_LIB', 'lib/'); include 'core/utils.php'; // get core include_dir(PATH_TO_CORE); // for timer, etc do_hooks('absolute_beginning'); // get helpers, lib include_dir(PATH_TO_HELPERS); include_dir(PATH_TO_LIB); // get config include PATH_TO_CONFIG; // log the request if ($config['keep_log']) { write_to_log("\n" . $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n"); } // set error reporting (defined in config) if ($config['error_reporting']) { error_reporting($config['error_reporting']); } // connect to database if (!empty($config['database'])) {