本文整理汇总了PHP中validater::checkSensitive方法的典型用法代码示例。如果您正苦于以下问题:PHP validater::checkSensitive方法的具体用法?PHP validater::checkSensitive怎么用?PHP validater::checkSensitive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validater
的用法示例。
在下文中一共展示了validater::checkSensitive方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post
/**
* Post a message.
*
* @access public
* @return void
*/
public function post($type)
{
$account = $this->app->user->account;
$admin = $this->app->user->admin;
$message = fixer::input('post')->add('date', helper::now())->add('type', $type)->add('status', '0')->setDefault('public', '1')->setIF(isset($_POST['secret']) and $_POST['secret'] == 1, 'public', '0')->setIF($type == 'message', 'to', 'admin')->setIF($account != 'guest', 'account', $account)->setIF($admin == 'super', 'status', '1')->add('ip', $this->server->REMOTE_ADDR)->get();
if (isset($this->config->site->filterSensitive) and $this->config->site->filterSensitive == 'open') {
$dicts = !empty($this->config->site->sensitive) ? $this->config->site->sensitive : $this->config->sensitive;
$dicts = explode(',', $dicts);
if (!validater::checkSensitive($message, $dicts)) {
return array('result' => 'fail', 'reason' => 'error', 'message' => $this->lang->error->sensitive);
}
}
$this->dao->insert(TABLE_MESSAGE)->data($message, $skip = 'captcha, secret')->autoCheck()->check('captcha', 'captcha')->check('type', 'in', $this->config->message->types)->checkIF(!empty($message->email), 'email', 'email')->batchCheck($this->config->message->require->post, 'notempty')->exec();
if (dao::isError()) {
return array('result' => 'fail', 'message' => dao::getError());
}
$this->setCookie($this->dao->lastInsertId());
return array('result' => 'success', 'message' => $this->lang->message->thanks);
}
示例2: update
/**
* Update thread.
*
* @param int $threadID
* @access public
* @return void
*/
public function update($threadID)
{
$thread = $this->getByID($threadID);
$isAdmin = $this->app->user->admin == 'super';
$canManage = $this->canManage($thread->board);
$allowedTags = $this->app->user->admin == 'super' ? $this->config->allowedTags->admin : $this->config->allowedTags->front;
$thread = fixer::input('post')->setIF(!$canManage, 'readonly', 0)->setIF(!$this->post->isLink, 'link', '')->stripTags('content,link', $allowedTags)->setForce('editor', $this->session->user->account)->setForce('editedDate', helper::now())->setDefault('readonly', 0)->remove('files,labels, views, replies, stick, hidden')->get();
if (isset($this->config->site->filterSensitive) and $this->config->site->filterSensitive == 'open') {
$dicts = !empty($this->config->site->sensitive) ? $this->config->site->sensitive : $this->config->sensitive;
$dicts = explode(',', $dicts);
if (!validater::checkSensitive($thread, $dicts)) {
return array('result' => 'fail', 'message' => $this->lang->error->sensitive);
}
}
$this->dao->update(TABLE_THREAD)->data($thread, $skip = "{$this->session->captchaInput}, uid, isLink")->autoCheck()->batchCheckIF(!$this->post->isLink, $this->config->thread->require->edit, 'notempty')->batchCheckIF($this->post->isLink, $this->config->thread->require->link, 'notempty')->check($this->session->captchaInput, 'captcha')->where('id')->eq($threadID)->exec();
$this->loadModel('file')->updateObjectID($this->post->uid, $threadID, 'thread');
if (dao::isError()) {
return false;
}
/* Upload file.*/
$this->loadModel('file')->saveUpload('thread', $threadID);
$thread = $this->getByID($threadID);
if (empty($thread)) {
return false;
}
return $this->loadModel('search')->save('thread', $thread);
}
示例3: update
/**
* Update a reply.
*
* @param int $replyID
* @access public
* @return void
*/
public function update($replyID)
{
$allowedTags = $this->app->user->admin == 'super' ? $this->config->allowedTags->admin : $this->config->allowedTags->front;
$reply = fixer::input('post')->setForce('editor', $this->session->user->account)->setForce('editedDate', helper::now())->stripTags('content', $allowedTags)->remove('files,labels,hidden')->get();
if (isset($this->config->site->filterSensitive) and $this->config->site->filterSensitive == 'open') {
$dicts = !empty($this->config->site->sensitive) ? $this->config->site->sensitive : $this->config->sensitive;
$dicts = explode(',', $dicts);
if (!validater::checkSensitive($reply, $dicts)) {
return array('result' => 'fail', 'message' => $this->lang->error->sensitive);
}
}
$this->dao->update(TABLE_REPLY)->data($reply, $skip = 'captcha, uid')->autoCheck()->batchCheck($this->config->reply->require->post, 'notempty')->check('captcha', 'captcha')->where('id')->eq($replyID)->exec();
$this->loadModel('file')->updateObjectID($this->post->uid, $replyID, 'reply');
if (!dao::isError()) {
$this->loadModel('file')->saveUpload('reply', $replyID);
return true;
}
return false;
}
示例4: post
/**
* Post a message.
*
* @access public
* @return void
*/
public function post($type)
{
$account = $this->app->user->account;
$admin = $this->app->user->admin;
$message = fixer::input('post')->add('date', helper::now())->add('type', $type)->add('status', '0')->setDefault('public', '1')->setIF(isset($_POST['secret']) and $_POST['secret'] == 1, 'public', '0')->setIF($type == 'message', 'to', 'admin')->setIF($account != 'guest', 'account', $account)->setIF($admin == 'super', 'status', '1')->add('ip', $this->server->REMOTE_ADDR)->get();
if (strlen($message->content) > 29) {
$repeat = $this->loadModel('guarder')->checkRepeat($message->content);
if ($repeat) {
return array('result' => 'fail', 'message' => $this->lang->error->noRepeat);
}
}
if ($this->loadModel('guarder')->matchList($message)) {
return array('result' => 'fail', 'reason' => 'error', 'message' => $this->lang->error->sensitive);
}
if (isset($this->config->site->filterSensitive) and $this->config->site->filterSensitive == 'open') {
$dicts = !empty($this->config->site->sensitive) ? $this->config->site->sensitive : $this->config->sensitive;
$dicts = explode(',', $dicts);
if (!validater::checkSensitive($message, $dicts)) {
return array('result' => 'fail', 'reason' => 'error', 'message' => $this->lang->error->sensitive);
}
}
$this->dao->insert(TABLE_MESSAGE)->data($message, $skip = $this->session->captchaInput . ', secret')->autoCheck()->check($this->session->captchaInput, 'captcha')->check('type', 'in', $this->config->message->types)->checkIF(!empty($message->email), 'email', 'email')->checkIF(!empty($message->phone), 'phone', 'phone')->batchCheck($this->config->message->require->post, 'notempty')->exec();
$this->setCookie($this->dao->lastInsertId());
/* Record post number. */
$guarder = $this->loadModel('guarder');
$guarder->logOperation('account', 'postComment');
$guarder->logOperation('ip', 'postComment');
if (dao::isError()) {
$errors = dao::getError();
if (isset($errors[$this->session->captchaInput])) {
$guarder->logOperation('ip', 'captchaFail');
$guarder->logOperation('account', 'captchaFail');
}
return array('result' => 'fail', 'message' => $errors);
}
return array('result' => 'success', 'message' => $this->lang->message->needCheck);
}