Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: functions_upload.php 5487 2011-07-12 13:16:58Z Tomm $
| * $Id$
|
*/
| */
|
Zeile 32 | Zeile 32 |
---|
$query = $db->simple_select("attachments", "aid, attachname, thumbnail, visible", "aid='{$aid}' AND pid='{$pid}'"); $attachment = $db->fetch_array($query); }
|
$query = $db->simple_select("attachments", "aid, attachname, thumbnail, visible", "aid='{$aid}' AND pid='{$pid}'"); $attachment = $db->fetch_array($query); }
|
|
|
$plugins->run_hooks("remove_attachment_do_delete", $attachment);
|
$plugins->run_hooks("remove_attachment_do_delete", $attachment);
|
|
|
$db->delete_query("attachments", "aid='{$attachment['aid']}'");
|
$db->delete_query("attachments", "aid='{$attachment['aid']}'");
|
|
|
if(defined('IN_ADMINCP')) { $uploadpath = '../'.$mybb->settings['uploadspath'];
|
if(defined('IN_ADMINCP')) { $uploadpath = '../'.$mybb->settings['uploadspath'];
|
} else
| } else
|
{ $uploadpath = $mybb->settings['uploadspath']; }
|
{ $uploadpath = $mybb->settings['uploadspath']; }
|
|
|
// 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)
|
// 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['attachname']); if($attachment['thumbnail']) {
| @unlink($uploadpath."/".$attachment['attachname']); if($attachment['thumbnail']) {
|
Zeile 79 | Zeile 79 |
---|
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 93 | Zeile 93 |
---|
{ $query = $db->simple_select("attachments", "*", "pid='$pid'"); }
|
{ $query = $db->simple_select("attachments", "*", "pid='$pid'"); }
|
|
|
if(defined('IN_ADMINCP')) { $uploadpath = '../'.$mybb->settings['uploadspath'];
| if(defined('IN_ADMINCP')) { $uploadpath = '../'.$mybb->settings['uploadspath'];
|
Zeile 110 | Zeile 110 |
---|
{ $num_attachments++; }
|
{ $num_attachments++; }
|
|
|
$plugins->run_hooks("remove_attachments_do_delete", $attachment);
|
$plugins->run_hooks("remove_attachments_do_delete", $attachment);
|
|
|
$db->delete_query("attachments", "aid='".$attachment['aid']."'");
|
$db->delete_query("attachments", "aid='".$attachment['aid']."'");
|
|
|
// 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)
|
// 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['attachname']); if($attachment['thumbnail']) { @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])) {
| $date_directory = explode('/', $attachment['attachname']); if(@is_dir($uploadpath."/".$date_directory[0])) {
|
Zeile 132 | Zeile 132 |
---|
} } }
|
} } }
|
|
|
if($post['tid']) { update_thread_counters($post['tid'], array("attachmentcount" => "-{$num_attachments}"));
| if($post['tid']) { update_thread_counters($post['tid'], array("attachmentcount" => "-{$num_attachments}"));
|
Zeile 148 | Zeile 148 |
---|
function remove_avatars($uid, $exclude="") { global $mybb, $plugins;
|
function remove_avatars($uid, $exclude="") { global $mybb, $plugins;
|
|
|
if(defined('IN_ADMINCP'))
|
if(defined('IN_ADMINCP'))
|
{
| {
|
$avatarpath = '../'.$mybb->settings['avataruploadpath']; } else { $avatarpath = $mybb->settings['avataruploadpath']; }
|
$avatarpath = '../'.$mybb->settings['avataruploadpath']; } else { $avatarpath = $mybb->settings['avataruploadpath']; }
|
|
|
$dir = opendir($avatarpath); if($dir) { while($file = @readdir($dir)) { $plugins->run_hooks("remove_avatars_do_delete", $file);
|
$dir = opendir($avatarpath); if($dir) { while($file = @readdir($dir)) { $plugins->run_hooks("remove_avatars_do_delete", $file);
|
|
|
if(preg_match("#avatar_".$uid."\.#", $file) && is_file($avatarpath."/".$file) && $file != $exclude) { @unlink($avatarpath."/".$file);
| if(preg_match("#avatar_".$uid."\.#", $file) && is_file($avatarpath."/".$file) && $file != $exclude) { @unlink($avatarpath."/".$file);
|
Zeile 185 | Zeile 185 |
---|
function upload_avatar($avatar=array(), $uid=0) { global $db, $mybb, $lang, $plugins;
|
function upload_avatar($avatar=array(), $uid=0) { global $db, $mybb, $lang, $plugins;
|
|
|
if(!$uid) { $uid = $mybb->user['uid'];
| if(!$uid) { $uid = $mybb->user['uid'];
|
Zeile 197 | Zeile 197 |
---|
}
if(!is_uploaded_file($avatar['tmp_name']))
|
}
if(!is_uploaded_file($avatar['tmp_name']))
|
{ $ret['error'] = $lang->error_uploadfailed; return $ret; }
| { $ret['error'] = $lang->error_uploadfailed; return $ret; }
|
// 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; }
|
|
|
if(defined('IN_ADMINCP')) { $avatarpath = '../'.$mybb->settings['avataruploadpath'];
| if(defined('IN_ADMINCP')) { $avatarpath = '../'.$mybb->settings['avataruploadpath'];
|
Zeile 219 | Zeile 219 |
---|
{ $avatarpath = $mybb->settings['avataruploadpath']; }
|
{ $avatarpath = $mybb->settings['avataruploadpath']; }
|
|
|
$filename = "avatar_".$uid.".".$ext; $file = upload_file($avatar, $avatarpath, $filename); if($file['error']) {
|
$filename = "avatar_".$uid.".".$ext; $file = upload_file($avatar, $avatarpath, $filename); if($file['error']) {
|
@unlink($avatarpath."/".$filename); $ret['error'] = $lang->error_uploadfailed; return $ret; }
// Lets just double check that it exists if(!file_exists($avatarpath."/".$filename)) { $ret['error'] = $lang->error_uploadfailed;
| @unlink($avatarpath."/".$filename); $ret['error'] = $lang->error_uploadfailed; return $ret; }
// Lets just double check that it exists if(!file_exists($avatarpath."/".$filename)) { $ret['error'] = $lang->error_uploadfailed;
|
@unlink($avatarpath."/".$filename); return $ret; }
|
@unlink($avatarpath."/".$filename); return $ret; }
|
|
|
// Check if this is a valid image or not $img_dimensions = @getimagesize($avatarpath."/".$filename); if(!is_array($img_dimensions))
| // Check if this is a valid image or not $img_dimensions = @getimagesize($avatarpath."/".$filename); if(!is_array($img_dimensions))
|
Zeile 246 | Zeile 246 |
---|
$ret['error'] = $lang->error_uploadfailed; return $ret; }
|
$ret['error'] = $lang->error_uploadfailed; return $ret; }
|
|
|
// Check avatar dimensions if($mybb->settings['maxavatardims'] != '') { list($maxwidth, $maxheight) = @explode("x", $mybb->settings['maxavatardims']); if(($maxwidth && $img_dimensions[0] > $maxwidth) || ($maxheight && $img_dimensions[1] > $maxheight))
|
// Check avatar dimensions if($mybb->settings['maxavatardims'] != '') { list($maxwidth, $maxheight) = @explode("x", $mybb->settings['maxavatardims']); if(($maxwidth && $img_dimensions[0] > $maxwidth) || ($maxheight && $img_dimensions[1] > $maxheight))
|
{
| {
|
// Automatic resizing enabled? if($mybb->settings['avatarresizing'] == "auto" || ($mybb->settings['avatarresizing'] == "user" && $mybb->input['auto_resize'] == 1)) {
| // Automatic resizing enabled? if($mybb->settings['avatarresizing'] == "auto" || ($mybb->settings['avatarresizing'] == "user" && $mybb->input['auto_resize'] == 1)) {
|
Zeile 263 | Zeile 263 |
---|
$ret['error'] = $lang->sprintf($lang->error_avatartoobig, $maxwidth, $maxheight); $ret['error'] .= "<br /><br />".$lang->error_avatarresizefailed; @unlink($avatarpath."/".$filename);
|
$ret['error'] = $lang->sprintf($lang->error_avatartoobig, $maxwidth, $maxheight); $ret['error'] .= "<br /><br />".$lang->error_avatarresizefailed; @unlink($avatarpath."/".$filename);
|
return $ret;
| return $ret;
|
} else {
| } else {
|
Zeile 282 | Zeile 282 |
---|
} @unlink($avatarpath."/".$filename); return $ret;
|
} @unlink($avatarpath."/".$filename); return $ret;
|
}
| }
|
} }
|
} }
|
|
|
// Next check the file size if($avatar['size'] > ($mybb->settings['avatarsize']*1024) && $mybb->settings['avatarsize'] > 0) { @unlink($avatarpath."/".$filename); $ret['error'] = $lang->error_uploadsize; return $ret;
|
// Next check the file size if($avatar['size'] > ($mybb->settings['avatarsize']*1024) && $mybb->settings['avatarsize'] > 0) { @unlink($avatarpath."/".$filename); $ret['error'] = $lang->error_uploadsize; return $ret;
|
}
| }
|
// Check a list of known MIME types to establish what kind of avatar we're uploading switch(my_strtolower($avatar['type']))
| // Check a list of known MIME types to establish what kind of avatar we're uploading switch(my_strtolower($avatar['type']))
|
Zeile 314 | Zeile 314 |
---|
default: $img_type = 0; }
|
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) { $ret['error'] = $lang->error_uploadfailed; @unlink($avatarpath."/".$filename);
|
// Check if the uploaded file type matches the correct image type (returned by getimagesize) if($img_dimensions[2] != $img_type || $img_type == 0) { $ret['error'] = $lang->error_uploadfailed; @unlink($avatarpath."/".$filename);
|
return $ret;
| return $ret;
|
} // Everything is okay so lets delete old avatars for this user remove_avatars($uid, $filename);
| } // Everything is okay so lets delete old avatars for this user remove_avatars($uid, $filename);
|
Zeile 330 | Zeile 330 |
---|
"width" => intval($img_dimensions[0]), "height" => intval($img_dimensions[1]) );
|
"width" => intval($img_dimensions[0]), "height" => intval($img_dimensions[1]) );
|
$plugins->run_hooks_by_ref("upload_avatar_end", $ret);
| $ret = $plugins->run_hooks("upload_avatar_end", $ret);
|
return $ret; }
| return $ret; }
|
Zeile 344 | Zeile 344 |
---|
function upload_attachment($attachment, $update_attachment=false) { global $db, $theme, $templates, $posthash, $pid, $tid, $forum, $mybb, $lang, $plugins, $cache;
|
function upload_attachment($attachment, $update_attachment=false) { global $db, $theme, $templates, $posthash, $pid, $tid, $forum, $mybb, $lang, $plugins, $cache;
|
|
|
$posthash = $db->escape_string($mybb->input['posthash']);
|
$posthash = $db->escape_string($mybb->input['posthash']);
|
| $pid = intval($pid);
|
if(isset($attachment['error']) && $attachment['error'] != 0) {
| if(isset($attachment['error']) && $attachment['error'] != 0) {
|
Zeile 357 | Zeile 358 |
---|
break; case 2: // UPLOAD_ERR_FORM_SIZE $ret['error'] .= $lang->error_uploadfailed_php2;
|
break; case 2: // UPLOAD_ERR_FORM_SIZE $ret['error'] .= $lang->error_uploadfailed_php2;
|
break;
| 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;
|
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;
| 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;
|
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;
| break;
|
default: $ret['error'] .= $lang->sprintf($lang->error_uploadfailed_phpx, $attachment['error']); break; } return $ret; }
|
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'])) { $ret['error'] = $lang->error_uploadfailed.$lang->error_uploadfailed_php4; return $ret; }
|
if(!is_uploaded_file($attachment['tmp_name']) || empty($attachment['tmp_name'])) { $ret['error'] = $lang->error_uploadfailed.$lang->error_uploadfailed_php4; return $ret; }
|
|
|
$ext = get_extension($attachment['name']); // Check if we have a valid extension $query = $db->simple_select("attachtypes", "*", "extension='".$db->escape_string($ext)."'");
| $ext = get_extension($attachment['name']); // Check if we have a valid extension $query = $db->simple_select("attachtypes", "*", "extension='".$db->escape_string($ext)."'");
|
Zeile 392 | Zeile 393 |
---|
$ret['error'] = $lang->error_attachtype; return $ret; }
|
$ret['error'] = $lang->error_attachtype; return $ret; }
|
|
|
// Check the size if($attachment['size'] > $attachtype['maxsize']*1024 && $attachtype['maxsize'] != "") { $ret['error'] = $lang->sprintf($lang->error_attachsize, $attachtype['maxsize']);
|
// Check the size if($attachment['size'] > $attachtype['maxsize']*1024 && $attachtype['maxsize'] != "") { $ret['error'] = $lang->sprintf($lang->error_attachsize, $attachtype['maxsize']);
|
return $ret;
| return $ret;
|
}
// Double check attachment space usage
| }
// Double check attachment space usage
|
Zeile 418 | Zeile 419 |
---|
$forumpermissions = forum_permissions($forum['fid']);
// Check if an attachment with this name is already in the post
|
$forumpermissions = forum_permissions($forum['fid']);
// Check if an attachment with this name is already in the post
|
$query = $db->simple_select("attachments", "*", "filename='".$db->escape_string($attachment['name'])."' AND (posthash='$posthash' OR (pid='".intval($pid)."' AND pid!='0'))");
| if($pid != 0) { $uploaded_query = "pid='{$pid}'"; } else { $uploaded_query = "posthash='{$posthash}'"; } $query = $db->simple_select("attachments", "*", "filename='".$db->escape_string($attachment['name'])."' AND ".$uploaded_query);
|
$prevattach = $db->fetch_array($query); if($prevattach['aid'] && $update_attachment == false) { if(!$mybb->usergroup['caneditattachments'] && !$forumpermissions['caneditattachments'])
|
$prevattach = $db->fetch_array($query); 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; }
|
|
|
$ret['error'] = $lang->error_alreadyuploaded; return $ret;
|
$ret['error'] = $lang->error_alreadyuploaded; return $ret;
|
}
// Check if the attachment directory (YYYYMM) exists, if not, create it $month_dir = gmdate("Ym"); if(!@is_dir($mybb->settings['uploadspath']."/".$month_dir))
| }
$month_dir = ''; if(ini_get('safe_mode') != 1 && strtolower(ini_get('safe_mode')) != 'on')
|
{
|
{
|
@mkdir($mybb->settings['uploadspath']."/".$month_dir); // Still doesn't exist - oh well, throw it in the main directory
| // Check if the attachment directory (YYYYMM) exists, if not, create it $month_dir = gmdate("Ym");
|
if(!@is_dir($mybb->settings['uploadspath']."/".$month_dir)) {
|
if(!@is_dir($mybb->settings['uploadspath']."/".$month_dir)) {
|
$month_dir = '';
| @mkdir($mybb->settings['uploadspath']."/".$month_dir); // Still doesn't exist - oh well, throw it in the main directory if(!@is_dir($mybb->settings['uploadspath']."/".$month_dir)) { $month_dir = ''; }
|
} }
|
} }
|
// If safe_mode is enabled, don't attempt to use the monthly directories as it won't work if(ini_get('safe_mode') == 1 || strtolower(ini_get('safe_mode')) == 'on') { $month_dir = ''; }
|
|
// All seems to be good, lets move the attachment! $filename = "post_".$mybb->user['uid']."_".TIME_NOW."_".md5(random_str()).".attach";
|
// All seems to be good, lets move the attachment! $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);
|
|
|
// Failed to create the attachment in the monthly directory, just throw it in the main directory if($file['error'] && $month_dir) {
|
// Failed to create the attachment in the monthly directory, just throw it in the main directory if($file['error'] && $month_dir) {
|
$file = upload_file($attachment, $mybb->settings['uploadspath'].'/', $filename);
| $file = upload_file($attachment, $mybb->settings['uploadspath'].'/', $filename);
|
}
if($month_dir)
|
}
if($month_dir)
|
{
| {
|
$filename = $month_dir."/".$filename; }
|
$filename = $month_dir."/".$filename; }
|
|
|
if($file['error']) { $ret['error'] = $lang->error_uploadfailed.$lang->error_uploadfailed_detail;
| if($file['error']) { $ret['error'] = $lang->error_uploadfailed.$lang->error_uploadfailed_detail;
|
Zeile 476 | Zeile 483 |
---|
break; case 2: $ret['error'] .= $lang->error_uploadfailed_movefailed;
|
break; case 2: $ret['error'] .= $lang->error_uploadfailed_movefailed;
|
break; } return $ret; }
| break; } return $ret; }
|
// Lets just double check that it exists if(!file_exists($mybb->settings['uploadspath']."/".$filename))
| // Lets just double check that it exists if(!file_exists($mybb->settings['uploadspath']."/".$filename))
|
Zeile 490 | Zeile 497 |
---|
// Generate the array for the insert_query $attacharray = array(
|
// Generate the array for the insert_query $attacharray = array(
|
"pid" => intval($pid),
| "pid" => $pid,
|
"posthash" => $posthash, "uid" => $mybb->user['uid'], "filename" => $db->escape_string($file['original_filename']),
| "posthash" => $posthash, "uid" => $mybb->user['uid'], "filename" => $db->escape_string($file['original_filename']),
|
Zeile 524 | Zeile 531 |
---|
default: $img_type = 0; }
|
default: $img_type = 0; }
|
|
|
$supported_mimes = array(); $attachtypes = $cache->read("attachtypes"); foreach($attachtypes as $attachtype)
| $supported_mimes = array(); $attachtypes = $cache->read("attachtypes"); foreach($attachtypes as $attachtype)
|
Zeile 555 | Zeile 562 |
---|
{ @unlink($mybb->settings['uploadspath']."/".$filename); $ret['error'] = $lang->error_uploadfailed;
|
{ @unlink($mybb->settings['uploadspath']."/".$filename); $ret['error'] = $lang->error_uploadfailed;
|
return $ret; }
| return $ret; }
|
require_once MYBB_ROOT."inc/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_once MYBB_ROOT."inc/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']);
|
|
|
if($thumbnail['filename']) { $attacharray['thumbnail'] = $thumbnail['filename'];
| if($thumbnail['filename']) { $attacharray['thumbnail'] = $thumbnail['filename'];
|
Zeile 578 | Zeile 585 |
---|
{ $attacharray['visible'] = 1; }
|
{ $attacharray['visible'] = 1; }
|
$plugins->run_hooks_by_ref("upload_attachment_do_insert", $attacharray);
| $attacharray = $plugins->run_hooks("upload_attachment_do_insert", $attacharray);
|
if($prevattach['aid'] && $update_attachment == true) { unset($attacharray['downloads']); // Keep our download count if we're updating an attachment
| if($prevattach['aid'] && $update_attachment == true) { unset($attacharray['downloads']); // Keep our download count if we're updating an attachment
|
Zeile 590 | Zeile 597 |
---|
else { $aid = $db->insert_query("attachments", $attacharray);
|
else { $aid = $db->insert_query("attachments", $attacharray);
|
}
if($tid) { update_thread_counters($tid, array("attachmentcount" => "+1"));
| if($pid) { update_thread_counters($tid, array("attachmentcount" => "+1")); }
|
} $ret['aid'] = $aid; return $ret;
| } $ret['aid'] = $aid; return $ret;
|
Zeile 610 | Zeile 616 |
---|
function upload_file($file, $path, $filename="") { global $plugins;
|
function upload_file($file, $path, $filename="") { global $plugins;
|
|
|
if(empty($file['name']) || $file['name'] == "none" || $file['size'] < 1) { $upload['error'] = 1; return $upload;
|
if(empty($file['name']) || $file['name'] == "none" || $file['size'] < 1) { $upload['error'] = 1; return $upload;
|
}
| }
|
if(!$filename) { $filename = $file['name']; }
|
if(!$filename) { $filename = $file['name']; }
|
|
|
$upload['original_filename'] = preg_replace("#/$#", "", $file['name']); // Make the filename safe
|
$upload['original_filename'] = preg_replace("#/$#", "", $file['name']); // Make the filename safe
|
| $upload['original_filename'] = utf8_handle_4byte_string($upload['original_filename']);
|
$filename = preg_replace("#/$#", "", $filename); // Make the filename safe $moved = @move_uploaded_file($file['tmp_name'], $path."/".$filename);
|
$filename = preg_replace("#/$#", "", $filename); // Make the filename safe $moved = @move_uploaded_file($file['tmp_name'], $path."/".$filename);
|
|
|
if(!$moved) { $upload['error'] = 2;
| if(!$moved) { $upload['error'] = 2;
|
Zeile 636 | Zeile 643 |
---|
$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);
| $upload = $plugins->run_hooks("upload_file_end", $upload);
|
return $upload; } ?>
| return $upload; } ?>
|