New else-block added, some rewrites
authorRoland Häder <roland@mxchange.org>
Sun, 1 Mar 2009 00:42:51 +0000 (00:42 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 1 Mar 2009 00:42:51 +0000 (00:42 +0000)
inc/extensions.php
inc/functions.php
inc/mysql-manager.php

index 7ed3d49..88a33b4 100644 (file)
@@ -256,7 +256,7 @@ function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = tr
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": LOAD!");
                if ($logout) {
                        // Then redirect to logout
-                       LOAD_URL("modules.php?module=admin&logout=1&".$EXT_LOAD_MODE."=sql_patches");
+                       LOAD_URL("modules.php?module=admin&amp;logout=1&amp;".$EXT_LOAD_MODE."=sql_patches");
                } else {
                        // Add temporary filter
                        REGISTER_FILTER('shutdown', 'REDIRECT_TO_LOGOUT_SQL_PATCHES', true, true);
@@ -313,7 +313,7 @@ function EXTENSION_RUN_SQLS ($ext_id, $load_mode) {
        if (($ext_name == "sql_patches") && (($load_mode == "register") || ($load_mode == "remove"))) {
                // Then redirect to logout
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, ": LOAD!");
-               LOAD_URL("modules.php?module=admin&logout=1&".$load_mode."=sql_patches");
+               LOAD_URL("modules.php?module=admin&amp;logout=1&amp;".$load_mode."=sql_patches");
        } // END - if
 }
 
index 61aeedd..a0d62bc 100644 (file)
@@ -931,7 +931,7 @@ function LOAD_URL($URL, $addUrlData=true) {
        } // END - if
 
        // Add some data to URL if cookies are not accepted
-       if (((!defined('__COOKIES')) || (!__COOKIES)) && ($addUrlData)) $URL = ADD_URL_DATA($URL);
+       if (((!defined('__COOKIES')) || (!constant('__COOKIES'))) && ($addUrlData)) $URL = ADD_URL_DATA($URL);
 
        // Probe for bot from search engine
        if ((eregi("spider", GET_USER_AGENT())) || (eregi("bot", GET_USER_AGENT()))) {
index a5eccf7..648e183 100644 (file)
@@ -54,7 +54,8 @@ function ADD_MODULE_TITLE ($mod) {
                        incrementConfigEntry('cache_hits');
                } elseif (!EXT_IS_ACTIVE("cache")) {
                        // Load from database
-                       $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1", array($mod), __FILE__, __LINE__);
+                       $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1",
+                               array($mod), __FILE__, __LINE__);
                        list($name) = SQL_FETCHROW($result);
                        SQL_FREERESULT($result);
                }
@@ -92,17 +93,26 @@ function CHECK_MODULE ($mod) {
                if (EXT_IS_ACTIVE($modSplit[0])) {
                        // The prefix is an extension's name, so let's set it
                        $extension = $modSplit[0]; $mod = $modSplit[1];
-               }
-       }
+               } // END - if
+       } // END - if
 
        // Major error in module registry is the default
        $ret = "major";
 
        // Check if script is installed if not return a "done" to prevent some errors
-       if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (!isBooleanConstantAndTrue('admin_registered'))) return "done";
+       if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (!isBooleanConstantAndTrue('admin_registered'))) {
+               // Not installed or no admin registered or in installation phase
+               return "done";
+       } // END - if
+
+       // Init variables
+       $locked = "Y";
+       $hidden = "N";
+       $admin  = "N";
+       $mem    = "N";
+       $found  = false;
 
        // Check if cache is latest version
-       $locked = "Y"; $hidden = "N"; $admin = "N"; $mem = "N"; $found = false;
        if (GET_EXT_VERSION("cache") >= "0.1.2") {
                // Is the module cached?
                if (isset($GLOBALS['cache_array']['modules']['locked'][$mod_chk])) {
@@ -121,7 +131,8 @@ function CHECK_MODULE ($mod) {
                }
        } elseif (!EXT_IS_ACTIVE("cache")) {
                // Check for module in database
-               $result = SQL_QUERY_ESC("SELECT locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1", array($mod_chk), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SELECT locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1",
+                       array($mod_chk), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Read data
                        list($locked, $hidden, $admin, $mem) = SQL_FETCHROW($result);
@@ -147,12 +158,20 @@ function CHECK_MODULE ($mod) {
                } elseif (($admin == "Y") && (!IS_ADMIN())) {
                        // Only the Admin is allowed to enter this module!
                        $ret = "admin_only";
+               } else {
+                       // @TODO Nothing helped???
+                       DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("ret=%s,locked=%s,admin=%s,mem=%s",
+                               $ret,
+                               $locked,
+                               $admin,
+                               $mem
+                       ));
                }
        } // END - if
 
        // Still no luck or not found?
        if (($ret == "cache_miss") || (!$found)) {
-               //              ----- Legacy module -----                                   ---- Module in base folder  ----                       --- Module with extension's name ---
+               //              ----- Legacy module -----                                               ---- Module in base folder  ----                       --- Module with extension's name ---
                if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) {
                        // Data is missing so we add it
                        if (GET_EXT_VERSION("sql_patches") >= "0.3.6") {