Zeile 3 | Zeile 3 |
---|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html
| * Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html
|
*
|
*
|
* $Id: functions_upload.php 2163 2006-08-30 05:53:05Z chris $
| * $Id: functions_upload.php 3055 2007-05-13 15:01:15Z Tikitiki $
|
*/
| */
|
Zeile 20 | Zeile 20 |
---|
function remove_attachment($pid, $posthash, $aid) { global $db, $mybb;
|
function remove_attachment($pid, $posthash, $aid) { global $db, $mybb;
|
| if($pid) { $post = get_post($pid); }
|
$aid = intval($aid); $posthash = $db->escape_string($posthash); if($posthash != "")
| $aid = intval($aid); $posthash = $db->escape_string($posthash); if($posthash != "")
|
Zeile 37 | Zeile 43 |
---|
if($attachment['thumbnail']) { @unlink($mybb->settings['uploadspath']."/".$attachment['thumbnail']);
|
if($attachment['thumbnail']) { @unlink($mybb->settings['uploadspath']."/".$attachment['thumbnail']);
|
| } if($attachment['visible'] == 1 && $post['pid']) { update_thread_counters($post['tid'], array("attachmentcount" => "-1"));
|
} }
| } }
|
Zeile 49 | Zeile 59 |
---|
function remove_attachments($pid, $posthash="") { global $db, $mybb;
|
function remove_attachments($pid, $posthash="") { global $db, $mybb;
|
| if($pid) { $post = get_post($pid); }
|
$posthash = $db->escape_string($posthash); if($posthash != "" && !$pid) {
| $posthash = $db->escape_string($posthash); if($posthash != "" && !$pid) {
|
Zeile 58 | Zeile 74 |
---|
{ $query = $db->simple_select(TABLE_PREFIX."attachments", "*", "pid='$pid'"); }
|
{ $query = $db->simple_select(TABLE_PREFIX."attachments", "*", "pid='$pid'"); }
|
| $num_attachments = 0;
|
while($attachment = $db->fetch_array($query)) {
|
while($attachment = $db->fetch_array($query)) {
|
| if($attachment['visible'] == 1) { $num_attachments++; }
|
$db->delete_query(TABLE_PREFIX."attachments", "aid='".$attachment['aid']."'"); @unlink($mybb->settings['uploadspath']."/".$attachment['attachname']); if($attachment['thumbnail']) { @unlink($mybb->settings['uploadspath']."/".$attachment['thumbnail']); }
|
$db->delete_query(TABLE_PREFIX."attachments", "aid='".$attachment['aid']."'"); @unlink($mybb->settings['uploadspath']."/".$attachment['attachname']); if($attachment['thumbnail']) { @unlink($mybb->settings['uploadspath']."/".$attachment['thumbnail']); }
|
| } if($post['pid']) { update_thread_counters($post['tid'], array("attachmentcount" => "-{$num_attachments}"));
|
} }
| } }
|
Zeile 103 | Zeile 128 |
---|
global $db, $mybb, $lang, $_FILES; $avatar = $_FILES['avatarupload']; if(!is_uploaded_file($avatar['tmp_name']))
|
global $db, $mybb, $lang, $_FILES; $avatar = $_FILES['avatarupload']; 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
| }
// Check we have a valid extension
|
Zeile 152 | Zeile 177 |
---|
$img_type = 1; break; case "image/jpeg":
|
$img_type = 1; break; case "image/jpeg":
|
| case "image/x-jpg":
|
case "image/x-jpeg": case "image/pjpeg":
|
case "image/x-jpeg": case "image/pjpeg":
|
| case "image/jpg":
|
$img_type = 2; break; case "image/png":
| $img_type = 2; break; case "image/png":
|
Zeile 231 | Zeile 258 |
---|
break; default: $ret['error'] .= sprintf($lang->error_uploadfailed_phpx, $attachment['error']);
|
break; default: $ret['error'] .= sprintf($lang->error_uploadfailed_phpx, $attachment['error']);
|
break; } return $ret; }
| break; } return $ret; }
|
if(!is_uploaded_file($attachment['tmp_name']) || empty($attachment['tmp_name'])) { $ret['error'] = $lang->error_uploadfailed.$lang->error_uploadfailed_php4;
| if(!is_uploaded_file($attachment['tmp_name']) || empty($attachment['tmp_name'])) { $ret['error'] = $lang->error_uploadfailed.$lang->error_uploadfailed_php4;
|
Zeile 242 | Zeile 269 |
---|
} $ext = get_extension($attachment['name']); // Check if we have a valid extension
|
} $ext = get_extension($attachment['name']); // Check if we have a valid extension
|
$query = $db->simple_select(TABLE_PREFIX."attachtypes", "*", "extension='$ext'");
| $query = $db->simple_select(TABLE_PREFIX."attachtypes", "*", "extension='".$db->escape_string($ext)."'");
|
$attachtype = $db->fetch_array($query); if(!$attachtype['atid']) {
| $attachtype = $db->fetch_array($query); if(!$attachtype['atid']) {
|
Zeile 262 | Zeile 289 |
---|
$query = $db->simple_select(TABLE_PREFIX."attachments", "SUM(filesize) AS ausage", "uid='".$mybb->user['uid']."'"); $usage = $db->fetch_array($query); $usage = $usage['ausage']+$attachment['size'];
|
$query = $db->simple_select(TABLE_PREFIX."attachments", "SUM(filesize) AS ausage", "uid='".$mybb->user['uid']."'"); $usage = $db->fetch_array($query); $usage = $usage['ausage']+$attachment['size'];
|
if($usage > ($mybb->usergroup['attachquota']*1000))
| if($usage > ($mybb->usergroup['attachquota']*1024))
|
{
|
{
|
$friendlyquota = get_friendly_size($mybb->usergroup['attachquota']*1000);
| $friendlyquota = get_friendly_size($mybb->usergroup['attachquota']*1024);
|
$ret['error'] = sprintf($lang->error_reachedattachquota, $friendlyquota); return $ret; }
| $ret['error'] = sprintf($lang->error_reachedattachquota, $friendlyquota); return $ret; }
|
Zeile 326 | Zeile 353 |
---|
$img_type = 1; break; case "image/jpeg":
|
$img_type = 1; break; case "image/jpeg":
|
| case "image/x-jpg":
|
case "image/x-jpeg": case "image/pjpeg":
|
case "image/x-jpeg": case "image/pjpeg":
|
| case "image/jpg":
|
$img_type = 2; break; case "image/png":
| $img_type = 2; break; case "image/png":
|
Zeile 345 | Zeile 374 |
---|
@unlink($mybb->settings['uploadspath']."/".$filename); $ret['error'] = $lang->error_uploadfailed; return $ret;
|
@unlink($mybb->settings['uploadspath']."/".$filename); $ret['error'] = $lang->error_uploadfailed; 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']);
|
Zeile 368 | Zeile 397 |
---|
}
$db->insert_query(TABLE_PREFIX."attachments", $attacharray);
|
}
$db->insert_query(TABLE_PREFIX."attachments", $attacharray);
|
| if($attacharray['pid'] > 0) { $post = get_post($attacharray['pid']); update_thread_counters($post['tid'], array("attachmentcount" => +1)); }
|
$aid = $db->insert_id(); $ret['aid'] = $aid;
| $aid = $db->insert_id(); $ret['aid'] = $aid;
|