]> git.mxchange.org Git - mailer.git/blobdiff - inc/language-functions.php
Fixes/rewrites
[mailer.git] / inc / language-functions.php
index dad887e92cf3d1a21fdef4096c74784b7b9f604a..77f6f2e9e543d328ff1d60b39bfad4e83c7fedbd 100644 (file)
@@ -111,10 +111,15 @@ function setCurrentLanguage ($language) {
        $GLOBALS['language'] = (string) $language;
 }
 
+// Checks wether current language is set
+function isCurrentLanguageSet () {
+       return (isset($GLOBALS['language']));
+}
+
 // "Getter" for language
 function getLanguage () {
        // Do we have cache?
-       if (!isset($GLOBALS['language'])) {
+       if (!isCurrentLanguageSet()) {
                // Default is 'de'. DO NOT CHANGE THIS!!!
                $ret = 'de';
 
@@ -124,17 +129,17 @@ function getLanguage () {
                } // END - if
 
                // Is the variable set
-               if (isGetRequestParameterSet('mx_lang')) {
+               if (isGetRequestParameterSet('mailer_lang')) {
                        // Accept only first 2 chars
-                       $ret = substr(getRequestParameter('mx_lang'), 0, 2);
-               } elseif (isset($GLOBALS['language'])) {
+                       $ret = substr(getRequestParameter('mailer_lang'), 0, 2);
+               } elseif (isCurrentLanguageSet()) {
                        // Use cached
                        $ret = getCurrentLanguage();
-               } elseif (isSessionVariableSet('mx_lang')) {
+               } elseif (isSessionVariableSet('mailer_lang')) {
                        // Return stored value from cookie
-                       $ret = getSession('mx_lang');
+                       $ret = getSession('mailer_lang');
 
-                       // Fixes a warning before the session has the mx_lang constant
+                       // Fixes a warning before the session has the mailer_lang constant
                        if (empty($ret)) {
                                $ret = getDefaultLanguage();
                        } // END - if
@@ -154,7 +159,7 @@ function setLanguage ($lang) {
        $lang = substr(secureString($lang), 0, 2);
 
        // Set cookie
-       setSession('mx_lang', $lang);
+       setSession('mailer_lang', $lang);
 }
 
 // Checks wether a language file is there for optional extension
@@ -172,7 +177,7 @@ function isLanguageIncludeReadable ($ext_name = 'none') {
 
                // Look for file if no extension name is provided
                $GLOBALS['lang_inc'][$ext_name] = isIncludeReadable($languageInclude);
-               //* DEBUG: */ debugOutput(__FUNCTION__.':'.$ext_name.'='.$languageInclude.'='.intval(isIncludeReadable($languageInclude)));
+               //* DEBUG: */ debugOutput(__FUNCTION__ . ':' . $ext_name . '=' . $languageInclude . '=' . intval(isIncludeReadable($languageInclude)));
        } // END - if
 
        // Return it
@@ -265,7 +270,9 @@ function ifLanguageFilesCompares ($source, $target, $targetLanguage) {
        // Init differences
        $GLOBALS['lang_diff'][$target] = array();
        $GLOBALS['lang_diff_count'][$target] = 0;
-       if (!isset($GLOBALS['lang_diff_count']['total'])) $GLOBALS['lang_diff_count']['total'] = 0;
+       if (!isset($GLOBALS['lang_diff_count']['total'])) {
+               $GLOBALS['lang_diff_count']['total'] = 0;
+       } // END - if
 
        // *Does* match by default
        $matches = true;