Merge pull request #178 from diolektor/fix-user_lang-locale

Add check lang
This commit is contained in:
Yuriy Pikhtarev 2017-02-19 19:47:00 +03:00 committed by GitHub
commit 4e97e814d4
2 changed files with 4 additions and 2 deletions

View file

@ -125,7 +125,8 @@ $template->assign_vars(array(
// The following assigns all _common_ variables that may be used at any point in a template
$template->assign_vars(array(
'SIMPLE_HEADER' => !empty($gen_simple_header),
'CONTENT_ENCODING' => $bb_cfg['lang'][$userdata['user_lang']]['encoding'],
'CONTENT_ENCODING' => isset($bb_cfg['lang'][$userdata['user_lang']]['encoding']) ?
$bb_cfg['lang'][$userdata['user_lang']]['encoding'] : 'utf-8',
'IN_ADMIN' => defined('IN_ADMIN'),
'SHOW_ADS' => (!$logged_in || isset($bb_cfg['show_ads_users'][$user->id]) || (!IS_AM && $user->show_ads)),

View file

@ -562,7 +562,8 @@ class user_common
}
require(LANG_DIR . 'main.php');
setlocale(LC_ALL, $bb_cfg['lang'][$this->data['user_lang']]['locale']);
setlocale(LC_ALL, isset($bb_cfg['lang'][$this->data['user_lang']]['locale']) ?
$bb_cfg['lang'][$this->data['user_lang']]['locale'] : 'en_US.UTF-8');
$theme = setup_style();
$DeltaTime = new Date_Delta();