Exemple #1
0
 /**
  * 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');
     }
 }
Exemple #2
0
 /**
  * Loads the session from the database
  *
  * @return void
  */
 private function _loadSession()
 {
     // Check if we've got an existing session stored
     $input =& ASO_Input::filterInput();
     if (!array_key_exists('session', $input)) {
         $this->newSession();
     } else {
         $this->_id = $input['session'];
         // Grab the session data from the database
         $result = $this->_db->get('session', "session_id = '{$this->_id}'");
         if ($this->_db->num_rows() == 1) {
             $this->_data = unserialize($result['data']);
             $this->_time = $result['time'];
             setcookie('session', $this->_id, time() + $this->timeout, $this->path, $this->domain, FALSE, TRUE);
         } else {
             $this->newSession();
         }
     }
 }
Exemple #3
0
 /** 
  * 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();
 }
Exemple #4
0
 /**
  * Loads the session from the database
  *
  * @return void
  */
 private function _loadSession()
 {
     // Check if we've got an existing session stored
     $input =& ASO_Input::filterInput();
     if (!array_key_exists('session', $input)) {
         $this->newSession();
     } else {
         session_start();
         $this->_id = $input['session'];
         if ($_SESSION['session_id'] == $this->_id) {
             $this->_data = $_SESSION['data'];
             $this->_time = $_SESSION['time'];
             setcookie('session', $this->_id, time() + $this->timeout, $this->path, $this->domain, FALSE, TRUE);
         } else {
             $this->newSession();
         }
     }
 }