From c1f17f1495b1666f02e70ad6752bdb9673fa5e1f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 21 Feb 2009 02:15:27 +0000 Subject: [PATCH] Fixes for broken extension loader and language error. Resolves #87/#88 --- inc/extensions.php | 7 +++++-- inc/extensions/ext-sql_patches.php | 2 +- inc/language.php | 22 ++++++++++++++++------ inc/modules/admin/overview-inc.php | 2 +- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/inc/extensions.php b/inc/extensions.php index 07fd2858b0..bb8e8eefd1 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -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") { diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index be096d76bd..fb72b89c8b 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -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 diff --git a/inc/language.php b/inc/language.php index 6399eca657..6814974eb4 100644 --- a/inc/language.php +++ b/inc/language.php @@ -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); + // ?> diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index 301f3bc35f..eaad650727 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -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)."
\n"; -- 2.39.5