Minor improvements (#1122)

* Minor improvements

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2023-11-18 22:43:58 +07:00 committed by GitHub
commit eecbe070c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 12 deletions

View file

@ -26,7 +26,7 @@
- Translations for config.php, raised scrape interval [\#1100](https://github.com/torrentpier/torrentpier/pull/1100) ([kovalensky](https://github.com/kovalensky)) - Translations for config.php, raised scrape interval [\#1100](https://github.com/torrentpier/torrentpier/pull/1100) ([kovalensky](https://github.com/kovalensky))
- Don't re-announce for hybrids if the event is "stopped" [\#1099](https://github.com/torrentpier/torrentpier/pull/1099) ([kovalensky](https://github.com/kovalensky)) - Don't re-announce for hybrids if the event is "stopped" [\#1099](https://github.com/torrentpier/torrentpier/pull/1099) ([kovalensky](https://github.com/kovalensky))
- Security measures [\#1098](https://github.com/torrentpier/torrentpier/pull/1098), [\#1113](https://github.com/torrentpier/torrentpier/pull/1113) ([kovalensky](https://github.com/kovalensky), [belomaxorka](https://github.com/belomaxorka)) - Security measures [\#1098](https://github.com/torrentpier/torrentpier/pull/1098), [\#1113](https://github.com/torrentpier/torrentpier/pull/1113) ([kovalensky](https://github.com/kovalensky), [belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1121](https://github.com/torrentpier/torrentpier/pull/1121) ([belomaxorka](https://github.com/belomaxorka)) - Minor improvements [\#1121](https://github.com/torrentpier/torrentpier/pull/1121), [\#1122](https://github.com/torrentpier/torrentpier/pull/1122) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#1097](https://github.com/torrentpier/torrentpier/pull/1097), [\#1101](https://github.com/torrentpier/torrentpier/pull/1101) ([Exileum](https://github.com/Exileum)) - New Crowdin updates [\#1097](https://github.com/torrentpier/torrentpier/pull/1097), [\#1101](https://github.com/torrentpier/torrentpier/pull/1101) ([Exileum](https://github.com/Exileum))
## [v2.4.0-beta4](https://github.com/torrentpier/torrentpier/tree/v2.4.0-beta4) (2023-11-14) ## [v2.4.0-beta4](https://github.com/torrentpier/torrentpier/tree/v2.4.0-beta4) (2023-11-14)

11
dl.php
View file

@ -24,14 +24,14 @@ $thumbnail = request_var('thumb', 0);
// Send file to browser // Send file to browser
function send_file_to_browser($attachment, $upload_dir) function send_file_to_browser($attachment, $upload_dir)
{ {
global $bb_cfg, $lang, $userdata; global $bb_cfg, $lang;
$filename = ($upload_dir == '') ? $attachment['physical_filename'] : $upload_dir . '/' . $attachment['physical_filename']; $filename = ($upload_dir == '') ? $attachment['physical_filename'] : $upload_dir . '/' . $attachment['physical_filename'];
$gotit = false; $gotit = false;
if (@!file_exists(@amod_realpath($filename))) { if (@!file_exists(@amod_realpath($filename))) {
bb_die($lang['ERROR_NO_ATTACHMENT'] . "<br /><br />" . $filename . "<br /><br />" . $lang['TOR_NOT_FOUND']); bb_die($lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . htmlCHR($filename));
} else { } else {
$gotit = true; $gotit = true;
} }
@ -66,7 +66,7 @@ function send_file_to_browser($attachment, $upload_dir)
} }
readfile($filename); readfile($filename);
} else { } else {
bb_die($lang['ERROR_NO_ATTACHMENT'] . "<br /><br />" . $filename . "<br /><br />" . $lang['TOR_NOT_FOUND']); bb_die($lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . htmlCHR($filename));
} }
exit; exit;
@ -149,6 +149,7 @@ $datastore->rm('cat_forums');
$rows = get_extension_informations(); $rows = get_extension_informations();
$num_rows = count($rows); $num_rows = count($rows);
$allowed_extensions = $download_mode = [];
for ($i = 0; $i < $num_rows; $i++) { for ($i = 0; $i < $num_rows; $i++) {
$extension = strtolower(trim($rows[$i]['extension'])); $extension = strtolower(trim($rows[$i]['extension']));
$allowed_extensions[] = $extension; $allowed_extensions[] = $extension;
@ -156,8 +157,8 @@ for ($i = 0; $i < $num_rows; $i++) {
} }
// Disallowed // Disallowed
if (!in_array($attachment['extension'], $allowed_extensions) && !IS_ADMIN) { if (!in_array($attachment['extension'], $allowed_extensions)) {
bb_die(sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])); bb_die(sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']) . '<br /><br />' . $lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . htmlCHR($attachment['physical_filename']));
} }
$download_mode = (int)$download_mode[$attachment['extension']]; $download_mode = (int)$download_mode[$attachment['extension']];

View file

@ -25,11 +25,7 @@ if (!$torrent) {
$filename = get_attachments_dir() . '/' . $torrent['physical_filename']; $filename = get_attachments_dir() . '/' . $torrent['physical_filename'];
if (!file_exists($filename) || !$file_contents = file_get_contents($filename)) { if (!file_exists($filename) || !$file_contents = file_get_contents($filename)) {
if (IS_AM) {
$this->ajax_die($lang['ERROR_NO_ATTACHMENT'] . "\n\n" . htmlCHR($filename)); $this->ajax_die($lang['ERROR_NO_ATTACHMENT'] . "\n\n" . htmlCHR($filename));
} else {
$this->ajax_die($lang['ERROR_NO_ATTACHMENT']);
}
} }
if (!$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY)) { if (!$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY)) {

View file

@ -312,7 +312,7 @@ class Torrent
$filename = get_attachments_dir() . '/' . $torrent['physical_filename']; $filename = get_attachments_dir() . '/' . $torrent['physical_filename'];
if (!is_file($filename)) { if (!is_file($filename)) {
self::torrent_error_exit($lang['ERROR_NO_ATTACHMENT']); self::torrent_error_exit($lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . htmlCHR($filename));
} }
$file_contents = file_get_contents($filename); $file_contents = file_get_contents($filename);