public function broker($request, $response) {/*{{{*/ $url = $res = null; if (isset($_REQUEST['url']) && !empty($_REQUEST['url'])) { $url = urldecode($_REQUEST['url']); } elseif (isset($_REQUEST['to']) && !empty($_REQUEST['to'])) { $url = urldecode($_REQUEST['to']); } elseif (isset($_REQUEST['text']) && !empty($_REQUEST['text'])) { $res = urldecode($_REQUEST['text']); } else { $res = 'error'; } if ($url) { $cookie = isset($_SERVER['HTTP_COOKIE'])?$_SERVER['HTTP_COOKIE']:''; //增加post方法 if (0 < strpos($url, '?')) $separator = '&'; else $separator = '?'; $request = new Request(); $params = http_build_query($request->getAllSafePost()); $url = $url.$separator.$params; $remoter = new RequestDelegate(); $res = $remoter->request($url, 'get', array(), $cookie, 5); } header('Content-Type: text/html; charset=GBK'); echo $res; exit; }/*}}}*/
public function doBroker($request, $response) { $remoter = new RequestDelegate(); if ($request->url) { $url = $request->url; } elseif ($request->to) { $url = $request->to; } elseif ($request->text) { $url = $request->text; } else { $url = null; } if ($url) { $result = $_SERVER['REQUEST_METHOD'] == 'POST' ? $remoter->request($url, 'post', $request->getAllSafePost()) : $remoter->request($url); echo mb_convert_encoding($result, 'utf-8', 'gbk'); } else { echo "error"; } return parent::DIRECT_OUTPUT; }
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; } } }
public static function getIp() { if (isset($_COOKIE['forceipaddress']) && $_COOKIE['forceipaddress']) { return $_COOKIE['forceipaddress']; } return RequestDelegate::getIp(); }
private function buildOptions(&$params) { /*{{{*/ $options = array(); //是否cache if (isset($params['nocache'])) { $options['nocache'] = $params['nocache']; unset($params['nocache']); } //强制走master,忽略缓存 if (isset($_GET['_m_m_']) || isset($_POST['_m_m_']) || isset($_GET['nocache']) && RequestDelegate::isOfficeIp()) { $options['_master_'] = true; $options['nocache'] = true; } //是否独占 if (isset($params['synchronized'])) { $options['synchronized'] = $params['synchronized']; unset($params['synchronized']); if (isset($params['synchronizedKey'])) { $options['synchronizedKey'] = $params['synchronizedKey']; unset($params['synchronizedKey']); } } //是否单独设置超时时间 if (isset($params['timeout'])) { $options['timeout'] = $params['timeout']; unset($params['timeout']); } return $options; }
private function addSearchLog($kw) {/*{{{*/ if(false == empty($kw)) { $ip = RequestDelegate::getIp(); BeanFinder::get('logger')->addInfo('ip '.$ip.' searchword '.$kw); } }/*}}}*/
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)); }
public function before($context) { $userId = $context->request->userId; $user = DAL::get()->find('user', $userId); $action = strtolower($context->request->action); $os = $context->request->os; $ver = $context->request->v; if(false !== strpos($action, 'doctoruser') || false !== strpos($action, 'main') || $context->request->xdoc || false !== strpos($action, 'flowref_uploadsound')) { } else { if ($user->isNull() || $user->getCertificateForMobile() != $context->request->certificateToken) { $this->echoErrorCode(); } if($user->hasSpace()) { $space = $user->getSpace(); if($user->name != 'malijuanmlj' && $space->host instanceof Doctor && $space->host->hospitalfaculty->hospital->isInnerTestHospital() && false == RequestDelegate::isOfficeIp()) { $this->echoErrorCode(); } } //绑定设备验证 if ($os == 'ios' && $ver >= '3.0.3' || $os == 'android' && $ver >= '3.0.8') { $deviceToken = $os == 'ios' ? $context->request->deviceOpenUDID : $context->request->deviceToken; $doctorUser = DAL::get()->find_by_userid_and_status('doctoruser', $userId, DoctorUser::STATUS_BIND, true); if($doctorUser->isNull() == false && $doctorUser->deviceToken != $deviceToken && false == in_array($userId, DoctorUser::$doctorId4Test)) { $msg = "您的账号于 ".date('H:m', strtotime($doctorUser->ctime))." 在一台 ".$doctorUser->deviceType." 手机登录。如非本人操作,则密码可能已泄露,建议重新登录修改密码或直接联系我们 ".HdfPhoneNumber::PHONE_DOCTORHELP." 修改密码"; $msg = XString::convertToUnicode($msg); echo '{"errorCode":"888","msg":"'.$msg.'","content":[]}'; exit; } } } if (($os == 'ios' && $ver >= '3.0.1' || $os == 'android' && $ver >= '3.0.5') && $this->actionIsNotInActions($context->action)) { if ($user->id == 0) return;//用户id是0 的过滤 $doctorOwner = DAL::get()->find_by_userid('DoctorOwner', $user->id); if (false == $doctorOwner->isNull() && $doctorOwner->isPreDoctor()) { $predoctor = $doctorOwner->source; if ($predoctor->isRefused()) { echo '{"errorCode":"8000","msg":"","content":[]}'; exit; } if ($predoctor->isAbnormal()) { echo '{"errorCode":"8001","msg":"","content":[]}'; exit; } } } }
public function before($context) {/*{{{*/ //$ip = RequestDelegate::getIp(); //$userInfo = $context->request->getCookie('userinfo'); if(false == RequestDelegate::isOfficeIp()) { echo 'ÎÞЧµÄ·ÃÎÊ£¡'; exit; } }/*}}}*/
private function validTesterDoctor($request) { $doctorId = (int)Codec::getInstance()->decodeId($request->id); $doctor = DAL::get()->find('Doctor', $doctorId); if($doctor->isNull() == false && $doctor->hospitalfaculty->hospital->isInnerTestHospital() && false == RequestDelegate::isOfficeIp()) { header('Location: http://www.haodf.com'); exit; } }
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; } }
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 before($context) { $spaceUserName = WebUtil::getSpaceUserName($context->request); $space = SpaceClient::getInstance()->getSpaceByUserName($spaceUserName); /** * 测试医院下所有space只能在办公区访问 * **/ $userId = UserClient::getInstance()->getCheckedSeed('id'); $user = DAL::get()->find('user', $userId); $hdferUserNames = array('verygoodman', 'willowliu', 'dvsj', 'yangshiqi'); if(in_array($user->name, $hdferUserNames) == false && $space->host instanceof Doctor && $space->host->hospitalfaculty->hospital->isInnerTestHospital() && false == RequestDelegate::isOfficeIp()) { header('Location: http://www.haodf.com'); exit; } }
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; } } }
<?php $base = dirname(__FILE__); require $base . '/../assembly.php'; @header('Content-Type: text/html; charset=gbk'); $tmpRequest = new Request(); $url = $tmpRequest->url; $text = $tmpRequest->text; if (!empty($url)) { if (0 < strpos($url, '?')) { $separator = '&'; } else { $separator = '?'; } $request = new Request(); $params = http_build_query($request->getAllSafePost()); //echo Lib_CrossDomainAgent::getUrl(urldecode($url.$separator.$params)); $url = urldecode($url . $separator . $params); $remoter = new RequestDelegate(); $cookie = isset($_SERVER['HTTP_COOKIE']) ? $_SERVER['HTTP_COOKIE'] : ''; echo $remoter->request($url, 'get', array(), $cookie, 5); //public function request($hosts, $method='get', $args=array(), $cookie='', $timeout=self::TIME_OUT, $noRetry=false, $host='') } elseif (!empty($text)) { echo urldecode($text); } else { echo 'error'; }
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))); }/*}}}*/
<?php require 'init.php'; $tmpRequest = new Request(); $url = $tmpRequest->url; $method = $tmpRequest->method; $nocache = $tmpRequest->nocache; $forward = "http://www.haodf.com"; $result = ""; $text = ''; $u = ''; $remoter = new RequestDelegate(); $cleanCacheUrls = array(); if ($url) { $urls = preg_split('/\\r?\\n|\\s+/', $url); //clean memcache if ($nocache) { foreach ($urls as $u) { if ($u) { if (false === strpos($u, '?')) { $u .= '?nocache=1'; } else { $u .= '&nocache=1'; } $cleanCacheUrls[] = $u; } } } if (false == empty($cleanCacheUrls)) { $remoter->multiRequest($cleanCacheUrls); }
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 testloginin($request, $response) { /*{{{*/ $userName = '******'; $password = '******'; $remoter = new RequestDelegate(); $url = "http://" . URL_PREFIX . "mobile-api.haodf.com/mobileapi/authUser"; $userName = mb_convert_encoding($userName, 'utf-8', 'gbk'); $cryptedData = $this->cryptWithKey(json_encode(array("userName" => $userName, 'password' => $password, 'requestTime' => time())), "fa28bd37cd7f397fbd088649c1d09af8"); $args = array('os' => 'android', 'app' => 'followup', 'version' => 'fu1.0', '_s' => $cryptedData); $res = $remoter->request($url, 'post', $args); $res = json_decode($res); var_dump($this->decryptWithKey($res->content->_s, "fa28bd37cd7f397fbd088649c1d09af8")); exit; }
<?php require('init.php'); @header('Content-Type: text/html; charset=gbk'); $tmpRequest = new Request(); $url = $tmpRequest->url; $text = $tmpRequest->text; if (!empty($url)) { $remoter = new RequestDelegate(); $cookie = isset($_SERVER['HTTP_COOKIE'])?$_SERVER['HTTP_COOKIE']:''; $method = 'post'; if ('GET' == $_SERVER['REQUEST_METHOD']) { $method = 'get'; } $request = new Request(); echo $remoter->request($url, $method, $request->getAllSafePost(), $cookie, 5); } elseif (!empty($text)) { echo urldecode($text); } else { echo 'error'; }
public function simpleDetail($request, $response) {/*{{{*/ header('Content-Type: text/html; charset=gb2312'); $spaceId = $request->getRequest('spaceId', 0); $response->spaceId = $spaceId; $from = $request->getRequest('from', ''); $idStr = $request->ids; $ids = explode(',', $idStr); $paList = DAL::get()->find('PatientAttachment', $ids); $canViewPa = false; $anyPa = NullEntity::create(); foreach($paList as $index => $pa) { if($pa->isNull() || $pa->isDeleted() && empty($spaceId)) unset($paList[$index]); $anyPa = $pa; } //医生和患者本人可以看到附件 if (false == $this->_newUser->isNull() && false == $anyPa->isNull()) { if ($this->_newUser->id == $pa->user->id || $this->_newUser->id === $spaceId) { $canViewPa = true; } else if (RequestDelegate::isOfficeIp() && self::isAuditorPage()) { //管理员在公司ip内也可以看到 $curInspector = DAL::get()->find_by_userid('inspector', $this->_newUser->id); if ($curInspector instanceOf inspector) { $canViewPa = true; } } } $response->canViewPa = $canViewPa; $response->paList = $paList; if ($from) { return "detail4dzone"; } return "default"; }/*}}}*/
private function getSpaceHits($request) { /*{{{*/ if (false == RequestDelegate::isAjaxRequest() && false == in_array($request->controller, self::$UnRecordHitsControllers)) { return (int) (HitClient::getInstance()->getHitCnt4Space($this->space->id) + $this->space->hits); } }
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()); // } //} }
$exception_sys = file_get_contents('/home/avatar/bin/exception_sys.log'); } if (is_file('/home/avatar/bin/exception_sys.log')) { $exception_db = file_get_contents('/home/avatar/bin/exception_db.log'); } if ('' == $exception_sys && '' == $exception_db) { exit; } //require('/home/tester/php/libs/framework/util/remoter.php'); require('remoter.php'); require('xstring.php'); //public function request($hosts, $method='get', $args=array(), $cookie='', $timeout=self::TIME_OUT, $noRetry=false, $host='') $r = new RequestDelegate(); $cookie = 'Bugzilla_login=6; Bugzilla_logincookie=F7nDtJe2pq; TUI=expert_fields=1'; //提一个新的bug $args = array('product' => '意见汇总'); $getArgs = XString::convertEncoding($args, 'utf-8', 'gbk'); $getContent = $r->request('http://192.168.1.99/enter_bug.cgi', 'get', $getArgs, $cookie, 10, true, 'bug.haodf.com'); //sleep(1); //提交bugform $args = array(); $args['short_desc'] = '[自动提交]线上程序异常'; $args['comment'] = "exception_sys: ".strlen($exception_sys)."\r\n\r\nexception_db: ".strlen($exception_db)."\r\n\r\n努力改吧"; $args['product'] = '意见汇总'; $args['token'] = getToken($getContent);