コード例 #1
0
 public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     // if user is logged in and went here, something is definitely wrong
     if ($this->getDi()->auth->getUserId()) {
         $this->needRefresh($this->getDi()->auth->getUser());
         if (parse_url($request->getParam('url'), PHP_URL_SCHEME)) {
             $url = $request->getParam('url');
         } else {
             $url = sprintf('%s://%s%s', $request->isSecure() ? 'https' : 'http', $request->getHttpHost(), $request->getParam('url'));
         }
         Am_Controller::redirectLocation($url);
         return;
     }
     //
     require_once APPLICATION_PATH . '/default/controllers/LoginController.php';
     $c = new LoginController($request, $response, $invokeArgs);
     $c->setRedirectUrl($request->getEscaped('url'));
     $c->run();
 }
コード例 #2
0
ファイル: User.php プロジェクト: subashemphasize/test_site
 /** @return Am_Auth_User provides fluent interface */
 function requireLogin($redirectUrl = null)
 {
     if (!$this->getUserId()) {
         $front = Zend_Controller_Front::getInstance();
         if (!$front->getRequest()) {
             $front->setRequest(new Am_Request());
         } else {
             $front->setRequest(clone $front->getRequest());
         }
         $front->getRequest()->setActionName('index');
         if (!$front->getResponse()) {
             $front->setResponse(new Zend_Controller_Response_Http());
         }
         require_once APPLICATION_PATH . '/default/controllers/LoginController.php';
         $c = new LoginController($front->getRequest(), $front->getResponse(), array('di' => Am_Di::getInstance()));
         if ($redirectUrl) {
             $c->setRedirectUrl($redirectUrl);
         }
         $c->run();
         Zend_Controller_Front::getInstance()->getResponse()->sendResponse();
         exit;
     }
 }
コード例 #3
0
ファイル: new-rewrite.php プロジェクト: grlf/eyedock
 public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
 {
     if ($url = $request->get('url')) {
         $url = urldecode($url);
     }
     if ($request->get('host') && $request->get('ssl')) {
         $url = (!strcasecmp($request->get('ssl'), 'on') ? 'https://' : 'http://') . $request->get('host') . $url;
         $request->set('url', $url);
     }
     // if user is logged in and went here, something is definitely wrong
     if ($this->getDi()->auth->getUserId()) {
         $this->needRefresh($this->getDi()->auth->getUser());
         if (!parse_url($url, PHP_URL_SCHEME)) {
             $url = sprintf('%s://%s%s', $request->isSecure() ? 'https' : 'http', $request->getHttpHost(), $url);
         }
         Am_Controller::redirectLocation($url);
         return;
     }
     //
     require_once APPLICATION_PATH . '/default/controllers/LoginController.php';
     $c = new LoginController($request, $response, $invokeArgs);
     $c->setRedirectUrl(Am_Controller::escape($url));
     $c->run();
 }