Esempio n. 1
0
 /**
  * function for checking if we need to redirect with 301
  * if param url is not equal to current url, then 
  * we redirect to url given
  * 
  * @param string $url the rul to check against and redirect to.
  * @param array $options set a action message with array ('message' => 'message');  
  */
 public static function permMovedHeader($redirect, $options = array())
 {
     if (isset($options['message'])) {
         session::setActionMessage($options['message']);
     }
     if ($_SERVER['REQUEST_URI'] != $redirect) {
         header("HTTP/1.1 301 Moved Permanently");
         self::locationHeader($redirect);
     }
 }
Esempio n. 2
0
 /**
  * method for relocate user to login, and after correct login 
  * redirect to the page where he was. You can set message to
  * be shown on login screen.
  *  
  * @param string $message 
  */
 public static function loginThenRedirect($message)
 {
     unset($_SESSION['return_to']);
     if (!session::isUser()) {
         $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
         session::setActionMessage($message);
         http::locationHeader('/account/login/index');
         die;
     }
 }