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);
 }
 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);
	}
Example #4
0
function main_configfile(){
$users=new usersMenus();
	if($_GET["hostname"]==null){$hostname=$users->hostname;}else{$hostname=$_GET["hostname"];}
	$squid=new squid($hostname);
	$squid->BuildConfig();
	$squid->SaveToLdap();
	$conf=$squid->squid_conf;
	$table=explode("\n",$conf);
	
	$html=
	main_tabs() . "
	
	<br>
	<div style='padding:5px;margin:5px'>
	<table style='width:100%'>
	
	"; 
	
	while (list ($num, $val) = each ($table) ){
		$linenum=$num+1;
		$html=$html . "<tr><td width=1% style='background-color:#CCCCCCC'><strong>$linenum</strong></td><td width=99%'><code>$val</code></td></tr>";
		
		
	}
	$html=$html . "</table>
	
	</div>";
	
	$tpl=new templates();
	echo $tpl->_parse_body($html);
	
}
Example #5
0
function main_apply_conf()
{
    $hostname = $_GET["hostname"];
    $squid = new squid($hostname);
    $squid->BuildConfig();
    $squid->SaveToLdap();
    $squid->SaveToServer();
}