Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Use MyBB's attachment.php to Download XThreads Attachment
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Use MyBB's attachment.php to Download XThreads Attachment
XThreads itself already have a permission to view its attachments (files or images). And XThreads has a global settings to change the attachments URL based on IP and/or time.

This is only my ugly and a very simple "trick" to add a permission to download XThreads attachments. I use MyBB's attachment.php file for this (using attachment_start hook). I use this for file attachments (not image attachments).

In this example, it will look at the XThreads Viewable by Usergroups settings permission to download the attachment.

We can use something like this in the Display Format:

HTML Code
<a href="{$mybb->settings['bburl']}/attachment.php?xtaid={$GLOBALS['threadfields']['key']['aid']}">Download</a>

I don't know what I should use for the aid in the Display Format, so I use the {$GLOBALS['threadfields']['key']['aid']}. We can design it as our needs (using button, form and etc).

Because I'm not a coder, please tell me if there is something wrong with the code.



Attached File(s)
.php  xt_att.php (Size: 1.19 KB / Downloads: 508)

07-14-2012 07:54 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #2
RE: Use MyBB's attachment.php to Download XThreads Attachment
Good one RateU Smile

Thanks for sharing.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
07-14-2012 08:12 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #3
RE: Use MyBB's attachment.php to Download XThreads Attachment
Nice try!
Just be aware that it's still possibly to fetch the URL that the user gets redirected to, but I can see this masking having uses at places.

My Blog
07-14-2012 12:08 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #4
RE: Use MyBB's attachment.php to Download XThreads Attachment
(07-14-2012 12:08 PM)ZiNgA BuRgA Wrote:  Just be aware that it's still possibly to fetch the URL that the user gets redirected to
Biggrin

07-15-2012 08:20 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: