当前位置: 首页>>代码示例>>PHP>>正文


PHP Akismet::submitHam方法代码示例

本文整理汇总了PHP中Akismet::submitHam方法的典型用法代码示例。如果您正苦于以下问题:PHP Akismet::submitHam方法的具体用法?PHP Akismet::submitHam怎么用?PHP Akismet::submitHam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Akismet的用法示例。


在下文中一共展示了Akismet::submitHam方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Akismet

 function report_ham($c)
 {
     $spam = $this->db->quick_query('SELECT * FROM %pspam WHERE spam_id=%d', $c);
     if (!$spam) {
         return $this->message('Spam Control', 'There is no such spam comment.', 'Continue', '/index.php?a=spam_control');
     }
     if ($this->user['user_level'] == USER_CONTRIBUTOR) {
         $user = null;
         if ($spam['spam_type'] == COMMENT_BLOG) {
             $user = $this->db->quick_query('SELECT post_user FROM %blogposts WHERE post_id=%d', $spam['spam_post']);
         } else {
             if ($spam['spam_type'] == COMMENT_GALLERY) {
                 $user = $this->db->quick_query('SELECT photo_user FROM %pphotogallery WHERE photo_id=%d', $spam['spam_post']);
             } else {
                 if ($spam['spam_type'] == COMMENT_FILE) {
                     $user = $this->db->quick_query('SELECT file_user FROM %pfilelist WHERE file_id=%d', $spam['spam_post']);
                 }
             }
         }
         if (!$user) {
             return $this->error('Access Denied: You do not own the entry you are trying to report.');
         }
     }
     $svars = json_decode($spam['spam_server'], true);
     // Setup and deliver the information to flag this comment as legit with Akismet.
     require_once 'lib/akismet.php';
     $akismet = new Akismet($this->settings['site_address'], $this->settings['wordpress_api_key'], $this->version);
     $akismet->setCommentAuthor($spam['spam_author']);
     $akismet->setCommentAuthorURL($spam['spam_url']);
     $akismet->setCommentContent($spam['spam_message']);
     $akismet->setUserIP($spam['spam_ip']);
     $akismet->setReferrer($svars['HTTP_REFERER']);
     $akismet->setUserAgent($svars['HTTP_USER_AGENT']);
     $akismet->setCommentType('comment');
     $akismet->submitHam();
     $q = $spam['spam_post'];
     $author = $spam['spam_user'];
     $author_name = $spam['spam_author'];
     $message = $spam['spam_message'];
     $url = $spam['spam_url'];
     $time = $spam['spam_date'];
     $ip = $spam['spam_ip'];
     $type = $spam['spam_type'];
     $this->settings['spam_count']--;
     $this->settings['ham_count']++;
     $this->save_settings();
     $this->db->dbquery("INSERT INTO %pblogcomments\n\t\t   (comment_post, comment_user, comment_author, comment_message, comment_date, comment_ip, comment_type)\n\t\t   VALUES ( %d, %d, '%s', '%s', %d, '%s', %d)", $q, $author, $author_name, $message, $time, $ip, $type);
     if ($type == COMMENT_BLOG) {
         $this->db->dbquery('UPDATE %pblogposts SET post_comment_count=post_comment_count+1 WHERE post_id=%d', $q);
     } elseif ($type == COMMENT_GALLERY) {
         $this->db->dbquery('UPDATE %pphotogallery SET photo_comment_count=photo_comment_count+1 WHERE photo_id=%d', $q);
     } elseif ($type == COMMENT_FILE) {
         $this->db->dbquery('UPDATE %pfilelist SET file_comment_count=file_comment_count+1 WHERE file_id=%d', $q);
     }
     $this->db->dbquery('DELETE FROM %pspam WHERE spam_id=%d', $c);
     return $this->message('Spam Control', 'Comment has been posted and Akismet notified of a false positive.', 'Continue', $this->settings['site_address'] . 'index.php?a=spam_control');
 }
开发者ID:biggtfish,项目名称:Sandbox,代码行数:57,代码来源:spam_control.php

示例2: akismet_showpage


//.........这里部分代码省略.........
                            $user->read();
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'));
                            $akismet->setCommentAuthor($user->username);
                            $akismet->setCommentAuthorEmail($user->email);
                            $akismet->setCommentAuthorURL($link->url);
                            $akismet->setCommentContent($link->content);
                            $akismet->setPermalink(getmyurl('story', $link->id));
                            $akismet->submitSpam();
                        } elseif ($value == "notspam") {
                            if (isset($key)) {
                                $link_id = sanitize($key, 3);
                            } else {
                                $link_id = '';
                            }
                            $spam_links = get_misc_data('spam_links');
                            $spam_links = unserialize(get_misc_data('spam_links'));
                            $key = array_search($link_id, $spam_links);
                            unset($spam_links[$key]);
                            misc_data_update('spam_links', serialize($spam_links));
                            $link = new Link();
                            $link->id = $link_id;
                            $link->read(FALSE);
                            $link->status = 'queued';
                            $link->store();
                            $user = new User();
                            $user->id = $link->author;
                            $user->read();
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'));
                            $akismet->setCommentAuthor($user->username);
                            $akismet->setCommentAuthorEmail($user->email);
                            $akismet->setCommentAuthorURL($link->url);
                            $akismet->setCommentContent($link->content);
                            $akismet->setPermalink(getmyurl('story', $link->id));
                            $akismet->submitHam();
                        }
                    }
                }
            }
            header('Location: ' . URL_akismet . '&view=manageSpam');
        }
        if ($view == 'isSpamcomment') {
            if ($_GET['action'] == "bulkmod") {
                if (isset($_POST['submit'])) {
                    $spamcomment = array();
                    foreach ($_POST["spamcomment"] as $k => $v) {
                        $spamcomment[intval($k)] = $v;
                    }
                    foreach ($spamcomment as $key => $value) {
                        if ($value == "spamcomment") {
                            if (isset($key)) {
                                $link_id = sanitize($key, 3);
                            } else {
                                $link_id = '';
                            }
                            global $db;
                            $spam_comments = get_misc_data('spam_comments');
                            $spam_comments = unserialize(get_misc_data('spam_comments'));
                            $key = array_search($link_id, $spam_comments);
                            unset($spam_comments[$key]);
                            $sql_result = "Select * from " . table_prefix . "spam_comments where auto_id=" . $link_id;
                            $result_arr = $db->get_results($sql_result);
                            if ($result_arr) {
                                foreach ($result_arr as $result_arr_comments) {
                                    $link = new Link();
                                    $link->id = $result_arr_comments->linkid;
                                    $link->read();
开发者ID:pantofla,项目名称:waterfan,代码行数:67,代码来源:akismet_main.php

示例3: appconf

$ak = appconf('akismet_key');
if (!$ak) {
    header('Location: ' . site_prefix() . '/index/siteblog-akismet-action');
    exit;
}
loader_import('siteblog.Filters');
loader_import('siteblog.Akismet');
$comment = (array) db_single('select * from siteblog_akismet where id = ?', $parameters['id']);
unset($comment['id']);
$title = db_shift('select subject from siteblog_post where id = ?', $comment['post_id']);
$comment['permalink'] = site_url() . '/index/siteblog-post-action/id.' . $comment['post_id'] . '/title.' . siteblog_filter_link_title($title);
$pid = $comment['post_id'];
unset($comment['post_id']);
$akismet = new Akismet(site_url(), $ak, $comment);
if (!$akismet->errorsExist()) {
    // no errors
    switch ($parameters['spam']) {
        case 'yes':
            $akismet->submitSpam();
            db_execute('delete from siteblog_akismet where id = ?', $parameters['id']);
            break;
        case 'no':
            $akismet->submitHam();
            db_execute('insert into siteblog_comment values (null, ?, ?, ?, ?, ?, ?, 0, ?)', $comment['ts'], $comment['author'], $comment['email'], $comment['website'], $comment['user_ip'], $pid, $comment['body']);
            db_execute('delete from siteblog_akismet where id = ?', $parameters['id']);
            break;
    }
}
header('Location: ' . site_prefix() . '/index/siteblog-akismet-action');
exit;
开发者ID:vojtajina,项目名称:sitellite,代码行数:30,代码来源:index.php

示例4: akismet_showpage


//.........这里部分代码省略.........
                    $spam = array();
                    foreach ($_POST["spam"] as $k => $v) {
                        $spam[intval($k)] = $v;
                    }
                    foreach ($spam as $key => $value) {
                        if (isset($key)) {
                            $link_id = sanitize($key, 3);
                        } else {
                            continue;
                        }
                        $link = new Link();
                        $link->id = $link_id;
                        $link->read();
                        $user = new User();
                        $user->id = $link->author;
                        $user->read();
                        if (phpnum() < 5) {
                            $comment = array('author' => $user->username, 'email' => $user->email, 'website' => $link->url, 'body' => $link->content, 'permalink' => my_base_url . getmyurl('story', $link->id));
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'), $comment);
                        } else {
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'));
                            $akismet->setCommentAuthor($user->username);
                            $akismet->setCommentAuthorEmail($user->email);
                            $akismet->setCommentAuthorURL($link->url);
                            $akismet->setCommentContent($link->content);
                            $akismet->setPermalink(my_base_url . getmyurl('story', $link->id));
                        }
                        if ($value == "spam") {
                            $link->status = 'spam';
                            $link->store();
                            killspam($user->id);
                            $akismet->submitSpam();
                        } elseif ($value == "notspam") {
                            $link->status = 'new';
                            $link->store();
                            $akismet->submitHam();
                        }
                        $db->query("DELETE FROM " . table_prefix . "spam_links WHERE linkid={$link_id}");
                    }
                }
            }
            header('Location: ' . URL_akismet . '&view=manageSpam');
            die;
        }
        if ($view == 'isSpamcomment') {
            if ($_GET['action'] == "bulkmod") {
                if (isset($_POST['submit'])) {
                    $spamcomment = array();
                    foreach ($_POST["spamcomment"] as $k => $v) {
                        $spamcomment[intval($k)] = $v;
                    }
                    foreach ($spamcomment as $key => $value) {
                        if (isset($key)) {
                            $link_id = sanitize($key, 3);
                        } else {
                            continue;
                        }
                        $sql_result = "Select * from " . table_prefix . "spam_comments where auto_id=" . $link_id;
                        $result = $db->get_row($sql_result);
                        #print_r($result);
                        $link = new Link();
                        $link->id = $result->linkid;
                        $link->read();
                        $user = new User();
                        $user->id = $result->userid;
                        $user->read();
                        #print_r($user);
                        if (phpnum() < 5) {
                            $comment = array('author' => $user->username, 'email' => $user->email, 'website' => $link->url, 'body' => $result->cmt_content, 'permalink' => my_base_url . getmyurl('story', $link->id));
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'), $comment);
                        } else {
                            $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'));
                            $akismet->setCommentAuthor($user->username);
                            $akismet->setCommentAuthorEmail($user->email);
                            $akismet->setCommentAuthorURL($link->url);
                            $akismet->setCommentContent($result->cmt_content);
                            $akismet->setPermalink(my_base_url . getmyurl('story', $link->id));
                        }
                        if ($value == "spamcomment") {
                            $akismet->submitSpam();
                        } elseif ($value == "notspamcomment") {
                            $akismet->submitHam();
                            $sql = "INSERT INTO " . table_comments . " (comment_parent, comment_user_id, comment_link_id , comment_date, comment_randkey, comment_content) VALUES ('{$result->cmt_parent}', '{$result->userid}', '{$result->linkid}', now(), '{$result->cmt_rand}', '{$result->cmt_content}')";
                            $db->query($sql);
                            #print $sql;
                        }
                        $link->adjust_comment(1);
                        $link->store();
                        $db->query(' Delete from ' . table_prefix . 'spam_comments where auto_id=' . $link_id);
                    }
                }
                header('Location: ' . URL_akismet . '&view=manageSpamcomments');
                die;
            }
        }
    } else {
        header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI']));
        die;
    }
}
开发者ID:hyrmedia,项目名称:pligg-cms,代码行数:101,代码来源:akismet_main.php

示例5: submitHam

 /**
  * Submit ham, this call is intended for the marking of false positives, things that were incorrectly marked as spam.
  *
  * @return	bool						If everything went fine true will be returned, otherwise an exception will be triggered.
  * @param	string $userIp				IP address of the comment submitter.
  * @param	string $userAgent			User agent information.
  * @param	string[optional] $content	The content that was submitted.
  * @param	string[optional] $author	Submitted name with the comment.
  * @param	string[optional] $email		Submitted email address.
  * @param	string[optional] $url		Commenter URL.
  * @param	string[optional] $permalink	The permanent location of the entry the comment was submitted to.
  * @param	string[optional] $type		May be blank, comment, trackback, pingback, or a made up value like "registration".
  * @param	string[optional] $referrer	The content of the HTTP_REFERER header should be sent here.
  * @param	array[optional] $others		Other data (the variables from $_SERVER).
  */
 public static function submitHam($userIp, $userAgent, $content, $author = null, $email = null, $url = null, $permalink = null, $type = null, $referrer = null, $others = null)
 {
     // get some settings
     $akismetKey = self::getModuleSetting('core', 'akismet_key');
     // invalid key, so we can't detect spam
     if ($akismetKey === '') {
         return false;
     }
     // require the class
     require_once PATH_LIBRARY . '/external/akismet.php';
     // create new instance
     $akismet = new Akismet($akismetKey, SITE_URL);
     // set properties
     $akismet->setTimeOut(10);
     $akismet->setUserAgent('Fork CMS/2.1');
     // try it to decide it the item is spam
     try {
         // check with Akismet if the item is spam
         return $akismet->submitHam($userIp, $userAgent, $content, $author = null, $email = null, $url = null, $permalink = null, $type = null, $referrer = null, $others = null);
     } catch (Exception $e) {
         // in debug mode we want to see exceptions, otherwise the fallback will be triggered
         if (SPOON_DEBUG) {
             throw $e;
         }
     }
     // when everything fails
     return false;
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:43,代码来源:model.php

示例6: reportHam

 static function reportHam($comments)
 {
     $config = Config::current();
     foreach ($comments as $comment) {
         $akismet = new Akismet($config->url, $config->akismet_api_key);
         $akismet->setCommentAuthor($comment->author);
         $akismet->setCommentAuthorEmail($comment->author_email);
         $akismet->setCommentAuthorURL($comment->author_url);
         $akismet->setCommentContent($comment->body);
         $akismet->setPermalink($comment->post_id);
         $akismet->setReferrer($comment->author_agent);
         $akismet->setUserIP($comment->author_ip);
         $akismet->submitHam();
     }
 }
开发者ID:betsyzhang,项目名称:chyrp,代码行数:15,代码来源:comments.php

示例7: unmarkspamAction

 public function unmarkspamAction()
 {
     $id = $this->intVal(3);
     if ($id == 0) {
         header("location:/homeadmin/comments/");
     }
     $newsModel = new NewsModel();
     $newsModel->markSpam($id, 0);
     $akismet = new Akismet();
     $akismet->key = "5a3c4dc9f909";
     $akismet->blog = "http://tiny4cocoa.org/home/";
     if (!$akismet->verifyKey()) {
         die("akismet verify error");
     }
     $comment = $newsModel->commentById($id);
     if (!$comment) {
         die("can not find comment");
     }
     $data = array('blog' => 'http://tiny4cocoa.org/home/', 'user_ip' => $comment["ip"], 'user_agent' => $comment["useragent"], 'referrer' => $comment["referrer"], 'permalink' => "http://tiny4cocoa.org/home/s/{$comment['newsid']}", 'comment_type' => 'comment', 'comment_author' => $comment["poster"], 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $comment["content"]);
     $ret = $akismet->submitHam($data);
     header("location:/homeadmin/comments/");
 }
开发者ID:lilhorse,项目名称:cocoa,代码行数:22,代码来源:HomeadminController.php

示例8: action_admin_moderate_comments

 public function action_admin_moderate_comments($action, $comments, $handler)
 {
     $false_negatives = 0;
     $false_positives = 0;
     $provider = Options::get('habariakismet__provider');
     $endpoint = $provider == 'Akismet' ? self::SERVER_AKISMET : self::SERVER_TYPEPAD;
     $a = new Akismet(Site::get_url('habari'), Options::get('habariakismet__api_key'));
     $a->setAkismetServer($endpoint);
     foreach ($comments as $comment) {
         switch ($action) {
             case 'spam':
                 if ($comment->status == Comment::STATUS_APPROVED || $comment->status == Comment::STATUS_UNAPPROVED) {
                     $a->setCommentAuthor($comment->name);
                     $a->setCommentAuthorEmail($comment->email);
                     $a->setCommentAuthorURL($comment->url);
                     $a->setCommentContent($comment->content);
                     $a->submitSpam();
                     $false_negatives++;
                 }
                 break;
             case 'approved':
                 if ($comment->status == Comment::STATUS_SPAM) {
                     $a->setCommentAuthor($comment->name);
                     $a->setCommentAuthorEmail($comment->email);
                     $a->setCommentAuthorURL($comment->url);
                     $a->setCommentContent($comment->content);
                     $a->submitHam();
                     $false_positives++;
                 }
                 break;
         }
     }
     if ($false_negatives) {
         Session::notice(_t('Reported %d false negatives to %s.', array($false_negatives, $provider)));
     }
     if ($false_positives) {
         Session::notice(_t('Reported %d false positives to %s.', array($false_positives, $provider)));
     }
 }
开发者ID:habari-extras,项目名称:habariakismet,代码行数:39,代码来源:habariakismet.plugin.php

示例9: execute

    function execute()
    {
        $svars = array();
        $this->title('Spam Control');
        if (isset($this->get['s'])) {
            switch ($this->get['s']) {
                case 'keytest':
                    return $this->test_akismet_key();
            }
        }
        if (!isset($this->get['p'])) {
            return $this->display_spam_comments();
        }
        if (!$this->is_valid_token()) {
            return $this->error('Invalid or expired security token. Please go back, reload the form, and try again.');
        }
        $p = intval($this->get['p']);
        if ($p == 0) {
            $this->db->dbquery('TRUNCATE TABLE %pspam');
            return $this->message('Spam Control', 'All entries in the spam table have been cleared.', 'Continue', 'admin.php?a=spam');
        }
        $spam = $this->db->quick_query('SELECT s.*, u.user_name, u.user_url, u.user_id FROM %pspam s
					LEFT JOIN %pusers u ON u.user_id=s.spam_user WHERE spam_id=%d', $p);
        if (!$spam) {
            return $this->message('Spam Control', 'There is no such spam comment.', 'Continue', 'admin.php?a=spam');
        }
        $out = '';
        if (!isset($this->get['s']) || $this->get['s'] != 'delete_spam') {
            $svars = json_decode($spam['spam_server'], true);
            // Setup and deliver the information to flag this comment as legit with Akismet.
            require_once 'lib/akismet.php';
            $akismet = new Akismet($this->settings['site_address'], $this->settings['wordpress_api_key'], $this->version);
            $akismet->setCommentAuthor($spam['spam_author']);
            $akismet->setCommentAuthorURL($spam['user_url']);
            $akismet->setCommentContent($spam['spam_message']);
            $akismet->setUserIP($spam['spam_ip']);
            $akismet->setReferrer($svars['HTTP_REFERER']);
            $akismet->setCommentUserAgent($svars['HTTP_USER_AGENT']);
            $akismet->setCommentType('Sandbox');
            $akismet->submitHam();
            $q = $spam['spam_post'];
            $author = $spam['user_id'];
            $author_name = $spam['spam_author'];
            $message = $spam['spam_message'];
            $url = $spam['spam_url'];
            $time = $spam['spam_date'];
            $ip = $spam['spam_ip'];
            $type = $spam['spam_type'];
            $this->settings['spam_count']--;
            $this->settings['ham_count']++;
            $this->save_settings();
            $this->db->dbquery("INSERT INTO %pblogcomments\n\t\t\t   (comment_post, comment_user, comment_author, comment_message, comment_date, comment_ip, comment_type)\n\t\t\t   VALUES (%d, %d, '%s', '%s', %d, '%s', %d)", $q, $author, $author_name, $message, $time, $ip, $type);
            if ($type == COMMENT_BLOG) {
                $this->db->dbquery('UPDATE %pblogposts SET post_comment_count=post_comment_count+1 WHERE post_id=%d', $q);
            } elseif ($type == COMMENT_GALLERY) {
                $this->db->dbquery('UPDATE %pphotogallery SET photo_comment_count=photo_comment_count+1 WHERE photo_id=%d', $q);
            } elseif ($type == COMMENT_FILE) {
                $this->db->dbquery('UPDATE %pfilelist SET file_comment_count=file_comment_count+1 WHERE file_id=%d', $q);
            }
            $out .= 'Comment has been posted and Akismet notified of false positive.<br />';
        }
        $this->db->dbquery('DELETE FROM %pspam WHERE spam_id=%d', $p);
        $out .= 'Message deleted from spam table.';
        return $this->message('Spam Control', $out, 'Continue', 'admin.php?a=spam');
    }
开发者ID:biggtfish,项目名称:Sandbox,代码行数:65,代码来源:spam.php

示例10: delete_comments

 public function delete_comments($marks, $deleteallspam = false) {
   if ($this->manage !== true) return false;
   if (is_array($marks)) {
     foreach ($marks as $k => $mark) {
       if (!is_numeric($mark)) { // id must be a number
         unset($marks[$k]);
         continue;
       }
       if ($where) $where .= ' OR ';
       $where .= "id=$mark";
     }
   }
   elseif ($deleteallspam) $where = 'spam=1';
   if (!$where) return;
   if ($_POST['unspam'] || $_POST['spam']) {
     $action = 'UPDATE ';
     $action_result = $_POST['unspam'] ? 'unmarked as spam' : 'marked as spam';
     $set = ' SET spam=' . (int)(bool)$_POST['spam'] . ' ';
     if ($_POST['spam'] && $GLOBALS['mark_as_spam_and_delete']) {
       $action = 'DELETE FROM ';
       $action_result = 'marked for Akismet as spam and then deleted';
       $set = '';
     }
     if (!empty($this->akismet_file) && !empty($this->wpAPIkey) && @include_once($this->akismet_file)) { // submit false positive or missed spam to Akismet
       $res = mysqli_query($this->link, "SELECT * FROM commentator_comments WHERE $where AND page=\"{$this->page}\"");
       $error = mysqli_error($this->link);
       if (!$res) {
         if ($_POST['unspam']) $not = ' not';
         $error = $error ? "Mysql error: $error" : "Selection is already$not spam";
         $this->alert("No comments affected. $error");
         return;
       } 
       while ($row = mysqli_fetch_array($res, MYSQL_ASSOC)) {
         $akismet = new Akismet($this->domain, $this->wpAPIkey);
         $akismet->setCommentAuthor($row['name']);
         $akismet->setCommentAuthorEmail($row['email']);
         $akismet->setCommentAuthorURL($row['website']);
         $akismet->setCommentContent($row['comment']);
         $akismet->setPermalink('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
         if ($_POST['unspam']) $akismet->submitHam();
         else $akismet->submitSpam();
       }
     }
   }
   else {
     $action = 'DELETE FROM ';
     $action_result = 'deleted';
   }
   $res = mysqli_query($this->link, $action . "commentator_comments {$set}WHERE $where AND page=\"{$this->page}\"");
   $affected = mysqli_affected_rows($this->link);
   if ($affected !== 1) $s = 's';
   $this->alert($affected . " comment$s $action_result");
 }
开发者ID:raffles,项目名称:Commentator,代码行数:53,代码来源:commentator.php

示例11: array

 function submitham_action()
 {
     global $vars, $post, $get;
     $error = NULL;
     if (PLUGIN_AKISMET_USE_RECAPTCHA) {
         // was there a reCAPTCHA response?
         if (isset($post["recaptcha_response_field"])) {
             $resp = recaptcha_check_answer(PLUGIN_AKISMET_RECAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], $post["recaptcha_challenge_field"], $post["recaptcha_response_field"]);
             $error = $resp->error;
             $captcha_valid = $resp->is_valid;
             // If no response from reCAPTCHA, Assume as valid.
         } else {
             $captcha_valid = TRUE;
             if (PLUGIN_AKISMET_RECAPTCHA_LOG) {
                 PluginAkismet::spamlog_write($vars, array('body' => 'reCaptcha invalid'), LOG_DIR . 'captchalog.txt');
             }
         }
     }
     $comment = $vars['comment'];
     $vars = $vars['vars'];
     if ($captcha_valid) {
         if (PLUGIN_AKISMET_RECAPTCHA_LOG) {
             PluginAkismet::spamlog_write($vars, array('body' => 'break'), LOG_DIR . 'captchalog.txt');
         }
         // Memorize the user is human because he could pass captcha
         $use_authlevel = PLUGIN_AKISMET_THROUGH_IF_ENROLLEE ? ROLE_AUTH : (PLUGIN_AKISMET_THROUGH_IF_ADMIN ? ROLE_ADM_CONTENTS : 0);
         is_human(TRUE, PLUGIN_AKISMET_USE_SESSION, $use_authlevel);
         // set to session
         // submitHam
         if (PLUGIN_AKISMET_USE_AKISMET) {
             $akismet = new Akismet(get_script_uri(), PLUGIN_AKISMET_API_KEY, $comment);
             $akismet->submitHam();
         }
         // autopost
         if (PLUGIN_AKISMET_AUTOPOST_AFTER_SUBMITHAM) {
             // throw to originally called plugin
             // refer lib/pukiwiki.php
             $cmd = isset($vars['cmd']) ? $vars['cmd'] : (isset($vars['plugin']) ? $vars['plugin'] : 'read');
             if (exist_plugin_action($cmd)) {
                 $post = $vars;
                 $get = array();
                 do_plugin_init($cmd);
                 return do_plugin_action($cmd);
             } else {
                 $msg = 'plugin=' . htmlspecialchars($cmd) . ' is not implemented.';
                 return array('msg' => $msg, 'body' => $msg);
             }
         } else {
             $body = '<p>スパム取り消し報告を行いました。以下がスパムと判断された投稿内容です。再度投稿してください。</p>' . "\n";
             $body .= '<div class="ie5"><table class="style_table" cellspacing="1" border="0"><tbody>' . "\n";
             foreach ($vars as $key => $val) {
                 $body .= '<tr>' . "\n";
                 $body .= ' <td class="style_td">' . htmlspecialchars($key) . '<td>' . "\n";
                 $body .= ' <td class="style_td">' . htmlspecialchars($val) . '<td>' . "\n";
                 $body .= '</tr>' . "\n";
             }
             $body .= '</tbody></table></div>' . "\n";
             return array('msg' => 'キャプチャ認証', 'body' => $body);
         }
     } else {
         $form = PluginAkismet::get_captcha_form($vars, $comment, $error);
         return array('msg' => 'キャプチャ認証', 'body' => $form);
     }
 }
开发者ID:orangeal2o3,项目名称:pukiwiki-plugin,代码行数:64,代码来源:akismet.inc.php


注:本文中的Akismet::submitHam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。