Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: functions_upload.php 4101 2008-08-10 18:52:38Z Tikitiki $
| * $Id: functions_upload.php 4864 2010-04-10 09:13:19Z RyanGordon $
|
*/
| */
|
Zeile 36 | Zeile 36 |
---|
$plugins->run_hooks("remove_attachment_do_delete", $attachment); $db->delete_query("attachments", "aid='{$attachment['aid']}'");
|
$plugins->run_hooks("remove_attachment_do_delete", $attachment); $db->delete_query("attachments", "aid='{$attachment['aid']}'");
|
@unlink($mybb->settings['uploadspath']."/".$attachment['attachname']); if($attachment['thumbnail']) { @unlink($mybb->settings['uploadspath']."/".$attachment['thumbnail']); }
$date_directory = explode('/', $attachment['attachname']); if(@is_dir($mybb->settings['uploadspath']."/".$date_directory[0])) { @rmdir($mybb->settings['uploadspath']."/".$date_directory[0]); }
if($attachment['visible'] == 1 && $pid)
| if(defined('IN_ADMINCP')) { $uploadpath = '../'.$mybb->settings['uploadspath']; } else { $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) { @unlink($uploadpath."/".$attachment['attachname']); if($attachment['thumbnail']) { @unlink($uploadpath."/".$attachment['thumbnail']); }
$date_directory = explode('/', $attachment['attachname']); if(@is_dir($uploadpath."/".$date_directory[0])) { @rmdir($uploadpath."/".$date_directory[0]); } }
if($attachment['visible'] == 1 && $pid)
|
{ $post = get_post($pid); update_thread_counters($post['tid'], array("attachmentcount" => "-1"));
| { $post = get_post($pid); update_thread_counters($post['tid'], array("attachmentcount" => "-1"));
|
Zeile 77 | Zeile 92 |
---|
else { $query = $db->simple_select("attachments", "*", "pid='$pid'");
|
else { $query = $db->simple_select("attachments", "*", "pid='$pid'");
|
| } if(defined('IN_ADMINCP')) { $uploadpath = '../'.$mybb->settings['uploadspath']; } else { $uploadpath = $mybb->settings['uploadspath'];
|
}
$num_attachments = 0; while($attachment = $db->fetch_array($query)) { if($attachment['visible'] == 1)
|
}
$num_attachments = 0; while($attachment = $db->fetch_array($query)) { if($attachment['visible'] == 1)
|
{
| {
|
$num_attachments++; }
| $num_attachments++; }
|
Zeile 91 | Zeile 115 |
---|
$db->delete_query("attachments", "aid='".$attachment['aid']."'");
|
$db->delete_query("attachments", "aid='".$attachment['aid']."'");
|
@unlink($mybb->settings['uploadspath']."/".$attachment['attachname']); if($attachment['thumbnail'])
| // 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($mybb->settings['uploadspath']."/".$attachment['thumbnail']); }
| @unlink($uploadpath."/".$attachment['attachname']); if($attachment['thumbnail']) { @unlink($uploadpath."/".$attachment['thumbnail']); }
|
|
|
$date_directory = explode('/', $attachment['attachname']); if(@is_dir($mybb->settings['uploadspath']."/".$date_directory[0])) { @rmdir($mybb->settings['uploadspath']."/".$date_directory[0]);
| $date_directory = explode('/', $attachment['attachname']); if(@is_dir($uploadpath."/".$date_directory[0])) { @rmdir($uploadpath."/".$date_directory[0]); }
|
} }
| } }
|
Zeile 175 | Zeile 204 |
---|
// 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;
|
Zeile 249 | Zeile 278 |
---|
$ret['error'] = $lang->sprintf($lang->error_avatartoobig, $maxwidth, $maxheight); if($mybb->settings['avatarresizing'] == "user") {
|
$ret['error'] = $lang->sprintf($lang->error_avatartoobig, $maxwidth, $maxheight); if($mybb->settings['avatarresizing'] == "user") {
|
$ret['error'] .= "<br /<br />".$lang->error_avataruserresize;
| $ret['error'] .= "<br /><br />".$lang->error_avataruserresize;
|
} @unlink($avatarpath."/".$filename); return $ret;
| } @unlink($avatarpath."/".$filename); return $ret;
|
Zeile 294 | Zeile 323 |
---|
return $ret; } // Everything is okay so lets delete old avatars for this user
|
return $ret; } // Everything is okay so lets delete old avatars for this user
|
remove_avatars($user['uid'], $filename);
| remove_avatars($uid, $filename);
|
$ret = array( "avatar" => $mybb->settings['avataruploadpath']."/".$filename,
| $ret = array( "avatar" => $mybb->settings['avataruploadpath']."/".$filename,
|
Zeile 385 | Zeile 414 |
---|
}
// Check if an attachment with this name is already in the post
|
}
// 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='$pid' AND pid!='0'))");
| $query = $db->simple_select("attachments", "*", "filename='".$db->escape_string($attachment['name'])."' AND (posthash='$posthash' OR (pid='".intval($pid)."' AND pid!='0'))");
|
$prevattach = $db->fetch_array($query); if($prevattach['aid']) {
| $prevattach = $db->fetch_array($query); if($prevattach['aid']) {
|
Zeile 412 | Zeile 441 |
---|
} // All seems to be good, lets move the attachment!
|
} // All seems to be good, lets move the attachment!
|
$filename = "post_".$mybb->user['uid']."_".TIME_NOW.".attach";
| $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);
|