本文整理汇总了PHP中Akismet::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Akismet::check方法的具体用法?PHP Akismet::check怎么用?PHP Akismet::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akismet
的用法示例。
在下文中一共展示了Akismet::check方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: akismet_fake_draft
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;
}
}