rewritten, variable errors fixed
authorRoland Häder <roland@mxchange.org>
Sun, 1 Mar 2009 02:26:47 +0000 (02:26 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 1 Mar 2009 02:26:47 +0000 (02:26 +0000)
inc/extensions.php
inc/functions.php
inc/install-inc.php

index 0fbfc12..dabaadb 100644 (file)
@@ -39,7 +39,7 @@ if (!defined('__SECURITY')) {
 
 // Load the extension and maybe found language and function files.
 function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run = false, &$SQLs = array()) {
-       global $EXT_LOADED, $_CONFIG, $EXT_VER_HISTORY;
+       global $_CONFIG, $EXT_VER_HISTORY;
        global $INC_POOL, $EXT_UPDATE_DEPENDS, $EXT_DEPRECATED, $UPDATE_NOTES;
        global $EXT_VERSION, $EXT_ALWAYS_ACTIVE;
 
@@ -48,7 +48,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run
 
        // Is the extension already loaded?
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Loading extension {$ext_name}, mode={$EXT_LOAD_MODE}, ver={$EXT_VER}.");
-       if ((isset($EXT_LOADED['ext'][$ext_name])) && (empty($EXT_LOAD_MODE))) {
+       if ((isset($GLOBALS['ext_loaded']['ext'][$ext_name])) && (empty($EXT_LOAD_MODE))) {
                // Debug message
                DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s already loaded.", $ext_name));
                return false;
@@ -73,10 +73,10 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run
        $langInclude = sprintf("inc/language/%s_%s.php", $ext_name, GET_LANGUAGE());
 
        // Is this include there?
-       if ((FILE_READABLE($langInclude)) && (!isset($EXT_LOADED['lang'][$ext_name]))) {
+       if ((FILE_READABLE($langInclude)) && (!isset($GLOBALS['ext_loaded']['lang'][$ext_name]))) {
                // Then load it
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Language loaded.");
-               $EXT_LOADED['lang'][$ext_name] = true;
+               $GLOBALS['ext_loaded']['lang'][$ext_name] = true;
                LOAD_INC_ONCE($langInclude);
        } // END - if
 
@@ -84,10 +84,10 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run
        $funcsInclude = sprintf("inc/libs/%s_functions.php", $ext_name);
 
        // Is this include there?
-       if ((FILE_READABLE($funcsInclude)) && (!isset($EXT_LOADED['funcs'][$ext_name]))) {
+       if ((FILE_READABLE($funcsInclude)) && (!isset($GLOBALS['ext_loaded']['funcs'][$ext_name]))) {
                // Then load it
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "--- Functions loaded.");
-               $EXT_LOADED['funcs'][$ext_name] = true;
+               $GLOBALS['ext_loaded']['funcs'][$ext_name] = true;
                LOAD_INC_ONCE($funcsInclude);
        } // END - if
 
@@ -119,7 +119,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run
        // Mark it as loaded in normal mode
        if (empty($EXT_LOAD_MODE)) {
                // Mark it now...
-               $EXT_LOADED['ext'][$ext_name] = true;
+               $GLOBALS['ext_loaded']['ext'][$ext_name] = true;
        } // END - if
 
        // All fine!
@@ -333,6 +333,9 @@ function EXT_IS_ACTIVE ($ext_name) {
 
                // Count cache hits
                incrementConfigEntry('cache_hits');
+       } elseif (isset($GLOBALS['ext_loaded'][$ext_name])) {
+               // Extension is loaded!
+               die("LOADED:$ext_name");
        } elseif (($ext_name == "cache") || (GET_EXT_VERSION("cache") == "")) {
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "DB! ext_name={$ext_name}");
                // Load from database
index a930b87..f353494 100644 (file)
@@ -2923,13 +2923,10 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
                                // Copy back tmp file and delete tmp :-)
                                @copy($tmp, $FQFN);
                                @unlink($tmp);
-                               define('_FATAL', false);
                        } elseif (!$found) {
                                OUTPUT_HTML("<strong>CHANGE:</strong> 404!");
-                               define('_FATAL', true);
                        } else {
                                OUTPUT_HTML("<strong>TMP:</strong> UNDONE!");
-                               define('_FATAL', true);
                        }
                }
        } else {
index 6613994..1ad0dbc 100644 (file)
@@ -281,10 +281,10 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                                                        $FQFN = secureString(REQUEST_POST('spath')) . "install/" . $dump;
                                                        if (FILE_READABLE($FQFN)) {
                                                                // Read the file
-                                                               $SQLs = READ_FILE($FQFN, true);
+                                                               $fileContent = READ_FILE($FQFN, true);
 
                                                                // And split it up against ;\n ...
-                                                               $SQLs = merge_array($SQLs, explode(";\n", $sql));
+                                                               $SQLs = merge_array($SQLs, explode(";\n", $fileContent));
                                                        } else {
                                                                // Not readable!
                                                                debug_report_bug(sprintf("SQL dump %s is not readable!", $dump));