Vergleich inc/functions_upload.php - 1.4.7 - 1.4.15

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: functions_upload.php 4337 2009-03-30 01:21:51Z Tikitiki $

 * $Id: functions_upload.php 5379 2011-02-21 11:06:42Z Tomm $

 */



 */



Zeile 46Zeile 46
	    $uploadpath = $mybb->settings['uploadspath'];
}


	    $uploadpath = $mybb->settings['uploadspath'];
}


	@unlink($uploadpath."/".$attachment['attachname']);
if($attachment['thumbnail'])


	// Check if this attachment is referenced in any other posts. If it isn't, then we are safe to delete the actual file.
$query = $db->simple_select("attachments", "COUNT(aid) as numreferences", "attachname='".$db->escape_string($attachment['attachname'])."'");
if($db->fetch_field($query, "numreferences") == 0)

	{

	{

		@unlink($uploadpath."/".$attachment['thumbnail']);
}




		@unlink($uploadpath."/".$attachment['attachname']);
if($attachment['thumbnail'])
{
@unlink($uploadpath."/".$attachment['thumbnail']);
}





	$date_directory = explode('/', $attachment['attachname']);
if(@is_dir($uploadpath."/".$date_directory[0]))
{
@rmdir($uploadpath."/".$date_directory[0]);


		$date_directory = explode('/', $attachment['attachname']);
if(@is_dir($uploadpath."/".$date_directory[0]))
{
@rmdir($uploadpath."/".$date_directory[0]);
}

	}

if($attachment['visible'] == 1 && $pid)

	}

if($attachment['visible'] == 1 && $pid)

Zeile 78Zeile 83
	if($pid)
{
$post = get_post($pid);

	if($pid)
{
$post = get_post($pid);

	}

	}

	$posthash = $db->escape_string($posthash);
if($posthash != "" && !$pid)
{

	$posthash = $db->escape_string($posthash);
if($posthash != "" && !$pid)
{

Zeile 94Zeile 99
	    $uploadpath = '../'.$mybb->settings['uploadspath'];
}
else

	    $uploadpath = '../'.$mybb->settings['uploadspath'];
}
else

	{

	{

	    $uploadpath = $mybb->settings['uploadspath'];
}


	    $uploadpath = $mybb->settings['uploadspath'];
}


Zeile 110Zeile 115
		
$db->delete_query("attachments", "aid='".$attachment['aid']."'");


		
$db->delete_query("attachments", "aid='".$attachment['aid']."'");


		@unlink($uploadpath."/".$attachment['attachname']);
if($attachment['thumbnail'])


		// Check if this attachment is referenced in any other posts. If it isn't, then we are safe to delete the actual file.
$query2 = $db->simple_select("attachments", "COUNT(aid) as numreferences", "attachname='".$db->escape_string($attachment['attachname'])."'");
if($db->fetch_field($query2, "numreferences") == 0)

		{

		{

			@unlink($uploadpath."/".$attachment['thumbnail']);
}




			@unlink($uploadpath."/".$attachment['attachname']);
if($attachment['thumbnail'])
{
@unlink($uploadpath."/".$attachment['thumbnail']);
}





		$date_directory = explode('/', $attachment['attachname']);
if(@is_dir($uploadpath."/".$date_directory[0]))
{
@rmdir($uploadpath."/".$date_directory[0]);


			$date_directory = explode('/', $attachment['attachname']);
if(@is_dir($uploadpath."/".$date_directory[0]))
{
@rmdir($uploadpath."/".$date_directory[0]);
}

		}
}


		}
}


Zeile 194Zeile 204

// Check we have a valid extension
$ext = get_extension(my_strtolower($avatar['name']));


// Check we have a valid extension
$ext = get_extension(my_strtolower($avatar['name']));

	if(!preg_match("#(gif|jpg|jpeg|jpe|bmp|png)$#i", $ext)) 

	if(!preg_match("#^(gif|jpg|jpeg|jpe|bmp|png)$#i", $ext)) 

	{
$ret['error'] = $lang->error_avatartype;
return $ret;

	{
$ret['error'] = $lang->error_avatartype;
return $ret;

Zeile 313Zeile 323
		return $ret;		
}
// Everything is okay so lets delete old avatars for this user

		return $ret;		
}
// Everything is okay so lets delete old avatars for this user

	remove_avatars($user['uid'], $filename);

	remove_avatars($uid, $filename);


$ret = array(
"avatar" => $mybb->settings['avataruploadpath']."/".$filename,


$ret = array(
"avatar" => $mybb->settings['avataruploadpath']."/".$filename,

Zeile 431Zeile 441
	}

// All seems to be good, lets move the attachment!

	}

// All seems to be good, lets move the attachment!

	$filename = "post_".$mybb->user['uid']."_".TIME_NOW."_".md5(uniqid(rand(),�true)).".attach";

	$filename = "post_".$mybb->user['uid']."_".TIME_NOW."_".md5(random_str()).".attach";

	
$file = upload_file($attachment, $mybb->settings['uploadspath']."/".$month_dir, $filename);


	
$file = upload_file($attachment, $mybb->settings['uploadspath']."/".$month_dir, $filename);