diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a48ceaec..148415a88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Release 2.4.4 🦩 ([belomaxorka](https://github.com/belomaxorka)) - Some improvements for integrity checker [\#1501](https://github.com/torrentpier/torrentpier/pull/1501) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#1502](https://github.com/torrentpier/torrentpier/pull/1502) ([belomaxorka](https://github.com/belomaxorka)) ## [v2.4.3](https://github.com/torrentpier/torrentpier/tree/v2.4.3) (2024-06-09) [Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.2...v2.4.3) diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql index edf03db8e..0cdc4643a 100644 --- a/install/sql/mysql.sql +++ b/install/sql/mysql.sql @@ -676,7 +676,8 @@ INSERT INTO `bb_disallow` (`disallow_id`, `disallow_username`) VALUES ('1', 'torrentpier*'), ('2', 'tracker*'), ('3', 'forum*'), - ('4', 'torrent*'); + ('4', 'torrent*'), + ('5', 'admin*'); -- ---------------------------- -- Table structure for `bb_extensions` diff --git a/library/config.php b/library/config.php index 49c44c6be..b9cfaf2b4 100644 --- a/library/config.php +++ b/library/config.php @@ -557,6 +557,7 @@ $bb_cfg['last_visit_date_format'] = 'd-M H:i'; $bb_cfg['last_post_date_format'] = 'd-M-y H:i'; $bb_cfg['poll_max_days'] = 180; // How many days will the poll be active $bb_cfg['integrity_check'] = true; // TorrentPier files integrity check (Not recommended to disable!) +$bb_cfg['enable_additional_flags'] = true; // Enables ability to select additional flags in "Country select" $bb_cfg['allow_change'] = [ 'language' => true, // Allow user to change language diff --git a/library/includes/datastore/build_files_integrity.php b/library/includes/datastore/build_files_integrity.php index e7d8922dd..2d730c838 100644 --- a/library/includes/datastore/build_files_integrity.php +++ b/library/includes/datastore/build_files_integrity.php @@ -17,6 +17,9 @@ if (!$bb_cfg['integrity_check']) { return; } +$filesList = []; +$wrongFilesList = []; + $checksumFile = new SplFileObject(CHECKSUMS_FILE, 'r'); $checksumFile->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE); @@ -36,7 +39,6 @@ $ignoreFiles = [ 'styles/images/logo/logo.png' ]; -$filesList = []; $lines = []; foreach ($checksumFile as $line) { $parts = explode(' ', $line); @@ -54,7 +56,6 @@ foreach ($checksumFile as $line) { ]; } -$wrongFilesList = []; foreach ($filesList as $file) { if (!file_exists(BB_ROOT . '/' . $file['path']) || (strtolower(md5_file(BB_ROOT . '/' . $file['path'])) !== strtolower($file['hash']))) { $wrongFilesList[] = $file['path']; diff --git a/library/language/source/main.php b/library/language/source/main.php index 4ad0dee1f..e37ad6dcb 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -1076,7 +1076,6 @@ $lang['COUNTRIES'] = [ 'GN' => 'Guinea', 'GP' => 'Guadeloupe', 'GQ' => 'Equatorial Guinea', - 'GR3' => 'German Reich (3rd)', 'GR' => 'Greece', 'GS' => 'South Georgia and the South Sandwich Islands', 'GT' => 'Guatemala', @@ -1116,7 +1115,6 @@ $lang['COUNTRIES'] = [ 'KZ' => 'Kazakhstan', 'LA' => 'Laos (Lao People\'s Democratic Republic)', 'LB' => 'Lebanon', - 'LGBT' => 'Pride flag', // __ // 'LC' => 'Saint Lucia', 'LI' => 'Liechtenstein', 'LK' => 'Sri Lanka', @@ -1163,7 +1161,6 @@ $lang['COUNTRIES'] = [ 'NZ' => 'New Zealand', 'OM' => 'Oman', 'PA' => 'Panama', - 'PACE' => 'Peace flag', // __ // 'PE' => 'Peru', 'PF' => 'French Polynesia', 'PG' => 'Papua New Guinea', @@ -1234,7 +1231,6 @@ $lang['COUNTRIES'] = [ 'VI' => 'Virgin Islands, U.S.', 'VN' => 'Vietnam', 'VU' => 'Vanuatu', - 'WBW' => 'Wonderful Russia of the Future 🕊', 'WF' => 'Wallis and Futuna Islands', 'WS' => 'Samoa', 'XK' => 'Kosovo', @@ -1246,6 +1242,12 @@ $lang['COUNTRIES'] = [ 'ZW' => 'Zimbabwe' ]; +$lang['ADDITIONAL_FLAGS'] = [ + 'WBW' => 'Wonderful Russia of the Future', + 'PACE' => 'Peace flag', + 'LGBT' => 'Pride flag' +]; + // Errors $lang['INFORMATION'] = 'Information'; $lang['ADMIN_REAUTHENTICATE'] = 'To administer/moderate the board you must re-authenticate yourself.'; diff --git a/src/Legacy/Cache/File.php b/src/Legacy/Cache/File.php index 965c3bf6a..20cff706f 100644 --- a/src/Legacy/Cache/File.php +++ b/src/Legacy/Cache/File.php @@ -37,7 +37,7 @@ class File extends Common $this->cur_query = "cache->get('$name')"; $this->debug('start'); - if (file_exists($filename)) { + if (is_file($filename) && is_readable($filename)) { require($filename); } @@ -80,7 +80,7 @@ class File extends Common $this->debug('start'); $filename = $this->dir . clean_filename($this->prefix . $name) . '.php'; - if (file_exists($filename)) { + if (is_file($filename)) { $clear = (bool)unlink($filename); } diff --git a/src/Legacy/Common/User.php b/src/Legacy/Common/User.php index a6e4779d3..dd72c016b 100644 --- a/src/Legacy/Common/User.php +++ b/src/Legacy/Common/User.php @@ -227,6 +227,11 @@ class User } } + // Merge additional flags with country flags + if ($bb_cfg['enable_additional_flags']) { + $lang['COUNTRIES'] = array_merge($lang['COUNTRIES'], $lang['ADDITIONAL_FLAGS']); + } + return $this->data; } diff --git a/src/Legacy/Datastore/File.php b/src/Legacy/Datastore/File.php index 797361c5b..241892dcd 100644 --- a/src/Legacy/Datastore/File.php +++ b/src/Legacy/Datastore/File.php @@ -84,7 +84,7 @@ class File extends Common $this->cur_query = null; $this->num_queries++; - if (file_exists($filename)) { + if (is_file($filename) && is_readable($filename)) { require($filename); $this->data[$item] = $filecache; diff --git a/styles/images/flags/GR3.svg b/styles/images/flags/GR3.svg deleted file mode 100644 index de1d40871..000000000 --- a/styles/images/flags/GR3.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - diff --git a/styles/templates/default/usercp_viewprofile.tpl b/styles/templates/default/usercp_viewprofile.tpl index ddd9c1520..7a428e972 100644 --- a/styles/templates/default/usercp_viewprofile.tpl +++ b/styles/templates/default/usercp_viewprofile.tpl @@ -324,7 +324,7 @@ ajax.callback.index_data = function(data) {