MyBB Hacks

Full Version: XThreads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Updated to v1.20.  I've changed quite a lot in this release, so hopefully I haven't stuffed anything up.
Thanks to everyone who have made suggestions or pointed out issues, resulting in these fixes.

Changes:
  • improve template caching (thanks to RateU for pointing that out) - all templates used by XThreads should now be cached
  • sanitise evaluated variables during cache build - improves performance slightly; also slightly improve handling of these variables, also making it harder for evaluated variables to invoke the {VALUE} replacement code (may improve security)
  • add {$forumurl}, {$threadurl}, {$forumurl_q} and {$threadurl_q} for templates.  It does the same thing as {$threadurl$} and {$forumurl?} etc did in the v1.10 update, except these will work in templates.  Although these also work in thread fields, the old format will still work.  Note, {$threadurl}/{$threadurl_q} may not work in newthread (preview post), as there is no URL associated with a thread which doesn't exist.
  • enable {$thread['threaddate']} and {$thread['threadtime']} template variables to search results (threads display only) as well showthread/forumdisplay (for those that didn't know, I guess this was a hidden variable that's existed in XThreads for a while - it formats the thread's creation time/date); this also does work with search results posts display with the $post variable instead of $thread (eg {$post['threaddate']}), however, despite what it looks like, it's for the post's date/time, rather than the thread's
  • tweaks to XThreads attachment downloading - now will send proper HTTP 206 header for ranged requests, and will also fulfill If-Range requests
  • defer MD5 hashing of larger files to a task (uses the xtattachment orphan cleanup task) - this improves XThreads' handling of larger attachments; size limit can be tweaked in inc/plugins/xthreads.php, but the default of 10MB should be fine for most servers
  • add ability for admins to move files on the server to be used as attachments (rather than force them to upload it, or fetch by URL).  This can make it easier for admins to attach very large (eg multi-gigabyte) attachments; files to be attached should be uploaded to the uploads/xthreads_ul/admindrop/ folder (and not in any further subforlder), and should be writable by the webserver.  When specifying what to attach, select the URL option in the attachment input, and prefix the filename with "file://".  For example, if an admin specifies "file://bigfile.iso" as the URL, the file uploads/xthreads_ul/admindrop/bigfile.iso will be MOVED (not copied) as an XThreads attachment.  Note, you cannot move index.html, or capitalised variants of the name.
  • add option to hide threadfields input from newthread/editpost - this can be useful if you wish to reposition the input field elsewhere (will require a manual template edit)
  • add option to hide a forum from the index/forumdisplay pages; note that this is different from disabling the can view forum permission as it can allow users to view the forum, but simply just not list it on the index/forumdisplay pages (may be useful if you only want to link to it in the header)
  • fix various forumdisplay URLs (paging, sorter links, sorter listboxes and inline search) when inline search or filters are used (thanks to leefish for pointing that out)
  • add portal support - you can now call {$threadfields...} from portal templates, and portal_announcement* templates will be affected if template prefixes are used (thanks to leefish for the suggestion)
  • fix bug which allowed some XThreads attachments to become orphaned
  • identified and fixed a security issue in regards to incorrect permission checking with modifying xtattachments
  • fix up some small issues specific to the MyBB 1.6 beta in regards to the version check
  • some other minor bug fixes and tweaks

Note that this update fixes some possible ways to orphan xtattachments, however the upgrader doesn't check for invalid references (somewhat annoying to write); it shouldn't be a big issue, especially as no-one's reported anything.
Hi Zinga, Im getting an error message when I try to download the file... is it removed?

EDIT: I saw some odd formatting around the link as below.

Code:
http://mybbhacks.zingaburga.com\/"xthreads_attach.php/46_1278147498_c3bd6cd6/b9df54b755001a09848e1d0761e868a8/xthreads-1.2.7z\"


When I removed the extra " and the \ it worked. See below.

Code:
http://mybbhacks.zingaburga.com/xthreads_attach.php/46_1278147498_c3bd6cd6/b9df54b755001a09848e1d0761e868a8/xthreads-1.2.7z

I believe Yumi will fix it soon, Lee. It seems that we have some great new features Smile A huge change list there.
Hi RateU - I have it in my grubby little hands but I'm scared to install it. :/  I fear the error may be in the Xthreads attachment code as this bug is true of all download links from the plug ins area.
Please don't install it first Smile
RateU - I won't. Would be a SUPER STUPID thing to do
Biggrin

Ah, yes, Lee, what about the Book Review tutorial? I believe it will be a great sample. Did you finish it?
Well, its waiting for the filter issue to be fixed - which Zinga says it is. So then I can upload it. Im excited to be able to share it soon Smile
Great! I've seen it in your forum. It looks great. Smile
Frown Very sorry guys, can't believe I missed that >_>

Yeah, please tell me if you find any more issues.

Updated to v1.21:
  • Fix regression in v1.20 with incorrect sanitisation of variables.

EDIT: urgh, didn't upload the right thing - if you downloaded the above before this edit, please download the file again.  Thanks.
Reference URL's