Beispiel #1
0
    require RPG_LIBRARY_PATH . '/RPG/Session/Hybrid.php';
}
// Set up the error handler
set_error_handler(array('RPG', 'handlePhpError'));
// Default configuration items
$defaultConfig = array('modelPath' => RPG_ROOT . '/models', 'viewPath' => RPG_ROOT . '/views', 'controllerPath' => RPG_ROOT . '/controllers', 'cachePath' => RPG_ROOT . '/cache', 'tmpPath' => RPG_ROOT . '/tmp', 'sessionPath' => RPG_ROOT . '/tmp/sessions', 'objectsPath' => RPG_ROOT . '/cache/objects');
// Override defaults if needed
$config = array_merge($defaultConfig, $config);
//
// Start the main execution!
// Top-level try/catch block for a last-ditch effort error page.
//
try {
    // Initialize the system
    RPG::setConfig($config);
    RPG_Template::setPath($config['viewPath']);
    RPG_Model::setPath($config['modelPath']);
    RPG::session();
    RPG::user(RPG::model('user'));
    // add this now, so controllers can include CSS that overrides defaults
    RPG::view()->addStyleSheet('media/styles/light.css');
    // Process the request
    RPG::router($config['controllerPath'])->processRequest();
    // stop the timer - needs to be here so it can get rendered via templates
    RPG::debug('Execution Time (pre-render): ' . round(microtime(true) - RPG::get('__debug_time'), 4));
    // Render the output - TODO: handle styles differently later
    RPG::view()->render();
} catch (RPG_Exception $ex) {
    // Basic error page
    echo '<html>
<head>