Vergleich inc/functions_upload.php - 1.8.22 - 1.8.25

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 374Zeile 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 481Zeile 451
	if($prevattach['aid'] && $update_attachment == false)
{
if(!$mybb->usergroup['caneditattachments'] && !$forumpermissions['caneditattachments'])

	if($prevattach['aid'] && $update_attachment == false)
{
if(!$mybb->usergroup['caneditattachments'] && !$forumpermissions['caneditattachments'])

		{

		{

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

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

Zeile 676Zeile 646
			if(@is_dir($mybb->settings['uploadspath']."/".$date_directory[0]))
{
delete_upload_directory($mybb->settings['uploadspath']."/".$date_directory[0]);

			if(@is_dir($mybb->settings['uploadspath']."/".$date_directory[0]))
{
delete_upload_directory($mybb->settings['uploadspath']."/".$date_directory[0]);

			}
}


			}
}


		$aid = $prevattach['aid'];

		$aid = $prevattach['aid'];

	}

	}

	else

	else

	{

	{

		$aid = $db->insert_query("attachments", $attacharray);
if($pid)

		$aid = $db->insert_query("attachments", $attacharray);
if($pid)

		{

		{

			update_thread_counters($tid, array("attachmentcount" => "+1"));

			update_thread_counters($tid, array("attachmentcount" => "+1"));

		}

		}

	}
$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 722Zeile 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];
}


Zeile 746Zeile 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 757Zeile 777
					if($action == "editpost")
{
if($exists && $mybb->get_input('updateattachment') && ($mybb->usergroup['caneditattachments'] || $forumpermissions['caneditattachments']))

					if($action == "editpost")
{
if($exists && $mybb->get_input('updateattachment') && ($mybb->usergroup['caneditattachments'] || $forumpermissions['caneditattachments']))

						{
$update_attachment = true;

						{
$update_attachment = true;

						}
}
else

						}
}
else

Zeile 767Zeile 787
						{
$update_attachment = true;
}

						{
$update_attachment = true;
}

					}


					}


					$attachedfile = upload_attachment($FILE, $update_attachment);

if(!empty($attachedfile['error']))

					$attachedfile = upload_attachment($FILE, $update_attachment);

if(!empty($attachedfile['error']))

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

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

 


				}
else
{

				}
else
{