From 4bd12d7c844163f67cca3489aa0b6c9af61d8adb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 22 Dec 2008 13:32:44 +0000 Subject: [PATCH] Fixed endless loop, if no sql_patches is installed and modules.php?module=index was called. Resolved #17 --- inc/databases.php | 2 +- inc/functions.php | 2 +- inc/language/de.php | 2 +- inc/language/en.ph | 2 +- inc/modules/admin/action-logout.php | 2 +- inc/modules/index.php | 16 ++++++++-------- inc/mysql-manager.php | 6 +++++- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index e020097b9d..59153f0a29 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -115,7 +115,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "695"); +define('CURR_SVN_REVISION', "696"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/functions.php b/inc/functions.php index 0ef88afef5..e255045bb0 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -940,7 +940,7 @@ function LOAD_URL($URL, $addUrlData=true) { if (((!defined('__COOKIES')) || (!__COOKIES)) && ($addUrlData)) $URL = ADD_URL_DATA($URL); // Probe for bot from search engine - if ((eregi("spider", GET_USER_AGENT())) || (eregi("bot", GET_USER_AGENT())) || (eregi("spider", GET_USER_AGENT()))) { + if ((eregi("spider", GET_USER_AGENT())) || (eregi("bot", GET_USER_AGENT()))) { // Search engine bot detected so let's rewrite many chars for the link $URL = htmlentities(strip_tags($URL), ENT_QUOTES); diff --git a/inc/language/de.php b/inc/language/de.php index b6284cfd5c..1ed76cb73a 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -900,7 +900,7 @@ define('ADMIN_VERBOSE_SQL', "SQL-Anweisungen beim Registrieren/Updates/Entfernen define('ADMIN_REMOVING_THESE_EXTENSIONS', "Diese Erweiterungen werden deinstalliert"); define('ADMIN_REMOVE_EXTENSIONS', "Erweiterungen jetzt entfernen"); define('ADMIN_SQLS_EXECUTED_ON_REMOVAL', "Beim Entfernen ausgeführte SQL-Anweisungen"); -define('ADMIN_NO_ADDIONAL_SQLS', "Keine weiteren SQL-Anweisungen zum Ausführen!"); +define('ADMIN_NO_ADDITIONAL_SQLS', "Keine weiteren SQL-Anweisungen zum Ausführen!"); define('ADMIN_SQLS_EXECUTED_ON_UPDATE', "Beim Aktualisieren ausgeführte SQL-Anweisungen"); define('ADMIN_SQLS_EXECUTED_ON_REGISTER', "Beim Registrieren ausgeführte SQL-Anweisungen"); define('ADMIN_UNKNOWN_FIELD_TYPE_1', "Unbekannter Datentyp "); diff --git a/inc/language/en.ph b/inc/language/en.ph index 0ccb9e1fbe..fecebe1803 100644 --- a/inc/language/en.ph +++ b/inc/language/en.ph @@ -591,7 +591,7 @@ define('ADMIN_VERBOSE_SQL', "SQL-Anweisungen beim Registrieren/Updates/Entfernen define('ADMIN_REMOVING_THESE_EXTENSIONS', "Diese Erweiterungen werden deinstalliert"); define('ADMIN_REMOVE_EXTENSIONS', "Erweiterungen jetzt entfernen"); define('ADMIN_SQLS_EXECUTED_ON_REMOVAL', "Beim Entfernen ausgeführte SQL-Anweisungen"); -define('ADMIN_NO_ADDIONAL_SQLS', "Keine weiteren SQL-Anweisungen zum Ausführen!"); +define('ADMIN_NO_ADDITIONAL_SQLS', "Keine weiteren SQL-Anweisungen zum Ausführen!"); define('ADMIN_SQLS_EXECUTED_ON_UPDATE', "Beim Aktualisieren ausgeführte SQL-Anweisungen"); define('ADMIN_SQLS_EXECUTED_ON_REGISTER', "Beim Registrieren ausgeführte SQL-Anweisungen"); define('ADMIN_UNKNOWN_FIELD_TYPE_1', "Unbekannter Datentyp "); diff --git a/inc/modules/admin/action-logout.php b/inc/modules/admin/action-logout.php index 5dbcecf292..82b4aeacda 100644 --- a/inc/modules/admin/action-logout.php +++ b/inc/modules/admin/action-logout.php @@ -42,7 +42,7 @@ ADD_DESCR("admin", __FILE__); if (!empty($_POST['no'])) { // Do not logout now - LOAD_URL("modules.php?module=admin"); + LOAD_URL("admin.php"); } elseif ((!empty($_POST['yes'])) && ($GLOBALS['action'] == "logout")) { // Redirect to logout link LOAD_URL("modules.php?module=admin&logout=1"); diff --git a/inc/modules/index.php b/inc/modules/index.php index 6180e3e941..eae4c4c111 100644 --- a/inc/modules/index.php +++ b/inc/modules/index.php @@ -35,9 +35,9 @@ if (!defined('__SECURITY')) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; require($INC); -} elseif ((!EXT_IS_ACTIVE("sql_patches", true)) && (!IS_ADMIN())) { +} elseif (!EXT_IS_ACTIVE("sql_patches")) { // The extension "sql_patches" *MUST* be activated or you have lot's of problems! - LOAD_URL("modules.php?module=admin"); + LOAD_URL("admin.php"); } // Load adverstising template @@ -95,13 +95,10 @@ if (empty($GLOBALS['action'])) { $GLOBALS['action'] = GET_ACTION("guest", $GLOBALS['what']); } // END - if -// Get action value directly from URL -$act = COMPILE_CODE($GLOBALS['action']); - // Add the guest's menu here... if ((getConfig('guest_menu') == "Y") || (!EXT_IS_ACTIVE("sql_patches", true))) { // Show only when guest menu is active - ADD_MENU("guest", $act, $GLOBALS['what']); + ADD_MENU("guest", $GLOBALS['action'], $GLOBALS['what']); } // END - if // TDs between menu and content @@ -110,8 +107,11 @@ LOAD_TEMPLATE("guest_menu_content"); // Disable block-mode by default $BLOCK_MODE = false; -$INC_ACTION = sprintf("%sinc/modules/guest/action-%s.php", PATH, $act); -if ((FILE_READABLE($INC_ACTION)) && (VALIDATE_MENU_ACTION("guest", $act, $GLOBALS['what']))) { +// Construct FQFN +$INC_ACTION = sprintf("%sinc/modules/guest/action-%s.php", PATH, $GLOBALS['action']); + +// Is the file there? +if ((FILE_READABLE($INC_ACTION)) && (VALIDATE_MENU_ACTION("guest", $GLOBALS['action'], $GLOBALS['what']))) { // Requested module is available so we load it require_once($INC_ACTION); } else { diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index ef9e1cc911..504e0ebb11 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -891,6 +891,7 @@ function GET_ACTION ($MODE, &$wht) { } //* DEBUG: */ echo __FUNCTION__."(".__LINE__."): ret=".$ret."
\n"; + // Does the module have a menu? if (MODULE_HAS_MENU($MODE)) { // Rewriting modules to menu switch ($MODE) { @@ -911,7 +912,10 @@ function GET_ACTION ($MODE, &$wht) { // Free memory SQL_FREERESULT($result); - } // END - if + } elseif (GET_EXT_VERSION("sql_patches") == "") { + // No sql_patches installed! + LOAD_URL("admin.php"); + } // Return action value return $ret; -- 2.39.5