aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2013-03-04 02:43:48 +0100
committerAndreas Fischer <bantu@phpbb.com>2013-06-03 16:14:22 +0200
commit11c80c040243244757ea75ef4ab23a70a725254f (patch)
tree716240a45c7069fa7bc84e3fd35e4711cd08da79 /phpBB/includes/functions_posting.php
parentcb54f56c3db0bedefaa76113f7491203962004ed (diff)
downloadforums-11c80c040243244757ea75ef4ab23a70a725254f.tar
forums-11c80c040243244757ea75ef4ab23a70a725254f.tar.gz
forums-11c80c040243244757ea75ef4ab23a70a725254f.tar.bz2
forums-11c80c040243244757ea75ef4ab23a70a725254f.tar.xz
forums-11c80c040243244757ea75ef4ab23a70a725254f.zip
[ticket/11586] Use a variable for $cat_id == ATTACHMENT_CATEGORY_IMAGE.
PHPBB3-11586
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r--phpBB/includes/functions_posting.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 8b4a833d8e..a31d3b5a3f 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -429,15 +429,16 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
return $filedata;
}
- $cat_id = (isset($extensions[$file->get('extension')]['display_cat'])) ? $extensions[$file->get('extension')]['display_cat'] : ATTACHMENT_CATEGORY_NONE;
+ // Whether the uploaded file is in the image category
+ $is_image = (isset($extensions[$file->get('extension')]['display_cat'])) ? $extensions[$file->get('extension')]['display_cat'] == ATTACHMENT_CATEGORY_IMAGE : false;
// Do we have to create a thumbnail?
- $filedata['thumbnail'] = ($cat_id == ATTACHMENT_CATEGORY_IMAGE && $config['img_create_thumbnail']) ? 1 : 0;
+ $filedata['thumbnail'] = ($is_image && $config['img_create_thumbnail']) ? 1 : 0;
if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id))
{
// Check Image Size, if it is an image
- if ($cat_id == ATTACHMENT_CATEGORY_IMAGE)
+ if ($is_image)
{
$file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']);
}
@@ -457,10 +458,9 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
$file->clean_filename('unique', $user->data['user_id'] . '_');
- // Are we uploading an image *and* this image being within the image category? Only then perform additional image checks.
- $no_image = ($cat_id == ATTACHMENT_CATEGORY_IMAGE) ? false : true;
-
- $file->move_file($config['upload_path'], false, $no_image);
+ // Are we uploading an image *and* this image being within the image category?
+ // Only then perform additional image checks.
+ $file->move_file($config['upload_path'], false, !$is_image);
if (sizeof($file->error))
{
@@ -472,7 +472,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
}
// Make sure the image category only holds valid images...
- if ($cat_id == ATTACHMENT_CATEGORY_IMAGE && !$file->is_image())
+ if ($is_image && !$file->is_image())
{
$file->remove();