Zeile 119 | Zeile 119 |
---|
// basename isn't UTF-8 safe. This is a workaround. $attachment['filename'] = ltrim(basename(' '.$attachment['filename']));
|
// basename isn't UTF-8 safe. This is a workaround. $attachment['filename'] = ltrim(basename(' '.$attachment['filename']));
|
| $uploadspath_abs = mk_path_abs($mybb->settings['uploadspath']);
|
$plugins->run_hooks("attachment_end");
|
$plugins->run_hooks("attachment_end");
|
|
|
if(isset($mybb->input['thumbnail']))
|
if(isset($mybb->input['thumbnail']))
|
{ if(!file_exists($mybb->settings['uploadspath']."/".$attachment['thumbnail'])) { error($lang->error_invalidattachment); }
| { if(!file_exists($uploadspath_abs."/".$attachment['thumbnail'])) { error($lang->error_invalidattachment); }
|
$ext = get_extension($attachment['thumbnail']); switch($ext) {
| $ext = get_extension($attachment['thumbnail']); switch($ext) {
|
Zeile 149 | Zeile 151 |
---|
default: $type = "image/unknown"; break;
|
default: $type = "image/unknown"; break;
|
}
| }
|
header("Content-disposition: filename=\"{$attachment['filename']}\""); header("Content-type: ".$type);
|
header("Content-disposition: filename=\"{$attachment['filename']}\""); header("Content-type: ".$type);
|
$thumb = $mybb->settings['uploadspath']."/".$attachment['thumbnail'];
| $thumb = $uploadspath_abs."/".$attachment['thumbnail'];
|
header("Content-length: ".@filesize($thumb)); $handle = fopen($thumb, 'rb'); while(!feof($handle))
| header("Content-length: ".@filesize($thumb)); $handle = fopen($thumb, 'rb'); while(!feof($handle))
|
Zeile 164 | Zeile 166 |
---|
} else {
|
} else {
|
if(!file_exists($mybb->settings['uploadspath']."/".$attachment['attachname']))
| if(!file_exists($uploadspath_abs."/".$attachment['attachname']))
|
{ error($lang->error_invalidattachment); }
| { error($lang->error_invalidattachment); }
|
Zeile 181 | Zeile 183 |
---|
case "image/png": case "text/plain": header("Content-type: {$attachment['filetype']}");
|
case "image/png": case "text/plain": header("Content-type: {$attachment['filetype']}");
|
$disposition = "inline";
| if(!empty($attachtypes[$ext]['forcedownload'])) { $disposition = "attachment"; } else { $disposition = "inline"; }
|
break;
default:
| break;
default:
|
Zeile 212 | Zeile 221 |
---|
header("Content-length: {$attachment['filesize']}"); header("Content-range: bytes=0-".($attachment['filesize']-1)."/".$attachment['filesize']);
|
header("Content-length: {$attachment['filesize']}"); header("Content-range: bytes=0-".($attachment['filesize']-1)."/".$attachment['filesize']);
|
$handle = fopen($mybb->settings['uploadspath']."/".$attachment['attachname'], 'rb');
| $handle = fopen($uploadspath_abs."/".$attachment['attachname'], 'rb');
|
while(!feof($handle)) { echo fread($handle, 8192);
| while(!feof($handle)) { echo fread($handle, 8192);
|