MyBB Community Forums

Full Version: View Attachment Images But Still Disallow .ZIP Downloads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
This has annoyed me for as long as I can remember. You upload a new theme or plugin as a .zip package on your forum and you attach some screenshots to give your users or guests an idea of what you've just uploaded. But the MyBB attachment system also blocks access to image attachments if you don't have permission to access attachments.

This small edit will allow you to block access to .ZIP attachments but allow access to all other attachments (Images etc...)

Open "attachment.php" in your forum root.

Find:
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 ||
 ($forumpermissions['candlattachments'] == 0 && !$mybb->input['thumbnail']))
{
	error_no_permission();
}

Replace:
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 ||
 ($forumpermissions['candlattachments'] == 0 && !$mybb->input['thumbnail']
 && $attachment['filetype'] == "application/zip"))
{
	error_no_permission();
}
Great tip, thank you (repp'd)
Your welcome !
Thanks so much Big Grin!
how about pdf files, 3gp?
(2012-11-04, 04:48 PM)harlenjoy Wrote: [ -> ]how about pdf files, 3gp?

Only .zip files are blocked. All other files are accessible. What do you want to do exactly ?
my forum has a lot of pdf files, 3gp, zip, .docx. ,i would like also to disable the download for that. Smile
So you want to allow images to be downloaded and everything else to be disallowed ?
Yhup, Thats It Sir!
Thats exactly what the edit does.

It allows you to access all file types, apart from .ZIP files. Only people allowed to download attachments can download .ZIP files. You can make other edits to allow or disallow different file types if you like.
Pages: 1 2