From 398983d8cf83bb46a5843ed55de3ea43d0fba35a Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 8 Oct 2023 11:52:11 +0700 Subject: [PATCH] Minor improvements (#312) * Minor improvements * Update CHANGELOG.md --- CHANGELOG.md | 2 +- dl.php | 3 ++- library/config.php | 2 +- library/includes/classes/emailer.php | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85d8a57c..2785b27f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ - Release v2.1.5-2023.10 🎉 - Updated Text_LangCorrect class [\#309](https://github.com/torrentpier/torrentpier-lts/pull/309) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#297](https://github.com/torrentpier/torrentpier-lts/pull/297), [\#298](https://github.com/torrentpier/torrentpier-lts/pull/298), [\#300](https://github.com/torrentpier/torrentpier-lts/pull/300), [\#301](https://github.com/torrentpier/torrentpier-lts/pull/301), [\#302](https://github.com/torrentpier/torrentpier-lts/pull/302), [\#303](https://github.com/torrentpier/torrentpier-lts/pull/303), [\#305](https://github.com/torrentpier/torrentpier-lts/pull/305), [\#306](https://github.com/torrentpier/torrentpier-lts/pull/306), [\#307](https://github.com/torrentpier/torrentpier-lts/pull/307), [\#310](https://github.com/torrentpier/torrentpier-lts/pull/310) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#297](https://github.com/torrentpier/torrentpier-lts/pull/297), [\#298](https://github.com/torrentpier/torrentpier-lts/pull/298), [\#300](https://github.com/torrentpier/torrentpier-lts/pull/300), [\#301](https://github.com/torrentpier/torrentpier-lts/pull/301), [\#302](https://github.com/torrentpier/torrentpier-lts/pull/302), [\#303](https://github.com/torrentpier/torrentpier-lts/pull/303), [\#305](https://github.com/torrentpier/torrentpier-lts/pull/305), [\#306](https://github.com/torrentpier/torrentpier-lts/pull/306), [\#307](https://github.com/torrentpier/torrentpier-lts/pull/307), [\#310](https://github.com/torrentpier/torrentpier-lts/pull/310), [\#312](https://github.com/torrentpier/torrentpier-lts/pull/312) ([belomaxorka](https://github.com/belomaxorka)) ## [v2.1.5-2023.09](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.09) (2023-10-04) [Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.08-HotFix...v2.1.5-2023.09) diff --git a/dl.php b/dl.php index 3fbbee18..a00891ef 100644 --- a/dl.php +++ b/dl.php @@ -50,7 +50,8 @@ function send_file_to_browser($attachment, $upload_dir) header('Pragma: public'); $real_filename = clean_filename(basename($attachment['real_filename'])); $mimetype = $attachment['mimetype'].';'; - $charset = "charset={$bb_cfg['lang'][$userdata['user_lang']]['encoding']};"; + $encoding = isset($bb_cfg['lang'][$userdata['user_lang']]['encoding']) ? $bb_cfg['lang'][$userdata['user_lang']]['encoding'] : 'utf-8'; + $charset = "charset=$encoding;"; // Send out the Headers header("Content-Type: $mimetype $charset name=\"$real_filename\""); diff --git a/library/config.php b/library/config.php index 0df6e4bd..28299b05 100644 --- a/library/config.php +++ b/library/config.php @@ -214,7 +214,7 @@ $bb_cfg['posting_url'] = 'posting.php'; # "http://{$domain_name}/posting.php" $bb_cfg['pm_url'] = 'privmsg.php'; # "http://{$domain_name}/privmsg.php" // Language -$bb_cfg['charset'] = 'utf8'; // page charset +$bb_cfg['charset'] = 'utf-8'; // page charset if (isset($bb_cfg['default_lang']) && file_exists(LANG_ROOT_DIR . $bb_cfg['default_lang'] .'/')) { diff --git a/library/includes/classes/emailer.php b/library/includes/classes/emailer.php index ab2a271a..4d0b28f7 100644 --- a/library/includes/classes/emailer.php +++ b/library/includes/classes/emailer.php @@ -176,12 +176,12 @@ class emailer if (preg_match('#^(Charset:(.*?))$#m', $this->msg, $match)) { - $this->encoding = (trim($match[2]) != '') ? trim($match[2]) : trim($bb_cfg['lang'][$userdata['user_lang']]['encoding']); + $this->encoding = (trim($match[2]) != '') ? trim($match[2]) : isset($bb_cfg['lang'][$userdata['user_lang']]['encoding']) ? trim($bb_cfg['lang'][$userdata['user_lang']]['encoding']) : 'utf-8'; $drop_header .= '[\r\n]*?' . preg_quote($match[1], '#'); } else { - $this->encoding = trim($bb_cfg['lang'][$userdata['user_lang']]['encoding']); + $this->encoding = isset($bb_cfg['lang'][$userdata['user_lang']]['encoding']) ? trim($bb_cfg['lang'][$userdata['user_lang']]['encoding']) : 'utf-8'; } $this->subject = $this->encode($this->subject);