mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-19 21:03:54 -07:00
Fixed extensions issue (#1218)
* Fixed extensions issue * Update CHANGELOG.md
This commit is contained in:
parent
0e7a60ad41
commit
6660bf26e4
4 changed files with 15 additions and 13 deletions
|
@ -20,6 +20,7 @@
|
||||||
- Limit execution time for forum file-listing [\#1211](https://github.com/torrentpier/torrentpier/pull/1211) ([kovalensky](https://github.com/kovalensky), [belomaxorka](https://github.com/belomaxorka))
|
- Limit execution time for forum file-listing [\#1211](https://github.com/torrentpier/torrentpier/pull/1211) ([kovalensky](https://github.com/kovalensky), [belomaxorka](https://github.com/belomaxorka))
|
||||||
- Some reported bugfixes [\#1214](https://github.com/torrentpier/torrentpier/pull/1214) ([belomaxorka](https://github.com/belomaxorka))
|
- Some reported bugfixes [\#1214](https://github.com/torrentpier/torrentpier/pull/1214) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Minor improvements [\#1215](https://github.com/torrentpier/torrentpier/pull/1215), [\#1217](https://github.com/torrentpier/torrentpier/pull/1217) ([belomaxorka](https://github.com/belomaxorka))
|
- Minor improvements [\#1215](https://github.com/torrentpier/torrentpier/pull/1215), [\#1217](https://github.com/torrentpier/torrentpier/pull/1217) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
|
- Fixed extensions issue [\#1218](https://github.com/torrentpier/torrentpier/pull/1218) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
|
|
||||||
## [v2.4.0-rc2](https://github.com/torrentpier/torrentpier/tree/v2.4.0-rc2) (2023-12-12)
|
## [v2.4.0-rc2](https://github.com/torrentpier/torrentpier/tree/v2.4.0-rc2) (2023-12-12)
|
||||||
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-rc1...v2.4.0-rc2)
|
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.0-rc1...v2.4.0-rc2)
|
||||||
|
|
5
dl.php
5
dl.php
|
@ -173,12 +173,15 @@ $num_rows = count($rows);
|
||||||
$allowed_extensions = $download_mode = [];
|
$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']));
|
||||||
|
// Get allowed extensions
|
||||||
|
if ((int)$rows[$i]['allow_group'] === 1) {
|
||||||
$allowed_extensions[] = $extension;
|
$allowed_extensions[] = $extension;
|
||||||
|
}
|
||||||
$download_mode[$extension] = $rows[$i]['download_mode'];
|
$download_mode[$extension] = $rows[$i]['download_mode'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disallowed
|
// Disallowed
|
||||||
if (!in_array($attachment['extension'], $allowed_extensions)) {
|
if (!in_array($attachment['extension'], $allowed_extensions) && !IS_ADMIN) {
|
||||||
bb_die(sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']) . '<br /><br />' . $lang['FILENAME'] . ": " . $attachment['physical_filename']);
|
bb_die(sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']) . '<br /><br />' . $lang['FILENAME'] . ": " . $attachment['physical_filename']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,14 @@ function init_complete_extensions_data()
|
||||||
$GLOBALS['datastore']->update('attach_extensions');
|
$GLOBALS['datastore']->update('attach_extensions');
|
||||||
$extension_informations = get_extension_informations();
|
$extension_informations = get_extension_informations();
|
||||||
}
|
}
|
||||||
$allowed_extensions = [];
|
|
||||||
|
|
||||||
|
$allowed_extensions = [];
|
||||||
for ($i = 0, $size = count($extension_informations); $i < $size; $i++) {
|
for ($i = 0, $size = count($extension_informations); $i < $size; $i++) {
|
||||||
$extension = strtolower(trim($extension_informations[$i]['extension']));
|
$extension = strtolower(trim($extension_informations[$i]['extension']));
|
||||||
|
// Get allowed extensions
|
||||||
|
if ((int)$extension_informations[$i]['allow_group'] === 1) {
|
||||||
$allowed_extensions[] = $extension;
|
$allowed_extensions[] = $extension;
|
||||||
|
}
|
||||||
$display_categories[$extension] = (int)$extension_informations[$i]['cat_id'];
|
$display_categories[$extension] = (int)$extension_informations[$i]['cat_id'];
|
||||||
$download_modes[$extension] = (int)$extension_informations[$i]['download_mode'];
|
$download_modes[$extension] = (int)$extension_informations[$i]['download_mode'];
|
||||||
$upload_icons[$extension] = trim($extension_informations[$i]['upload_icon']);
|
$upload_icons[$extension] = trim($extension_informations[$i]['upload_icon']);
|
||||||
|
|
|
@ -11,16 +11,11 @@ if (!defined('BB_ROOT')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't count on forbidden extensions table, because it is not allowed to allow forbidden extensions at all
|
|
||||||
$extensions = DB()->fetch_rowset("
|
$extensions = DB()->fetch_rowset("
|
||||||
SELECT
|
SELECT e.extension, g.cat_id, g.download_mode, g.upload_icon, g.allow_group FROM
|
||||||
e.extension, g.cat_id, g.download_mode, g.upload_icon
|
|
||||||
FROM
|
|
||||||
" . BB_EXTENSIONS . " e,
|
" . BB_EXTENSIONS . " e,
|
||||||
" . BB_EXTENSION_GROUPS . " g
|
" . BB_EXTENSION_GROUPS . " g
|
||||||
WHERE
|
WHERE e.group_id = g.group_id
|
||||||
e.group_id = g.group_id
|
|
||||||
AND g.allow_group = 1
|
|
||||||
");
|
");
|
||||||
|
|
||||||
$this->store('attach_extensions', $extensions);
|
$this->store('attach_extensions', $extensions);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue