From: Roland Häder Date: Tue, 6 Oct 2009 20:20:27 +0000 (+0000) Subject: Code from inc/language.php moved to function loadLanguageFile(), the include is now... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d234d1de6ad6e7afe77507f421c9930833731d88;p=mailer.git Code from inc/language.php moved to function loadLanguageFile(), the include is now deprecated --- diff --git a/inc/language-functions.php b/inc/language-functions.php index b416d32dc0..5cde4b6ebe 100644 --- a/inc/language-functions.php +++ b/inc/language-functions.php @@ -111,5 +111,36 @@ function setLanguage ($lang) { setSession('mx_lang', $lang); } +// Load the current language file or fixes it to 'de' +function loadLanguageFile () { + // Try to get language from session + $mx_lang = getSession('mx_lang'); + + // Set default language if it is not (yet) set + if (is_null($mx_lang)) $mx_lang = getConfig('DEFAULT_LANG'); + + // Generate filename + $INC = sprintf("inc/language/%s.php", SQL_ESCAPE($mx_lang)); + + // Look for file + if (!isIncludeReadable($INC)) { + // Switch to default (DO NOT CHANGE!!!) + setLanguage('de'); + $INC = 'inc/language/de.php'; + + // And set it temporarily + setConfigEntry('DEFAULT_LANG', 'de'); + } // END - if + + // Load language file + loadIncludeOnce($INC); + + // Check for installation mode + if ((isInstalling()) || (!isInstalled()) || (!isAdminRegistered())) { + // Load matching language file + loadInclude('inc/language/install_' . getSession('mx_lang') . '.php'); + } // END - if +} + // [EOF] ?> diff --git a/inc/language.php b/inc/language.php index fdb0d6dbec..f551ef47b7 100644 --- a/inc/language.php +++ b/inc/language.php @@ -1,78 +1,3 @@ diff --git a/inc/session.php b/inc/session.php index 26e296685d..ec9dff751e 100644 --- a/inc/session.php +++ b/inc/session.php @@ -51,8 +51,8 @@ if (getConfig('session_save_path') != '') { // Start the session session_start(); -// Load language system -loadIncludeOnce('inc/language.php'); +// Load language file(s) +loadLanguageFile(); // Load extensions here loadIncludeOnce('inc/load_extensions.php');