예제 #1
0
파일: Auth.php 프로젝트: hzh123/my_yaf
 public function dispatchLoopStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
 {
     $session = Yaf_Session::getInstance();
     if (!isset($_COOKIE['wrm_uuid'])) {
         $identify = uniqid() . $_COOKIE['PHPSESSID'];
         setcookie('wrm_uuid', $identify, time() + 604800, '/', ".renmai.cn");
     } else {
         setcookie('wrm_uuid', $_COOKIE['wrm_uuid'], time() + 604800, '/', ".renmai.cn");
     }
     $isLogin = LoginHandler::isLogin();
     if (!$isLogin) {
         $_REQUEST['login'] = false;
         if ($this->isGuestAccessible($request)) {
             return;
         } else {
             if ($request->get('trace_type') == 'ajax') {
                 echo json_encode(array('code' => -1999, 'data' => array('login_status' => 0)));
                 haloDie();
             } else {
                 $this->goLoginWithBackUrl();
             }
             return;
         }
     } else {
         $_REQUEST['login'] = true;
         $this->syncSession($session, $response);
         $this->userAccessRedirect($request);
         //
         $model = UserAuthModel::singleton();
         //            $userInfo = $model->getBasicAuthInfo($this->getObjectId(),2);
         //            var_dump($userInfo);
     }
 }
예제 #2
0
 protected function inputErrorResult($code)
 {
     //        $desc = ErrorCode::errorMsgByCode($code);
     $desc = WrmErrorCodeManager::getErrorInfo($code, "client");
     echo json_encode(array('code' => $code, 'desc' => $desc));
     haloDie();
 }
예제 #3
0
 protected function inputErrorWithDesc($desc)
 {
     echo json_encode(array('code' => 410, 'desc' => $desc));
     haloDie();
 }