mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
- extensions_allowed changed a bit.
git-svn-id: file:///svn/phpbb/trunk@4986 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
f8c8d23a72
commit
8906e07d41
4 changed files with 7 additions and 8 deletions
|
@ -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.<br />Error was: ' . $php_errormsg, E_USER_WARNING);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue