From b80fa8857d2855df37ad2016b4d14a2abcffa88e Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 5 May 2024 23:48:00 +0700 Subject: [PATCH] Some enhancements for flags (#1470) * Some enhancements for flags * Update main.php * Upload * Update functions.php * Update functions.php * Update main.php * Update CHANGELOG.md --- CHANGELOG.md | 1 + library/includes/functions.php | 12 +++++++++--- library/language/source/main.php | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc328995a..cc262ed05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Some enhancements [\#1445](https://github.com/torrentpier/torrentpier/pull/1445) ([belomaxorka](https://github.com/belomaxorka)) - Guests can view polls [\#1464](https://github.com/torrentpier/torrentpier/pull/1464) ([belomaxorka](https://github.com/belomaxorka)) - Improved app debug [\#1438](https://github.com/torrentpier/torrentpier/pull/1438) ([belomaxorka](https://github.com/belomaxorka)) +- Some enhancements for flags [\#1470](https://github.com/torrentpier/torrentpier/pull/1470) ([belomaxorka](https://github.com/belomaxorka)) - Fixed quote selection for smiles [\#1457](https://github.com/torrentpier/torrentpier/pull/1457) ([belomaxorka](https://github.com/belomaxorka)) - Demo mode: Allow registering torrents by default [\#1440](https://github.com/torrentpier/torrentpier/pull/1440) ([belomaxorka](https://github.com/belomaxorka)) - Temp: Removed showing forum description in `viewforum.php` [\#1465](https://github.com/torrentpier/torrentpier/pull/1465) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/library/includes/functions.php b/library/includes/functions.php index 58a555c7b..3bc9a907f 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -1193,9 +1193,15 @@ function render_flag(string $code): string global $lang; static $iconExtension = '.svg'; - $flagIconPath = BB_ROOT . 'styles/images/flags/' . $code . $iconExtension; - if (isset($lang['COUNTRIES'][$code]) && is_file($flagIconPath)) { - return '' . $code . ''; + if (isset($lang['COUNTRIES'][$code])) { + if ($code === '0') { + return ''; // No selected + } else { + $flagIconPath = BB_ROOT . 'styles/images/flags/' . $code . $iconExtension; + if (is_file($flagIconPath)) { + return '' . $code . ''; + } + } } return $code; diff --git a/library/language/source/main.php b/library/language/source/main.php index 8a50f70fe..d13071312 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -979,6 +979,7 @@ $lang['DATETIME']['DEC'] = 'Dec'; // Country selector $lang['COUNTRIES'] = [ + 0 => 'No select', 'AD' => 'Andorra', 'AE' => 'United Arab Emirates', 'AF' => 'Afghanistan',