[geeklog-cvs] Geeklog-1.x/plugins/spamx MailAdmin.Action.class.php, 1.13, 1.14 functions.inc, 1.30, 1.31

Dirk Haun dhaun at qs1489.pair.com
Sat Jan 26 12:17:44 EST 2008


Update of /cvsroot/geeklog/Geeklog-1.x/plugins/spamx
In directory qs1489.pair.com:/tmp/cvs-serv87214/plugins/spamx

Modified Files:
	MailAdmin.Action.class.php functions.inc 
Log Message:
Added Spam-X config to the configuration GUI


Index: functions.inc
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/plugins/spamx/functions.inc,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** functions.inc	11 Feb 2007 02:06:28 -0000	1.30
--- functions.inc	26 Jan 2008 17:17:41 -0000	1.31
***************
*** 5,9 ****
   * This is the functions.inc for the Geeklog Spam-X plugin
   *
!  * Copyright (C) 2004-2006 by the following authors:
   * Authors      Tom Willett     tomw AT pigstye DOT net
   *              Dirk Haun       dirk AT haun-online DOT de
--- 5,9 ----
   * This is the functions.inc for the Geeklog Spam-X plugin
   *
!  * Copyright (C) 2004-2008 by the following authors:
   * Authors      Tom Willett     tomw AT pigstye DOT net
   *              Dirk Haun       dirk AT haun-online DOT de
***************
*** 14,18 ****
   */
  
! if (strpos ($_SERVER['PHP_SELF'], 'functions.inc') !== false) {
      die ('This file can not be used on its own.');
  }
--- 14,18 ----
   */
  
! if (strpos($_SERVER['PHP_SELF'], 'functions.inc') !== false) {
      die ('This file can not be used on its own.');
  }
***************
*** 21,37 ****
   * Language file include
   */
! $langfile = $_CONF['path'] . 'plugins/spamx/language/'
!           . $_CONF['language'] . '.php';
  
! if (file_exists ($langfile)) {
!     include_once ($langfile);
  } else {
!     include_once ($_CONF['path'] . 'plugins/spamx/language/english.php');
  }
  
  /*
! * Include spamx config files
  */
! require_once ($_CONF['path'] . 'plugins/spamx/config.php');
  
  // +---------------------------------------------------------------------------+
--- 21,52 ----
   * Language file include
   */
! $plugin_path = $_CONF['path'] . 'plugins/spamx/';
! $langfile = $plugin_path . 'language/' . $_CONF['language'] . '.php';
  
! if (file_exists($langfile)) {
!     include_once $langfile;
  } else {
!     include_once $plugin_path . 'language/english.php';
  }
  
  /*
! * As of Geeklog 1.5, the plugin's config.php is not needed any more and
! * should be removed after upgrading.
  */
! if (file_exists($plugin_path . 'config.php')) {
!     include_once $plugin_path . 'config.php';
! }
! 
! /*
! * Check and see if we need to load the plugin configuration
! */
! if (!isset($_SPX_CONF['timeout'])) {
!     require_once $_CONF['path_system'] . 'classes/config.class.php';
! 
!     $sp_config = config::get_instance();
!     $_SPX_CONF = $sp_config->get_config('spamx');
! }
! 
! $_SPX_CONF['version'] = '1.1.1';
  
  // +---------------------------------------------------------------------------+
***************
*** 153,179 ****
  *
  */
! function plugin_upgrade_spamx ()
  {
!     global $_TABLES, $_SPX_CONF;
  
!     if (!function_exists ('PLG_spamAction')) {
          return 3002; // plugin not compatible with this Geeklog version
      }
  
!     $v = DB_getItem ($_TABLES['plugins'], 'pi_version', "pi_name = 'spamx'");
  
      if ($v != $_SPX_CONF['version']) {
          switch ($v) {
!             case '1.0.1':
!                 // Add the counter
!                 DB_query ("INSERT INTO {$_TABLES['vars']} VALUES ('spamx.counter', '0')");
!                 break;
          }
  
          // update version numbers
-         DB_query ("UPDATE {$_TABLES['plugins']} SET pi_version = '{$_SPX_CONF['version']}', pi_gl_version = '1.4.1' WHERE pi_name = 'spamx'");
  
          // check if version number was updated successfully
!         $v = DB_getItem ($_TABLES['plugins'], 'pi_version', "pi_name = 'spamx'");
      }
  
--- 168,231 ----
  *
  */
! function plugin_upgrade_spamx()
  {
!     global $_CONF, $_TABLES, $_SPX_CONF, $plugin_path;
  
!     if (!function_exists('PLG_spamAction')) {
          return 3002; // plugin not compatible with this Geeklog version
      }
  
!     $v = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = 'spamx'");
  
      if ($v != $_SPX_CONF['version']) {
          switch ($v) {
!         case '1.0.1':
!             // Add the counter
!             DB_query("INSERT INTO {$_TABLES['vars']} VALUES ('spamx.counter', '0')");
!             DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.1.0', pi_gl_version = '1.4.1' WHERE pi_name = 'spamx'");
!             break;
! 
!         case '1.1.0':
!             if (file_exists($plugin_path . 'config.php')) {
!                 require_once $_CONF['path_system'] . 'classes/config.class.php';
! 
!                 $spx_config = config::get_instance();
!                 $spx_config->initConfig();
!                 if (!$spx_config->group_exists('spamx')) {
!                     $enable_email = true;
!                     if (empty($_SPX_CONF['notification_email']) || ($_SPX_CONF['notification_email'] == $_CONF['site_mail'])) {
!                         $enable_email = false;
!                     }
! 
!                     $spx_config->add('logging', $_SPX_CONF['logging'], 'select', 0, 0, 1, 10, true, 'spamx');
!                     $spx_config->add('admin_override', $_SPX_CONF['admin_override'], 'select', 0, 0, 1, 20, true, 'spamx');
!                     $spx_config->add('timeout', $_SPX_CONF['timeout'], 'text', 0, 0, null, 30, true, 'spamx');
!                     $spx_config->add('notification_email', $_SPX_CONF['notification_email'], 'text', 0, 0, null, 40, $enable_email, 'spamx');
!                     $spx_config->add('action', $_SPX_CONF['action'], 'text', 0, 0, null, 50, false, 'spamx');
! 
!                     // rename plugin's config.php as it's not needed any more
!                     $ret = @rename($plugin_path . 'config.php',
!                                    $plugin_path . 'config-pre1.1.1.php');
!                     if (!ret) {
!                         COM_errorLog("Spam-X upgrade failed - unable to rename plugin's config.php to complete upgrade");
!                         return 3002;
!                     } elseif ($spx_config->group_exists('spamx')) {
!                         DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '{$_SPX_CONF['version']}', pi_gl_version = '1.5.0' WHERE pi_name = 'spamx'");
!                     } else {
!                         COM_errorLog("Spam-X upgrade failed.");
!                         return 3002;
!                     }
!                 }
!             } else {
!                 COM_errorLog("Spam-X upgrade failed - did not find plugin's config.php");
!                 return 3002;
!             }
!             break;
          }
  
          // update version numbers
  
          // check if version number was updated successfully
!         $v = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = 'spamx'");
      }
  
***************
*** 350,358 ****
          'php_blocks' => array(),
          /* give all vars with their name */
!         'vars'=> array("{$pi_name}_gid", 'spamx.counter')
      );
      return $out;
  }
- 
  
  ?>
--- 402,410 ----
          'php_blocks' => array(),
          /* give all vars with their name */
!         'vars' => array('spamx_gid', 'spamx.counter')
      );
+ 
      return $out;
  }
  
  ?>

Index: MailAdmin.Action.class.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/plugins/spamx/MailAdmin.Action.class.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** MailAdmin.Action.class.php	12 Aug 2006 14:22:48 -0000	1.13
--- MailAdmin.Action.class.php	26 Jan 2008 17:17:41 -0000	1.14
***************
*** 5,9 ****
   * This is the Mail Admin Action for the Geeklog Spam-X plugin
   * 
!  * Copyright (C) 2004-2006 by the following authors:
   * Author   Tom Willett     tomw AT pigstye DOT net
   * 
--- 5,9 ----
   * This is the Mail Admin Action for the Geeklog Spam-X plugin
   * 
!  * Copyright (C) 2004-2008 by the following authors:
   * Author   Tom Willett     tomw AT pigstye DOT net
   * 
***************
*** 72,79 ****
          }
  
!         $subject = sprintf ($LANG_SX00['emailsubject'], $_CONF['site_name']);
!         COM_mail ($_SPX_CONF['notification_email'], $subject, $msg);
          $result = 8;
!         SPAMX_log ('Mail Sent to Admin');
          return 0;
      }
--- 72,85 ----
          }
  
!         $subject = sprintf($LANG_SX00['emailsubject'], $_CONF['site_name']);
!         if (empty($_SPX_CONF['notification_email'])) {
!             $email_address = $_CONF['site_mail'];
!         } else {
!             $email_address = $_SPX_CONF['notification_email'];
!         }
!         COM_mail($email_address, $subject, $msg);
          $result = 8;
!         SPAMX_log('Mail Sent to Admin');
! 
          return 0;
      }




More information about the geeklog-cvs mailing list