From 8906e07d414a2fa379e3aba0b96b4f3ea468699f Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 17 Sep 2004 09:11:48 +0000 Subject: [PATCH] - extensions_allowed changed a bit. git-svn-id: file:///svn/phpbb/trunk@4986 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/download.php | 5 +++-- phpBB/includes/functions.php | 6 ++---- phpBB/includes/functions_display.php | 2 +- phpBB/includes/functions_posting.php | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/phpBB/download.php b/phpBB/download.php index eff6d0c603..2cac956a53 100644 --- a/phpBB/download.php +++ b/phpBB/download.php @@ -87,7 +87,8 @@ else } // disallowed ? -if (!extension_allowed($row['forum_id'], $attachment['extension'])) +$extensions = array(); +if (!extension_allowed($row['forum_id'], $attachment['extension'], $extensions)) { trigger_error(sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])); } @@ -207,7 +208,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) header("Content-length: $size"); } $result = @readfile($filename); - + if (!$result) { trigger_error('Unable to deliver file.
Error was: ' . $php_errormsg, E_USER_WARNING); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 6589f804bd..1d1c32119b 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1341,11 +1341,9 @@ function parse_inline_attachments(&$text, &$attachments, &$update_count, $forum_ } // Check if extension is allowed to be posted within forum X (forum_id 0 == private messaging) -function extension_allowed($forum_id, $extension) +function extension_allowed($forum_id, $extension, &$extensions) { - global $extensions; - - if (!isset($extensions) || !is_array($extensions)) + if (!sizeof($extensions)) { $extensions = array(); obtain_attach_extensions($extensions); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 71c76b24f6..3e6a511c62 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -422,7 +422,7 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_ $denied = false; - if (!extension_allowed($forum_id, $attachment['extension'])) + if (!extension_allowed($forum_id, $attachment['extension'], $extensions)) { $denied = true; diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 5946183b21..61a2620e74 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -157,7 +157,7 @@ function upload_attachment($forum_id, $filename, $local = false, $local_storage obtain_attach_extensions($extensions); // Check Extension - if (!extension_allowed($forum_id, $filedata['extension'])) + if (!extension_allowed($forum_id, $filedata['extension'], $extensions)) { $filedata['error'][] = sprintf($user->lang['DISALLOWED_EXTENSION'], $filedata['extension']); $filedata['post_attach'] = false;