From 66e6293a92ce860c6f5da2e876f04c58ce2f490d Mon Sep 17 00:00:00 2001
From: Thomas Hochstein <thh@inter.net>
Date: Sun, 30 Sep 2018 11:37:12 +0200
Subject: [PATCH] [spamblock] Remove dead code (Akismet spam toggle)

This code was used to tell Akismet that a comment
is spam or ham. It can't be triggered as there
are no UI buttons, and it shouldn't be used as
it uses GET params. I don't think it will be
missed.

The relevant issue has been open for about two
and a half years without a new implementation,
so let's drop it. We can always re-implement it
later ...

Closes #405.

Signed-off-by: Thomas Hochstein <thh@inter.net>
---
 .../serendipity_event_spamblock.php           | 56 -------------------
 1 file changed, 56 deletions(-)

diff --git a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php
index 9c6e2f5d..c0869668 100644
--- a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php
+++ b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php
@@ -625,45 +625,6 @@ class serendipity_event_spamblock extends serendipity_event
         }
     }
 
-    function tellAboutComment($where, $api_key, $comment_id, $is_spam)
-    {
-        global $serendipity;
-        $comment = serendipity_db_query(" SELECT C.*, L.useragent as log_useragent, E.title as entry_title "
-                                      . " FROM {$serendipity['dbPrefix']}comments C, {$serendipity['dbPrefix']}spamblocklog L , {$serendipity['dbPrefix']}entries E "
-                                      . " WHERE C.id = '" . (int)$comment_id . "' AND C.entry_id=L.entry_id AND C.entry_id=E.id "
-                                      . " AND C.author=L.author AND C.url=L.url AND C.referer=L.referer "
-                                      . " AND C.ip=L.ip AND C.body=L.body", true, 'assoc');
-        if (!is_array($comment)) return;
-
-        require_once S9Y_PEAR_PATH . 'HTTP/Request2.php';
-        if (function_exists('serendipity_request_start')) serendipity_request_start();
-
-        switch($where) {
-            case 'akismet.com':
-                // DEBUG
-                //$this->log($this->logfile, $eventData['id'], 'AKISMET_SAFETY', 'Akismet verification takes place', $addData);
-                $ret  = array();
-                $data = array(
-                  'blog'                    => $serendipity['baseURL'],
-                  'user_agent'              => $comment['log_useragent'],
-                  'referrer'                => $comment['referer'],
-                  'user_ip'                 => $comment['ip'],
-                  'permalink'               => serendipity_archiveURL($comment['entry_id'], $comment['entry_title'], 'serendipityHTTPPath', true, array('timestamp' => $comment['timestamp'])),
-                  'comment_type'            => ($comment['type'] == 'NORMAL' ? 'comment' : strtolower($comment['type'])), // second: pingback or trackback.
-                  'comment_author'          => $comment['author'],
-                  'comment_author_email'    => $comment['email'],
-                  'comment_author_url'      => $comment['url'],
-                  'comment_content'         => $comment['body']
-                );
-
-                $this->akismetRequest($api_key, $data, $ret, ($is_spam ? 'submit-spam' : 'submit-ham'));
-
-                break;
-        }
-
-        if (function_exists('serendipity_request_end')) serendipity_request_end();
-    }
-
     function &getBlacklist($where, $api_key, &$eventData, &$addData)
     {
         global $serendipity;
@@ -1362,23 +1323,6 @@ class serendipity_event_spamblock extends serendipity_event
 
                 case 'backend_comments_top':
 
-                    // Tell Akismet about spam or not spam
-                    $tell_id = null;
-                    if (isset($serendipity['GET']['spamIsSpam'])) {
-                        $tell_spam = true;
-                        $tell_id = $serendipity['GET']['spamIsSpam'];
-                    }
-                    if (isset($serendipity['GET']['spamNotSpam'])) {
-                        $tell_spam = false;
-                        $tell_id = $serendipity['GET']['spamNotSpam'];
-                    }
-                    if ($tell_id !== null) {
-                        $akismet_apikey = $this->get_config('akismet');
-                        $akismet        = $this->get_config('akismet_filter');
-                        if (!empty($akismet_apikey))
-                            $this->tellAboutComment('akismet.com', $akismet_apikey, $tell_id, $tell_spam);
-                    }
-
                     // Add Author to blacklist. If already filtered, it will be removed from the filter. (AKA "Toggle")
                     if (isset($serendipity['GET']['spamBlockAuthor'])) {
                         $item    = $this->getComment('author', $serendipity['GET']['spamBlockAuthor']);