]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Ignore user language settings that aren't listed in language config; we'll then fall...
[quix0rs-gnu-social.git] / lib / util.php
index fa74c2f861cbe88411e9fe81b445e39dbcd73643..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
@@ -1064,12 +1072,7 @@ function common_request_id()
             $url = $_SERVER['REQUEST_URI'];
         }
         $method = $_SERVER['REQUEST_METHOD'];
-        if (common_logged_in()) {
-            $user = common_current_user()->nickname;
-        } else {
-            $user = 'anon';
-        }
-        return "$pid.$req_id $user $method $url";
+        return "$pid.$req_id $method $url";
     }
 }