diff -Nuar roundcubemail-0.1beta2.orig/program/include/main.inc roundcubemail-0.1beta2/program/include/main.inc
|
old
|
new
|
|
| 39 | 39 | // check client |
| 40 | 40 | $BROWSER = rcube_browser(); |
| 41 | 41 | |
| | 42 | // Get HTTP_ACCEPT_LANGUAGE |
| | 43 | $accept_lang = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); |
| | 44 | $accept_lang = str_replace('-', '_', $accept_lang[0]); |
| | 45 | |
| 42 | 46 | // load config file |
| 43 | 47 | include_once('config/main.inc.php'); |
| 44 | 48 | $CONFIG = is_array($rcmail_config) ? $rcmail_config : array(); |
| … |
… |
|
| 92 | 96 | // create session and set session vars |
| 93 | 97 | if (!isset($_SESSION['auth_time'])) |
| 94 | 98 | { |
| 95 | | $_SESSION['user_lang'] = rcube_language_prop($CONFIG['locale_string']); |
| | 99 | if (!empty($accept_lang)) |
| | 100 | $_SESSION['user_lang'] = rcube_language_prop($accept_lang); |
| | 101 | else |
| | 102 | $_SESSION['user_lang'] = rcube_language_prop($CONFIG['locale_string']); |
| | 103 | |
| 96 | 104 | $_SESSION['auth_time'] = mktime(); |
| 97 | 105 | setcookie('sessauth', rcmail_auth_hash($sess_id, $_SESSION['auth_time'])); |
| 98 | 106 | } |
| … |
… |
|
| 119 | 127 | |
| 120 | 128 | |
| 121 | 129 | // set localization |
| 122 | | if ($CONFIG['locale_string']) |
| 123 | | setlocale(LC_ALL, $CONFIG['locale_string']); |
| 124 | | else if ($sess_user_lang) |
| | 130 | if ($sess_user_lang) |
| 125 | 131 | setlocale(LC_ALL, $sess_user_lang); |
| | 132 | else if ($CONFIG['locale_string']) |
| | 133 | setlocale(LC_ALL, $CONFIG['locale_string']); |
| 126 | 134 | |
| 127 | 135 | |
| 128 | 136 | register_shutdown_function('rcmail_shutdown'); |
| … |
… |
|
| 302 | 310 | // check the given string and returns language properties |
| 303 | 311 | function rcube_language_prop($lang, $prop='lang') |
| 304 | 312 | { |
| 305 | | global $INSTALL_PATH; |
| | 313 | global $INSTALL_PATH, $CONFIG; |
| 306 | 314 | static $rcube_languages, $rcube_language_aliases, $rcube_charsets; |
| 307 | 315 | |
| 308 | 316 | if (empty($rcube_languages)) |
| … |
… |
|
| 319 | 327 | $lang = rcube_language_prop($lang); |
| 320 | 328 | } |
| 321 | 329 | |
| | 330 | if (!isset($rcube_languages[$lang]) && (isset($rcube_languages[$CONFIG['locale_string']]) || isset($rcube_languages[substr($CONFIG['local_string'], 0, 2)]))) |
| | 331 | $lang = rcube_language_prop($CONFIG['locale_string']); |
| | 332 | |
| 322 | 333 | if (!isset($rcube_languages[$lang])) |
| 323 | 334 | $lang = 'en_US'; |
| 324 | 335 | |