Ejemplo n.º 1
0
 /**
  * Initialize alerts alerts.
  * 
  * Initialize alerts alerts by copying redirected alerts from 
  * session to the local <var>$alerts</var> array.
  */
 public static function init()
 {
     // setup alerts
     self::$alerts[self::TYPE_ERROR] = array();
     self::$alerts[self::TYPE_NOTICE] = array();
     if (Pfw_Session::isStarted()) {
         //  setup session alerts
         $session_alerts = Pfw_Session::get(self::SESSION_KEY);
         if (isset($session_alerts)) {
             if (isset($session_alerts[self::TYPE_ERROR])) {
                 self::$alerts[self::TYPE_ERROR] = $session_alerts[self::TYPE_ERROR];
             }
             if (isset($session_alerts[self::TYPE_NOTICE])) {
                 self::$alerts[self::TYPE_NOTICE] = $session_alerts[self::TYPE_NOTICE];
             }
             Pfw_Session::clear(self::SESSION_KEY);
         }
     } else {
         error_log("Pfw_Session is not initialized prior to Pfw_Alert, " . "alerts / notices which follow redirects " . "may exhibit unexpected behavior", E_USER_WARNING);
     }
     self::$initialized = true;
 }
Ejemplo n.º 2
0
 /**
  * Logout
  */
 function logoutAction()
 {
     Pfw_Session::set('is_logged_in', false);
     Pfw_Session::clear('login_id');
     $this->redirect('/user/login');
 }