Add check lang

Fixed:
#174. PHP Notice in GET /
#175. PHP Notice in GET /
This commit is contained in:
Vasily Komrakov 2017-02-12 11:51:17 +03:00
commit 8b33d82fc6
No known key found for this signature in database
GPG key ID: 558236680C20A69A
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 // The following assigns all _common_ variables that may be used at any point in a template
$template->assign_vars(array( $template->assign_vars(array(
'SIMPLE_HEADER' => !empty($gen_simple_header), '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'), 'IN_ADMIN' => defined('IN_ADMIN'),
'SHOW_ADS' => (!$logged_in || isset($bb_cfg['show_ads_users'][$user->id]) || (!IS_AM && $user->show_ads)), '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'); 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(); $theme = setup_style();
$DeltaTime = new Date_Delta(); $DeltaTime = new Date_Delta();