/** * Display the data through Smarty * * @param array $view The template to use * @param array $data The data to be used in the template * @return void */ public function runDisplay($view, $data) { $this->smarty->assign($data); $this->smarty->assign('input', ASO_Input::filterInput()); $this->smarty->assign('sess', ASO_Registry('sess')); // GZip compression //ob_start( 'ob_gzhandler' ); if (file_exists('app/views/global.tpl') && $view != 'error' && $view != '404') { $this->smarty->assign('templatefile', $view . '.tpl'); $this->smarty->display('global.tpl'); } else { $this->smarty->display($view . '.tpl'); } }
/** * Sends the browser to the page with errors, passed via session * * @param string $location Where to send the user if there are errors */ public function trap($location) { if (count(self::$_errors) > 0) { // Store the errors into the session for the following page load and redirect $sess =& ASO_Registry('sess'); $sess['ASO_Error'] = self::$_errors; $this->_controller->redirect($location); } }
/** * Constructor * * @return void */ public function __construct() { global $CONFIG; $conf =& ASO_Registry('config'); $conf = $this->config =& $CONFIG; $this->_setupExceptionHandling(); $this->_baseURL = preg_replace('#index\\.php.*#i', '', $_SERVER['PHP_SELF']); ASO_Display::factory($this->config['display_backend']); }
/** * Constructor * * Sets up the controller environment at the same time, including input filtering * and session access. * * @param array $config System configuration for setting up environment */ public function __construct($config) { // Verify that controller config is in an array. if (!is_array($config)) { throw new ASO_Controller_Exception('Controller configuraion must be in an array'); } $this->_setEnvironment(); $this->baseURL = $config['baseURL']; $this->config = $config; $input =& ASO_Registry('input'); $input = $this->input =& ASO_Input::filterInput(); $db =& ASO_Registry('db'); $db = $this->db = ASO_Db::factory($config['db_type'], $config); $this->_session = ASO_Session::factory($config['session_type'], array('db' => &$this->db, 'session_timeout' => $config['session_timeout'], 'session_domain' => $config['session_domain'], 'session_path' => $config['session_path'])); $sess =& ASO_Registry('sess'); $sess = $this->_session->getData(); $this->sess =& $sess; $error =& ASO_Registry('error'); $error = $this->error = new ASO_Error($this); $this->_loadPlugins(); // Run the setup function, if defined $this->_setup(); }