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 5623 2011-10-01 02:46:09Z ralgith $
| * $Id$
|
*/
| */
|
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) {
|
Zeile 432 | Zeile 441 |
---|
return $ret; }
|
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 = ''; }
|
} }
| } }
|
Zeile 464 | Zeile 477 |
---|
{ $ret['error'] = $lang->error_uploadfailed.$lang->error_uploadfailed_detail; switch($file['error'])
|
{ $ret['error'] = $lang->error_uploadfailed.$lang->error_uploadfailed_detail; switch($file['error'])
|
{
| {
|
case 1: $ret['error'] .= $lang->error_uploadfailed_nothingtomove; break;
| case 1: $ret['error'] .= $lang->error_uploadfailed_nothingtomove; break;
|
Zeile 484 | 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 565 | Zeile 578 |
---|
} } if($forum['modattachments'] == 1 && !is_moderator($forum['fid'], "", $mybb->user['uid']))
|
} } if($forum['modattachments'] == 1 && !is_moderator($forum['fid'], "", $mybb->user['uid']))
|
{
| {
|
$attacharray['visible'] = 0;
|
$attacharray['visible'] = 0;
|
} else
| } else
|
{ $attacharray['visible'] = 1; }
| { $attacharray['visible'] = 1; }
|
Zeile 580 | Zeile 593 |
---|
unset($attacharray['downloads']); // Keep our download count if we're updating an attachment $db->update_query("attachments", $attacharray, "aid='".$db->escape_string($prevattach['aid'])."'"); $aid = $prevattach['aid'];
|
unset($attacharray['downloads']); // Keep our download count if we're updating an attachment $db->update_query("attachments", $attacharray, "aid='".$db->escape_string($prevattach['aid'])."'"); $aid = $prevattach['aid'];
|
}
| }
|
else { $aid = $db->insert_query("attachments", $attacharray); }
|
else { $aid = $db->insert_query("attachments", $attacharray); }
|
if($tid)
| if($pid)
|
{ update_thread_counters($tid, array("attachmentcount" => "+1")); }
| { update_thread_counters($tid, array("attachmentcount" => "+1")); }
|