Merge pull request #10 from torrentpier/fix-user_lang-locale

Add check lang
This commit is contained in:
Roman Kelesidis 2023-03-11 22:06:17 +07:00 committed by GitHub
commit 494d9b24fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -269,7 +269,7 @@ else
{
// Generate frameset
$template->assign_vars(array(
'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',
'TPL_ADMIN_FRAMESET' => true,
));
send_no_cache_headers();

View File

@ -110,7 +110,7 @@ $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

@ -595,7 +595,7 @@ class user_common
if (!defined('LANG_DIR')) define('LANG_DIR', DEFAULT_LANG_DIR);
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();