From: Roland Häder Date: Sun, 4 Oct 2009 22:29:53 +0000 (+0000) Subject: More getModule() used, some SQL rewrites, constant __MODULE rewritten X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f75ece45874353859d07849cc9c6f79f76f76aa8;p=mailer.git More getModule() used, some SQL rewrites, constant __MODULE rewritten --- diff --git a/inc/modules/admin/what-config_stats.php b/inc/modules/admin/what-config_stats.php index 8f2b6284e9..f3322389b3 100644 --- a/inc/modules/admin/what-config_stats.php +++ b/inc/modules/admin/what-config_stats.php @@ -53,22 +53,22 @@ if (isFormSent()) { // Guest stats switch (getConfig('guest_stats')) { - case "MEMBERS": - define('__MEMBERS_RADIO', ' selected="selected"'); + case 'MEMBERS': + define('__MEMBERS_RADIO', ' selected='selected''); define('__MODULES_RADIO', ''); define('__INACTIVE_RADIO', ''); break; - case "MODULES": + case 'MODULES': define('__MEMBERS_RADIO', ''); - define('__MODULES_RADIO', ' selected="selected"'); + define('__MODULES_RADIO', ' selected='selected''); define('__INACTIVE_RADIO', ''); break; - case "INACTIVE": + case 'INACTIVE': define('__MEMBERS_RADIO', ''); define('__MODULES_RADIO', ''); - define('__INACTIVE_RADIO', ' selected="selected"'); + define('__INACTIVE_RADIO', ' selected='selected''); break; } @@ -76,7 +76,7 @@ if (isFormSent()) { define('__STATS_LIMIT', getConfig('stats_limit')); // Load template - LOAD_TEMPLATE("admin_config_stats"); + LOAD_TEMPLATE('admin_config_stats'); } // diff --git a/modules.php b/modules.php index b8b9705bfe..dcc22657d4 100644 --- a/modules.php +++ b/modules.php @@ -58,7 +58,7 @@ if (!REQUEST_ISSET_GET('module')) REQUEST_SET_GET('module', 'index'); // Check if logged in if (IS_MEMBER()) { // Is still logged in so we welcome him with his name - $result = SQL_QUERY_ESC("SELECT surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `surname`, `family` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Load surname and family's name and build the username @@ -95,50 +95,49 @@ if (IS_MEMBER()) { loadIncludeOnce('inc/header.php'); // Modules are by default not valid! -$MOD_VALID = false; $check = 'failed'; -if ((getConfig('maintenance') == 'Y') && (!IS_ADMIN()) && ($GLOBALS['module'] != 'admin')) { +$isModuleValid = false; $check = 'failed'; +if ((getConfig('maintenance') == 'Y') && (!IS_ADMIN()) && (getModule() != 'admin')) { // Maintain mode is active and you are no admin addFatalMessage(__FILE__, __LINE__, getMessage('LANG_DOWN_MAINTAINCE')); } elseif ((SQL_IS_LINK_UP()) && (getTotalFatalErrors() == 0)) { // Construct module name - define('__MODULE', sprintf("inc/modules/%s.php", SQL_ESCAPE($GLOBALS['module']))); + $GLOBALS['module_inc'] = sprintf("inc/modules/%s.php", SQL_ESCAPE(getModule())); // Did we found the module listed in allowed modules and are we successfully connected? - $check = checkModulePermissions($GLOBALS['module']); - switch ($check) - { + $check = checkModulePermissions(getModule()); + switch ($check) { case 'cache_miss': // The cache is gone case 'admin_only': // Admin-only access case 'mem_only': // Member-only access case 'done': // All fine! // Does the module exists on local file system? - if ((isFileReadable(constant('__MODULE'))) && (getTotalFatalErrors() == 0)) { + if ((isFileReadable($GLOBALS['module_inc'])) && (getTotalFatalErrors() == 0)) { // Module is valid, active and located on the local disc... - $MOD_VALID = true; + $isModuleValid = true; } elseif (!empty($URL)) { // An URL was specified so we load the de-referrer module redirectToUrl(DEREFERER($URL)); } elseif (getTotalFatalErrors() == 0) { - addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_404'), $GLOBALS['module'])); + addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_404'), getModule())); } break; case '404': - addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_404'), $GLOBALS['module'])); + addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_404'), getModule())); break; case 'locked': - if (!isFileReadable(constant('__MODULE'))) { + if (!isFileReadable($GLOBALS['module_inc'])) { // Module does addionally not exists - addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_404'), $GLOBALS['module'])); + addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_404'), getModule())); } // END - if // Add fatal message - addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_LOCKED'), $GLOBALS['module'])); + addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_LOCKED'), getModule())); break; default: - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $check, $GLOBALS['module'])); + DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $check, getModule())); addFatalMessage(__FILE__, __LINE__, sprintf(getMessage('LANG_MOD_REG_UNKNOWN'), $check)); break; } @@ -147,13 +146,13 @@ if ((getConfig('maintenance') == 'Y') && (!IS_ADMIN()) && ($GLOBALS['module'] != addFatalMessage(__FILE__, __LINE__, getMessage('MYSQL_ERRORS')); } -if (($MOD_VALID) && (defined('__MODULE'))) { +if (($isModuleValid === true) && (isset($GLOBALS['module_inc']))) { ///////////////////////////////////////////// // Main including line DO NOT REMOVE/EDIT! // ///////////////////////////////////////////// // // Everything is okay so we can load the module - loadIncludeOnce(constant('__MODULE')); + loadIncludeOnce($GLOBALS['module_inc']); } // END - if // Next-to-end add the footer diff --git a/view.php b/view.php index 90441e0055..cf6207ed84 100644 --- a/view.php +++ b/view.php @@ -48,13 +48,13 @@ require('inc/config-global.php'); if (((REQUEST_ISSET_GET('user')) || (REQUEST_ISSET_GET('reseller'))) && (REQUEST_ISSET_GET('banner'))) { // for later things... ;-) - $result = SQL_QUERY_ESC("SELECT url FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `id`=%s LIMIT 1", - array(bigintval(REQUEST_GET('banner'))), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT `url` FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `id`=%s LIMIT 1", + array(bigintval(REQUEST_GET('banner'))), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { list($url) = SQL_FETCHROW($result); SQL_FREERESULT($result); - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refbanner` SET counter=counter+1 WHERE `id`=%s LIMIT 1", - array(bigintval(REQUEST_GET('banner'))), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_refbanner` SET `counter`=`counter`+1 WHERE `id`=%s LIMIT 1", + array(bigintval(REQUEST_GET('banner'))), __FILE__, __LINE__); $type = substr($url, -3); sendHeader('Content-Type: image/' . $type);