[geeklog-cvs] geeklog-1.3/plugins/spamx config.php,1.3,1.4 functions.inc,1.3,1.4

blaine at iowaoutdoors.org blaine at iowaoutdoors.org
Fri Sep 24 23:24:07 EDT 2004


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

Modified Files:
	config.php functions.inc 
Log Message:
Added function plugin_chkVersion_spamx to return the current code version. The version is set in the plugins config.php. Cleaned up tabs in functions.inc to be 4 spaces.

Index: functions.inc
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/functions.inc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** functions.inc	16 Sep 2004 17:22:14 -0000	1.3
--- functions.inc	25 Sep 2004 03:24:04 -0000	1.4
***************
*** 6,10 ****
  * Copyright (C) 2004 by the following authors:
  *
! * @ Author		Tom Willett		tomw at pigstye.net
  *
  * Licensed under GNU General Public License
--- 6,10 ----
  * Copyright (C) 2004 by the following authors:
  *
! * @ Author        Tom Willett        tomw at pigstye.net
  *
  * Licensed under GNU General Public License
***************
*** 100,105 ****
      if (SEC_hasRights('spamx.admin')) {
          $retval = array($LANG_SX00['plugin_name'],
!                         $_CONF['site_admin_url'] . '/plugins/spamx/index.php',
!                         $_CONF['site_admin_url'] . '/plugins/spamx/images/spamx.gif');
      }
  
--- 100,105 ----
      if (SEC_hasRights('spamx.admin')) {
          $retval = array($LANG_SX00['plugin_name'],
!             $_CONF['site_admin_url'] . '/plugins/spamx/index.php',
!             $_CONF['site_admin_url'] . '/plugins/spamx/images/spamx.gif');
      }
  
***************
*** 123,127 ****
      if (SEC_hasRights('spamx.admin')) {
          return array($LANG_SX00['plugin_name'],
!                      $_CONF['site_admin_url'] . '/plugins/spamx/index.php', 0);
      }
  }
--- 123,127 ----
      if (SEC_hasRights('spamx.admin')) {
          return array($LANG_SX00['plugin_name'],
!            $_CONF['site_admin_url'] . '/plugins/spamx/index.php', 0);
      }
  }
***************
*** 140,152 ****
  function plugin_commentPreSave_spamx($uid, $title, $comment, $sid, $pid, $type, $postmode, $extra=null, $extra2=null)
  {
! 	global $_TABLES, $_CONF;
  
! 	// Set up Spamx_Action and SpamX_Examine arrays
! 	$result=DB_query("SELECT * FROM {$_TABLES['spamx']} WHERE name='Action'");
! 	$nrows = DB_numRows($result);
! 	for ($i=1;$i<=$nrows;$i++) {
! 		$A=DB_fetchArray($result);
! 		$Spamx_Action[]=$A['value'];
! 	}
      $result=DB_query("SELECT * FROM {$_TABLES['spamx']} WHERE name='Examine'");
      $nrows = DB_numRows($result);
--- 140,152 ----
  function plugin_commentPreSave_spamx($uid, $title, $comment, $sid, $pid, $type, $postmode, $extra=null, $extra2=null)
  {
!     global $_TABLES, $_CONF;
  
!     // Set up Spamx_Action and SpamX_Examine arrays
!     $result=DB_query("SELECT * FROM {$_TABLES['spamx']} WHERE name='Action'");
!     $nrows = DB_numRows($result);
!     for ($i=1;$i<=$nrows;$i++) {
!         $A=DB_fetchArray($result);
!         $Spamx_Action[]=$A['value'];
!     }
      $result=DB_query("SELECT * FROM {$_TABLES['spamx']} WHERE name='Examine'");
      $nrows = DB_numRows($result);
***************
*** 154,207 ****
          $A=DB_fetchArray($result);
          $Spamx_Examine[]=$A['value'];
!     }   
!  
!    	if ($extra == null) {
! 		$commnt = array(
! 			'uid'     => $uid,
! 			'title'   => $title,
! 			'comment' => $comment,
! 			'sid'     => $sid,
! 			'pid'     => $pid,
! 		   	'type'    => $type,
! 			'postmode'=> $postmode);
! 	} else {
! 		$commnt = array(
! 			'uid'     => $uid,
! 			'title'   => $sid,
! 			'comment' => $pid,
! 			'sid'     => $type,
! 			'pid'     => $postmode,
! 		   	'type'    => $extra,
! 			'postmode'=> $extra2);
! 	}
  
! 	$res=0;
      foreach ($Spamx_Examine as $Examine) {
! 		$filename = $Examine . '.Examine.class.php';
          if (file_exists($_CONF['path'] . 'plugins/spamx/' . $filename)) {
! 			require_once $_CONF['path'] . 'plugins/spamx/' . $filename;
! 			$EX = new $Examine;
! 			$EX->init($commnt);
! 			$res = $EX->execute();
! 			$commnt = $EX->getComment();
! 			if ($res == 1) {
! 				break;
! 			}
! 		}
! 	}
! 	if ($res == 1) {
! 		foreach($Spamx_Action as $Action) {
! 			$filename = $Action . '.Action.class.php';
! 			if (file_exists($_CONF['path'] . 'plugins/spamx/' . $filename)) {
! 				require_once($_CONF['path'] . 'plugins/spamx/' . $filename);
! 				$AC = new $Action;
!        	        $AC->init($commnt);
! 				$AC->execute();	
! 				$commnt=$AC->getComment();
! 			}
! 		}
! 		return $AC->result();
! 	}
! 	return false;
  }
  
--- 154,207 ----
          $A=DB_fetchArray($result);
          $Spamx_Examine[]=$A['value'];
!     }
  
!        if ($extra == null) {
!         $commnt = array(
!             'uid'     => $uid,
!             'title'   => $title,
!             'comment' => $comment,
!             'sid'     => $sid,
!             'pid'     => $pid,
!             'type'    => $type,
!             'postmode'=> $postmode);
!     } else {
!         $commnt = array(
!             'uid'     => $uid,
!             'title'   => $sid,
!             'comment' => $pid,
!             'sid'     => $type,
!             'pid'     => $postmode,
!             'type'    => $extra,
!             'postmode'=> $extra2);
!     }
! 
!     $res=0;
      foreach ($Spamx_Examine as $Examine) {
!         $filename = $Examine . '.Examine.class.php';
          if (file_exists($_CONF['path'] . 'plugins/spamx/' . $filename)) {
!             require_once $_CONF['path'] . 'plugins/spamx/' . $filename;
!             $EX = new $Examine;
!             $EX->init($commnt);
!             $res = $EX->execute();
!             $commnt = $EX->getComment();
!             if ($res == 1) {
!                 break;
!             }
!         }
!     }
!     if ($res == 1) {
!         foreach($Spamx_Action as $Action) {
!             $filename = $Action . '.Action.class.php';
!             if (file_exists($_CONF['path'] . 'plugins/spamx/' . $filename)) {
!                 require_once($_CONF['path'] . 'plugins/spamx/' . $filename);
!                 $AC = new $Action;
!                 $AC->init($commnt);
!                 $AC->execute();
!                 $commnt=$AC->getComment();
!             }
!         }
!         return $AC->result();
!     }
!     return false;
  }
  
***************
*** 215,219 ****
  */
  
! $_SPAMX_log_flg = true;		// Set to false to turn of logging
  
  function SPAMX_log( $logentry )
--- 215,219 ----
  */
  
! $_SPAMX_log_flg = true;        // Set to false to turn of logging
  
  function SPAMX_log( $logentry )
***************
*** 222,235 ****
      
      if ($_SPAMX_log_flg == true) {
! 	$timestamp = strftime( "%c" );
! 	$logfile = $_CONF['path_log'] . 'spamx.log';
!            
!     	if( !$file = fopen( $logfile, "a" ))
!     	{
!         	COM_errorLog($LANG01[33] . $logfile . ' (' . $timestamp . ')',1);
!     	}
!                
!     	fputs( $file, "$timestamp - $logentry \n" );
!     }          
      return $retval;
  }
--- 222,235 ----
      
      if ($_SPAMX_log_flg == true) {
!     $timestamp = strftime( "%c" );
!     $logfile = $_CONF['path_log'] . 'spamx.log';
! 
!         if( !$file = fopen( $logfile, "a" ))
!         {
!             COM_errorLog($LANG01[33] . $logfile . ' (' . $timestamp . ')',1);
!         }
! 
!         fputs( $file, "$timestamp - $logentry \n" );
!     }
      return $retval;
  }
***************
*** 282,286 ****
      return $p;
  }
!                                         
  
  /**
--- 282,296 ----
      return $p;
  }
! 
! 
! /**
! * Return the current version of code. 
! * Used in the Plugin Editor to show the registered version and code version
! */
! function plugin_chkVersion_spamx() {
!     global $_SPX_CONF;
!     return $_SPX_CONF['version'];
! }
! 
  
  /**
***************
*** 309,322 ****
      // Check and see if plugin is still enabled - if so display warning and exit
      if ($installCheck != '' && DB_getItem($_TABLES['plugins'],'pi_enabled', 'pi_name = "' .$pi_name. '"')) {
! 	    COM_errorLog("Plugin is installed and enabled. Disable first if you want to de-install it",1);
! 		$display .= COM_startBlock($LANG_SX00['warning']);
! 		$display .= $LANG_SX00['enabled'];
! 		$display .= COM_endBlock();
! 		echo $display;
! 		return false;
! 		exit;
! 	}
  
! 	// Ok to proceed and delete plugin
  
      // Unregister the plugin with Geeklog
--- 319,332 ----
      // Check and see if plugin is still enabled - if so display warning and exit
      if ($installCheck != '' && DB_getItem($_TABLES['plugins'],'pi_enabled', 'pi_name = "' .$pi_name. '"')) {
!         COM_errorLog("Plugin is installed and enabled. Disable first if you want to de-install it",1);
!         $display .= COM_startBlock($LANG_SX00['warning']);
!         $display .= $LANG_SX00['enabled'];
!         $display .= COM_endBlock();
!         echo $display;
!         return false;
!         exit;
!     }
  
!     // Ok to proceed and delete plugin
  
      // Unregister the plugin with Geeklog
***************
*** 348,350 ****
  }
  
! ?>
--- 358,360 ----
  }
  
! ?>
\ No newline at end of file

Index: config.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/spamx/config.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** config.php	16 Sep 2004 08:19:19 -0000	1.3
--- config.php	25 Sep 2004 03:24:04 -0000	1.4
***************
*** 12,15 ****
--- 12,17 ----
  */
  
+ $_SPX_CONF['version'] = '1.01';
+ 
  // URL blacklist changes RSS feed (currently only RSS v1.0 is supported)
  $_SPX_CONF['rss_url'] = 'http://www.jayallen.org/comment_spam/feeds/blacklist-changes.rdf';




More information about the geeklog-cvs mailing list