public function before($context)
 {
     /*{{{*/
     $curOperator = DAL::get()->find("TeleOperator", $context->request->getCookie('operator'));
     /**
      * 如果没有登录,调到登录页面 
      */
     if ($curOperator->isNull()) {
         header('Location:http://' . URL_PREFIX . 'callcenter.haodf.com/operator/login');
         exit;
     }
     $bk = $context->request->getCookie('bk');
     $ip = RequestDelegate::getIp();
     $session = SessionDefault::singleton();
     /**
      * 网站用户已登录,而且允许在外网访问管理后台
      * 或者
      * 是超级管理员
      * 可以在外放访问呼叫中心
      */
     if (false == RequestDelegate::isOfficeIp()) {
         if ($bk && isset($session->UserId) && BackYardAuth::authVerificationCode($bk, $session->UserId, $ip) || $curOperator->isSupperAdmin()) {
         } else {
             echo "本系统只允许在办公室内使用!";
             exit;
         }
     }
 }
Example #2
0
	public static function getIp() {
        if (isset($_COOKIE['forceipaddress']) && $_COOKIE['forceipaddress'])
        {
            return $_COOKIE['forceipaddress'];
        }
		return RequestDelegate::getIp();
	}
 private function backYardAuth($context)
 {
     $ip = RequestDelegate::getIp();
     $userInfo = $context->request->getCookie('userinfo');
     $userId = isset($userInfo['id'])?$userInfo['id']:0;
     $bk = $context->request->getCookie('bk');
     return ($bk && isset($userId) && BackYardAuth::authVerificationCode($bk, $userId, $ip));
 }
 private function addSearchLog($kw)
 {/*{{{*/
     if(false == empty($kw))
     {
         $ip = RequestDelegate::getIp();
         BeanFinder::get('logger')->addInfo('ip '.$ip.' searchword '.$kw);
     }
 }/*}}}*/
	public function before($context)
	{
        $ip = RequestDelegate::getIp();
        $userInfo = $context->request->getCookie('userinfo');
        if(isset($_COOKIE['bk']) && isset($userInfo['id']) && BackYardAuth::authVerificationCode($_COOKIE['bk'], $userInfo['id'], $ip))
        {
        }
        else if(false == RequestDelegate::isOfficeIp())
        {
            echo '系统错误,请联系技术人员!!!';exit;
        }
    }
Example #6
0
 public function getUserInfo($access_token, $openid)
 {
     /*{{{*/
     $param['format'] = self::RESULT_FORMAT_JSON;
     $param['oauth_consumer_key'] = $this->appkey;
     $param['access_token'] = $access_token;
     $param['openid'] = $openid;
     $param['clientip'] = RequestDelegate::getIp();
     $param['oauth_version'] = Self::VERSION;
     $param['scope'] = 'all';
     $url = $this->userInfoUrl;
     $res = $this->remoter->request($url, 'get', $param, '', $this->timeout);
     return json_decode($res);
 }
 public function send($access_token, $openid, $content)
 {
     /*{{{*/
     $content = mb_convert_encoding($content, 'utf-8', 'auto');
     $param['content'] = $content;
     $param['format'] = parent::RESULT_FORMAT_JSON;
     $param['clientip'] = RequestDelegate::getIp();
     $param['oauth_consumer_key'] = $this->appkey;
     $param['access_token'] = $access_token;
     $param['openid'] = $openid;
     $param['oauth_version'] = parent::VERSION;
     $param['scope'] = 'all';
     $url = $this->sendUrl;
     $res = $this->remoter->request($url, 'post', $param, '', $this->timeout);
     return json_decode($res);
 }
 public function auth($request, $response)
 {
     /*{{{*/
     $userName = $request->field1;
     $password = $request->field4;
     $userToken = $request->bk2;
     if (false == empty($userName) && false == empty($password)) {
         $user = UserClient::getInstance()->checkPassword($userName, $password);
         if ($user->isNull()) {
             echo "系统错误,请联系技术人员!!!!";
             exit;
         } else {
             if (false == isset($_COOKIE['bk']) || $userToken != $_COOKIE['bk']) {
                 if (@setcookie('bk', $userToken, 0, '/', 'haodf.com')) {
                     $_COOKIE['bk'] = $userToken;
                 }
             }
             $ip = RequestDelegate::getIp();
             PrivilegeClient::getInstance()->bindUser($user->id, $userToken, $ip);
             echo "成功";
             exit;
         }
     }
 }
Example #9
0
 private function prepareEnvInfo()
 {
     /*{{{*/
     $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
     $this->addTransInfo('request_uri', $uri);
     $sysinfo = posix_uname();
     $this->addTransInfo('node', $sysinfo['nodename']);
     $this->addTransInfo('remote_addr', RequestDelegate::getIp());
     $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
     $this->addTransInfo('http_user_agent', $userAgent);
     //传递客户端的调用堆栈给服务端供异常抛出时获取调用堆栈
     //if ($this->_clientUtil->debug)
     //{
     //    try
     //    {
     //        throw new Exception();
     //    }
     //    catch (Exception $ex)
     //    {
     //        $this->addTransInfo('xdebug_trace', $ex->getTraceAsString());
     //    }
     //}
 }
Example #10
0
 public function creatNewOrderbyOldOrder($request, $response)
 {/*{{{*/
     $product = DAL::get()->mustFind('product', $request->productid);
     if ($product->isNull()) $this->exit();
     $proposal = DAL::get()->find('Proposal', $request->telOrderId);
     $ip = RequestDelegate::getIp();
     $intention = IntentionClient::getInstance()->createWithProduct($proposal->patient, $product, Intention::SRC_TOUCH, array(), $ip);
     NodeClient::getInstance()->copyFromSources($intention, array($proposal));//复制病例
     $response->setRedirect($response->router->urlfor('tel/payway', array('payableid'=>$intention->id)));
 }/*}}}*/
    public function add($request, $response)
    {/*{{{*/
        $this->breakIfLessMessage($request, $response);
        if ($response->isQQ)
        {
            $this->checkLogin($request, $response);  
        }
        $isLogin = UserClient::getInstance()->isLogin();
        if ($isLogin == true)
        {
            $curUser = $this->_newUser;
        }
        else
        {
            $username = $request->username;
            $password = $request->password;
            $curUser = UserClient::getInstance()->register($username, $password);
            User::sendRegisterMsg($curUser->id);
            $curUser = UserClient::getInstance()->login($username, $password, false, null, $this->partnerDomain);
        }

        if ($curUser->isNull())
        {
            throw new BizException('该邮箱已被注册!');;
        }

        if (false == $curUser->allowQuestion())
        {
            throw new BizException('不允许提问');
        }

        $patient = $this->getPatient($request, $curUser);
        $space = DAL::get()->find('space', $request->host_id);
        $ip = RequestDelegate::getIp();
        $diseaseDto = BingLiDto::createDiseaseDto(XString::convertToGbk($request->case_disease_tag), $patient->id);
        $titleDto = BingLiDto::createTitleDto(XString::convertToGbk($request->case_title), $patient->id);
        $hospitalDto = BingLiDto::createHospitalDto(XString::convertToGbk($request->case_prehospital), XString::convertToGbk($request->case_prekeshi), $patient->id);
        $hopeHelpDto = BingLiDto::createHopeHelpDto(XString::convertToGbk($request->post_help), $patient->id);
        $content = "检查及化验:\n".XString::convertToGbk($request->post_content).
            "\n治疗情况(当前用药或近期手术):\n".XString::convertToGbk($request->post_effects).
            "\n病史:\n".XString::convertToGbk($request->post_history);
        if(XString::getLengthOfGBKString(XString::getLengthOfGBKString($content)>1000))
        {
            throw new BizException('请精简您所填写的病情信息');
        }
        $contentDto = BingLiDto::createConditionDescDto($content, $patient->id);
        $realBingLiDtos = NodeClient::getInstance()->addBingLis(array(
            $diseaseDto, $titleDto, $hospitalDto, $hopeHelpDto, $contentDto,
        ), NodeObj::SOURCE_PATIENT);

        if(false == $space->isNull())
        {
            $product = ProductClient::getInstance()->getFirstFlowProduct($space);
        }
        else
        {
            $product = FirstFlowPoolVirtualProduct::fetch();
        }

        SpaceClient::getInstance()->ensureAllowAskRule($curUser, $space);
        $src = $_SERVER['HTTP_HOST'];
        $intention = IntentionClient::getInstance()->createWithProduct($patient, $product, $src, $realBingLiDtos, $ip);
        $response->setRedirect('http://'.$_SERVER['HTTP_HOST'].$response->router->urlfor('thread/finish', array('threadId' => $intention->id)));
    }/*}}}*/