[geeklog-cvs] geeklog: Added in configuration validation support for plugins p...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Mar 10 14:36:05 EST 2011


changeset 8148:b4edcfea31f5
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/b4edcfea31f5
user: Tom <websitemaster at cogeco.net>
date: Thu Mar 10 14:07:42 2011 -0500
description:
Added in configuration validation support for plugins plus rules for each plugins configuration options.

diffstat:

 plugins/calendar/configuration_validation.php    |   78 +++++++++++++++
 plugins/links/configuration_validation.php       |   95 +++++++++++++++++++
 plugins/polls/configuration_validation.php       |  110 ++++++++++++++++++++++
 plugins/spamx/configuration_validation.php       |   40 ++++++++
 plugins/staticpages/configuration_validation.php |  115 +++++++++++++++++++++++
 plugins/xmlsitemap/configuration_validation.php  |   53 ++++++++++
 public_html/admin/configuration.php              |   11 ++-
 system/classes/scripts.class.php                 |    2 +-
 8 files changed, 502 insertions(+), 2 deletions(-)

diffs (truncated from 548 to 300 lines):

diff -r e2a5c8d3613e -r b4edcfea31f5 plugins/calendar/configuration_validation.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/calendar/configuration_validation.php	Thu Mar 10 14:07:42 2011 -0500
@@ -0,0 +1,78 @@
+<?php
+
+/* Reminder: always indent with 4 spaces (no tabs). */
+// +---------------------------------------------------------------------------+
+// | Calendar                                                              |
+// +---------------------------------------------------------------------------+
+// | configuration_validation.php                                              |
+// |                                                                           |
+// | List of validation rules for the Links plugin configurations                          |
+// +---------------------------------------------------------------------------+
+// | Copyright (C) 2007-2010 by the following authors:                         |
+// |                                                                           |
+// | Authors: Akeda Bagus       - admin AT gedex DOT web DOT id                |
+// |          Tom Homer         - tomhomer AT gmail DOT com                    |
+// +---------------------------------------------------------------------------+
+// |                                                                           |
+// | 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.           |
+// |                                                                           |
+// +---------------------------------------------------------------------------+
+
+// General Calendar Settings
+$_CONF_VALIDATE['calendar']['calendarloginrequired'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['calendar']['hidecalendarmenu'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['calendar']['personalcalendars'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['calendar']['eventsubmission'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['calendar']['showupcomingevents'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['calendar']['upcomingeventsrange'] = array('rule' => 'numeric');
+$_CONF_VALIDATE['calendar']['hour_mode'] = array(
+    'rule' => array('inList', array('12', '24'), true)
+);
+$_CONF_VALIDATE['calendar']['event_types'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['calendar']['notification'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['calendar']['delete_event'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['calendar']['aftersave'] = array(
+    'rule' => array('inList', array('item', 'list', 'plugin', 'home', 'admin'), true)
+);
+
+// Default Permissions
+$_CONF_VALIDATE['calendar']['default_permissions[0]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['calendar']['default_permissions[1]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['calendar']['default_permissions[2]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['calendar']['default_permissions[3]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+
+// Autotag Usage Permissions
+$_CONF_VALIDATE['calendar']['autotag_permissions_event[0]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['calendar']['autotag_permissions_event[1]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['calendar']['autotag_permissions_event[2]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['calendar']['autotag_permissions_event[3]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+
+?>
diff -r e2a5c8d3613e -r b4edcfea31f5 plugins/links/configuration_validation.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/links/configuration_validation.php	Thu Mar 10 14:07:42 2011 -0500
@@ -0,0 +1,95 @@
+<?php
+
+/* Reminder: always indent with 4 spaces (no tabs). */
+// +---------------------------------------------------------------------------+
+// | Links                                                              |
+// +---------------------------------------------------------------------------+
+// | configuration_validation.php                                              |
+// |                                                                           |
+// | List of validation rules for the Links plugin configurations                          |
+// +---------------------------------------------------------------------------+
+// | Copyright (C) 2007-2010 by the following authors:                         |
+// |                                                                           |
+// | Authors: Akeda Bagus       - admin AT gedex DOT web DOT id                |
+// |          Tom Homer         - tomhomer AT gmail DOT com                    |
+// +---------------------------------------------------------------------------+
+// |                                                                           |
+// | 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.           |
+// |                                                                           |
+// +---------------------------------------------------------------------------+
+
+// Public Links List Settings
+$_CONF_VALIDATE['links']['linksloginrequired'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['links']['linkcols'] = array('rule' => 'numeric');
+$_CONF_VALIDATE['links']['linksperpage'] = array('rule' => 'numeric');
+$_CONF_VALIDATE['links']['show_top10'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['links']['show_category_descriptions'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['links']['new_window'] = array('rule' => 'boolean');
+
+// Links Admin Settings
+$_CONF_VALIDATE['links']['hidenewlinks'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['links']['newlinksinterval'] = array('rule' => 'numeric');
+$_CONF_VALIDATE['links']['hidelinksmenu'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['links']['linksubmission'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['links']['notification'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['links']['delete_links'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['links']['aftersave'] = array(
+    'rule' => array('inList', array('item', 'list', 'plugin', 'home', 'admin'), true)
+);
+$_CONF_VALIDATE['links']['root'] = array('rule' => 'notEmpty');
+
+// Link Permissions
+$_CONF_VALIDATE['links']['default_permissions[0]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['links']['default_permissions[1]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['links']['default_permissions[2]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['links']['default_permissions[3]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+
+// Category Permissions
+$_CONF_VALIDATE['links']['category_permissions[0]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['links']['category_permissions[1]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['links']['category_permissions[2]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['links']['category_permissions[3]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+
+// Autotag Usage Permissions
+$_CONF_VALIDATE['links']['autotag_permissions_link[0]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['links']['autotag_permissions_link[1]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['links']['autotag_permissions_link[2]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['links']['autotag_permissions_link[3]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+
+?>
diff -r e2a5c8d3613e -r b4edcfea31f5 plugins/polls/configuration_validation.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/polls/configuration_validation.php	Thu Mar 10 14:07:42 2011 -0500
@@ -0,0 +1,110 @@
+<?php
+
+/* Reminder: always indent with 4 spaces (no tabs). */
+// +---------------------------------------------------------------------------+
+// | Polls                                                              |
+// +---------------------------------------------------------------------------+
+// | configuration_validation.php                                              |
+// |                                                                           |
+// | List of validation rules for the Links plugin configurations                          |
+// +---------------------------------------------------------------------------+
+// | Copyright (C) 2007-2010 by the following authors:                         |
+// |                                                                           |
+// | Authors: Akeda Bagus       - admin AT gedex DOT web DOT id                |
+// |          Tom Homer         - tomhomer AT gmail DOT com                    |
+// +---------------------------------------------------------------------------+
+// |                                                                           |
+// | 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.           |
+// |                                                                           |
+// +---------------------------------------------------------------------------+
+
+// General Polls Settings
+$_CONF_VALIDATE['polls']['pollsloginrequired'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['polls']['hidepollsmenu'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['polls']['maxquestions'] = array('rule' => 'numeric');
+$_CONF_VALIDATE['polls']['maxanswers'] = array('rule' => 'numeric');
+$_CONF_VALIDATE['polls']['answerorder'] = array(
+    'rule' => array('inList', array('submitorder', 'voteorder'), true)
+);
+$_CONF_VALIDATE['polls']['pollcookietime'] = array('rule' => 'numeric');
+$_CONF_VALIDATE['polls']['polladdresstime'] = array('rule' => 'numeric');
+$_CONF_VALIDATE['polls']['delete_polls'] = array('rule' => 'boolean');
+$_CONF_VALIDATE['polls']['aftersave'] = array(
+    'rule' => array('inList', array('item', 'list', 'plugin', 'home', 'admin'), true)
+);
+$_CONF_VALIDATE['polls']['meta_tags'] = array('rule' => 'boolean');
+
+// What's New Block
+$_CONF_VALIDATE['polls']['newpollsinterval'] = array('rule' => 'numeric');
+$_CONF_VALIDATE['polls']['hidenewpolls'] = array(    
+    'rule' => array('inList', array('hide', 'modified', 'created'), true)
+);
+$_CONF_VALIDATE['polls']['title_trim_length'] = array('rule' => 'numeric');
+
+// Default Permissions
+$_CONF_VALIDATE['polls']['default_permissions[0]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['polls']['default_permissions[1]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['polls']['default_permissions[2]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+$_CONF_VALIDATE['polls']['default_permissions[3]'] = array(
+    'rule' => array('inList', array(0, 2, 3), true)
+);
+
+// Autotag Usage Permissions
+$_CONF_VALIDATE['polls']['autotag_permissions_poll[0]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['polls']['autotag_permissions_poll[1]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['polls']['autotag_permissions_poll[2]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['polls']['autotag_permissions_poll[3]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+
+$_CONF_VALIDATE['polls']['autotag_permissions_poll_vote[0]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['polls']['autotag_permissions_poll_vote[1]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['polls']['autotag_permissions_poll_vote[2]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['polls']['autotag_permissions_poll_vote[3]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+
+$_CONF_VALIDATE['polls']['autotag_permissions_poll_result[0]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['polls']['autotag_permissions_poll_result[1]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['polls']['autotag_permissions_poll_result[2]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+$_CONF_VALIDATE['polls']['autotag_permissions_poll_result[3]'] = array(
+    'rule' => array('inList', array(0, 2), true)
+);
+
+?>
diff -r e2a5c8d3613e -r b4edcfea31f5 plugins/spamx/configuration_validation.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/spamx/configuration_validation.php	Thu Mar 10 14:07:42 2011 -0500
@@ -0,0 +1,40 @@
+<?php



More information about the geeklog-cvs mailing list