From 2592ef433edd0c7cbde318e76792a521b6ec155e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 26 Jul 2009 19:31:02 +0000 Subject: [PATCH] Fix for ext-wernis, some rewrites, fixes for array-to-string convertion --- inc/extensions/ext-wernis.php | 21 ++++++--------------- inc/modules/admin/what-extensions.php | 11 ++++++++--- inc/request-functions.php | 4 ++-- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 9d03db33ff..23d8cb6e87 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -35,16 +35,15 @@ if (!defined('__SECURITY')) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php'; require($INC); -} +} // END - if // Version of this extension -EXT_SET_VERSION('0.0.4'); +EXT_SET_VERSION('0.0.3'); // Version history array (add more with , '0.1.0' and so on) -EXT_SET_VER_HISTORY(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4')); +EXT_SET_VER_HISTORY(array('0.0', '0.0.1', '0.0.2', '0.0.3')); -switch ($EXT_LOAD_MODE) -{ +switch ($EXT_LOAD_MODE) { case 'register': // Do stuff when installation is running (modules.php?module=admin&action=login is called) // SQL commands to run ADD_EXT_SQL("DROP TABLE IF EXISTS `{!_MYSQL_PREFIX!}_user_wernis`"); @@ -104,8 +103,7 @@ PRIMARY KEY(id) break; case 'update': // Update an extension - switch ($EXT_VER) - { + switch ($EXT_VER) { case '0.0.1': // SQL queries for v0.0.1 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_payout_active ENUM ('Y','N') NOT NULL DEFAULT 'Y'"); ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD wernis_withdraw_active ENUM ('Y','N') NOT NULL DEFAULT 'Y'"); @@ -128,17 +126,10 @@ PRIMARY KEY(id) break; case '0.0.3': // SQL queries for v0.0.3 - ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` CHANGE `wernis_refid` `wernis_refid` INT(5) UNSIGNED ZEROFILL NOT NULL DEFAULT '00000'"); - - // Update notes (these will be set as task text!) - EXT_SET_UPDATE_NOTES("Spaltentyp von VARCHAR(6) auf BIGINT(5) geändert."); - break; - - case '0.0.4': // SQL queries for v0.0.4 ADD_EXT_SQL("ALTER TABLE `{!_MYSQL_PREFIX!}_config` ADD `wernis_refid` INT(5) UNSIGNED ZEROFILL NOT NULL DEFAULT '00000'"); // Update notes (these will be set as task text!) - EXT_SET_UPDATE_NOTES("Fehlende Ref-Id hinzugetan."); + EXT_SET_UPDATE_NOTES("Spaltentyp von VARCHAR(6) auf INT(5) geändert."); break; } break; diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index cd21e9208e..be7cc1d23b 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -46,11 +46,16 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR('admin', __FILE__); // Normally we want the overview of all registered extensions -$do = "overview"; +$do = 'overview'; $SEL = 0; -if (REQUEST_ISSET_POST('sel')) $SEL = countPostSelection(); -if (REQUEST_ISSET_GET(('reg_ext'))) { +// Are some extensions submitted? +if (REQUEST_ISSET_POST('sel')) { + // Then count all + $SEL = countPostSelection(); +} // END - if + +if (REQUEST_ISSET_GET('reg_ext')) { // We are about to register a new extension $do = 'register'; $ext_id = bigintval(REQUEST_GET('reg_ext')); // The ID comes from task management and it is - of course - *not* the extension's name! diff --git a/inc/request-functions.php b/inc/request-functions.php index 5f9f1e263b..0ae3de0a6a 100644 --- a/inc/request-functions.php +++ b/inc/request-functions.php @@ -129,13 +129,13 @@ function REQUEST_POST ($element, $subElement=-1) { if (($subElement != -1) && (REQUEST_ISSET_POST($element, $subElement))) { // Then use this $value = SQL_ESCAPE($value[$subElement]); - } else { + } elseif (!is_array($value)) { // Escape it here $value = SQL_ESCAPE($value); } // Set it in cache - $GLOBALS['cache_request']['request_post'][$element][$subElement] = SQL_ESCAPE($value); + $GLOBALS['cache_request']['request_post'][$element][$subElement] = $value; } // END - if // Return value -- 2.30.2