コード例 #1
0
ファイル: Controller.php プロジェクト: endelwar/zigra
 /**
  * Forwards current action to a new route.
  *
  * @param string $routename Name of route
  * @param array $params array of parameter for the route
  * @param int $statuscode HTTP status code
  * @param string $anchor string to append as hash anchor
  *
  * @return void
  */
 public function forward($routename, $params = array(), $statuscode = null, $anchor = null)
 {
     $url = Zigra_Router::generate($routename, $params);
     if ($url) {
         if (null !== $statuscode && array_key_exists($statuscode, self::$statusTexts)) {
             header('HTTP/1.1 ' . $statuscode . ' ' . self::$statusTexts[$statuscode], true);
         }
         if (null !== $anchor) {
             $url = $url . '#' . $anchor;
         }
         header('Location: ' . $url);
     } else {
         $this->forward404();
     }
     die;
 }
コード例 #2
0
ファイル: User.php プロジェクト: endelwar/zigra
 /**
  * Logout
  * @param string|null $routeName
  * @param array $routeParams
  * @throws Exception
  */
 public function logout($routeName = null, $routeParams = array())
 {
     // Clear the SESSION
     $_SESSION = array();
     // Destroy the SESSION
     session_unset();
     session_destroy();
     // Redirect
     if (null === $routeName) {
         $routeName = 'homepage';
     }
     $url = Zigra_Router::generate($routeName, $routeParams);
     header('Location: ' . $url);
 }