]> 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>
Mon, 21 Dec 2009 14:57:10 +0000 (06:57 -0800)
lib/util.php

index 99a0a1db30fee5c9fd73f38ced66699445e7e57b..5d20ed82df8ba0395d418305368edabb61f8b005 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