Vergleich inc/functions_upload.php - 1.16 - 1.18

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 114Zeile 114
	
// Check if this is a valid image or not
$img_dimensions = @getimagesize($mybb->settings['avataruploadpath']."/".$filename);

	
// Check if this is a valid image or not
$img_dimensions = @getimagesize($mybb->settings['avataruploadpath']."/".$filename);

 

// Check a list of known MIME types to establish what kind of avatar we're uploading
switch(strtolower($avatar['type']))
{
case "image/gif":
$img_type = 1;
break;
case "image/jpeg":
case "image/x-jpeg":
case "image/pjpeg":
$img_type = 2;
break;
case "image/png":
case "image/x-png":
$img_type = 3;
break;
default:
$img_type = 0;
}

// Check if the uploaded file type matches the correct image type (returned by getimagesize)
if($img_dimensions[2] != $img_type || $img_type == 0)
{
@unlink($mybb->settings['avataruploadpath']."/".$filename);
$ret['error'] = $lang->error_uploadfailed;
return $ret;
}


	if(!is_array($img_dimensions))
{
$ret['error'] = $lang->error_uploadfailed;

	if(!is_array($img_dimensions))
{
$ret['error'] = $lang->error_uploadfailed;

Zeile 178Zeile 206
			$friendlyquota = getfriendlysize($mybb->usergroup['attachquota']*1000);
$ret['error'] = sprintf($lang->error_reachedattachquota, $friendlyquota);
return $ret;

			$friendlyquota = getfriendlysize($mybb->usergroup['attachquota']*1000);
$ret['error'] = sprintf($lang->error_reachedattachquota, $friendlyquota);
return $ret;

		}
}


		}
}


	// Check if an attachment with this name is already in the post
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."attachments WHERE filename='".$attachment['name']."' AND (posthash='$posthash' OR (pid='$pid' AND pid!='0'))");
$prevattach = $db->fetch_array($query);

	// Check if an attachment with this name is already in the post
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."attachments WHERE filename='".$attachment['name']."' AND (posthash='$posthash' OR (pid='$pid' AND pid!='0'))");
$prevattach = $db->fetch_array($query);

Zeile 194Zeile 222
	$filename = "post_".$mybb->user['uid']."_".time().".attach";
$file = upload_file($attachment, $mybb->settings['uploadspath'], $filename);
if($file['error'])

	$filename = "post_".$mybb->user['uid']."_".time().".attach";
$file = upload_file($attachment, $mybb->settings['uploadspath'], $filename);
if($file['error'])

	{

	{

		$ret['error'] = $lang->error_uploadfailed;
return $ret;
}

		$ret['error'] = $lang->error_uploadfailed;
return $ret;
}

Zeile 221Zeile 249
	// Alls well that ends well? Lets generate a thumbnail (if image) and insert it all in to the database
if($ext == "gif" || $ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "jpe")
{

	// Alls well that ends well? Lets generate a thumbnail (if image) and insert it all in to the database
if($ext == "gif" || $ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "jpe")
{

 
		// Check a list of known MIME types to establish what kind of image we're uploading
switch(strtolower($file['type']))
{
case "image/gif":
$img_type = 1;
break;
case "image/jpeg":
case "image/x-jpeg":
case "image/pjpeg":
$img_type = 2;
break;
case "image/png":
case "image/x-png":
$img_type = 3;
break;
default:
$img_type = 0;
}

// Check if the uploaded file type matches the correct image type (returned by getimagesize)
$img_dimensions = @getimagesize($mybb->settings['uploadspath']."/".$filename);
if(!is_array($img_dimensions) || $img_dimensions[2] != $img_type)
{
@unlink($mybb->settings['uploadspath']."/".$filename);
$ret['error'] = $lang->error_uploadfailed;
return $ret;
}


		require "functions_image.php";
$thumbname = str_replace(".attach", "_thumb.$ext", $filename);
$thumbnail = generate_thumbnail($mybb->settings['uploadspath']."/".$filename, $mybb->settings['uploadspath'], $thumbname, $mybb->settings['attachthumbh'], $mybb->settings['attachthumbw']);

		require "functions_image.php";
$thumbname = str_replace(".attach", "_thumb.$ext", $filename);
$thumbnail = generate_thumbnail($mybb->settings['uploadspath']."/".$filename, $mybb->settings['uploadspath'], $thumbname, $mybb->settings['attachthumbh'], $mybb->settings['attachthumbw']);