本文整理匯總了PHP中H::sensitive_word_exists方法的典型用法代碼示例。如果您正苦於以下問題:PHP H::sensitive_word_exists方法的具體用法?PHP H::sensitive_word_exists怎麽用?PHP H::sensitive_word_exists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類H
的用法示例。
在下文中一共展示了H::sensitive_word_exists方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: check_username_sensitive_words
/**
* 檢查用戶名中是否包含敏感詞或用戶信息保留字
*
* @param string
* @return boolean
*/
public function check_username_sensitive_words($user_name)
{
if (H::sensitive_word_exists($user_name)) {
return true;
}
if (!get_setting('censoruser')) {
return false;
}
if ($censorusers = explode("\n", get_setting('censoruser'))) {
foreach ($censorusers as $name) {
if (!($name = trim($name))) {
continue;
}
if (preg_match('/(' . $name . ')/is', $user_name)) {
return true;
}
}
}
return false;
}
示例2: save_comment_action
public function save_comment_action()
{
if (!($article_info = $this->model('article')->get_article_info_by_id($_POST['article_id']))) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('指定文章不存在')));
}
if ($article_info['lock'] and !($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('已經鎖定的文章不能回複')));
}
$message = trim($_POST['message'], "\r\n\t");
if (!$message) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請輸入回複內容')));
}
if (strlen($message) < get_setting('answer_length_lower')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('回複內容字數不得少於 %s 字節', get_setting('answer_length_lower'))));
}
if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($message)) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用戶組不允許發布站外鏈接')));
}
if (human_valid('answer_valid_hour') and !AWS_APP::captcha()->is_validate($_POST['seccode_verify'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請填寫正確的驗證碼')));
}
// !注: 來路檢測後麵不能再放報錯提示
if (!valid_post_hash($_POST['post_hash'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('頁麵停留時間過長,或內容已提交,請刷新頁麵')));
}
if ($this->publish_approval_valid() or H::sensitive_word_exists($message)) {
$this->model('publish')->publish_approval('article_comment', array('article_id' => intval($_POST['article_id']), 'message' => $message, 'at_uid' => intval($_POST['at_uid'])), $this->user_id);
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/publish/wait_approval/article_id-' . intval($_POST['article_id']) . '__is_mobile-' . $_POST['_is_mobile'])), 1, null));
} else {
$comment_id = $this->model('publish')->publish_article_comment($_POST['article_id'], $message, $this->user_id, $_POST['at_uid']);
//$url = get_js_url('/article/' . intval($_POST['article_id']) . '?item_id=' . $comment_id);
$comment_info = $this->model('article')->get_comment_by_id($comment_id);
$comment_info['message'] = $this->model('question')->parse_at_user($comment_info['message']);
TPL::assign('comment_info', $comment_info);
if (is_mobile()) {
H::ajax_json_output(AWS_APP::RSM(array('ajax_html' => TPL::output('m/ajax/article_answer', false)), 1, null));
} else {
H::ajax_json_output(AWS_APP::RSM(array('ajax_html' => TPL::output('article/ajax/comment', false)), 1, null));
}
}
}
示例3: publish_article_action
public function publish_article_action()
{
if (!$this->user_info['permission']['publish_article']) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你沒有權限發布文章')));
}
if (!$_POST['title']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請輸入文章標題')));
}
if (get_setting('category_enable') == 'N') {
$_POST['category_id'] = 1;
}
if (!$_POST['category_id']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請選擇文章分類')));
}
if (get_setting('question_title_limit') > 0 and cjk_strlen($_POST['title']) > get_setting('question_title_limit')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('文章標題字數不得大於 %s 字節', get_setting('question_title_limit'))));
}
if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($_POST['message'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用戶組不允許發布站外鏈接')));
}
if (!$this->model('publish')->insert_attach_is_self_upload($_POST['message'], $_POST['attach_ids'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('隻允許插入當前頁麵上傳的附件')));
}
if (human_valid('question_valid_hour') and !AWS_APP::captcha()->is_validate($_POST['seccode_verify'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請填寫正確的驗證碼')));
}
if ($_POST['topics']) {
foreach ($_POST['topics'] as $key => $topic_title) {
$topic_title = trim($topic_title);
if (!$topic_title) {
unset($_POST['topics'][$key]);
} else {
$_POST['topics'][$key] = $topic_title;
}
}
if (get_setting('question_topics_limit') and sizeof($_POST['topics']) > get_setting('question_topics_limit')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('單個文章話題數量最多為 %s 個, 請調整話題數量', get_setting('question_topics_limit'))));
}
}
if (get_setting('new_question_force_add_topic') == 'Y' and !$_POST['topics']) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請為文章添加話題')));
}
// !注: 來路檢測後麵不能再放報錯提示
if (!valid_post_hash($_POST['post_hash'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('頁麵停留時間過長,或內容已提交,請刷新頁麵')));
}
$this->model('draft')->delete_draft(1, 'article', $this->user_id);
if ($this->publish_approval_valid() or H::sensitive_word_exists(array($_POST['title'], $_POST['message']))) {
$this->model('publish')->publish_approval('article', array('title' => $_POST['title'], 'message' => $_POST['message'], 'category_id' => $_POST['category_id'], 'topics' => $_POST['topics'], 'permission_create_topic' => $this->user_info['permission']['create_topic']), $this->user_id, $_POST['attach_access_key']);
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/publish/wait_approval/')), 1, null));
} else {
$article_id = $this->model('publish')->publish_article($_POST['title'], $_POST['message'], $this->user_id, $_POST['topics'], $_POST['category_id'], $_POST['attach_access_key'], $this->user_info['permission']['create_topic']);
if ($_POST['_is_mobile']) {
$url = get_js_url('/m/article/' . $article_id);
} else {
$url = get_js_url('/article/' . $article_id);
}
H::ajax_json_output(AWS_APP::RSM(array('url' => $url), 1, null));
}
}
示例4: save_answer_action
public function save_answer_action()
{
// if ($this->user_info['integral'] < 0 and get_setting('integral_system_enabled') == 'Y')
// {
// H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你的剩餘積分已經不足以進行此操作')));
// }
if (!($question_info = $this->model('question')->get_question_info_by_id($_POST['question_id']))) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('問題不存在')));
}
if ($question_info['lock'] and !($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('已經鎖定的問題不能回複')));
}
$answer_content = trim($_POST['answer_content'], "\r\n\t");
if (!$answer_content) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請輸入回複內容')));
}
// // 判斷是否是問題發起者
// if (get_setting('answer_self_question') == 'N' and $question_info['published_uid'] == $this->user_id)
// {
// H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('不能回複自己發布的問題,你可以修改問題內容')));
// }
// // 判斷是否已回複過問題
// if ((get_setting('answer_unique') == 'Y') AND $this->model('answer')->has_answer_by_uid($question_info['question_id'], $this->user_id))
// {
// H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('一個問題隻能回複一次,你可以編輯回複過的回複')));
// }
if (strlen($answer_content) < get_setting('answer_length_lower')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('回複內容字數不得少於 %s 字節', get_setting('answer_length_lower'))));
}
if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($answer_content)) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用戶組不允許發布站外鏈接')));
}
if (!$this->model('publish')->insert_attach_is_self_upload($answer_content, $_POST['attach_ids'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('隻允許插入當前頁麵上傳的附件')));
}
if (human_valid('answer_valid_hour') and !AWS_APP::captcha()->is_validate($_POST['seccode_verify'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請填寫正確的驗證碼')));
}
// !注: 來路檢測後麵不能再放報錯提示
if (!valid_post_hash($_POST['post_hash'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('頁麵停留時間過長,或內容已提交,請刷新頁麵')));
}
$this->model('draft')->delete_draft($question_info['question_id'], 'answer', $this->user_id);
if ($this->publish_approval_valid() or H::sensitive_word_exists($answer_content)) {
$this->model('publish')->publish_approval('answer', array('question_id' => $question_info['question_id'], 'answer_content' => $answer_content, 'anonymous' => $_POST['anonymous'], 'attach_access_key' => $_POST['attach_access_key'], 'auto_focus' => $_POST['auto_focus']), $this->user_id, $_POST['attach_access_key']);
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/publish/wait_approval/question_id-' . $question_info['question_id'])), 1, null));
} else {
$answer_id = $this->model('publish')->publish_answer($question_info['question_id'], $answer_content, $this->user_id, $_POST['anonymous'], $_POST['attach_access_key'], $_POST['auto_focus']);
$answer_info = $this->model('answer')->get_answer_by_id($answer_id);
if ($answer_info['has_attach']) {
$answer_info['attachs'] = $this->model('publish')->get_attach('answer', $answer_id, 'min');
$answer_info['insert_attach_ids'] = FORMAT::parse_attachs($answer_info['answer_content'], true);
}
$answer_info['user_info'] = $this->user_info;
$answer_info['answer_content'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($answer_info['answer_content']))));
TPL::assign('answer_info', $answer_info);
H::ajax_json_output(AWS_APP::RSM(array('ajax_html' => TPL::output('question/ajax/answer', false)), 1, null));
}
}
示例5: publish_approval_valid
public function publish_approval_valid($content = null)
{
if ($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator']) {
return false;
}
if ($default_timezone = get_setting('default_timezone')) {
date_default_timezone_set($default_timezone);
}
if ($this->user_info['permission']['publish_approval'] == 1) {
if (!$this->user_info['permission']['publish_approval_time']['start'] and !$this->user_info['permission']['publish_approval_time']['end']) {
if ($this->user_info['default_timezone']) {
date_default_timezone_set($this->user_info['default_timezone']);
}
return true;
}
if ($this->user_info['permission']['publish_approval_time']['start'] < $this->user_info['permission']['publish_approval_time']['end']) {
if (intval(date('H')) >= $this->user_info['permission']['publish_approval_time']['start'] and intval(date('H')) < $this->user_info['permission']['publish_approval_time']['end']) {
if ($this->user_info['default_timezone']) {
date_default_timezone_set($this->user_info['default_timezone']);
}
return true;
}
}
if ($this->user_info['permission']['publish_approval_time']['start'] > $this->user_info['permission']['publish_approval_time']['end']) {
if (intval(date('H')) >= $this->user_info['permission']['publish_approval_time']['start'] or intval(date('H')) < $this->user_info['permission']['publish_approval_time']['end']) {
if ($this->user_info['default_timezone']) {
date_default_timezone_set($this->user_info['default_timezone']);
}
return true;
}
}
if ($this->user_info['permission']['publish_approval_time']['start'] == $this->user_info['permission']['publish_approval_time']['end']) {
if (intval(date('H')) == $this->user_info['permission']['publish_approval_time']['start']) {
if ($this->user_info['default_timezone']) {
date_default_timezone_set($this->user_info['default_timezone']);
}
return true;
}
}
}
if ($this->user_info['default_timezone']) {
date_default_timezone_set($this->user_info['default_timezone']);
}
if ($content and H::sensitive_word_exists($content)) {
return true;
}
return false;
}