本文整理汇总了PHP中Akismet::submit_spam方法的典型用法代码示例。如果您正苦于以下问题:PHP Akismet::submit_spam方法的具体用法?PHP Akismet::submit_spam怎么用?PHP Akismet::submit_spam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akismet
的用法示例。
在下文中一共展示了Akismet::submit_spam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: akismet_moderation_start
function akismet_moderation_start()
{
global $mybb, $db, $akismet, $lang, $cache, $fid, $pid;
if (!$mybb->settings['akismetswitch'] || $mybb->input['action'] != 'mark_as_spam') {
return;
}
$lang->load("akismet", false, true);
if (!$mybb->input['pid']) {
error("No Post ID specified.");
}
$pid = intval($mybb->input['pid']);
if (!$mybb->input['fid']) {
error("No Forum ID specified.");
}
$fid = intval($mybb->input['fid']);
if (!is_moderator($fid)) {
error("No Permissions to do this action.");
}
$query = $db->query("\r\n\t\tSELECT p.uid, p.username, u.email, u.website, u.akismetstopped, p.message, p.ipaddress, p.tid, p.replyto, p.fid, f.usepostcounts\r\n\t\tFROM " . TABLE_PREFIX . "posts p\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid=p.fid)\r\n\t\tWHERE p.pid = '{$pid}'\r\n\t");
$post = $db->fetch_array($query);
if (!$post) {
error("Invalid Post ID.");
}
if (!$mybb->input['my_post_key'] || $mybb->request_method != "post") {
akismet_show_confirm_page();
}
verify_post_check($mybb->input['my_post_key']);
$akismet_array = array('type' => 'post', 'username' => $post['username'], 'email' => $post['email'], 'website' => $post['website'], 'message' => $post['message'], 'user_ip' => $post['ipaddress']);
if ($post['replyto'] == 0) {
$db->update_query("threads", array('visible' => '-4'), "tid = '{$post['tid']}'");
$db->update_query("posts", array('visible' => '-4'), "tid = '{$post['tid']}'");
$snippit = "thread";
} else {
$db->update_query("posts", array('visible' => '-4'), "pid = '{$pid}'");
$snippit = "post";
}
if (!$akismet) {
$akismet = new Akismet($mybb->settings['bburl'], $mybb->settings['akismetapikey'], $akismet_array);
}
$akismet->submit_spam();
$numakismetthread = $numakismetpost = 0;
if ($snippit == "thread") {
$query = $db->query("\r\n\t\t\tSELECT p.uid, u.usergroup\r\n\t\t\tFROM " . TABLE_PREFIX . "posts p\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\r\n\t\t\tWHERE p.tid = '{$post['tid']}'\r\n\t\t");
while ($post2 = $db->fetch_array($query)) {
++$numakismetpost;
if ($post['usepostcounts'] != 0) {
$db->write_query("UPDATE " . TABLE_PREFIX . "users SET postnum=postnum-1 WHERE uid = '{$post2['uid']}'");
}
if ($mybb->settings['akismetuidsignore']) {
$akismet_uids_ignore = explode(',', $mybb->settings['akismetuidsignore']);
if (in_array($post2['usergroup'], $akismet_uids_ignore) || is_super_admin($post2['uid'])) {
continue;
}
}
if (is_super_admin($post2['uid'])) {
continue;
}
$db->write_query("UPDATE " . TABLE_PREFIX . "users SET akismetstopped=akismetstopped+1 WHERE uid = '{$post2['uid']}'");
$query1 = $db->simple_select("users", "akismetstopped", "uid = '{$post2['uid']}'");
$akismetstopped = $db->fetch_field($query1, 'akismetstopped');
// Check if the person should be banned
if ($mybb->settings['akismetnumtillban'] > 0 && $akismetstopped >= $mybb->settings['akismetnumtillban']) {
$banned_user = array("uid" => $post2['uid'], "admin" => 0, "gid" => 7, "oldgroup" => $post2['usergroup'], "dateline" => TIME_NOW, "bantime" => 'perm', "lifted" => 'perm', "reason" => "Automatically banned by the Akismet system for spamming.", "oldadditionalgroups" => '');
$db->insert_query("banned", $banned_user);
$db->update_query("users", array('usergroup' => 7), "uid = '{$post2['uid']}'");
$cache->update_moderators();
}
}
++$numakismetthread;
} else {
$db->write_query("UPDATE " . TABLE_PREFIX . "users SET akismetstopped=akismetstopped+1 WHERE uid = '{$post['uid']}'");
$query = $db->simple_select("users", "akismetstopped, usergroup", "uid = '{$post['uid']}'");
$akismetstopped = $db->fetch_field($query, 'akismetstopped');
$usergroup = $db->fetch_field($query, 'usergroup');
if ($mybb->settings['akismetuidsignore']) {
$akismet_uids_ignore = explode(',', $mybb->settings['akismetuidsignore']);
if (in_array($usergroup, $akismet_uids_ignore)) {
continue;
}
}
if (is_super_admin($post['uid'])) {
continue;
}
// Check if the person should be banned
if ($mybb->settings['akismetnumtillban'] > 0 && $akismetstopped >= $mybb->settings['akismetnumtillban']) {
$banned_user = array("uid" => $post['uid'], "admin" => 0, "gid" => 7, "oldgroup" => $usergroup, "dateline" => TIME_NOW, "bantime" => 'perm', "lifted" => 'perm', "reason" => "Automatically banned by the Akismet system for spamming.", "oldadditionalgroups" => '');
$db->insert_query("banned", $banned_user);
$db->update_query("users", array('usergroup' => 7), "uid = '{$post['uid']}'");
$cache->update_moderators();
}
++$numakismetpost;
if ($post['usepostcounts'] != 0) {
$db->write_query("UPDATE " . TABLE_PREFIX . "users SET postnum=postnum-1 WHERE uid = '{$post['uid']}'");
}
}
update_thread_counters($post['tid'], array('replies' => '-' . $numakismetpost));
update_forum_counters($post['fid'], array('threads' => '-' . $numakismetthread, 'posts' => '-' . $numakismetpost));
if ($snippit == "thread") {
redirect(get_forum_link($post['fid']), $lang->thread_spam_success);
} else {
//.........这里部分代码省略.........