Пример #1
0
 /**
  * Require the user to log in and return to this page afterwards.
  *
  * @param string $action
  *   The action on the login page.
  */
 public static function requireLogin($action = '')
 {
     if (self::getInstance()->id == 0) {
         $query = array();
         if (!empty($action)) {
             $query['action'] = $action;
         }
         // Set the redirect parameter.
         $query['redirect'] = Request::getLocation();
         // Add the current query string.
         $redirect_query = $_GET;
         unset($redirect_query['request']);
         if (!empty($redirect_query)) {
             $query['redirect'] .= '?' . http_build_query($redirect_query);
         }
         Navigation::redirect('/user' . $action, $query);
     }
 }
Пример #2
0
 protected static function loadRequestSessionKey()
 {
     return Request::cookie(Configuration::get('session.cookie'), 'hex');
 }