[geeklog-cvs] Geeklog-1.x/plugins/spamx install_defaults.php, NONE, 1.1 ProjectHoneyPot.Examine.class.php, 1.2, 1.3 functions.inc, 1.31, 1.32 config.php, 1.20, NONE
Dirk Haun
dhaun at qs1489.pair.com
Sat Feb 2 15:03:08 EST 2008
Update of /cvsroot/geeklog/Geeklog-1.x/plugins/spamx
In directory qs1489.pair.com:/tmp/cvs-serv51673/plugins/spamx
Modified Files:
ProjectHoneyPot.Examine.class.php functions.inc
Added Files:
install_defaults.php
Removed Files:
config.php
Log Message:
Have the config data for the Spam-X plugin in only one place
Index: functions.inc
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/plugins/spamx/functions.inc,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** functions.inc 26 Jan 2008 17:17:41 -0000 1.31
--- functions.inc 2 Feb 2008 20:03:06 -0000 1.32
***************
*** 177,182 ****
$v = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = 'spamx'");
-
if ($v != $_SPX_CONF['version']) {
switch ($v) {
case '1.0.1':
--- 177,182 ----
$v = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = 'spamx'");
if ($v != $_SPX_CONF['version']) {
+
switch ($v) {
case '1.0.1':
***************
*** 187,238 ****
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'");
}
! if ($v == $_SPX_CONF['version']) {
! return 3001;
! }
!
! return 3002;
}
--- 187,219 ----
case '1.1.0':
! require_once $_CONF['path_system'] . 'classes/config.class.php';
! require_once $plugin_path . 'install_defaults.php';
! if (!plugin_initconfig_spamx()) {
! COM_errorLog("Spam-X upgrade to 1.1.1 failed");
! return 3002;
! }
! if (file_exists($plugin_path . 'config.php')) {
! // Rename the existing config.php as it's not needed any more
! $ren = @rename($plugin_path . 'config.php',
! $plugin_path . 'config-pre1.1.1.php');
! if (!$ren) {
! COM_errorLog("Could not rename the ages Spam-X plugin's config.php file. Please remove if manually, as it is not needed any more.");
}
+ }
+
+ $spx_config = config::get_instance();
+ if ($spx_config->group_exists('spamx')) {
+ DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.1.1', pi_gl_version = '1.5.0' WHERE pi_name = 'spamx'");
} else {
! COM_errorLog("Spam-X upgrade to 1.1.1 failed");
return 3002;
}
break;
}
}
! return 3001; // success msg
}
--- config.php DELETED ---
Index: ProjectHoneyPot.Examine.class.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/plugins/spamx/ProjectHoneyPot.Examine.class.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ProjectHoneyPot.Examine.class.php 7 May 2007 19:40:45 -0000 1.2
--- ProjectHoneyPot.Examine.class.php 2 Feb 2008 20:03:06 -0000 1.3
***************
*** 56,59 ****
--- 56,79 ----
/*
+ * The following settings all relate to the ProjectHoneyPot.org http:BL
+ * examine module. In order to use this, you *MUST* register with
+ * ProjectHoneyPot. You *MUST* install a Honey Pot. You *MUST* accept the
+ * terms of use of the http:BL and acquire your own http:BL access key.
+ */
+ $_SPX_CONF['http_bl_enable'] = true; // Whether or not to use the http:BL, true or false.
+ // You can get your access key from: http://www.projecthoneypot.org/httpbl_configure.php
+ // regardless of http_bl_enable, if you don't have a key, this won't work.
+ $_SPX_CONF['http_bl_access_key'] = 'NOT.CONFIGURED.RIGHT';
+ // Whether or not to use TCP (Virtual Circuits) instead of UDP. If set to false,
+ // UDP will be used unless TCP is required. TCP is required for questions or
+ // responses greater than 512 bytes.
+ $_SPX_CONF['http_bl_use_tcp'] = true;
+ // DNS Servers to use, in my development environment, I found that the examine
+ // failed without configuring this. Must be an array of IP addresses, or false:
+ $_SPX_CONF['http_bl_dns_servers'] = false;
+ // example of array with dummy values: $_SPX_CONF['http_bl_dns_servers'] = array('ip1','ip2');
+
+
+ /*
* Debug settings:
*
--- NEW FILE: install_defaults.php ---
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Spam-X plugin 1.1 |
// +---------------------------------------------------------------------------+
// | install_defaults.php |
// | |
// | Initial Installation Defaults used when loading the online configuration |
// | records. These settings are only used during the initial installation |
// | and not referenced any more once the plugin is installed. |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2008 by the following authors: |
// | |
// | Authors: Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
// | |
// | This program is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
//
// $Id: install_defaults.php,v 1.1 2008/02/02 20:03:06 dhaun Exp $
if (strpos($_SERVER['PHP_SELF'], 'install_defaults.php') !== false) {
die('This file can not be used on its own!');
}
/*
* Spam-X default settings
*
* Initial Installation Defaults used when loading the online configuration
* records. These settings are only used during the initial installation
* and not referenced any more once the plugin is installed
*
*/
global $_SPX_DEFAULT;
// Default Spam-X Action
$_SPX_DEFAULT['action'] = 128; // Default is to ignore (delete) the post
// address which mail admin module will use
// same as $_CONF['site_mail'] if empty
$_SPX_DEFAULT['notification_email'] = '';
// if set to = true, skip spam check for members of the "spamx Admin" group
$_SPX_DEFAULT['admin_override'] = false;
// enable / disable logging to spamx.log
$_SPX_DEFAULT['logging'] = true;
// timeout for contacting external services, e.g. SLV
$_SPX_DEFAULT['timeout'] = 5; // in seconds
/**
* Initialize Spam-X plugin configuration
*
* Creates the database entries for the configuation if they don't already
* exist. Initial values will be taken from $_SPX_CONF if available (e.g. from
* an old config.php), uses $_SPX_DEFAULT otherwise.
*
* @return boolean true: success; false: an error occurred
*
*/
function plugin_initconfig_spamx()
{
global $_CONF, $_SPX_CONF, $_SPX_DEFAULT;
if (is_array($_SPX_CONF) && (count($_SPX_CONF) > 1)) {
$_SPX_DEFAULT = $_SPX_CONF;
}
$c = config::get_instance();
if (!$c->group_exists('spamx')) {
$enable_email = true;
if (empty($_SPX_DEFAULT['notification_email']) || ($_SPX_DEFAULT['notification_email'] == $_CONF['site_mail'])) {
$enable_email = false;
}
$c->add('logging', $_SPX_DEFAULT['logging'], 'select',
0, 0, 1, 10, true, 'spamx');
$c->add('admin_override', $_SPX_DEFAULT['admin_override'], 'select',
0, 0, 1, 20, true, 'spamx');
$c->add('timeout', $_SPX_DEFAULT['timeout'], 'text',
0, 0, null, 30, true, 'spamx');
$c->add('notification_email', $_SPX_DEFAULT['notification_email'],
'text', 0, 0, null, 40, $enable_email, 'spamx');
$c->add('action', $_SPX_DEFAULT['action'], 'text',
0, 0, null, 50, false, 'spamx');
}
return true;
}
?>
More information about the geeklog-cvs
mailing list