Esempio n. 1
0
 /**
  * Attempts to autoload a model class.
  *
  * @param  string $model Model class name, without Model suffix.
  * @return bool
  */
 protected static function loadModel($model)
 {
     $path = RPG_Model::getPath() . '/' . strtolower($model) . '.php';
     if (file_exists($path)) {
         require $path;
         $class = $model . 'Model';
         return class_exists($class) && is_subclass_of($class, 'RPG_Model');
     }
 }
Esempio n. 2
0
}
// 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>
	<title>Application Error</title>