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: attachment.php 5297 2010-12-28 22:01:14Z Tomm $
| * $Id$
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 55 | Zeile 55 |
---|
// Permissions $forumpermissions = forum_permissions($fid);
|
// Permissions $forumpermissions = forum_permissions($fid);
|
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 || ($forumpermissions['candlattachments'] == 0 && !$mybb->input['thumbnail']))
| if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 || ($forumpermissions['canonlyviewownthreads'] != 0 && $thread['uid'] != $mybb->user['uid']) || ($forumpermissions['candlattachments'] == 0 && !$mybb->input['thumbnail']))
|
{ error_no_permission(); }
// Error if attachment is invalid or not visible
|
{ error_no_permission(); }
// Error if attachment is invalid or not visible
|
if(!$attachment['aid'] || !$attachment['attachname'] || (!is_moderator($fid) && $attachment['visible'] != 1))
| if(!$attachment['aid'] || !$attachment['attachname'] || (!is_moderator($fid) && ($attachment['visible'] != 1 || $thread['visible'] != 1 || $post['visible'] != 1)))
|
{ error($lang->error_invalidattachment); }
| { error($lang->error_invalidattachment); }
|
Zeile 107 | Zeile 107 |
---|
header("Content-type: ".$type); $thumb = $mybb->settings['uploadspath']."/".$attachment['thumbnail']; header("Content-length: ".@filesize($thumb));
|
header("Content-type: ".$type); $thumb = $mybb->settings['uploadspath']."/".$attachment['thumbnail']; header("Content-length: ".@filesize($thumb));
|
echo file_get_contents($thumb);
| $handle = fopen($thumb, 'rb'); while(!feof($handle)) { echo fread($handle, 8192); } fclose($handle);
|
} else { $ext = get_extension($attachment['filename']);
|
} else { $ext = get_extension($attachment['filename']);
|
|
|
switch($attachment['filetype']) { case "application/pdf":
| switch($attachment['filetype']) { case "application/pdf":
|
Zeile 127 | Zeile 132 |
---|
break;
default:
|
break;
default:
|
header("Content-type: application/force-download");
| $filetype = $attachment['filetype'];
if(!$filetype) { $filetype = 'application/force-download'; }
header("Content-type: {$filetype}");
|
$disposition = "attachment"; }
if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "msie") !== false)
|
$disposition = "attachment"; }
if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "msie") !== false)
|
{
| {
|
header("Content-disposition: attachment; filename=\"{$attachment['filename']}\""); } else
|
header("Content-disposition: attachment; filename=\"{$attachment['filename']}\""); } else
|
{
| {
|
header("Content-disposition: {$disposition}; filename=\"{$attachment['filename']}\""); } if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "msie 6.0") !== false)
|
header("Content-disposition: {$disposition}; filename=\"{$attachment['filename']}\""); } if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "msie 6.0") !== false)
|
{
| {
|
header("Expires: -1");
|
header("Expires: -1");
|
}
| }
|
header("Content-length: {$attachment['filesize']}");
|
header("Content-length: {$attachment['filesize']}");
|
header("Content-range: bytes=0-".($attachment['filesize']-1)."/".$attachment['filesize']); echo file_get_contents($mybb->settings['uploadspath']."/".$attachment['attachname']);
| header("Content-range: bytes=0-".($attachment['filesize']-1)."/".$attachment['filesize']); $handle = fopen($mybb->settings['uploadspath']."/".$attachment['attachname'], 'rb'); while(!feof($handle)) { echo fread($handle, 8192); } fclose($handle);
|
} ?>
| } ?>
|