Vergleich inc/functions_upload.php - 1.8.19 - 1.8.23

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 21Zeile 21
	global $db, $mybb, $plugins;
$aid = (int)$aid;
$posthash = $db->escape_string($posthash);

	global $db, $mybb, $plugins;
$aid = (int)$aid;
$posthash = $db->escape_string($posthash);

	if($posthash != "")

	if(!empty($posthash))

	{
$query = $db->simple_select("attachments", "aid, attachname, thumbnail, visible", "aid='{$aid}' AND posthash='{$posthash}'");
$attachment = $db->fetch_array($query);

	{
$query = $db->simple_select("attachments", "aid, attachname, thumbnail, visible", "aid='{$aid}' AND posthash='{$posthash}'");
$attachment = $db->fetch_array($query);

Zeile 33Zeile 33
	}

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

	}

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

 

if($attachment === false)
{
// no attachment found with the given details
return;
}


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



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


Zeile 78Zeile 84
function remove_attachments($pid, $posthash="")
{
global $db, $mybb, $plugins;

function remove_attachments($pid, $posthash="")
{
global $db, $mybb, $plugins;





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

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

Zeile 101Zeile 107
	{
$uploadpath = $mybb->settings['uploadspath'];
}

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





	$num_attachments = 0;
while($attachment = $db->fetch_array($query))
{

	$num_attachments = 0;
while($attachment = $db->fetch_array($query))
{

Zeile 122Zeile 128
			if($attachment['thumbnail'])
{
delete_uploaded_file($uploadpath."/".$attachment['thumbnail']);

			if($attachment['thumbnail'])
{
delete_uploaded_file($uploadpath."/".$attachment['thumbnail']);

			}


			}


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

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

Zeile 368Zeile 374

$posthash = $db->escape_string($mybb->get_input('posthash'));
$pid = (int)$pid;


$posthash = $db->escape_string($mybb->get_input('posthash'));
$pid = (int)$pid;


if(isset($attachment['error']) && $attachment['error'] != 0)
{
$ret['error'] = $lang->error_uploadfailed.$lang->error_uploadfailed_detail;
switch($attachment['error'])
{
case 1: // UPLOAD_ERR_INI_SIZE
$ret['error'] .= $lang->error_uploadfailed_php1;
break;
case 2: // UPLOAD_ERR_FORM_SIZE
$ret['error'] .= $lang->error_uploadfailed_php2;
break;
case 3: // UPLOAD_ERR_PARTIAL
$ret['error'] .= $lang->error_uploadfailed_php3;
break;
case 4: // UPLOAD_ERR_NO_FILE
$ret['error'] .= $lang->error_uploadfailed_php4;
break;
case 6: // UPLOAD_ERR_NO_TMP_DIR
$ret['error'] .= $lang->error_uploadfailed_php6;
break;
case 7: // UPLOAD_ERR_CANT_WRITE
$ret['error'] .= $lang->error_uploadfailed_php7;
break;
default:
$ret['error'] .= $lang->sprintf($lang->error_uploadfailed_phpx, $attachment['error']);
break;
}
return $ret;
}

 

if(!is_uploaded_file($attachment['tmp_name']) || empty($attachment['tmp_name']))
{


if(!is_uploaded_file($attachment['tmp_name']) || empty($attachment['tmp_name']))
{

Zeile 427Zeile 403
	else
{
$attachtype = $attachtypes[$ext];

	else
{
$attachtype = $attachtypes[$ext];

 
	}

// check the length of the filename
$maxFileNameLength = 255;
if(my_strlen($attachment['name']) > $maxFileNameLength)
{
$ret['error'] = $lang->sprintf($lang->error_attach_filename_length, htmlspecialchars_uni($attachment['name']), $maxFileNameLength);
return $ret;

	}

// Check the size

	}

// Check the size

Zeile 579Zeile 563
			case "image/png":
case "image/x-png":
$img_type = 3;

			case "image/png":
case "image/x-png":
$img_type = 3;

				break;
default:

				break;
default:

				$img_type = 0;
}


				$img_type = 0;
}


Zeile 677Zeile 661
	}
$ret['aid'] = $aid;
return $ret;

	}
$ret['aid'] = $aid;
return $ret;

 
}

/**
* Check whether the input $FILE variable indicates a PHP file upload error,
* and if so, return an appropriate user-friendly error message.
*
* @param array $FILE File data (as fed by PHP's $_FILE).
*
* @return string Error message or empty if no error detected.
*/
function check_parse_php_upload_err($FILE)
{
global $lang;

$err = '';

if(isset($FILE['error']) && $FILE['error'] != 0 && ($FILE['error'] != UPLOAD_ERR_NO_FILE || $FILE['name']))
{
$err = $lang->error_uploadfailed.$lang->error_uploadfailed_detail;
switch($FILE['error'])
{
case 1: // UPLOAD_ERR_INI_SIZE
$err .= $lang->error_uploadfailed_php1;
break;
case 2: // UPLOAD_ERR_FORM_SIZE
$err .= $lang->error_uploadfailed_php2;
break;
case 3: // UPLOAD_ERR_PARTIAL
$err .= $lang->error_uploadfailed_php3;
break;
case 4: // UPLOAD_ERR_NO_FILE
$err .= $lang->error_uploadfailed_php4;
break;
case 6: // UPLOAD_ERR_NO_TMP_DIR
$err .= $lang->error_uploadfailed_php6;
break;
case 7: // UPLOAD_ERR_CANT_WRITE
$err .= $lang->error_uploadfailed_php7;
break;
default:
$err .= $lang->sprintf($lang->error_uploadfailed_phpx, $FILE['error']);
break;
}
}

return $err;

}

/**

}

/**

Zeile 708Zeile 738
		{
foreach($fields as $field)
{

		{
foreach($fields as $field)
{

				$attach1[$field] = $_FILES['attachments'][$field][$key];

 
				$attachments[$i][$field] = $_FILES['attachments'][$field][$i];

				$attachments[$i][$field] = $_FILES['attachments'][$field][$i];

			}

			}


$FILE = $attachments[$i];
if(!empty($FILE['name']) && !empty($FILE['type']) && $FILE['size'] > 0)


$FILE = $attachments[$i];
if(!empty($FILE['name']) && !empty($FILE['type']) && $FILE['size'] > 0)

Zeile 732Zeile 761

foreach($attachments as $FILE)
{


foreach($attachments as $FILE)
{

			if(!empty($FILE['name']) && !empty($FILE['type']))






			if($err = check_parse_php_upload_err($FILE))
{
$ret['errors'][] = $err;
$mybb->input['action'] = $action;
}
else if(!empty($FILE['name']) && !empty($FILE['type']))

			{
if($FILE['size'] > 0)
{

			{
if($FILE['size'] > 0)
{

Zeile 741Zeile 775

$update_attachment = false;
if($action == "editpost")


$update_attachment = false;
if($action == "editpost")

					{

					{

						if($exists && $mybb->get_input('updateattachment') && ($mybb->usergroup['caneditattachments'] || $forumpermissions['caneditattachments']))
{
$update_attachment = true;

						if($exists && $mybb->get_input('updateattachment') && ($mybb->usergroup['caneditattachments'] || $forumpermissions['caneditattachments']))
{
$update_attachment = true;

Zeile 762Zeile 796
						$ret['errors'][] = $attachedfile['error'];
$mybb->input['action'] = $action;
}

						$ret['errors'][] = $attachedfile['error'];
$mybb->input['action'] = $action;
}

 


				}
else
{

				}
else
{