Fixes for broken extension loader and language error. Resolves #87/#88
authorRoland Häder <roland@mxchange.org>
Sat, 21 Feb 2009 02:15:27 +0000 (02:15 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 21 Feb 2009 02:15:27 +0000 (02:15 +0000)
inc/extensions.php
inc/extensions/ext-sql_patches.php
inc/language.php
inc/modules/admin/overview-inc.php

index 07fd285..bb8e8ee 100644 (file)
@@ -55,7 +55,10 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run
        } // END - if
 
        // Construct FQFN for extension file
-       $extInclude = sprintf("inc/extensions/ext-%s.php", $ext_name);
+       $FQFN = sprintf("%sinc/extensions/ext-%s.php",
+               constant('PATH'),
+               $ext_name
+       );
 
        // Is the extension file NOT there?
        if (!FILE_READABLE($extInclude)) {
@@ -102,7 +105,7 @@ function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "", $EXT_VER = "", $dry_run
 
        // Include the extension file
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Extension loaded.");
-       LOAD_INC($extInclude);
+       require($extInclude);
 
        // Is this extension deprecated?
        if ($EXT_DEPRECATED == "Y") {
index be096d7..fb72b89 100644 (file)
@@ -741,7 +741,7 @@ default: // Do stuff when extension is loaded
                        if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($cacheInstance)) && (is_object($cacheInstance))) {
                                // Remove extensions and mod_reg cache file
                                LOAD_INC_ONCE("inc/libs/cache_functions.php");
-                               LOAD_INC_ONCE("inc/extensions/ext-cache.php");
+                               require(sprintf("%sinc/extensions/ext-cache.php", constant('PATH')));
                                if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
                                if ($cacheInstance->loadCacheFile("mod_reg"))          $cacheInstance->destroyCacheFile();
                        } // END - if
index 6399eca..6814974 100644 (file)
@@ -37,18 +37,24 @@ if (!defined('__SECURITY')) {
        require($INC);
 }
 
-// Set default language
-if (empty($mx_lang)) $mx_lang = constant('DEFAULT_LANG');
+// Try to get language from session
+$mx_lang = get_session('mx_lang');
+
+// Set default language if it is not (yet) set
+if (is_null($mx_lang)) $mx_lang = constant('DEFAULT_LANG');
+
+// Generate filename
+$INC = sprintf("inc/language/%s.php", SQL_ESCAPE($mx_lang));
 
 // Generate FQFN
-$FQFN = sprintf("%sinc/language/%s.php", constant('PATH'), $mx_lang);
+$FQFN = constant('PATH') . $INC;
 
 // Look for file
 if (!FILE_READABLE($FQFN)) {
        // Switch to default (DO NOT CHANGE!!!)
-       set_session('mx_lang', constant('DEFAULT_LANG'));
-       $mx_lang = "de";
-       $INC = sprintf("inc/language/%s.php", constant('DEFAULT_LANG'));
+       $mx_lang = constant('DEFAULT_LANG');
+       set_session('mx_lang', $mx_lang);
+       $INC = sprintf("inc/language/%s.php", $mx_lang);
 } // END - if
 
 // Load language file
@@ -60,5 +66,9 @@ if (isBooleanConstantAndTrue('mxchange_installing')) {
        LOAD_INC("inc/language/install_".$mx_lang.".php");
 }
 
+// Remove no more needed variables
+unset($mx_lang);
+unset($INC);
+
 //
 ?>
index 301f3bc..eaad650 100644 (file)
@@ -75,7 +75,7 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
                                } // END - if
                        } else {
                                // Test-drive extension in update mode
-                               LOAD_INC(sprintf("inc/extensions/ext-%s.php", $ext_name));
+                               require(sprintf("%sinc/extensions/ext-%s.php", constant('PATH'), $ext_name));
 
                                // Update extension if extension is installed and outdated
                                //* DEBUG: */ print "ext={$ext_name},ver={$EXT_VERSION}/".GET_EXT_VERSION($ext_name)."<br />\n";