public function newPost($request, $response)
 {
     /*{{{*/
     $verifyOk = Captcha::verify($request->verifyStr, XIpLocation::getIp(), 'article', $request->article_id, $request->token);
     DBC::requireTrue($verifyOk, "您输入的验证码有误!");
     //禁用词检查
     $title = $request->title;
     $result = DoctorClient::getInstance()->getProfanityCheck($title);
     DBC::requireFalse($result['CODE'] < 0, "文章 评论添加失败");
     DBC::requireFalse($result['CODE'] == 2, "文章 评论添加成功");
     $title = $result['CONTENT'];
     $content = htmlspecialchars($request->getRequest('content'), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1');
     $result = DoctorClient::getInstance()->getProfanityCheck($content);
     DBC::requireFalse($result['CODE'] < 0, "文章 评论添加失败");
     DBC::requireFalse($result['CODE'] == 2, "文章 评论添加成功");
     $content = $result['CONTENT'];
     $article = DAL::get()->find('article', $request->article_id);
     $feilds = array();
     $feilds['ip'] = XIpLocation::getIp();
     $feilds['ipLocation'] = XIpLocation::getLocationArea();
     $userId = $this->user->isNull() == false ? $this->user->id : '';
     $comment = ArticleClient::getInstance()->addComment($article, $userId, $title, $content, $feilds);
     squid::clean($article->getUrl(), true);
     $this->message('您发表的评论已经提交,待网站审核通过后即可展示。', $response);
 }
Пример #2
0
 public function newArticleComment($articleId, $content, $userId)
 {/*{{{*/
     $article = DAL::get()->find('article', $articleId);
     if ($article->isDelete() || $article->isNull()) {
         $this->setErrorCode(308);
         return 0;
     }
     if(1 > strlen(trim($content)))
     {
         $this->setErrorCode(310);
         return 0;
     }
     $userId = 0 == $userId ? '' : $userId;
     $title = '';
     $feilds = array();
     $feilds['ip'] = XIpLocation::getIp();
     $feilds['ipLocation'] = XIpLocation::getLocationArea();
     $comment = ArticleClient::getInstance()->addComment($article, $userId, $title, $content, $feilds);
     $info['successContent'] = '';
     squid::clean($article->getUrl(), true);
     if(false == empty($comment))
     {
         $info['successContent'] = '评论已提交,待审核通过后即可展示';
     }
     $this->content = $info;
 }/*}}}*/
	public function newPost($request, $response){
        $verifyStr = $request->verifystr;
        $verifyOk = Captcha::verify($verifyStr, XIpLocation::getIp(), 'article', $request->article_id, $request->token);
        if($verifyOk == false)
        {
            $this->message('您输入的验证码有误!', $response);
            return false;
        }

		//禁用词检查
		$title = $request->title;
		$result = DoctorClient::getInstance()->getProfanityCheck($request->title);
		if ($result['CODE'] < 0) {
			$this->message('文章 评论添加失败', $response);
			return false;
		}
		if ($result['CODE'] == 2) {
			//提示发表成功,但是数据没有入库
			$this->message('文章 评论添加成功', $response);
			return true;
		}
		$title = $result['CONTENT'];
		
		$content = htmlspecialchars($request->getRequest('content'), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1');
		$result = DoctorClient::getInstance()->getProfanityCheck($content);
		if ($result['CODE'] < 0) {
			$this->message('文章 评论添加失败', $response);
			return false;
		}
		if ($result['CODE'] == 2) {
			//提示发表成功,但是数据没有入库
			$this->message('文章 评论添加成功', $response);
			return true;
		}
		$content = $result['CONTENT'];
		
		$article = DAL::get()->find('article', $request->article_id);
		$feilds = array();
		$feilds['ip'] = XIpLocation::getIp();
		$feilds['ipLocation'] = XIpLocation::getLocationArea();
		$userId = ($this->_newUser->isNull() == false) ? $this->_newUser->id : '';
		$comment = ArticleClient::getInstance()->addComment($article, $userId, $title, $content, $feilds);
        squid::clean($article->getUrl(), true);

		$this->message('您发表的评论已经提交,待网站审核通过后即可展示。', $response);
	}
Пример #4
0
 /** 患友会投诉**/
 public function ajaxComplaint($request, $response)
 {
     /*{{{*/
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') || strpos($_SERVER['HTTP_USER_AGENT'], 'Baiduspider')) {
         return false;
     }
     $topicUrl = $request->topicUrl;
     $messageId = $request->messageId;
     $floor = $request->floor;
     $isAjax = $request->isAjax;
     $adviceContent = trim($request->adviceContent);
     $complaintType = trim($request->complaintType);
     if ($isAjax) {
         $complaintType = mb_convert_encoding($complaintType, 'gbk', 'utf-8');
         $adviceContent = mb_convert_encoding($adviceContent, 'gbk', 'utf-8');
     }
     $content = "";
     $content .= "来自 " . XIpLocation::getLocationArea() . '[' . XIpLocation::getIp() . "] 的用户发送了一条患友会投诉, 内容如下:\n";
     $content .= "类型:" . $complaintType . "\n";
     $content .= "投诉内容:" . $adviceContent . "\n";
     $content .= "所提交的话题:<a href='" . $topicUrl . "' target='_blank'>点击查看</a>\n";
     $content .= "所提交的回复ID:" . $messageId . "\n";
     $content .= "所在楼:" . $floor . "楼\n";
     $content .= "所提交的空间: <a href=\"http://" . URL_PREFIX . $this->space->userName . ".haodf.com\" target=\"_blank\">" . $this->space->host->name . "</a>\n";
     $content .= "----------------------------------------------------------------------------\n";
     $content .= "提交人:" . $this->user->name . "(" . $this->user->id . ")\n";
     $content .= "发送时间: " . date("Y-m-d H:i") . "\n";
     $content .= "----------------------------------------------------------------------------\n";
     $content .= "用户端信息: \n" . $_SERVER['HTTP_USER_AGENT'];
     UserClient::getInstance()->addUserAdvice('评论投诉', $content, $this->user->id);
     return parent::DIRECT_OUTPUT;
 }
Пример #5
0
 /**
  * @brief 举报   ajax提交
  * @author lhl
  * @version branches/v2.14.23
  * @date 2013-07-25
  */
 public function ajaxComplaint($request, $response)
 {
     /*{{{*/
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') || strpos($_SERVER['HTTP_USER_AGENT'], 'Baiduspider')) {
         return false;
     }
     $flowId = $request->flowId;
     $refId = $request->refId;
     $ref = DAL::get()->find('DoctorPatientRef', $refId);
     $refUrl = $ref->getUrl();
     $isAjax = $request->isAjax;
     if ($isAjax) {
         $complaintType = mb_convert_encoding(trim($request->complaintType), 'gbk', 'utf-8');
         $adviceContent = mb_convert_encoding(trim($request->adviceContent), 'gbk', 'utf-8');
     } else {
         $adviceContent = trim($request->adviceContent);
         $complaintType = trim($request->complaintType);
     }
     $content = "";
     $content .= "来自 " . XIpLocation::getLocationArea() . '[' . XIpLocation::getIp() . "] 的用户发送了一条流页面<font color='red'>" . ($this->user->id == $this->space->id ? "医生" : "患者") . "投诉</font>, 内容如下:\n";
     $content .= "类型:" . $complaintType . "\n";
     $content .= "投诉内容:" . $adviceContent . "\n";
     $content .= "所提交的流:<a href='" . $refUrl . "' target='_blank'>点击查看</a>\n";
     $content .= "所提交的post ID:" . $flowId . "\n";
     $content .= "所提交的空间: <a href=\"http://" . URL_PREFIX . $this->space->userName . ".haodf.com\" target=\"_blank\">" . $this->space->host->name . "</a>\n";
     $content .= "----------------------------------------------------------------------------\n";
     $content .= "提交人:" . $this->user->name . "(" . $this->user->id . ")\n";
     $content .= "发送时间: " . date("Y-m-d H:i") . "\n";
     $content .= "----------------------------------------------------------------------------\n";
     $content .= "用户端信息: \n" . $_SERVER['HTTP_USER_AGENT'];
     $userAdviceId = UserClient::getInstance()->addUserAdvice('评论投诉', $content, $this->user->id);
     if ($userAdviceId) {
         die("true");
     }
     die("false");
 }
	public function sosPost($request, $response)
	{
		$tel = $request->tel;
		$time = $request->time;
        $isAjax = $request->isAjax;
		$confirm = $request->confirm;
        if($isAjax)
        {
            $adviceContent = mb_convert_encoding(trim($request->adviceContent),'gbk','utf-8');
            $clientInfo = mb_convert_encoding($request->clientInfo, 'gbk', 'utf-8');
        }
        else
        {
            $adviceContent = trim($request->adviceContent);
            $clientInfo = $request->clientInfo;
        }

        $msg = null;
		
		if( empty($adviceContent) )
		{
            $msg  = '您还没有简要描述您使用好大夫在线所遇到的困难或需要的帮助,请填写后再点击提交';
            if(false == $isAjax)
            {
                MsgHtml::msg($msg, '', array('button' => 'back' ));
                exit;
            }
		}
        else
        {
            $title = "空间求助 (" . date ( "y-m-d H:i" ) . ")";
            $content = "";
            $content .= "来自 " . XIpLocation::getLocationArea() . '[' . XIpLocation::getIp() . "] 的用户发送了一条空间求助, 内容如下:\n";
            $content .= $adviceContent ."\n";
            if (! $this->_newSpace->isConfirmed()) {
                $content .= "<font color=red>注意: 该用户未认证(" . date ( 'y-m-d H:i:s', time() ) . "之前)!!!</font>\n";
            }
            $content .= "所提交的空间: <a href=\"http://" . $this->_newSpace->userName . ".haodf.com\" target=\"_blank\">" . $this->_newSpace->host->name . "</a>\n";
            if($request->id)
            {
                if($request->type == DoctorPatientRef::DOCTORPATIENTREF_TYPE) 
                {
                    $sourceUrl = DoctorPatientRef::getStaticUrl($this->_newSpace->userName, $request->id);
                    $content .= "<a href= '{$sourceUrl}'  target='_blank' > 来源链接 </a>\n";
                }
                else if($request->type == DoctorPatientRef::THREAD_TYPE) 
                {
                    $sourceUrl = Thread::getStaticUrl($this->_newSpace->userName, $request->id);
                    $content .= "<a href= '{$sourceUrl}'  target='_blank' > 来源链接 </a>\n";
                }
            }
            $content .= "----------------------------------------------------------------------------\n";
            $content .= "联系电话: " . $tel . "\n";

            if ($time) {
                $content .= "方便联系的时间: " . $time . "\n";
            }
            $content .= "----------------------------------------------------------------------------\n";
            $content .= "发送时间: " . date("Y-m-d H:i");
            $content .= "----------------------------------------------------------------------------\n";
            $content .= "用户端信息: \n" . $clientInfo;
            UserClient::getInstance()->addUserAdvice('空间求助', $content, $this->_newSpace->user->id);

            $msg = '信息发送成功,感谢对好大夫在线的支持,管理员稍后为您处理遇到的问题,处理后我们会发送站内信通知您,请继续浏览网站信息';
            if(false == $isAjax)
            {
                MsgHtml::msg($msg, $this->_newSpace->getUrl());
            }
        }
        $response->msg = $msg;
	}
Пример #7
0
    public function ajaxUploadFailed($request, $response)
    {/*{{{*/
        $failedFiles = $request->files;
        $location = $request->location;
        $postUrl = urldecode($request->posturl);
        $userId = UserClient::getInstance()->getSeed('id');
        $userName = UserClient::getInstance()->getSeed('name');
        $title = "\n------------------------------------------------------\n".XDateTime::now()."   $userId     $userName     $location    $postUrl";
        $title .= "\n     ".$_SERVER['HTTP_USER_AGENT']."    ".XIpLocation::getLocationArea()."[".XIpLocation::getIp()."]";
        error_log(print_r($title,true), 3, '/tmp/uploadfailed.log');

        foreach($failedFiles as $n => $file)
        {
            $fileName = XString::convertToGbk($file['name']);
            $line = "\n\t$n\t{$fileName}\t{$file['status']}\t{$file['size']}\t{$file['loaded']}\t{$file['percent']}%\t{$file['responseStatus']}";
            $line .= "\nresponse={$file['response']}\n";
            error_log(print_r($line,true), 3, '/tmp/uploadfailed.log');
        }
        exit;
    }/*}}}*/