[geeklog-cvs] geeklog-1.3/plugins/spamx DeleteComment.Action.class.php,1.1,1.2 EditBlackList.Admin.class.php,1.1,1.2 Import.Admin.class.php,1.5,1.6 LogView.Admin.class.php,1.1,1.2 MTBlackList.Examine.class.php,1.2,1.3 MailAdmin.Action.class.php,1.2,1.3 ViewBlacklist.Admin.class.php,1.2,1.3 rss.inc.php,1.1,1.2

blaine at iowaoutdoors.org blaine at iowaoutdoors.org
Sun Oct 3 14:41:20 EDT 2004


Update of /var/cvs/geeklog-1.3/plugins/spamx
In directory www:/tmp/cvs-serv14921/plugins/spamx

Modified Files:
	DeleteComment.Action.class.php EditBlackList.Admin.class.php 
	Import.Admin.class.php LogView.Admin.class.php 
	MTBlackList.Examine.class.php MailAdmin.Action.class.php 
	ViewBlacklist.Admin.class.php rss.inc.php 
Log Message:
Updated code from Tom as part of the GL 1.3.10 final preparation.
Formatted code to remove tabs to use spaces

Index: EditBlackList.Admin.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/EditBlackList.Admin.class.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** EditBlackList.Admin.class.php	3 Sep 2004 19:59:55 -0000	1.1
--- EditBlackList.Admin.class.php	3 Oct 2004 18:41:18 -0000	1.2
***************
*** 1,80 ****
  <?php
  /**
! * File: EditBlackList.Admin.class.php
! * This is the Edit Personal Blacklist Module for the Geeklog SpamX Plug-in!
! *
! * Copyright (C) 2004 by the following authors:
! *
! * @ Author		Tom Willett		tomw at pigstye.net
! *
! * Licensed under GNU General Public License
! *
! */
  
  /**
! * Personal Black List Editor
! *
! */
  
  require_once($_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php');
  
  class EditBlackList extends BaseAdmin {
! 	/**
! 	* Constructor
! 	* 
! 	*/
! 	function display(){
! 		global $_CONF, $HTTP_GET_VARS, $HTTP_POST_VARS, $_TABLES, $LANG_SX00;
  
! 		require_once $_CONF['path'] . 'plugins/spamx/rss.inc.php';
! 		
! 		$action = SPAMX_applyFilter($HTTP_GET_VARS['action']);
! 		if (empty($action)) {
! 			$action = SPAMX_applyFilter($HTTP_POST_VARS['paction']);
! 		}
  
! 		$entry = SPAMX_applyFilter($HTTP_GET_VARS['entry']);
! 		if (empty($entry)) {
! 			$entry = SPAMX_applyFilter($HTTP_POST_VARS['pentry']);
! 		}
  
! 		if ($action == 'delete') {
! 			$result = DB_query('DELETE FROM ' . $_TABLES['spamx'] . ' where name="Personal" AND value="' . $entry . '"');
! 		} elseif ($action == $LANG_SX00['addentry']) {
! 			if ($entry != "") {
! 				$result = DB_query('INSERT INTO ' . $_TABLES['spamx'] . ' VALUES ("Personal","' . $entry . '")');
! 			}
! 		} elseif ($action == $LANG_SX00['addcen']) {
! 			foreach($_CONF['censorlist'] as $entry) {
! 				$result = DB_query('INSERT INTO ' . $_TABLES['spamx'] . ' VALUES ("Personal","' . $entry . '")');
! 			}
! 		}
! 		
! 		$display = '<hr><p><b>';
! 		$display .= $LANG_SX00['pblack'];
! 		$display .= '</b></p><ul>';
! 		$result = DB_query('SELECT * FROM ' . $_TABLES['spamx'] . ' WHERE name="Personal"');
          $nrows = DB_numRows($result);
!         for($i=1;$i<=$nrows;$i++) {
!         	$A=DB_fetchArray($result);
!         	$e=$A['value'];
! 			$display .= '<li><a href="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditBlackList&action=delete&entry=' . urlencode($e) . '">' . $e . '</a></li>';
! 		}
! 		$display .= '</ul><p>' . $LANG_SX00['e1'] . '</p>';
! 		$display .= '<p>' . $LANG_SX00['e2'] . '</p>';
! 		$display .= '<form method="post" action="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditBlackList">';
! 		$display .= '<input type="text" size ="30" name="pentry">   ';
! 		$display .= '<input type="Submit" name="paction" value="' . $LANG_SX00['addentry'] . '">';
! 		$display .= '<p>' . $LANG_SX00['e3'] . '&nbsp&nbsp&nbsp';
! 		$display .= '<input type = "Submit" name="paction" value="' . $LANG_SX00['addcen'] . '">';
! 		$display .= '</form>';
! 		return $display;
! 	}
! 	
! 	function link()
! 	{
! 		return "Edit Personal Blacklist";
! 	}
! }
  
  ?>
\ No newline at end of file
--- 1,77 ----
  <?php
  /**
!  * File: EditBlackList.Admin.class.php
!  * This is the Edit Personal Blacklist Module for the Geeklog SpamX Plug-in!
!  * 
!  * Copyright (C) 2004 by the following authors:
!  * Author		Tom Willett		tomw at pigstye.net
!  * 
!  * Licensed under GNU General Public License
!  */
  
  /**
!  * Personal Black List Editor
!  */
  
  require_once($_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php');
  
  class EditBlackList extends BaseAdmin {
!     /**
!      * Constructor
!      */
!     function display()
!     {
!         global $_CONF, $HTTP_GET_VARS, $HTTP_POST_VARS, $_TABLES, $LANG_SX00;
  
!         require_once $_CONF['path'] . 'plugins/spamx/rss.inc.php';
  
!         $action = COM_applyFilter($HTTP_GET_VARS['action']);
!         if (empty($action)) {
!             $action = COM_applyFilter($HTTP_POST_VARS['paction']);
!         } 
  
!         $entry = COM_applyFilter($HTTP_GET_VARS['entry']);
!         if (empty($entry)) {
!             $entry = COM_applyFilter($HTTP_POST_VARS['pentry']);
!         } 
! 
!         if ($action == 'delete') {
!             $result = DB_query('DELETE FROM ' . $_TABLES['spamx'] . ' where name="Personal" AND value="' . $entry . '"');
!         } elseif ($action == $LANG_SX00['addentry']) {
!             if ($entry != "") {
!                 $result = DB_query('INSERT INTO ' . $_TABLES['spamx'] . ' VALUES ("Personal","' . $entry . '")');
!             } 
!         } elseif ($action == $LANG_SX00['addcen']) {
!             foreach($_CONF['censorlist'] as $entry) {
!                 $result = DB_query('INSERT INTO ' . $_TABLES['spamx'] . ' VALUES ("Personal","' . $entry . '")');
!             } 
!         } 
! 
!         $display = '<hr><p><b>';
!         $display .= $LANG_SX00['pblack'];
!         $display .= '</b></p><ul>';
!         $result = DB_query('SELECT * FROM ' . $_TABLES['spamx'] . ' WHERE name="Personal"');
          $nrows = DB_numRows($result);
!         for($i = 1;$i <= $nrows;$i++) {
!             $A = DB_fetchArray($result);
!             $e = $A['value'];
!             $display .= '<li><a href="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditBlackList&action=delete&entry=' . urlencode($e) . '">' . $e . '</a></li>';
!         } 
!         $display .= '</ul><p>' . $LANG_SX00['e1'] . '</p>';
!         $display .= '<p>' . $LANG_SX00['e2'] . '</p>';
!         $display .= '<form method="post" action="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditBlackList">';
!         $display .= '<input type="text" size ="30" name="pentry">   ';
!         $display .= '<input type="Submit" name="paction" value="' . $LANG_SX00['addentry'] . '">';
!         $display .= '<p>' . $LANG_SX00['e3'] . '&nbsp&nbsp&nbsp';
!         $display .= '<input type = "Submit" name="paction" value="' . $LANG_SX00['addcen'] . '">';
!         $display .= '</form>';
!         return $display;
!     } 
! 
!     function link()
!     {
!         return "Edit Personal Blacklist";
!     } 
! } 
  
  ?>
\ No newline at end of file

Index: ViewBlacklist.Admin.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/ViewBlacklist.Admin.class.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ViewBlacklist.Admin.class.php	16 Sep 2004 08:19:19 -0000	1.2
--- ViewBlacklist.Admin.class.php	3 Oct 2004 18:41:18 -0000	1.3
***************
*** 1,110 ****
  <?php
  /**
! * File: ViewBlacklist.Admin.class.php
! * This is a Module which allows you to view/import other blacklists. for the Geeklog SpamX Plug-in!
! *
! * Copyright (C) 2004 by the following authors:
! *
! * @ Author		Tom Willett		tomw at pigstye.net
! *
! * Licensed under GNU General Public License
! *
! */
  
  require_once($_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php');
  
  class ViewBlacklist extends BaseAdmin {
! 	/**
! 	* Constructor
! 	* 
! 	*/
! 	function display(){
          global $_CONF, $_TABLES, $HTTP_GET_VARS, $HTTP_POST_VARS,
!                $LANG_SX00, $_SPX_CONF;
  
! 		require_once($_CONF['path'] . 'plugins/spamx/magpierss/rss_fetch.inc');
! 		require_once($_CONF['path'] . 'plugins/spamx/magpierss/rss_utils.inc');
! 		require_once($_CONF['path'] . 'plugins/spamx/rss.inc.php');
! 		
! 		$result = DB_query("SELECT * FROM {$_TABLES['spamx']} WHERE name='Personal'");
! 		$nrows=DB_numRows($result);
! 		for($i=1;$i<=$nrows;$i++) {
! 			$A=DB_fetchArray($result);
! 			$SPAMX_BLACKLIST[]=$A['value'];
! 		}
! 		$action = SPAMX_applyFilter($HTTP_GET_VARS['action']);
! 		$paction = SPAMX_applyFilter($HTTP_POST_VARS['paction']);
! 		$site = SPAMX_applyFilter($HTTP_GET_VARS['site']);
! 		$rss = fetch_rss($_SPX_CONF['spamx_rss_url']);
! 		if ($action == 'import') {
! 			$rdf='';
! 			foreach($rss->items as $item) {
! 				if ($item['title'] == $site) {
! 					$rdf = $item['rdf'];
! 					break;
! 				}
! 			}
! 			if ($rdf != '') {
! 				$rss=fetch_rss($rdf);
! 				$i=0;
! 				foreach($rss->items as $item){
! 					$result = DB_query('INSERT INTO ' . $_TABLES['spamx'] . ' VALUES ("Personal","' . $item['title'] . '")');
! 					$SPAMX_BLACKLIST[]=$item['title'];
! 					$i=$i+1;
! 				}
! 				Spamx_rss($SPAMX_BLACKLIST);
                  SPAMX_log($LANG_SX00['add1'] . $i . $LANG_SX00['add2'] . $site . $LANG_SX00['add3']);
                  return COM_refresh($_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditBlackList');
!             }
! 		}
! 		if ($paction == 'Create Rss') {
! 			Spamx_rss($SPAMX_BLACKLIST);
! 			$display = $LANG_SX00['rsscreated'] . '<br>';
! 			$display .= '<form method="post" action="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=ViewBlackList">';
! 			$display .= '<input type="submit" name="paction" value="' . $LANG_SX00['ok'] . '">';
! 			$display .= '</form>';
! 			DB_query("Replace INTO " . $_TABLES['vars'] . " set name='spamx', value=1");
! 					
! 		} elseif (DB_getItem($_TABLES['vars'],'value','name = "spamx"') == 1) {
! 			$display .= "<p><b>" . $LANG_SX00['availb'] . "</b></p><table border='1' cellpadding='4'>";
! 			$display .= '<tr><td>' . $LANG_SX00['clickv'] . '</td><td>' . $LANG_SX00['clicki'] . '</td></tr>';
! 			foreach($rss->items as $item) {
! 				$display .= '<tr><td><a href="' . $item['link'] . '">' . $item['title'] . '</a></td>';
! 				$display .= '<td><a href="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=ViewBlackList&action=import&site=' . urlencode($item['title']) . '">Import ' . $item['title'] . '</a></td></tr>';
! 			}
! 			$display .= '</table>';
  
! 		} else {
! 			$display = '<p>' . $LANG_SX00['impinst1a'] . $LANG_SX00['impinst1b'] . '</p><p>';
! 			$display .= $LANG_SX00['impinst2'] . $LANG_SX00['impinst2a'] . $LANG_SX00['impinst2b'];
! 			$display .= $LANG_SX00['impinst2c'] . '</p>';
! 			$display .= $LANG_SX00['impinst3'];
! 			$display .= '<form method="post" action="' . $_SPX_CONF['spamx_submit_url'] . '">';
! 			$display .= '<table>';
! 			$display .= '<tr><td>' . $LANG_SX00['sitename'] . '</td><td><input type="text" size="45" name="site" value="' . $_CONF['site_name'] . '"></td></tr>';
! 			$display .= '<tr><td>' . $LANG_SX00['URL'] . '</td><td><input type="text" size="45" name="url" value="' . $_CONF['site_url'] . '/spamx/index.php"></td></tr>';
! 			$rdfpath = str_replace($_CONF['path_html'],"",dirname($_CONF['rdf_file']));
! 			$display .= '<tr><td>' . $LANG_SX00['RDF'] . '</td><td><input type="text" size="45" name="rdf" value="' . $_CONF['site_url'] . '/' . $rdfpath . '/spamx.rdf"></td></tr>';
! 			$display .= '</table>';
! 			$display .= '<input type="submit" name="paction" value="' . $LANG_SX00['submit'] . '"> ' . $LANG_SX00['subthis'];
! 			$display .= '</form>';
! 			$display .= '<p>This second button creates an rdf feed so that others can import your list.</p>';
! 			$display .= '<form method="post" action="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=ViewBlackList">';
! 			$display .= '<input type="submit" name="paction" value="Create Rss">';
! 			$display .= '</form>';
! 			$display .= $LANG_SX00['inst1'];
! 			$display .= $LANG_SX00['inst2'];
! 			$display .= $LANG_SX00['inst3'];
! 			$display .= $LANG_SX00['inst4'];
! 			$display .= $LANG_SX00['inst5'];
! 		}
! 		return $display;
! 	}
! 	
! 	function link()
! 	{
! 		return "View/Import Other SpamX Blacklists";
! 	}
! }
  
  ?>
--- 1,106 ----
  <?php
  /**
!  * File: ViewBlacklist.Admin.class.php
!  * This is a Module which allows you to view/import other blacklists. for the Geeklog SpamX Plug-in!
!  * 
!  * Copyright (C) 2004 by the following authors:
!  * Author		Tom Willett		tomw at pigstye.net
!  * 
!  * Licensed under GNU General Public License
!  */
  
  require_once($_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php');
  
  class ViewBlacklist extends BaseAdmin {
!     /**
!      * Constructor
!      */
!     function display()
!     {
          global $_CONF, $_TABLES, $HTTP_GET_VARS, $HTTP_POST_VARS,
!         $LANG_SX00, $_SPX_CONF;
  
!         require_once($_CONF['path'] . 'plugins/spamx/magpierss/rss_fetch.inc');
!         require_once($_CONF['path'] . 'plugins/spamx/magpierss/rss_utils.inc');
!         require_once($_CONF['path'] . 'plugins/spamx/rss.inc.php');
! 
!         $result = DB_query("SELECT * FROM {$_TABLES['spamx']} WHERE name='Personal'");
!         $nrows = DB_numRows($result);
!         for($i = 1;$i <= $nrows;$i++) {
!             $A = DB_fetchArray($result);
!             $SPAMX_BLACKLIST[] = $A['value'];
!         } 
!         $action = COM_applyFilter($HTTP_GET_VARS['action']);
!         $paction = COM_applyFilter($HTTP_POST_VARS['paction']);
!         $site = COM_applyFilter($HTTP_GET_VARS['site']);
!         $rss = fetch_rss($_SPX_CONF['spamx_rss_url']);
!         if ($action == 'import') {
!             $rdf = '';
!             foreach($rss->items as $item) {
!                 if ($item['title'] == $site) {
!                     $rdf = $item['rdf'];
!                     break;
!                 } 
!             } 
!             if ($rdf != '') {
!                 $rss = fetch_rss($rdf);
!                 $i = 0;
!                 foreach($rss->items as $item) {
!                     $result = DB_query('INSERT INTO ' . $_TABLES['spamx'] . ' VALUES ("Personal","' . $item['title'] . '")');
!                     $SPAMX_BLACKLIST[] = $item['title'];
!                     $i = $i + 1;
!                 } 
!                 Spamx_rss($SPAMX_BLACKLIST);
                  SPAMX_log($LANG_SX00['add1'] . $i . $LANG_SX00['add2'] . $site . $LANG_SX00['add3']);
                  return COM_refresh($_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=EditBlackList');
!             } 
!         } 
!         if ($paction == 'Create Rss') {
!             Spamx_rss($SPAMX_BLACKLIST);
!             $display = $LANG_SX00['rsscreated'] . '<br>';
!             $display .= '<form method="post" action="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=ViewBlackList">';
!             $display .= '<input type="submit" name="paction" value="' . $LANG_SX00['ok'] . '">';
!             $display .= '</form>';
!             DB_query("Replace INTO " . $_TABLES['vars'] . " set name='spamx', value=1");
!         } elseif (DB_getItem($_TABLES['vars'], 'value', 'name = "spamx"') == 1) {
!             $display .= "<p><b>" . $LANG_SX00['availb'] . "</b></p><table border='1' cellpadding='4'>";
!             $display .= '<tr><td>' . $LANG_SX00['clickv'] . '</td><td>' . $LANG_SX00['clicki'] . '</td></tr>';
!             foreach($rss->items as $item) {
!                 $display .= '<tr><td><a href="' . $item['link'] . '">' . $item['title'] . '</a></td>';
!                 $display .= '<td><a href="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=ViewBlackList&action=import&site=' . urlencode($item['title']) . '">Import ' . $item['title'] . '</a></td></tr>';
!             } 
!             $display .= '</table>';
!         } else {
!             $display = '<p>' . $LANG_SX00['impinst1a'] . $LANG_SX00['impinst1b'] . '</p><p>';
!             $display .= $LANG_SX00['impinst2'] . $LANG_SX00['impinst2a'] . $LANG_SX00['impinst2b'];
!             $display .= $LANG_SX00['impinst2c'] . '</p>';
!             $display .= $LANG_SX00['impinst3'];
!             $display .= '<form method="post" action="' . $_SPX_CONF['spamx_submit_url'] . '">';
!             $display .= '<table>';
!             $display .= '<tr><td>' . $LANG_SX00['sitename'] . '</td><td><input type="text" size="45" name="site" value="' . $_CONF['site_name'] . '"></td></tr>';
!             $display .= '<tr><td>' . $LANG_SX00['URL'] . '</td><td><input type="text" size="45" name="url" value="' . $_CONF['site_url'] . '/spamx/index.php"></td></tr>';
!             $rdfpath = str_replace($_CONF['path_html'], "", dirname($_CONF['rdf_file']));
!             $display .= '<tr><td>' . $LANG_SX00['RDF'] . '</td><td><input type="text" size="45" name="rdf" value="' . $_CONF['site_url'] . '/' . $rdfpath . '/spamx.rdf"></td></tr>';
!             $display .= '</table>';
!             $display .= '<input type="submit" name="paction" value="' . $LANG_SX00['submit'] . '"> ' . $LANG_SX00['subthis'];
!             $display .= '</form>';
!             $display .= '<p>This second button creates an rdf feed so that others can import your list.</p>';
!             $display .= '<form method="post" action="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=ViewBlackList">';
!             $display .= '<input type="submit" name="paction" value="Create Rss">';
!             $display .= '</form>';
!             $display .= $LANG_SX00['inst1'];
!             $display .= $LANG_SX00['inst2'];
!             $display .= $LANG_SX00['inst3'];
!             $display .= $LANG_SX00['inst4'];
!             $display .= $LANG_SX00['inst5'];
!         } 
!         return $display;
!     } 
  
!     function link()
!     {
!         return "View/Import Other SpamX Blacklists";
!     } 
! } 
  
  ?>

Index: Import.Admin.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/Import.Admin.class.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Import.Admin.class.php	24 Sep 2004 10:21:15 -0000	1.5
--- Import.Admin.class.php	3 Oct 2004 18:41:18 -0000	1.6
***************
*** 2,30 ****
  
  /**
! * file:  Import.Admin.class.php
! * MTBlacklist refresh module
! *
! * Updates Sites MT Blacklist via Master MT Blacklist rss feed
! * 
! * Copyright (C) 2004 by the following authors:
! *
! * @ Author      Tom Willett     tomw at pigstye.net
! * @ Author      Dirk Haun       dirk at haun-online.de
! *
! * Licensed under GNU General Public License
! *
! * Based on MT-Blacklist Updater by
! * Cheah Chu Yeow (http://blog.codefront.net/)
! *
! */
  
  require_once ($_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php');
  
- 
  class Import extends BaseAdmin {
      /**
!     * Constructor
!     * 
!     */
      function display ()
      {
--- 2,26 ----
  
  /**
!  * file:  Import.Admin.class.php
!  * MTBlacklist refresh module
!  * 
!  * Updates Sites MT Blacklist via Master MT Blacklist rss feed
!  * 
!  * Copyright (C) 2004 by the following authors:
!  * Author      Tom Willett     tomw at pigstye.net
!  * Author      Dirk Haun       dirk at haun-online.de
!  * 
!  * Licensed under GNU General Public License
!  * 
!  * Based on MT-Blacklist Updater by
!  * Cheah Chu Yeow (http://blog.codefront.net/)
!  */
  
  require_once ($_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php');
  
  class Import extends BaseAdmin {
      /**
!      * Constructor
!      */
      function display ()
      {
***************
*** 35,42 ****
          } else {
              $display = $this->_initial_import ();
!         }
  
          return $display;
!     }
  
      function link ()
--- 31,38 ----
          } else {
              $display = $this->_initial_import ();
!         } 
  
          return $display;
!     } 
  
      function link ()
***************
*** 48,60 ****
          } else {
              $display = $LANG_SX00['initial_import'];
!         }
  
          return $display;
!     }
  
      /**
!     * Update MT Blacklist from RSS feed
!     *
!     */
      function _update_blacklist ()
      {
--- 44,55 ----
          } else {
              $display = $LANG_SX00['initial_import'];
!         } 
  
          return $display;
!     } 
  
      /**
!      * Update MT Blacklist from RSS feed
!      */
      function _update_blacklist ()
      {
***************
*** 64,81 ****
          require_once($_CONF['path'] . 'plugins/spamx/magpierss/rss_utils.inc');
  
!         $rss = fetch_rss($_SPX_CONF['rss_url']);
          // 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?
!             if( strpos( $subject, 'addition' ) !== false ) {
                  // save it to database
                  $result = DB_query('SELECT * FROM ' . $_TABLES['spamx'] . ' WHERE name="MTBlacklist" AND value="' . $entry . '"');
--- 59,75 ----
          require_once($_CONF['path'] . 'plugins/spamx/magpierss/rss_utils.inc');
  
!         $rss = fetch_rss($_SPX_CONF['rss_url']); 
          // 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?
!             if (strpos($subject, 'addition') !== false) {
                  // save it to database
                  $result = DB_query('SELECT * FROM ' . $_TABLES['spamx'] . ' WHERE name="MTBlacklist" AND value="' . $entry . '"');
***************
*** 83,89 ****
                  if ($nrows < 1) {
                      $result = DB_query('INSERT INTO ' . $_TABLES['spamx'] . ' VALUES ("MTBlacklist","' . $entry . '")');
!                     $to_add[]=$entry;
!                 }
!             } else if( strpos( $subject, 'deletion' ) !== false ) {
                  // delete it from database
                  $result = DB_query('SELECT * FROM ' . $_TABLES['spamx'] . ' where name="MTBlacklist" AND value="' . $entry . '"');
--- 77,83 ----
                  if ($nrows < 1) {
                      $result = DB_query('INSERT INTO ' . $_TABLES['spamx'] . ' VALUES ("MTBlacklist","' . $entry . '")');
!                     $to_add[] = $entry;
!                 } 
!             } else if (strpos($subject, 'deletion') !== false) {
                  // delete it from database
                  $result = DB_query('SELECT * FROM ' . $_TABLES['spamx'] . ' where name="MTBlacklist" AND value="' . $entry . '"');
***************
*** 91,116 ****
                  if ($nrows >= 1) {
                      $result = DB_query('DELETE FROM ' . $_TABLES['spamx'] . ' where name="MTBlacklist" AND value="' . $entry . '"');
!                     $to_delete[]=$entry;
!                 }
!             }
!         }
          $display = '<hr><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 ()
      {
--- 85,109 ----
                  if ($nrows >= 1) {
                      $result = DB_query('DELETE FROM ' . $_TABLES['spamx'] . ' where name="MTBlacklist" AND value="' . $entry . '"');
!                     $to_delete[] = $entry;
!                 } 
!             } 
!         } 
          $display = '<hr><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 ()
      {
***************
*** 118,122 ****
  
          if (ini_get ('allow_url_fopen')) {
- 
              $blacklist = file ($_SPX_CONF['mtblacklist_url']);
              $count = $this->_do_import ($blacklist);
--- 111,114 ----
***************
*** 125,136 ****
                  $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';
  
--- 117,126 ----
                  $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';
  
***************
*** 142,158 ****
                      $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><a href="' . $_SPX_CONF['mtblacklist_url']
!                          . '">' . $_SPX_CONF['mtblacklist_url'] . '</a>';
!             }
!         }
! 
          // Import Personal Blacklist for existing users.
          $fromfile = $_CONF['path_html'] . 'spamx/blacklist.php';
--- 132,147 ----
                      $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><a href="' . $_SPX_CONF['mtblacklist_url']
!                  . '">' . $_SPX_CONF['mtblacklist_url'] . '</a>';
!             } 
!         } 
          // Import Personal Blacklist for existing users.
          $fromfile = $_CONF['path_html'] . 'spamx/blacklist.php';
***************
*** 160,184 ****
              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)
      {
--- 149,172 ----
              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)
      {
***************
*** 191,210 ****
              if (!empty ($entry)) {
                  DB_query ('INSERT INTO ' . $_TABLES['spamx']
!                           . ' VALUES ("MTBlacklist","' . addslashes ($entry)
!                           . '")');
                  $count++;
!             }
!         }
  
          return $count;
!     }
  
      /**
!     * Import personal blacklist
!     *
!     * @param    array   $lines  The blacklist
!     * @return   int             number of lines imported
!     *
!     */
      function _do_importp ($lines)
      {
--- 179,197 ----
              if (!empty ($entry)) {
                  DB_query ('INSERT INTO ' . $_TABLES['spamx']
!                      . ' VALUES ("MTBlacklist","' . addslashes ($entry)
!                      . '")');
                  $count++;
!             } 
!         } 
  
          return $count;
!     } 
  
      /**
!      * Import personal blacklist
!      * 
!      * @param array $lines The blacklist
!      * @return int number of lines imported
!      */
      function _do_importp ($lines)
      {
***************
*** 215,227 ****
              if (!empty ($entry)) {
                  DB_query ('INSERT INTO ' . $_TABLES['spamx']
!                           . ' VALUES ("Personal","' . $entry . '")');
!                $count++;
!             }
!         }
  
          return $count;
!     }
! 
! }
  
  ?>
--- 202,213 ----
              if (!empty ($entry)) {
                  DB_query ('INSERT INTO ' . $_TABLES['spamx']
!                      . ' VALUES ("Personal","' . $entry . '")');
!                 $count++;
!             } 
!         } 
  
          return $count;
!     } 
! } 
  
  ?>

Index: MailAdmin.Action.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/MailAdmin.Action.class.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MailAdmin.Action.class.php	16 Sep 2004 08:19:19 -0000	1.2
--- MailAdmin.Action.class.php	3 Oct 2004 18:41:18 -0000	1.3
***************
*** 1,47 ****
  <?php
  /**
! * File: DeleteComment.Action.class.php
! * This is the Delete Comment Action  for the Geeklog SpamX Plug-in!
! *
! * Copyright (C) 2004 by the following authors:
! *
! * @ Author		Tom Willett		tomw at pigstye.net
! *
! * Licensed under GNU General Public License
! *
! */
  
  /**
! * Include Abstract Action Class
! *
! */
  require_once($_CONF['path'] . 'plugins/spamx/' . 'BaseCommand.class.php');
  
- 
  /**
! * Action Class which just discards comment
! *
! * @author Tom Willett  tomw at pigstye.net
! *
! */
  class MailAdmin extends BaseCommand {
! 	/**
! 	* No Constructor  Uses BaseCommand
! 	*
! 	*/
  
! 	function execute()
! 	{
! 		global $result, $_CONF, $LANG_SX00, $_SPX_CONF, $comment;
  
- 		$msg = 'A new comment has been posted at ' . $_CONF['site_name'] . ":\n";
- 		$msg .= "Title: {$comment['title']}\n";
- 		$msg .= "UID: {$comment['uid']}\n";
- 		$msg .= "Content: {$comment['comment']}";
- 		COM_mail($_SPX_CONF['notification_email'], 'Spam Comment at ' . $_CONF['site_name'], $msg);
- 		$result = '';
- 		SPAMX_log('Mail Sent to Admin');
- 		return 1;
- 	}
- }
  ?>
--- 1,46 ----
  <?php
  /**
!  * File: DeleteComment.Action.class.php
!  * This is the Delete Comment Action  for the Geeklog SpamX Plug-in!
!  * 
!  * Copyright (C) 2004 by the following authors:
!  * Author		Tom Willett		tomw at pigstye.net
!  * 
!  * Licensed under GNU General Public License
!  */
  
  /**
!  * Include Abstract Action Class
!  */
  require_once($_CONF['path'] . 'plugins/spamx/' . 'BaseCommand.class.php');
  
  /**
!  * Action Class which just discards comment
!  * 
!  * @author Tom Willett  tomw at pigstye.net 
!  */
  class MailAdmin extends BaseCommand {
!     /**
!      * Constructor
!      */
!     function MailAdmin()
!     {
!         global $num;
  
!         $num = 8;
!     } 
! 
!     function execute($comment)
!     {
!         global $result, $_USER, $_CONF, $LANG_SX00, $_SPX_CONF, $comment;
! 
!         $msg = sprintf($LANG_SX00['emailmsg'], $_CONF['site_name'], $_USER['uid'], $comment);
! 
!         //COM_mail($_SPX_CONF['notification_email'], 'Spam Comment at ' . $_CONF['site_name'], $msg);
!         $result = 8;
!         SPAMX_log('Mail Sent to Admin');
!         return 0;
!     } 
! } 
  
  ?>

Index: MTBlackList.Examine.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/MTBlackList.Examine.class.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MTBlackList.Examine.class.php	2 Oct 2004 13:35:23 -0000	1.2
--- MTBlackList.Examine.class.php	3 Oct 2004 18:41:18 -0000	1.3
***************
*** 1,65 ****
  <?php
  /**
! * File: MTBlackList.Examine.class.php
! * This module examines comments for entries on the MT-Blacklist for the Geeklog SpamX Plug-in!
! *
! * Copyright (C) 2004 by the following authors:
! *
! * @ Author		Tom Willett		tomw at pigstye.net
! *
! * Licensed under GNU General Public License
! *
! * The MT-Blacklist is maintained by Jay Allen
! * http://www.jayallen.org/comment_spam/
! *
! */
  
  /**
! *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
! *
! */
  
  class MTBlackList extends BaseCommand {
! 	/**
! 	* No Constructor Use BaseCommand constructor
! 	*
! 	*/
! 	/**
! 	* Here we do the work
! 	*
! 	*/
! 	function execute()
! 	{
! 		global $_CONF, $comment, $_USER, $_TABLES, $LANG_SX00, $HTTP_SERVER_VARS;
! 		
! 		/**
! 		* Include Blacklist Data
! 		*
! 		*/
! 		$result = DB_Query("SELECT * FROM {$_TABLES['spamx']} WHERE name='MTBlacklist'",1);
! 		$nrows = DB_numRows($result);
! 		
! 		$ans = 0;   //Found Flag
! 		for ($i=1;$i<=$nrows;$i++) {
! 			$A=DB_fetchArray($result);
! 			$val=$A['value'];
! 			if (@preg_match("#$val#",$comment['comment'])) {
! 				$ans=1;  // quit on first positive match
! 				SPAMX_log($LANG_SX00['fsc'] . $val . $LANG_SX00['fsc1'] . $_USER['uid'] . $LANG_SX00['fsc2'] . $HTTP_SERVER_VARS['REMOTE_ADDR']);
! 				break;
! 			}
! 		}				
! 		return $ans;
! 	}
! }
  
! ?>
--- 1,57 ----
  <?php
  /**
!  * File: MTBlackList.Examine.class.php
!  * This module examines comments for entries on the MT-Blacklist for the Geeklog SpamX Plug-in!
!  * 
!  * Copyright (C) 2004 by the following authors:
!  * Author		Tom Willett		tomw at pigstye.net
!  * 
!  * Licensed under GNU General Public License
!  * 
!  * The MT-Blacklist is maintained by Jay Allen
!  * http://www.jayallen.org/comment_spam/
!  */
  
  /**
!  * 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 
!  */
  
  class MTBlackList extends BaseCommand {
!     /**
!      * No Constructor Use BaseCommand constructor
!      */
!     /**
!      * Here we do the work
!      */
!     function execute($comment)
!     {
!         global $_CONF, $_USER, $_TABLES, $REMOTE_ADDR, $LANG_SX00;
  
!         /**
!          * Include Blacklist Data
!          */
!         $result = DB_Query("SELECT * FROM {$_TABLES['spamx']} WHERE name='MTBlacklist'", 1);
!         $nrows = DB_numRows($result);
! 
!         $ans = 0; //Found Flag
!         for ($i = 1;$i <= $nrows;$i++) {
!             $A = DB_fetchArray($result);
!             $val = $A['value'];
!             if (@preg_match("#$val#", $comment)) {
!                 $ans = 1; // quit on first positive match
!                 SPAMX_log($LANG_SX00['fsc'] . $val . $LANG_SX00['fsc1'] . $_USER['uid'] . $LANG_SX00['fsc2'] . $REMOTE_ADDR);
!                 break;
!             } 
!         } 
!         return $ans;
!     } 
! } 
! 
! ?>
\ No newline at end of file

Index: rss.inc.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/rss.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rss.inc.php	3 Sep 2004 19:59:55 -0000	1.1
--- rss.inc.php	3 Oct 2004 18:41:18 -0000	1.2
***************
*** 1,120 ****
  <?php
  
! /** 
! * Create the spamx rss feed
! *
! * @param items	array of blacklisted sites
! */
! 
! function Spamx_rss($items) {
! 	global $_CONF;
! 
! 	// Basic Data
! 	$about = $_CONF['site_url'] . '/spamx/index.php';
! 	$title = 'SpamX Blacklist';
! 	$description = 'Personal Spamx Blacklist from site ' . $_CONF['site_name'];
! 	// Dublic Core Data
! 	$dc = array('dc:publisher' => $_CONF['site_name'],
! 				'dc:creator'   => $_CONF['site_name'],
! 				'dc:date'      => time());
! 	$rssfile = new RSSWriter($about, $title, $description, $dc);
! 	
! 	//  Add items
! 	foreach($items as $item) {
! 		$about = $_CONF['site_url'] . '/spamx/index.php';  
! 		$title = $item;
! 		$description = $item;
! 		$dc = array('dc:subject' => 'Personal Blacklist',
! 					'dc:author'  => $_CONF['site_name']);
! 		$rssfile->addItem($about, $title, $dc);
! 	}
  
! 	// Now write the file
! 	
! 	$buff = $rssfile->serialize();
! 	$rdfpath = dirname($_CONF['rdf_file']);
! 	$rdffile = $rdfpath . '/spamx.rdf';
! 	$fp = fopen($rdffile,"w");
! 	fputs($fp,$buff);
! 	fclose($fp);	
! }
  
- //
  // A convenience class to make it easy to write RSS classes
  // Edd Dumbill <mailto:edd+rsswriter at usefulinc.com>
! //
  // Revision 1.4  2004/06/11 11:00  towm
  // Changed output to string
! //
  // Revision 1.3  2001/05/20 17:58:02  edmundd
  // Final distribution tweaks.
! //
  // Revision 1.2  2001/05/20 17:41:30  edmundd
  // Ready for distribution.
! //
  // Revision 1.1  2001/05/20 17:01:43  edmundd
  // First functional draft of code working.
! //
  // Revision 1.1  2001/05/17 18:17:46  edmundd
  // Start of a convenience library to help RSS1.0 creation
- //
  
  class RSSWriter {
  
! function RSSWriter($uri, $title, $description, $meta=array()) {
! 	$this->chaninfo=array();
! 	$this->website=$uri;
! 	$this->chaninfo["link"]=$uri;
! 	$this->chaninfo["description"]=$description;
! 	$this->chaninfo["title"]=$title;
! 	$this->items=array();
! 	$this->modules=array("dc" => "http://purl.org/dc/elements/1.1/");
! 	$this->channelURI=str_replace("&", "&", "http://" . $GLOBALS["SERVER_NAME"] . $GLOBALS["REQUEST_URI"]);
! 	foreach ($meta as $key => $value) {
! 		$this->chaninfo[$key]=$value;
! 	}
! }
! 
! function useModule($prefix, $uri) {
! 	$this->modules[$prefix]=$uri;
! }
  
! function setImage($imgURI, $imgAlt, $imgWidth=88, $imgHeight=31) {
! 	$this->image=array(
! 		"uri" => $imgURI, "title" => $imgAlt, "width" => $imgWidth,
! 		"height" => $imgHeight);
! }
  
! function addItem($uri, $title, $meta=array()) {
! 	$item=array("uri" => $uri, "link" => $uri, 
! 		"title" => $this->deTag($title));
! 	foreach ($meta as $key => $value) {
! 		if ($key == "description" || $key == "dc:description") {
! 			$value=$this->deTag($value);
! 		}
! 		$item[$key]=$value;
! 	}
! 	$this->items[]=$item;
! }
  
! function serialize() {
! 	$buff = $this->preamble();
! 	$buff.= $this->channelinfo();
! 	$buff.= $this->image();
! 	$buff.= $this->items();
! 	$buff.= $this->postamble();
! 	return $buff;
! }
  
! function deTag($in) {
!   while(ereg('<[^>]+>', $in)) {
! 	$in=ereg_replace('<[^>]+>', '', $in);
!   }
!   return $in;
! }
  
! function preamble() {
! 	//header("Content-type: text/xml");
! 	$display = '<?xml version="1.0" encoding="iso-8859-1"?>
  <rdf:RDF 
           xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
--- 1,120 ----
  <?php
  
! /**
!  * Create the spamx rss feed
!  * 
!  * @param items $ array of blacklisted sites
!  */
  
! function Spamx_rss($items)
! {
!     global $_CONF; 
!     // Basic Data
!     $about = $_CONF['site_url'] . '/spamx/index.php';
!     $title = 'SpamX Blacklist';
!     $description = 'Personal Spamx Blacklist from site ' . $_CONF['site_name']; 
!     // Dublic Core Data
!     $dc = array('dc:publisher' => $_CONF['site_name'],
!         'dc:creator' => $_CONF['site_name'],
!         'dc:date' => time());
!     $rssfile = new RSSWriter($about, $title, $description, $dc); 
!     // Add items
!     foreach($items as $item) {
!         $about = $_CONF['site_url'] . '/spamx/index.php';
!         $title = $item;
!         $description = $item;
!         $dc = array('dc:subject' => 'Personal Blacklist',
!             'dc:author' => $_CONF['site_name']);
!         $rssfile->addItem($about, $title, $dc);
!     } 
!     // Now write the file
!     $buff = $rssfile->serialize();
!     $rdfpath = dirname($_CONF['rdf_file']);
!     $rdffile = $rdfpath . '/spamx.rdf';
!     $fp = fopen($rdffile, "w");
!     fputs($fp, $buff);
!     fclose($fp);
! } 
  
  // A convenience class to make it easy to write RSS classes
  // Edd Dumbill <mailto:edd+rsswriter at usefulinc.com>
! 
  // Revision 1.4  2004/06/11 11:00  towm
  // Changed output to string
! 
  // Revision 1.3  2001/05/20 17:58:02  edmundd
  // Final distribution tweaks.
! 
  // Revision 1.2  2001/05/20 17:41:30  edmundd
  // Ready for distribution.
! 
  // Revision 1.1  2001/05/20 17:01:43  edmundd
  // First functional draft of code working.
! 
  // Revision 1.1  2001/05/17 18:17:46  edmundd
  // Start of a convenience library to help RSS1.0 creation
  
  class RSSWriter {
+     function RSSWriter($uri, $title, $description, $meta = array())
+     {
+         $this->chaninfo = array();
+         $this->website = $uri;
+         $this->chaninfo["link"] = $uri;
+         $this->chaninfo["description"] = $description;
+         $this->chaninfo["title"] = $title;
+         $this->items = array();
+         $this->modules = array("dc" => "http://purl.org/dc/elements/1.1/");
+         $this->channelURI = str_replace("&", "&", "http://" . $GLOBALS["SERVER_NAME"] . $GLOBALS["REQUEST_URI"]);
+         foreach ($meta as $key => $value) {
+             $this->chaninfo[$key] = $value;
+         } 
+     } 
  
!     function useModule($prefix, $uri)
!     {
!         $this->modules[$prefix] = $uri;
!     } 
  
!     function setImage($imgURI, $imgAlt, $imgWidth = 88, $imgHeight = 31)
!     {
!         $this->image = array("uri" => $imgURI, "title" => $imgAlt, "width" => $imgWidth,
!             "height" => $imgHeight);
!     } 
  
!     function addItem($uri, $title, $meta = array())
!     {
!         $item = array("uri" => $uri, "link" => $uri,
!             "title" => $this->deTag($title));
!         foreach ($meta as $key => $value) {
!             if ($key == "description" || $key == "dc:description") {
!                 $value = $this->deTag($value);
!             } 
!             $item[$key] = $value;
!         } 
!         $this->items[] = $item;
!     } 
  
!     function serialize()
!     {
!         $buff = $this->preamble();
!         $buff .= $this->channelinfo();
!         $buff .= $this->image();
!         $buff .= $this->items();
!         $buff .= $this->postamble();
!         return $buff;
!     } 
  
!     function deTag($in)
!     {
!         while (ereg('<[^>]+>', $in)) {
!             $in = ereg_replace('<[^>]+>', '', $in);
!         } 
!         return $in;
!     } 
  
!     function preamble()
!     { 
!         // header("Content-type: text/xml");
!         $display = '<?xml version="1.0" encoding="iso-8859-1"?>
  <rdf:RDF 
           xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
***************
*** 122,172 ****
           xmlns:mn="http://usefulinc.com/rss/manifest/"
  ';
! 	foreach ($this->modules as $prefix => $uri) {
! 		$display .= "         xmlns:${prefix}=\"${uri}\"\n";
! 	}
! 	$display .= ">\n\n";
! 	return $display;
! }
  
! function channelinfo() {
! 	$display = '  <channel rdf:about="' .  $this->channelURI . '">';
! 	$i=$this->chaninfo;
! 	foreach (array("title", "link", "dc:source", "description", "dc:language", "dc:publisher",
! 		"dc:creator", "dc:rights") as $f) {
! 		if (isset($i[$f])) {
! 			$display .= "    <${f}>" . htmlspecialchars($i[$f]) . "</${f}>\n";
! 		}
! 	}
! 	if (isset($this->image)) {
! 		$display .= "    <image rdf:resource=\"" . htmlspecialchars($this->image["uri"]) . "\" />\n";
! 	}
! 	$display .= "    <items>\n";
! 	$display .= "      <rdf:Seq>\n";
! 	foreach ($this->items as $i) {
! 		$display .= "        <rdf:li rdf:resource=\"" . htmlspecialchars($i["uri"]) . "\" />\n";
! 	}
! 	$display .= "      </rdf:Seq>\n";
! 	$display .= "    </items>\n";
! 	$display .= "  </channel>\n\n";
! 	return $display;
! }
  
! function image() {
! 	$display = '';
! 	if (isset($this->image)) {
! 	$display .= "  <image rdf:about=\"" . htmlspecialchars($this->image["uri"]) . "\">\n";
!     $display .= "     <title>" . htmlspecialchars($this->image["title"]) . "</title>\n";
!     $display .= "     <url>" . htmlspecialchars($this->image["uri"]) . "</url>\n";
!     $display .= "     <link>" . htmlspecialchars($this->website) . "</link>\n";
!     if ($this->chaninfo["description"]) 
!    	 $display .= "     <dc:description>" . htmlspecialchars($this->chaninfo["description"]) . 
!    	 	"</dc:description>\n";
! 	$display .= "  </image>\n\n";
! 	}
! 	return $display;
! }
  
! function postamble() {
! 	$display = '  <rdf:Description rdf:ID="manifest">
      <mn:channels>
        <rdf:Seq>
--- 122,174 ----
           xmlns:mn="http://usefulinc.com/rss/manifest/"
  ';
!         foreach ($this->modules as $prefix => $uri) {
!             $display .= "         xmlns:${prefix}=\"${uri}\"\n";
!         } 
!         $display .= ">\n\n";
!         return $display;
!     } 
  
!     function channelinfo()
!     {
!         $display = '  <channel rdf:about="' . $this->channelURI . '">';
!         $i = $this->chaninfo;
!         foreach (array("title", "link", "dc:source", "description", "dc:language", "dc:publisher",
!                 "dc:creator", "dc:rights") as $f) {
!             if (isset($i[$f])) {
!                 $display .= "    <${f}>" . htmlspecialchars($i[$f]) . "</${f}>\n";
!             } 
!         } 
!         if (isset($this->image)) {
!             $display .= "    <image rdf:resource=\"" . htmlspecialchars($this->image["uri"]) . "\" />\n";
!         } 
!         $display .= "    <items>\n";
!         $display .= "      <rdf:Seq>\n";
!         foreach ($this->items as $i) {
!             $display .= "        <rdf:li rdf:resource=\"" . htmlspecialchars($i["uri"]) . "\" />\n";
!         } 
!         $display .= "      </rdf:Seq>\n";
!         $display .= "    </items>\n";
!         $display .= "  </channel>\n\n";
!         return $display;
!     } 
  
!     function image()
!     {
!         $display = '';
!         if (isset($this->image)) {
!             $display .= "  <image rdf:about=\"" . htmlspecialchars($this->image["uri"]) . "\">\n";
!             $display .= "     <title>" . htmlspecialchars($this->image["title"]) . "</title>\n";
!             $display .= "     <url>" . htmlspecialchars($this->image["uri"]) . "</url>\n";
!             $display .= "     <link>" . htmlspecialchars($this->website) . "</link>\n";
!             if ($this->chaninfo["description"])
!                 $display .= "     <dc:description>" . htmlspecialchars($this->chaninfo["description"]) . "</dc:description>\n";
!             $display .= "  </image>\n\n";
!         } 
!         return $display;
!     } 
  
!     function postamble()
!     {
!         $display = '  <rdf:Description rdf:ID="manifest">
      <mn:channels>
        <rdf:Seq>
***************
*** 178,205 ****
  </rdf:RDF>
  ';
! 	return $display;
! }
! 
! function items() {
! 	$display = '';
! 	foreach ($this->items as $item) {
! 		$display .= "  <item rdf:about=\"" .  htmlspecialchars($item["uri"]) . "\">\n";
! 		foreach ($item as $key => $value) {
! 			if ($key!="uri") {
! 				if (is_array($value)) {
! 					foreach ($value as $v1) {
! 						$display .= "    <${key}>" . htmlspecialchars($v1) . "</${key}>\n";
! 					}
! 				} else {
! 					$display .= "    <${key}>" . htmlspecialchars($value) . "</${key}>\n";
! 				}
! 			}
! 		}
! 		$display .= "  </item>\n\n";
! 	}
! 	return $display;
! }
  
! }
  
  ?>
\ No newline at end of file
--- 180,207 ----
  </rdf:RDF>
  ';
!         return $display;
!     } 
  
!     function items()
!     {
!         $display = '';
!         foreach ($this->items as $item) {
!             $display .= "  <item rdf:about=\"" . htmlspecialchars($item["uri"]) . "\">\n";
!             foreach ($item as $key => $value) {
!                 if ($key != "uri") {
!                     if (is_array($value)) {
!                         foreach ($value as $v1) {
!                             $display .= "    <${key}>" . htmlspecialchars($v1) . "</${key}>\n";
!                         } 
!                     } else {
!                         $display .= "    <${key}>" . htmlspecialchars($value) . "</${key}>\n";
!                     } 
!                 } 
!             } 
!             $display .= "  </item>\n\n";
!         } 
!         return $display;
!     } 
! } 
  
  ?>
\ No newline at end of file

Index: LogView.Admin.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/LogView.Admin.class.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LogView.Admin.class.php	3 Sep 2004 19:59:55 -0000	1.1
--- LogView.Admin.class.php	3 Oct 2004 18:41:18 -0000	1.2
***************
*** 1,51 ****
  <?php
  /**
! * File: Logview.Admin.class.php
! * This is the LogViewer for the Geeklog SpamX Plug-in!
! *
! * Copyright (C) 2004 by the following authors:
! *
! * @ Author		Tom Willett		tomw at pigstye.net
! *
! * Licensed under GNU General Public License
! *
! */
  
  require_once($_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php');
  
  class LogView extends BaseAdmin {
! 	/**
! 	* Constructor
! 	* 
! 	*/
! 	function display(){
! 		global $_CONF, $HTTP_POST_VARS, $LANG_SX00;
! 		
! 		$action = SPAMX_applyFilter($HTTP_POST_VARS['action']);
! 		$path = $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=LogView';
! 		$log = 'spamx.log';
! 		$display .= "<form method=\"post\" action=\"{$path}\">";
! 		$display .= "<input type=\"submit\" name=\"action\" value=\"{$LANG_SX00['clearlog']}\">";
! 		$display .= "</form>";
! 		if ($action == $LANG_SX00['clearlog']) {
! 		    $timestamp = strftime( "%c" );
! 		    $fd = fopen( $_CONF['path_log'] . $log, "w");
! 		    fputs( $fd, "$timestamp {$LANG_SX00['logcleared']} \n" );
!    		    fclose($fd);
! 		}
! 		$display .= "<hr><pre>";
!     		$display .= implode('', file($_CONF['path_log'] . $log));
!     		$display .= "</pre>";
! 		return $display;
  
! 	}
! 	
! 	function link()
! 	{
! 		global $LANG_SX00;
! 		
! 		return $LANG_SX00['viewlog'];
! 	}
! }
  
  ?>
\ No newline at end of file
--- 1,48 ----
  <?php
  /**
!  * File: Logview.Admin.class.php
!  * This is the LogViewer for the Geeklog SpamX Plug-in!
!  * 
!  * Copyright (C) 2004 by the following authors:
!  * Author		Tom Willett		tomw at pigstye.net
!  * 
!  * Licensed under GNU General Public License
!  */
  
  require_once($_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php');
  
  class LogView extends BaseAdmin {
!     /**
!      * Constructor
!      */
!     function display()
!     {
!         global $_CONF, $HTTP_POST_VARS, $LANG_SX00;
  
!         $action = COM_applyFilter($HTTP_POST_VARS['action']);
!         $path = $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=LogView';
!         $log = 'spamx.log';
!         $display .= "<form method=\"post\" action=\"{$path}\">";
!         $display .= "<input type=\"submit\" name=\"action\" value=\"{$LANG_SX00['clearlog']}\">";
!         $display .= "</form>";
!         if ($action == $LANG_SX00['clearlog']) {
!             $timestamp = strftime("%c");
!             $fd = fopen($_CONF['path_log'] . $log, "w");
!             fputs($fd, "$timestamp {$LANG_SX00['logcleared']} \n");
!             fclose($fd);
!         } 
!         $display .= "<hr><pre>";
!         $display .= implode('', file($_CONF['path_log'] . $log));
!         $display .= "</pre>";
!         return $display;
!     } 
! 
!     function link()
!     {
!         global $LANG_SX00;
! 
!         return $LANG_SX00['viewlog'];
!     } 
! } 
  
  ?>
\ No newline at end of file

Index: DeleteComment.Action.class.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/DeleteComment.Action.class.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DeleteComment.Action.class.php	3 Sep 2004 19:59:55 -0000	1.1
--- DeleteComment.Action.class.php	3 Oct 2004 18:41:18 -0000	1.2
***************
*** 1,41 ****
  <?php
  /**
! * File: DeleteComment.Action.class.php
! * This is the Delete Comment Action  for the Geeklog SpamX Plug-in!
! *
! * Copyright (C) 2004 by the following authors:
! *
! * @ Author		Tom Willett		tomw at pigstye.net
! *
! * Licensed under GNU General Public License
! *
! */
  
  /**
! * Include Abstract Action Class
! *
! */
  require_once($_CONF['path'] . 'plugins/spamx/' . 'BaseCommand.class.php');
  
- 
  /**
! * Action Class which just discards comment
! *
! * @author Tom Willett  tomw at pigstye.net
! *
! */
  class DeleteComment extends BaseCommand {
! 	/**
! 	* No Constructor  Uses BaseCommand
! 	*
! 	*/
  
- 	function execute()
- 	{
- 		global $result, $_CONF, $LANG_SX00;
- 		$result = COM_refresh ($_CONF['site_url'] . '/index.php');
- 		SPAMX_log($LANG_SX00['spamdeleted']);
- 		return 1;
- 	}
- }
  ?>
\ No newline at end of file
--- 1,43 ----
  <?php
  /**
!  * File: DeleteComment.Action.class.php
!  * This is the Delete Comment Action  for the Geeklog SpamX Plug-in!
!  * 
!  * Copyright (C) 2004 by the following authors:
!  * Author		Tom Willett		tomw at pigstye.net
!  * 
!  * Licensed under GNU General Public License
!  */
  
  /**
!  * Include Abstract Action Class
!  */
  require_once($_CONF['path'] . 'plugins/spamx/' . 'BaseCommand.class.php');
  
  /**
!  * Action Class which just discards comment
!  * 
!  * @author Tom Willett  tomw at pigstye.net 
!  */
  class DeleteComment extends BaseCommand {
!     /**
!      * Constructor
!      * Numbers are always binary digits and added together to make call
!      */
!     function DeleteComment()
!     {
!         global $num;
! 
!         $num = 128;
!     } 
! 
!     function execute($comment)
!     {
!         global $result, $_CONF, $LANG_SX00;
!         $result = 128;
!         SPAMX_log($LANG_SX00['spamdeleted']);
!         return 1;
!     } 
! } 
  
  ?>
\ No newline at end of file




More information about the geeklog-cvs mailing list