示例#1
0
 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();
 }