aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/download
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-02-23 18:15:54 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2011-02-23 20:16:16 -0500
commit786078d4232b1ca3b79d692938519e7bd677f12a (patch)
tree745f13cecd5484ae880c89d0723cb7a9b364c31f /phpBB/download
parent510248da2844df22af1cd807e13b46c0c8b68290 (diff)
downloadforums-786078d4232b1ca3b79d692938519e7bd677f12a.tar
forums-786078d4232b1ca3b79d692938519e7bd677f12a.tar.gz
forums-786078d4232b1ca3b79d692938519e7bd677f12a.tar.bz2
forums-786078d4232b1ca3b79d692938519e7bd677f12a.tar.xz
forums-786078d4232b1ca3b79d692938519e7bd677f12a.zip
[ticket/10041] Use send_status_line more in download/file.php
PHPBB3-10041
Diffstat (limited to 'phpBB/download')
-rw-r--r--phpBB/download/file.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index f5a766dd57..e1ec835b9b 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -125,11 +125,13 @@ $user->setup('viewtopic');
if (!$download_id)
{
+ send_status_line(404, 'Not Found');
trigger_error('NO_ATTACHMENT_SELECTED');
}
if (!$config['allow_attachments'] && !$config['allow_pm_attach'])
{
+ send_status_line(404, 'Not Found');
trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED');
}
@@ -142,11 +144,13 @@ $db->sql_freeresult($result);
if (!$attachment)
{
+ send_status_line(404, 'Not Found');
trigger_error('ERROR_NO_ATTACHMENT');
}
if ((!$attachment['in_message'] && !$config['allow_attachments']) || ($attachment['in_message'] && !$config['allow_pm_attach']))
{
+ send_status_line(404, 'Not Found');
trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED');
}
@@ -159,6 +163,7 @@ if ($attachment['is_orphan'])
if (!$own_attachment || ($attachment['in_message'] && !$auth->acl_get('u_pm_download')) || (!$attachment['in_message'] && !$auth->acl_get('u_download')))
{
+ send_status_line(404, 'Not Found');
trigger_error('ERROR_NO_ATTACHMENT');
}
@@ -191,6 +196,7 @@ else
}
else
{
+ send_status_line(403, 'Forbidden');
trigger_error('SORRY_AUTH_VIEW_ATTACH');
}
}
@@ -231,6 +237,7 @@ else
$extensions = array();
if (!extension_allowed($row['forum_id'], $attachment['extension'], $extensions))
{
+ send_status_line(404, 'Forbidden');
trigger_error(sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']));
}
}
@@ -253,6 +260,7 @@ $db->sql_freeresult($result);
if (!$attachment)
{
+ send_status_line(404, 'Not Found');
trigger_error('ERROR_NO_ATTACHMENT');
}
@@ -295,6 +303,7 @@ else
// This presenting method should no longer be used
if (!@is_dir($phpbb_root_path . $config['upload_path']))
{
+ send_status_line(500, 'Internal Server Error');
trigger_error($user->lang['PHYSICAL_DOWNLOAD_NOT_POSSIBLE']);
}
@@ -419,6 +428,7 @@ function send_file_to_browser($attachment, $upload_dir, $category)
if (!@file_exists($filename))
{
+ send_status_line(404, 'Not Found');
trigger_error($user->lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . sprintf($user->lang['FILE_NOT_FOUND_404'], $filename));
}
@@ -445,9 +455,11 @@ function send_file_to_browser($attachment, $upload_dir, $category)
// PHP track_errors setting On?
if (!empty($php_errormsg))
{
+ send_status_line(500, 'Internal Server Error');
trigger_error($user->lang['UNABLE_TO_DELIVER_FILE'] . '<br />' . sprintf($user->lang['TRACKED_PHP_ERROR'], $php_errormsg));
}
+ send_status_line(500, 'Internal Server Error');
trigger_error('UNABLE_TO_DELIVER_FILE');
}