[geeklog-cvs] geeklog: Removed unused code for MTBlacklist (R.I.P.)

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu May 13 10:42:16 EDT 2010


changeset 7932:c6030829e27f
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/c6030829e27f
user: Dirk Haun <dirk at haun-online.de>
date: Thu May 13 16:04:38 2010 +0200
description:
Removed unused code for MTBlacklist (R.I.P.)

diffstat:

 plugins/spamx/Import.Admin.class.php            |   242 ----
 plugins/spamx/MTBlackList.Examine.class.php     |    80 -
 plugins/spamx/magpierss/extlib/Snoopy.class.inc |  1257 -----------------------
 plugins/spamx/magpierss/rss_cache.inc           |   200 ---
 plugins/spamx/magpierss/rss_fetch.inc           |   458 --------
 plugins/spamx/magpierss/rss_parse.inc           |   605 -----------
 plugins/spamx/magpierss/rss_utils.inc           |    67 -
 plugins/spamx/rss.inc.php                       |   209 ---
 8 files changed, 0 insertions(+), 3118 deletions(-)

diffs (truncated from 3150 to 300 lines):

diff -r bae3a11e6b58 -r c6030829e27f plugins/spamx/Import.Admin.class.php
--- a/plugins/spamx/Import.Admin.class.php	Thu May 13 16:00:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +0,0 @@
-<?php
-
-/**
- * file:  Import.Admin.class.php
- * MTBlacklist refresh module
- *
- * Updates Sites MT Blacklist via Master MT Blacklist rss feed
- *
- * Copyright (C) 2004-2009 by the following authors:
- * Author      Tom Willett     tomw AT pigstye DOT net
- * Author      Dirk Haun       dirk AT haun-online DOT de
- *
- * Licensed under GNU General Public License
- *
- * Based on MT-Blacklist Updater by
- * Cheah Chu Yeow (http://blog.codefront.net/)
- *
- * @package Spam-X
- * @subpackage Modules
- */
-
-if (strpos(strtolower($_SERVER['PHP_SELF']), 'import.admin.class.php') !== false) {
-    die('This file can not be used on its own!');
-}
-
-/**
-* Include Abstract Base Class
-*/
-require_once $_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php';
-
-/**
-* MTBlacklist Import
-*
-* @package Spam-X
-*
-*/
-class Import extends BaseAdmin {
-    /**
-     * Constructor
-     */
-    function display()
-    {
-        global $_TABLES;
-
-        if (DB_count($_TABLES['spamx'], 'name', 'MTBlacklist') > 0) {
-            $display = $this->_update_blacklist();
-        } else {
-            $display = $this->_initial_import();
-        }
-
-        return $display;
-    }
-
-    function link()
-    {
-        global $_TABLES, $LANG_SX00;
-
-        if (DB_count($_TABLES['spamx'], 'name', 'MTBlacklist') > 0) {
-            $display = $LANG_SX00['uMTlist'];
-        } else {
-            $display = $LANG_SX00['initial_import'];
-        }
-
-        return $display;
-    }
-
-    /**
-     * Update MT Blacklist from RSS feed
-     */
-    function _update_blacklist()
-    {
-        global $_CONF, $_TABLES, $LANG_SX00, $_SPX_CONF;
-
-        require_once $_CONF['path'] . 'plugins/spamx/magpierss/rss_fetch.inc';
-        require_once $_CONF['path'] . 'plugins/spamx/magpierss/rss_utils.inc';
-
-        if (!defined('MAGPIE_USER_AGENT')) {
-            define('MAGPIE_USER_AGENT', 'Geeklog/' . VERSION);
-        }
-        $rss = fetch_rss($_SPX_CONF['rss_url']);
-        if ($rss === false) {
-            if (strpos($_SPX_CONF['rss_url'], 'jayallen.org') === false) {
-                return '<p>An error occured when updating MT Blacklist</p>';
-            } else {
-                $url = COM_createLink('discontinued', 'http://www.geeklog.net/article.php/mt-blacklist-discontinued');
-                return '<p>Please note that MT-Blacklist has been $url and will not be updated any more.</p>';
-            }
-        }
-
-        // entries to add and delete, according to the blacklist changes feed
-        $to_add = array();
-        $to_delete = array();
-
-        foreach ($rss->items as $item) {
-            // time this entry was published (currently unused)
-            // $published_time = parse_w3cdtf( $item['dc']['date'] );
-            $entry = substr($item['description'], 0, -3); // blacklist entry
-            $subject = $item['dc']['subject']; // indicates addition or deletion
-
-            // is this an addition or a deletion?
-            $dbentry = addslashes($entry);
-            if (strpos($subject, 'addition') !== false) {
-                // save it to database
-                $result = DB_query("SELECT name FROM {$_TABLES['spamx']} WHERE name = 'MTBlacklist' AND value = '$dbentry'");
-                $nrows = DB_numRows($result);
-                if ($nrows < 1) {
-                    DB_query("INSERT INTO {$_TABLES['spamx']} VALUES ('MTBlacklist', '$dbentry')");
-                    $to_add[] = $entry;
-                }
-            } else if (strpos($subject, 'deletion') !== false) {
-                // delete it from database
-                $result = DB_query("SELECT name FROM {$_TABLES['spamx']} WHERE name = 'MTBlacklist' AND value = '$dbentry'");
-                $nrows = DB_numRows($result);
-                if ($nrows >= 1) {
-                    DB_delete($_TABLES['spamx'], array('name', 'value'),
-                                                 array('MTBlacklist', $dbentry));
-                    $to_delete[] = $entry;
-                }
-            }
-        }
-        $display = '<hr' . XHTML . '><p><b>' . $LANG_SX00['entriesadded'] . '</b></p><ul>';
-        foreach ($to_add as $e) {
-            $display .= "<li>$e</li>";
-        }
-        $display .= '</ul><p><b>' . $LANG_SX00['entriesdeleted'] . '</b></p><ul>';
-        foreach ($to_delete as $e) {
-            $display .= "<li>$e</li>";
-        }
-        $display .= '</ul>';
-        SPAMX_log($LANG_SX00['uMTlist'] . $LANG_SX00['uMTlist2'] . count($to_add) . $LANG_SX00['uMTlist3'] . count($to_delete) . $LANG_SX00['entries']);
-
-        return $display;
-    }
-
-    /**
-     * Initial import of the MT Blacklist
-     */
-    function _initial_import()
-    {
-        global $_CONF, $_TABLES, $LANG_SX00, $_SPX_CONF;
-
-        if (ini_get('allow_url_fopen')) {
-            $blacklist = file($_SPX_CONF['mtblacklist_url']);
-            $count = $this->_do_import($blacklist);
-
-            if ($count > 0) {
-                $display = sprintf($LANG_SX00['import_success'], $count);
-                SPAMX_log($LANG_SX00['uMTlist'] . $LANG_SX00['uMTlist2']
-                          . $count . $LANG_SX00['uMTlist3'] . '0'
-                          . $LANG_SX00['entries']);
-            } else {
-                $display = $LANG_SX00['import_failure'];
-            }
-        } else { // read blacklist from local file
-            $fromfile = $_CONF['path_data'] . 'blacklist.txt';
-
-            if (file_exists($fromfile)) {
-                $blacklist = file($fromfile);
-                $count = $this->_do_import($blacklist);
-
-                if ($count > 0) {
-                    $display = sprintf($LANG_SX00['import_success'], $count);
-                    SPAMX_log($LANG_SX00['uMTlist'] . $LANG_SX00['uMTlist2']
-                              . $count . $LANG_SX00['uMTlist3'] . '0'
-                              . $LANG_SX00['entries']);
-                } else {
-                    $display = $LANG_SX00['import_failure'];
-                }
-            } else {
-                $display = sprintf($LANG_SX00['allow_url_fopen'],
-                        $_CONF['path_data']);
-                $display .= '<p>'. COM_createLink($_SPX_CONF['mtblacklist_url'],
-                        $_SPX_CONF['mtblacklist_url']);
-            }
-        }
-
-        // Import Personal Blacklist for existing users.
-        $fromfile = $_CONF['path_html'] . 'spamx/blacklist.php';
-        if (file_exists($fromfile)) {
-            require_once $fromfile;
-            $count = $this->_do_importp($SPAMX_BLACKLIST);
-            $display .= $LANG_SX00['initial_Pimport'];
-            if ($count > 0) {
-                $display .= sprintf($LANG_SX00['import_success'], $count);
-                SPAMX_log($LANG_SX00['uPlist'] . $LANG_SX00['uMTlist2']
-                          . $count . $LANG_SX00['uMTlist3'] . '0'
-                          . $LANG_SX00['entries']);
-            } else {
-                $display .= $LANG_SX00['import_failure'];
-            }
-        }
-
-        return $display;
-    }
-
-    /**
-     * Import the blacklist
-     *
-     * @param array $lines The blacklist
-     * @return int number of lines imported
-     */
-    function _do_import($lines)
-    {
-        global $_TABLES;
-
-        $count = 0;
-        foreach ($lines as $line) {
-            $l = explode('#', $line);
-            $entry = addslashes(trim($l[0]));
-            if (!empty($entry)) {
-                DB_query("INSERT INTO {$_TABLES['spamx']} VALUE ('MTBlacklist', '$entry')");
-                $count++;
-            }
-        }
-
-        return $count;
-    }
-
-    /**
-     * Import personal blacklist
-     *
-     * @param array $lines The blacklist
-     * @return int number of lines imported
-     */
-    function _do_importp($lines)
-    {
-        global $_TABLES;
-
-        $count = 0;
-        foreach ($lines as $entry) {
-            if (!empty($entry)) {
-                $entry = addslashes($entry);
-                DB_query("INSERT INTO {$_TABLES['spamx']} VALUES ('Personal', '$entry')");
-                $count++;
-            }
-        }
-
-        return $count;
-    }
-}
-
-?>
diff -r bae3a11e6b58 -r c6030829e27f plugins/spamx/MTBlackList.Examine.class.php
--- a/plugins/spamx/MTBlackList.Examine.class.php	Thu May 13 16:00:42 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-<?php
-
-/**
- * File: MTBlackList.Examine.class.php
- * This module examines comments for entries on the MT-Blacklist
- * for the Geeklog Spam-X plugin
- * 
- * Copyright (C) 2004-2009 by the following authors:
- * Author   Tom Willett     tomw AT pigstye DOT net
- * 
- * Licensed under GNU General Public License
- * 
- * The MT-Blacklist was maintained by Jay Allen
- * http://www.jayallen.org/comment_spam/
- *
- * @package Spam-X
- * @subpackage Modules
- */
-
-if (strpos(strtolower($_SERVER['PHP_SELF']), 'mtblacklist.examine.class.php') !== false) {
-    die('This file can not be used on its own!');
-}
-
-/**
- * Include Abstract Examine Class
- */
-require_once $_CONF['path'] . 'plugins/spamx/' . 'BaseCommand.class.php';
-
-/**
- * Examines Comment according to MT-BLacklist
- * 
- * @author Tom Willett tomw AT pigstye DOT net 
- *
- * @package Spam-X
- *
- */
-class MTBlackList extends BaseCommand {
-    /**
-     * No Constructor Use BaseCommand constructor
-     */
-    /**
-     * Here we do the work
-     */
-    function execute ($comment)
-    {
-        global $_CONF, $_USER, $_TABLES, $LANG_SX00;
-
-        if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) {
-            $uid = $_USER['uid'];
-        } else {



More information about the geeklog-cvs mailing list