diff --git a/CHANGELOG.md b/CHANGELOG.md index 99f19b1ae..046a5d6d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ - Some improvements for integrity checker [\#1501](https://github.com/torrentpier/torrentpier/pull/1501) ([belomaxorka](https://github.com/belomaxorka)) - Hide in topic: Added country hiding [\#1535](https://github.com/torrentpier/torrentpier/pull/1535) ([belomaxorka](https://github.com/belomaxorka)) - Hide vote button in topic for guests [\#1507](https://github.com/torrentpier/torrentpier/pull/1507) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#1502](https://github.com/torrentpier/torrentpier/pull/1502), [\#1506](https://github.com/torrentpier/torrentpier/pull/1506), [\#1509](https://github.com/torrentpier/torrentpier/pull/1509), [\#1511](https://github.com/torrentpier/torrentpier/pull/1511), [\#1515](https://github.com/torrentpier/torrentpier/pull/1515), [\#1516](https://github.com/torrentpier/torrentpier/pull/1516), [\#1517](https://github.com/torrentpier/torrentpier/pull/1517), [\#1519](https://github.com/torrentpier/torrentpier/pull/1519), [\#1523](https://github.com/torrentpier/torrentpier/pull/1523), [\#1525](https://github.com/torrentpier/torrentpier/pull/1525), [\#1530](https://github.com/torrentpier/torrentpier/pull/1530), [\#1532](https://github.com/torrentpier/torrentpier/pull/1532) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#1502](https://github.com/torrentpier/torrentpier/pull/1502), [\#1506](https://github.com/torrentpier/torrentpier/pull/1506), [\#1509](https://github.com/torrentpier/torrentpier/pull/1509), [\#1511](https://github.com/torrentpier/torrentpier/pull/1511), [\#1515](https://github.com/torrentpier/torrentpier/pull/1515), [\#1516](https://github.com/torrentpier/torrentpier/pull/1516), [\#1517](https://github.com/torrentpier/torrentpier/pull/1517), [\#1519](https://github.com/torrentpier/torrentpier/pull/1519), [\#1523](https://github.com/torrentpier/torrentpier/pull/1523), [\#1525](https://github.com/torrentpier/torrentpier/pull/1525), [\#1530](https://github.com/torrentpier/torrentpier/pull/1530), [\#1532](https://github.com/torrentpier/torrentpier/pull/1532), [\#1536](https://github.com/torrentpier/torrentpier/pull/1536) ([belomaxorka](https://github.com/belomaxorka)) - New Crowdin updates [\#1504](https://github.com/torrentpier/torrentpier/pull/1504), [\#1513](https://github.com/torrentpier/torrentpier/pull/1513) ([Exileum](https://github.com/Exileum)) ## [v2.4.3](https://github.com/torrentpier/torrentpier/tree/v2.4.3) (2024-06-09) diff --git a/library/ajax/thanks.php b/library/ajax/thanks.php index ec301dddd..3ce74cb6b 100644 --- a/library/ajax/thanks.php +++ b/library/ajax/thanks.php @@ -25,13 +25,17 @@ if (!$topic_id = (int)$this->request['topic_id']) { $this->ajax_die($lang['INVALID_TOPIC_ID']); } +if (!$poster_id = (int)$this->request['poster_id']) { + $this->ajax_die($lang['NO_USER_ID_SPECIFIED']); +} + switch ($mode) { case 'add': if (IS_GUEST) { $this->ajax_die($lang['NEED_TO_LOGIN_FIRST']); } - if (DB()->fetch_row('SELECT poster_id FROM ' . BB_BT_TORRENTS . " WHERE topic_id = $topic_id AND poster_id = " . $userdata['user_id'])) { + if ($poster_id == $userdata['user_id']) { $this->ajax_die($lang['LIKE_OWN_POST']); } @@ -48,14 +52,13 @@ switch ($mode) { $this->ajax_die($lang['NEED_TO_LOGIN_FIRST']); } - $sql = DB()->fetch_rowset('SELECT u.username, u.user_rank, u.user_id, t.* FROM ' . BB_THX . ' t, ' . BB_USERS . " u WHERE t.topic_id = $topic_id AND t.user_id = u.user_id"); - $user_list = []; + $sql = DB()->fetch_rowset('SELECT u.username, u.user_rank, u.user_id, t.* FROM ' . BB_THX . ' t, ' . BB_USERS . " u WHERE t.topic_id = $topic_id AND t.user_id = u.user_id"); foreach ($sql as $row) { $user_list[] = '' . profile_url($row) . ' (' . bb_date($row['time']) . ')'; } - $this->response['html'] = join(', ', $user_list) ?: $lang['NO_LIKES']; + $this->response['html'] = implode(', ', $user_list) ?: $lang['NO_LIKES']; break; default: $this->ajax_die('Invalid mode: ' . $mode); diff --git a/library/defines.php b/library/defines.php index 4cd5e9fbc..7f4bd47ad 100644 --- a/library/defines.php +++ b/library/defines.php @@ -47,6 +47,7 @@ define('CHECK_REQUIREMENTS', [ 'intl', 'xml', 'xmlwriter', + 'zip' ], ]); diff --git a/library/includes/datastore/build_check_updates.php b/library/includes/datastore/build_check_updates.php index 6e409a29a..3233d2da5 100644 --- a/library/includes/datastore/build_check_updates.php +++ b/library/includes/datastore/build_check_updates.php @@ -18,29 +18,32 @@ $data = []; $updaterDownloader = new \TorrentPier\Updater(); $updaterDownloader = $updaterDownloader->getLastVersion(); -$get_version = $updaterDownloader['tag_name']; -$version_code_actual = (int)trim(str_replace(['.', 'v'], '', $get_version)); +$getVersion = $updaterDownloader['tag_name']; +$versionCodeActual = (int)trim(str_replace(['.', 'v'], '', $getVersion)); // Has update! -if (VERSION_CODE < $version_code_actual) { - $latest_release_file = $updaterDownloader['assets'][0]['browser_download_url']; +if (VERSION_CODE < $versionCodeActual) { + $latestBuildFileLink = $updaterDownloader['assets'][0]['browser_download_url']; // Save current version & latest available - file_write(json_encode(['previous_version' => VERSION_CODE, 'latest_version' => $version_code_actual]), UPDATER_FILE, replace_content: true); + file_write(json_encode([ + 'previous_version' => VERSION_CODE, + 'latest_version' => $versionCodeActual + ]), UPDATER_FILE, replace_content: true); // Get MD5 checksum - $md5_file_checksum = ''; - if (isset($latest_release_file)) { - $md5_file_checksum = strtoupper(md5_file($latest_release_file)); + $buildFileChecksum = ''; + if (isset($latestBuildFileLink)) { + $buildFileChecksum = strtoupper(md5_file($latestBuildFileLink)); } // Build data array $data = [ 'available_update' => true, - 'latest_version' => $get_version, + 'latest_version' => $getVersion, 'latest_version_size' => isset($updaterDownloader['assets'][0]['size']) ? humn_size($updaterDownloader['assets'][0]['size']) : false, - 'latest_version_dl_link' => $latest_release_file ?? $updaterDownloader['html_url'], - 'latest_version_checksum' => $md5_file_checksum, + 'latest_version_dl_link' => $latestBuildFileLink ?? $updaterDownloader['html_url'], + 'latest_version_checksum' => $buildFileChecksum, 'latest_version_link' => $updaterDownloader['html_url'] ]; } diff --git a/src/Updater.php b/src/Updater.php index cb5777fd5..d5653cfed 100644 --- a/src/Updater.php +++ b/src/Updater.php @@ -77,10 +77,10 @@ class Updater { $this->targetVersion = $targetVersion; - if ($targetVersion === 'latest') { + if ($this->targetVersion === 'latest') { $versionInfo = $this->getLastVersion(); } else { - $targetIndex = array_search($targetVersion, array_column($this->jsonResponse, 'tag_name')); + $targetIndex = array_search($this->targetVersion, array_column($this->jsonResponse, 'tag_name')); $versionInfo = is_numeric($targetIndex) ? $this->jsonResponse[$targetIndex] : false; } diff --git a/styles/templates/default/viewforum.tpl b/styles/templates/default/viewforum.tpl index 9a79208b9..6aeefc788 100644 --- a/styles/templates/default/viewforum.tpl +++ b/styles/templates/default/viewforum.tpl @@ -512,9 +512,6 @@ td.topic_id { cursor: pointer; }   -
- {L_MOVE_TO_TOP} -
@@ -608,6 +605,7 @@ td.topic_id { cursor: pointer; }
+{L_MOVE_TO_TOP}