Changeset 1591 for trunk/gregarius/cls/l10n.php
- Timestamp:
- 09/25/06 14:33:50 (2 years ago)
- Files:
-
- 1 modified
-
trunk/gregarius/cls/l10n.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gregarius/cls/l10n.php
r1589 r1591 79 79 function __detectUserLang() { 80 80 if (isset($_REQUEST['lang']) && preg_match('#^[a-z]{2}_?([A-Z]{2})?$#',$_REQUEST['lang']) && ($_REQUEST['lang'] == 'en' || file_exists(GREGARIUS_HOME .'intl/'.$_REQUEST['lang']))) { 81 setcookie(RSS_LOCALE_COOKIE,$_REQUEST['lang'],time()+3600*6,getPath());81 $this -> __setLocaleCookie($_REQUEST['lang']); 82 82 return $_REQUEST['lang']; 83 83 } elseif (isset($_COOKIE[RSS_LOCALE_COOKIE])) { … … 96 96 if (preg_match('#^([a-z]{2})[\-_]?([a-z]{2})?$#i',$ll,$pm)) { 97 97 $ret =null; 98 if (isset($pm[2])){ 99 if (file_exists(GREGARIUS_HOME .'intl/'.$pm[1] ."_".strtoupper($pm[2]))) { 100 // xx-yy -> xx_YY 101 $ret= $pm[1] ."_".strtoupper($pm[2]); 102 } 98 if (isset($pm[2]) && file_exists(GREGARIUS_HOME .'intl/'.$pm[1] ."_".strtoupper($pm[2]))) { 99 // xx-yy -> xx_YY 100 $ret= $pm[1] ."_".strtoupper($pm[2]); 103 101 } elseif(file_exists(GREGARIUS_HOME .'intl/'.$pm[1] )) { 104 102 // xx -> xx … … 111 109 if ($ret) { 112 110 // remember the detected locale for a couple hours 113 setcookie(RSS_LOCALE_COOKIE,$ret,time()+3600*6,getPath());111 $this -> __setLocaleCookie($ret); 114 112 return $ret; 115 113 } … … 121 119 return getConfig('rss.output.lang'); 122 120 } 121 122 function __setLocaleCookie($value) { 123 setcookie(RSS_LOCALE_COOKIE,$value,time()+3600*6,getPath()); 124 } 123 125 } 124 126
