function akismet_fake_draft(&$post) { global $mybb, $isspam, $akismet, $cache; $exclude_array = explode(',', $mybb->settings['akismetuserstoignore']); if (!$mybb->settings['akismetswitch'] || in_array($mybb->user['uid'], $exclude_array) || is_super_admin($mybb->user['uid'])) { return; } if ($mybb->settings['akismetfidsignore']) { $akismet_fids_ignore = explode(',', $mybb->settings['akismetfidsignore']); if (in_array($post->data['fid'], $akismet_fids_ignore)) { return; } } if ($mybb->settings['akismetuidsignore']) { $akismet_uids_ignore = explode(',', $mybb->settings['akismetuidsignore']); if (in_array($mybb->user['usergroup'], $akismet_uids_ignore)) { return; } } $akismet_array = array('type' => 'post', 'username' => $post->data['username'], 'email' => $mybb->user['email'], 'website' => $mybb->user['website'], 'message' => $post->data['message'], 'user_ip' => $mybb->user['ipaddress']); if (!$akismet) { $akismet = new Akismet($mybb->settings['bburl'], $mybb->settings['akismetapikey'], $akismet_array); } if ($akismet->check()) { global $db; $isspam = true; // Update our spam count attempts ++$mybb->user['akismetstopped']; $db->update_query("users", array('akismetstopped' => $mybb->user['akismetstopped']), "uid = '{$mybb->user['uid']}'"); // Check if the person should be banned if ($mybb->settings['akismetnumtillban'] > 0 && $mybb->user['akismetstopped'] >= $mybb->settings['akismetnumtillban']) { $banned_user = array("uid" => $mybb->user['uid'], "admin" => 0, "gid" => 7, "oldgroup" => $mybb->user['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 = '{$mybb->user['uid']}'"); $cache->update_moderators(); // We better do this..otherwise they have dodgy permissions $mybb->user['banoldgroup'] = $mybb->user['usergroup']; $mybb->user['usergroup'] = 7; global $mybbgroups; $mybbgroups = $mybb->user['usergroup']; if ($mybb->user['additionalgroups']) { $mybbgroups .= ',' . $mybb->user['additionalgroups']; } } // Fake visibility // Essentially because you can't modify the $visible variable we need to trick it // into thinking its saving a draft so it won't modify the users lastpost and postcount // In akismet_verify, its set back to -4 so we can still uniquely verify that this is a spam message // before it's inserted into the database. $post->data['savedraft'] = 1; } }