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 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 346 | Zeile 346 |
---|
global $db, $theme, $templates, $posthash, $pid, $tid, $forum, $mybb, $lang, $plugins, $cache; $posthash = $db->escape_string($mybb->input['posthash']);
|
global $db, $theme, $templates, $posthash, $pid, $tid, $forum, $mybb, $lang, $plugins, $cache; $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 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)
|
$prevattach = $db->fetch_array($query); if($prevattach['aid'] && $update_attachment == false)
|
{
| {
|
if(!$mybb->usergroup['caneditattachments'] && !$forumpermissions['caneditattachments'])
|
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 = ''; } } // 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 = ''; }
| { @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 = ''; } } }
|
// 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";
|
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 509 | Zeile 516 |
---|
{ case "image/gif": $img_type = 1;
|
{ case "image/gif": $img_type = 1;
|
break;
| break;
|
case "image/jpeg": case "image/x-jpg": case "image/x-jpeg":
| case "image/jpeg": case "image/x-jpg": case "image/x-jpeg":
|
Zeile 549 | Zeile 556 |
---|
else if(function_exists("mime_content_type")) { $mime = mime_content_type(MYBB_ROOT.$file_path);
|
else if(function_exists("mime_content_type")) { $mime = mime_content_type(MYBB_ROOT.$file_path);
|
}
| }
|
if(!is_array($img_dimensions) || ($img_dimensions[2] != $img_type && !in_array($mime, $supported_mimes))) { @unlink($mybb->settings['uploadspath']."/".$filename);
| if(!is_array($img_dimensions) || ($img_dimensions[2] != $img_type && !in_array($mime, $supported_mimes))) { @unlink($mybb->settings['uploadspath']."/".$filename);
|
Zeile 579 | Zeile 586 |
---|
$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) {
| if($prevattach['aid'] && $update_attachment == true) {
|
Zeile 592 | Zeile 599 |
---|
$aid = $db->insert_query("attachments", $attacharray); }
|
$aid = $db->insert_query("attachments", $attacharray); }
|
if($tid)
| if($pid)
|
{ update_thread_counters($tid, array("attachmentcount" => "+1")); }
| { update_thread_counters($tid, array("attachmentcount" => "+1")); }
|
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; } ?>
|