function ShowRecommend() { if (jstrpos($_SERVER['HTTP_REFERER'], 'at') > 0) { return; } $uid = max(0, (int) $this->Post['uid']); $tid = max(0, (int) $this->Post['tid']); if ($uid < 1) { exit; } $return_tid = jlogic('buddy')->check_new_recd_topic($uid, $tid); if ($return_tid) { $tids = array($return_tid); $TopicListLogic = jlogic('topic_list'); $options = array('tid' => $tids, 'count' => '1'); $info = $TopicListLogic->get_data($options); $topic_list = $info['list']; if ($topic_list) { $TopicLogic = jlogic('topic'); $parent_list = $TopicLogic->GetParentTopic($topic_list, 1); $relate_list = $TopicLogic->GetRelateTopic($topic_list); foreach ($topic_list as $key => $val) { if ($val['longtextid'] > 0) { $topic_list[$key]['content'] = $val['content'] . '...'; } } include template('ajax_recommend'); } } }
function KeyWord() { $keyword = trim($this->Post['keyword']); $filter = jconf::get('filter'); $return = array(); foreach ($filter['keyword_list'] as $value) { if (jstrpos($value, $keyword) !== false) { $keyword_f[] = $value; } } if ($keyword_f) { $return['keyword_f'] = implode("<br>", $keyword_f); } foreach ($filter['verify_list'] as $value) { if (jstrpos($value, $keyword) !== false) { $verify_f[] = $value; } } if ($verify_f) { $return['verify_f'] = implode("<br>", $verify_f); } foreach ($filter['replace_list'] as $key => $value) { if (jstrpos($key, $keyword) !== false) { $replace_f[] = $key; } } if ($replace_f) { $return['replace_f'] = implode("<br>", $replace_f); } foreach ($filter['shield_list'] as $value) { if (jstrpos($value, $keyword) !== false) { $shield_f[] = $value; } } if ($shield_f) { $return['shield_f'] = implode("<br>", $shield_f); } if ($return) { json_result('', $return); } else { json_error('没有匹配的关键字'); } }
function __filter(&$string, $verify = 1, $replace = 1, $shield = 0) { static $filter = null; $rets = array(); $string = trim($string); if ($string) { if (false !== strpos($string, '<')) { $string = strip_selected_tags($string, "<script><iframe><style><link><meta>"); if ($string) { $string = remove_xss($string); } } if (empty($string)) { $rets['error'] = 1; $rets['type'] = 'xss'; $rets['msg'] = "含有禁止提交的代码,请修改后重新提交!"; return $rets; } if ($filter === null) { $filter = (array) jconf::get('filter'); } if (!$filter['enable']) { return false; } if ($replace && $filter['replace_list']) { foreach ($filter['replace_list'] as $search => $replace) { $strpos = jstrpos($string, $search); if ($strpos !== false) { $string = str_replace($search, $replace, $string); } } } if (!empty($filter['keywords'])) { if ($filter['keyword_list'] === null) { $filter['keyword_list'] = explode("|", str_replace(array("\r\n", "\r", "\n", "\t", "\\|"), "|", trim($filter['keywords']))); } foreach ($filter['keyword_list'] as $keyword) { $strpos = jstrpos($string, $keyword); if ($strpos !== false) { $rets['error'] = 1; $rets['type'] = 'filter'; $rets['keyword'] = $keyword; $rets['msg'] = "含有禁止的内容 " . ($filter['keyword_disable'] ? "" : " {$keyword} ") . ",请修改后重新提交!"; return $rets; } } } if ($verify && $filter['verify_list']) { foreach ($filter['verify_list'] as $keyword) { $strpos = jstrpos($string, $keyword); if ($strpos !== false) { $rets['verify'] = 1; $rets['type'] = 'verify'; $rets['keyword'] = $keyword; $rets['msg'] = "含审核内容 " . ($filter['keyword_disable'] ? "" : " {$keyword} ") . "需管理员审核后才会对外显示,<a href='index.php?mod=" . MEMBER_ID . "&type=my_verify'>点此查看</a>"; return $rets; } } } if ($shield && $shield != 0 && $filter['shield_list']) { foreach ($filter['shield_list'] as $keyword) { $strpos = jstrpos($string, $keyword); if ($strpos !== false) { $rets['shield'] = 1; $rets['type'] = 'shield'; $rets['keyword'] = $keyword; $rets['msg'] = "含有屏蔽的内容 " . ($filter['keyword_disable'] ? "" : " {$keyword} "); return $rets; } } } } return false; }