diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2004-03-11 21:17:32 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2004-03-11 21:17:32 +0000 |
| commit | ba7008b387d1972736c638444cb6273c3d9ebeab (patch) | |
| tree | e8e9872a6e33b1ffd3cb48951f09353702120043 /phpBB/includes/functions_posting.php | |
| parent | 7487bfce48dd90ea370c8a40e67a75b814f2eb37 (diff) | |
| download | forums-ba7008b387d1972736c638444cb6273c3d9ebeab.tar forums-ba7008b387d1972736c638444cb6273c3d9ebeab.tar.gz forums-ba7008b387d1972736c638444cb6273c3d9ebeab.tar.bz2 forums-ba7008b387d1972736c638444cb6273c3d9ebeab.tar.xz forums-ba7008b387d1972736c638444cb6273c3d9ebeab.zip | |
- re-enable drafts. ;)
- put extension checking into a small function...
git-svn-id: file:///svn/phpbb/trunk@4862 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_posting.php')
| -rw-r--r-- | phpBB/includes/functions_posting.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4c5a3d4c69..f43a28b9d3 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -188,7 +188,7 @@ function upload_attachment($forum_id, $filename, $local = false, $local_storage obtain_attach_extensions($extensions); // Check Extension - if ((is_array($extensions['_allowed_'][$filedata['extension']]) && !in_array($forum_id, $extensions['_allowed_'][$filedata['extension']])) || !isset($extensions['_allowed_'][$filedata['extension']])) + if (extension_allowed($forum_id, $filedata['extension'])) { $filedata['error'][] = sprintf($user->lang['DISALLOWED_EXTENSION'], $filedata['extension']); $filedata['post_attach'] = false; @@ -503,6 +503,20 @@ function create_thumbnail($source, $new_file, $mimetype) return true; } +// Check if extension is allowed to be posted within forum X +function extension_allowed($forum_id, $extension) +{ + global $extensions; + + if (!isset($extensions) || !is_array($extensions)) + { + $extensions = array(); + obtain_attach_extensions($extensions); + } + + return (is_array($extensions['_allowed_'][$extension]) && !in_array($forum_id, $extensions['_allowed_'][$extension])) || !isset($extensions['_allowed_'][$extension]); +} + // // TODO // |
