From 8b33d82fc6e190656cfd6f74db889b3621449c05 Mon Sep 17 00:00:00 2001 From: Vasily Komrakov Date: Sun, 12 Feb 2017 11:51:17 +0300 Subject: [PATCH] Add check lang Fixed: #174. PHP Notice in GET / #175. PHP Notice in GET / --- library/includes/page_header.php | 3 ++- library/includes/sessions.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/library/includes/page_header.php b/library/includes/page_header.php index c1ca64063..931ab6b5e 100644 --- a/library/includes/page_header.php +++ b/library/includes/page_header.php @@ -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)), diff --git a/library/includes/sessions.php b/library/includes/sessions.php index 8f8c7ffa4..21a0ee9d3 100644 --- a/library/includes/sessions.php +++ b/library/includes/sessions.php @@ -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();