1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-07 17:27:16 +02:00

#11074 - only process and check (as well as display) images if the category also matches. ;)

git-svn-id: file:///svn/phpbb/trunk@7616 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2007-05-17 13:23:13 +00:00
parent a2c81d763f
commit fbd7416060
5 changed files with 24 additions and 7 deletions

View File

@@ -2987,7 +2987,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
$display_cat = ATTACHMENT_CATEGORY_NONE;
}
$download_link = append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id'] . '&mode=view');
$download_link = append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id']);
switch ($display_cat)
{
@@ -2995,6 +2995,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
case ATTACHMENT_CATEGORY_IMAGE:
$l_downloaded_viewed = 'VIEWED_COUNT';
$inline_link = append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id']);
$download_link .= '&mode=view';
$block_array += array(
'S_IMAGE' => true,
@@ -3008,6 +3009,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
case ATTACHMENT_CATEGORY_THUMB:
$l_downloaded_viewed = 'VIEWED_COUNT';
$thumbnail_link = append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id'] . '&t=1');
$download_link = '&mode=view';
$block_array += array(
'S_THUMBNAIL' => true,

View File

@@ -408,7 +408,11 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
}
$file->clean_filename('unique', $user->data['user_id'] . '_');
$file->move_file($config['upload_path']);
// 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);
if (sizeof($file->error))
{

View File

@@ -230,7 +230,7 @@ class filespec
* @param octal $chmod Permission mask for chmodding the file after a successful move
* @access public
*/
function move_file($destination, $overwrite = false, $chmod = 0666)
function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = 0666)
{
global $user, $phpbb_root_path;
@@ -315,7 +315,7 @@ class filespec
// Try to get real filesize from destination folder
$this->filesize = (@filesize($this->destination_file)) ? @filesize($this->destination_file) : $this->filesize;
if ($this->is_image())
if ($this->is_image() && !$skip_image_check)
{
$this->width = $this->height = 0;

View File

@@ -1853,6 +1853,7 @@ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $
$avatar = $phpbb_root_path . $config['avatar_gallery_path'] . '/' . $avatar ;
break;
}
// Make sure getimagesize works...
if (($image_data = @getimagesize($avatar)) === false)
{