diff --git a/dl.php b/dl.php index ab8d5bc2..57459824 100644 --- a/dl.php +++ b/dl.php @@ -107,6 +107,12 @@ if (!($attachment = DB()->sql_fetchrow($result))) $attachment['physical_filename'] = basename($attachment['physical_filename']); +// Re-define download mode for thumbnails +if ($thumbnail) +{ + $attachment['physical_filename'] = THUMB_DIR . '/t_' . $attachment['physical_filename']; +} + DB()->sql_freeresult($result); // get forum_id for attachment authorization or private message authorization @@ -201,16 +207,12 @@ if (!in_array($attachment['extension'], $allowed_extensions)) bb_die(sprintf($lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']) . "

" . $lang['FILENAME'] . ": " . $attachment['physical_filename']); } +// Getting download mode by extension if (!$download_mode = intval($download_mode[$attachment['extension']])) { bb_die('Incorrect download mode'); } -if ($thumbnail) -{ - $attachment['physical_filename'] = THUMB_DIR . '/t_' . $attachment['physical_filename']; -} - // Update download count if (!$thumbnail) {