]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Ignore user language settings that aren't listed in language config; we'll then fall...
authorBrion Vibber <brion@pobox.com>
Sat, 19 Dec 2009 19:03:31 +0000 (14:03 -0500)
committerBrion Vibber <brion@pobox.com>
Sat, 19 Dec 2009 20:29:53 +0000 (15:29 -0500)
lib/util.php

index af4885f40f779bb8fa8ee1cc5080dc744f85681f..ed81aeba16ceffde2a25c84c1229f7c26dca7358 100644 (file)
@@ -91,8 +91,16 @@ function common_language()
     if (_have_config() && common_logged_in()) {
         $user = common_current_user();
         $user_language = $user->language;
-        if ($user_language)
-          return $user_language;
+
+        if ($user->language) {
+            // Validate -- we don't want to end up with a bogus code
+            // left over from some old junk.
+            foreach (common_config('site', 'languages') as $code => $info) {
+                if ($info['lang'] == $user_language) {
+                    return $user_language;
+                }
+            }
+        }
     }
 
     // Otherwise, find the best match for the languages requested by the