Vergleich inc/functions_upload.php - 1.2.7 - 1.2.11

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

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * $Id: functions_upload.php 3055 2007-05-13 15:01:15Z Tikitiki $

 * $Id: functions_upload.php 3135 2007-06-14 20:10:46Z dennis $

 */



 */



Zeile 19Zeile 19
 */
function remove_attachment($pid, $posthash, $aid)
{

 */
function remove_attachment($pid, $posthash, $aid)
{

	global $db, $mybb;

	global $db, $mybb, $plugins;

	
if($pid)
{

	
if($pid)
{

Zeile 38Zeile 38
		$query = $db->simple_select(TABLE_PREFIX."attachments", "*", "aid='$aid' AND pid='$pid'");
$attachment = $db->fetch_array($query);
}

		$query = $db->simple_select(TABLE_PREFIX."attachments", "*", "aid='$aid' AND pid='$pid'");
$attachment = $db->fetch_array($query);
}

 
	
$plugins->run_hooks("remove_attachment_do_delete", $attachment);


	$db->delete_query(TABLE_PREFIX."attachments", "aid='".$attachment['aid']."'");
@unlink($mybb->settings['uploadspath']."/".$attachment['attachname']);
if($attachment['thumbnail'])

	$db->delete_query(TABLE_PREFIX."attachments", "aid='".$attachment['aid']."'");
@unlink($mybb->settings['uploadspath']."/".$attachment['attachname']);
if($attachment['thumbnail'])

Zeile 58Zeile 61
 */
function remove_attachments($pid, $posthash="")
{

 */
function remove_attachments($pid, $posthash="")
{

	global $db, $mybb;

	global $db, $mybb, $plugins;

	
if($pid)
{

	
if($pid)
{

Zeile 81Zeile 84
		{ 
$num_attachments++;
}

		{ 
$num_attachments++;
}

 
		
$plugins->run_hooks("remove_attachments_do_delete", $attachment);


		$db->delete_query(TABLE_PREFIX."attachments", "aid='".$attachment['aid']."'");
@unlink($mybb->settings['uploadspath']."/".$attachment['attachname']);
if($attachment['thumbnail'])

		$db->delete_query(TABLE_PREFIX."attachments", "aid='".$attachment['aid']."'");
@unlink($mybb->settings['uploadspath']."/".$attachment['attachname']);
if($attachment['thumbnail'])

Zeile 102Zeile 108
 */
function remove_avatars($uid, $exclude="")
{

 */
function remove_avatars($uid, $exclude="")
{

	global $mybb;

	global $mybb, $plugins;

	$dir = opendir($mybb->settings['avataruploadpath']);
if($dir)
{
while($file = @readdir($dir))
{

	$dir = opendir($mybb->settings['avataruploadpath']);
if($dir)
{
while($file = @readdir($dir))
{

 
			$plugins->run_hooks("remove_avatars_do_delete", $file);

			if(preg_match("#avatar_".$uid."\.#", $file) && is_file($mybb->settings['avataruploadpath']."/".$file) && $file != $exclude)
{
@unlink($mybb->settings['avataruploadpath']."/".$file);

			if(preg_match("#avatar_".$uid."\.#", $file) && is_file($mybb->settings['avataruploadpath']."/".$file) && $file != $exclude)
{
@unlink($mybb->settings['avataruploadpath']."/".$file);

Zeile 125Zeile 132
 */
function upload_avatar()
{

 */
function upload_avatar()
{

	global $db, $mybb, $lang, $_FILES;

	global $db, $mybb, $lang, $_FILES, $plugins;

	$avatar = $_FILES['avatarupload'];
if(!is_uploaded_file($avatar['tmp_name']))

	$avatar = $_FILES['avatarupload'];
if(!is_uploaded_file($avatar['tmp_name']))

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

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

		return $ret;
}


		return $ret;
}


Zeile 151Zeile 158
	$file = upload_file($avatar, $mybb->settings['avataruploadpath'], $filename);
if($file['error'])
{

	$file = upload_file($avatar, $mybb->settings['avataruploadpath'], $filename);
if($file['error'])
{

 
		@unlink($mybb->settings['avataruploadpath']."/".$filename);		

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

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

Zeile 166Zeile 174
	$img_dimensions = @getimagesize($mybb->settings['avataruploadpath']."/".$filename);
if(!is_array($img_dimensions))
{

	$img_dimensions = @getimagesize($mybb->settings['avataruploadpath']."/".$filename);
if(!is_array($img_dimensions))
{

 
		@unlink($mybb->settings['avataruploadpath']."/".$filename);		

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

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

Zeile 194Zeile 203
	// Check if the uploaded file type matches the correct image type (returned by getimagesize)
if($img_dimensions[2] != $img_type || $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;
}

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

Zeile 217Zeile 227
		"avatar" => $mybb->settings['avataruploadpath']."/".$filename,
"width" => intval($img_dimensions[0]),
"height" => intval($img_dimensions[1])

		"avatar" => $mybb->settings['avataruploadpath']."/".$filename,
"width" => intval($img_dimensions[0]),
"height" => intval($img_dimensions[1])

	);


	);
$plugins->run_hooks_by_ref("upload_avatar_end", $ret);

	return $ret;
}


	return $ret;
}


Zeile 229Zeile 240
 */
function upload_attachment($attachment)
{

 */
function upload_attachment($attachment)
{

	global $db, $theme, $templates, $posthash, $pid, $tid, $forum, $mybb, $lang;

	global $db, $theme, $templates, $posthash, $pid, $tid, $forum, $mybb, $lang, $plugins;


$posthash = $db->escape_string($mybb->input['posthash']);



$posthash = $db->escape_string($mybb->input['posthash']);


Zeile 395Zeile 406
	{
$attacharray['visible'] = 1;
}

	{
$attacharray['visible'] = 1;
}

 
	
$plugins->run_hooks_by_ref("upload_attachment_do_insert", $attacharray);


$db->insert_query(TABLE_PREFIX."attachments", $attacharray);



$db->insert_query(TABLE_PREFIX."attachments", $attacharray);


Zeile 418Zeile 431
 */
function upload_file($file, $path, $filename="")
{

 */
function upload_file($file, $path, $filename="")
{

 
	global $plugins;

	if(empty($file['name']) || $file['name'] == "none" || $file['size'] < 1)
{
$upload['error'] = 1;

	if(empty($file['name']) || $file['name'] == "none" || $file['size'] < 1)
{
$upload['error'] = 1;

Zeile 441Zeile 455
	$upload['path'] = $path;
$upload['type'] = $file['type'];
$upload['size'] = $file['size'];

	$upload['path'] = $path;
$upload['type'] = $file['type'];
$upload['size'] = $file['size'];

 
	$plugins->run_hooks_by_ref("upload_file_end", $upload);

	return $upload;
}
?>

	return $upload;
}
?>