www: 1682321d: Fixing warning in language detection

caseyho at pidgin.im caseyho at pidgin.im
Wed Dec 31 04:50:35 EST 2008


-----------------------------------------------------------------
Revision: 1682321dfe9a32b84286407bd1438265cea441d3
Ancestor: b3278d36a57ff3b628db1a2a2192ab5c5a9de8f5
Author: caseyho at pidgin.im
Date: 2008-12-31T09:45:53
Branch: im.pidgin.www
URL: http://d.pidgin.im/viewmtn/revision/info/1682321dfe9a32b84286407bd1438265cea441d3

Modified files:
        inc/langdetect.inc

ChangeLog: 

Fixing warning in language detection

-------------- next part --------------
============================================================
--- inc/langdetect.inc	6e7fb5e26ba3734b64ebe09d6448e887e1518c67
+++ inc/langdetect.inc	74ee7120fdecdddeb6de7871bd668ef957938dd1
@@ -72,7 +72,12 @@ $languages["zh_TW"]="Traditional Chinese
 $languages["zh_HK"]="Hong Kong Chinese";
 $languages["zh_TW"]="Traditional Chinese";
 
-$language_code = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
-$language = $languages[$language_code];
+if (empty($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
+  $language_code = "";
+  $language = "";
+} else {
+  $language_code = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
+  $language = $languages[$language_code];
+}
 ?>
 


More information about the Commits mailing list