MyBB Hacks

Full Version: XThreads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
That wasn't very smart.  You've probably lost all your attachments/uploaded avatars too.
As for XThreads, if you have v1.42 installed, you can try saving the following as cache/xthreads.php to see if it works:

PHP Code:
<?php
// XThreads definition file
// This file contains a number of "internal" settings which you can modify if you wish

/**********  XTHREADS ATTACHMENT URL FETCHING  **********/
/**
 * Allows users to upload files through URL fetching
 */
define('XTHREADS_ALLOW_URL_FETCH', true);
/**
 * Hosts which URLs cannot be fetched from, note that this is based on the supplied URL
 *  hosts or IPs are not resolved; separate with commas
 */
define('XTHREADS_URL_FETCH_DISALLOW_HOSTS', 'localhost,127.0.0.1');
/**
 * Disallow users to specify custom ports in URL, eg http://example.com:1234/ [default=enabled (false)]
 */
define('XTHREADS_URL_FETCH_DISALLOW_PORT', false);

/**
 * Try to stop xtattachment flooding through orphaning (despite MyBB itself being vulnerable to it)
 *  we'll silently remove orphaned xtattachments that are added within a certain timeframe; note, this does not apply to guests, if you allow them to upload xtattachments...
 *  by default, we'll start removing old xtattachments made by a user within the last half hour if there's more than 50 orphaned xtattachments
 */
define('XTHREADS_UPLOAD_FLOOD_TIME', 30*60); // in seconds
define('XTHREADS_UPLOAD_FLOOD_NUMBER', 50);
// also, automatically remove xtattachments older than 3 hours when they try to upload something new
define('XTHREADS_UPLOAD_EXPIRE_TIME', 3*3600); // in seconds

/**
 * The size a file must be above to be considered a "large file"
 *  large files will have their MD5 calculation deferred to a task
 *  set to 0 to disable deferred MD5 hashing
 */
define('XTHREADS_UPLOAD_LARGEFILE_SIZE', 10*1024*1024); // in bytes, default is 10MB



/**********  XTHREADS ATTACH DOWNLOAD  **********/
/**
 * Use query string format in XThreads attachment URLs;
 * This should only be enabled if your host doesn't support the standard URL format
 *  if 0: default URL structure (if Apache webserver running in CGI)
 *  if 1: force use of query string (ex: xthreads_attach.php?file=xx_xxxx_xxxxxxxx/file.zip)
 *  if 2: force use of query string and use non-slash delimeters (ex: xthreads_attach.php?file=xx_xxxx_xxxxxxxx|file.zip)
 */
define('XTHREADS_ATTACH_USE_QUERY', 0);


/**
 * The following controls whether you wish to count downloads
 *  if 0: is disabled, and the DB won't be queried at all
 *  if 1: downloads = number of requests made (MyBB style attachment download counting)
 *  if 2 [default]: will count download only when entire file is sent; in the case of segmented download, will only count if last segment is requested (and completed)
 * mode 2 is perhaps the most accurate method of counting downloads under normal circumstances
 */
define('COUNT_DOWNLOADS', 2);


/**
 * The following is just the default cache expiry period for downloads, specified in seconds
 * as XThreads changes the URL if a file is modified, you can safely use a very long cache expiry time
 * the default value is 1 week (604800 seconds)
 */
define('CACHE_TIME', 7*24*3600);


/**
 * Redirect proxy response; this only applies if you're using a front-end web server to serve static files (eg nginx -> Apache for serving PHP files)
 * to use this feature, you specify the header, along with the root of the xthreads_ul folder (with trailing slash) as the front-end webserver sees it.  Note that it is up to you to set up the webserver correctly
 *
 * example for nginx
 *  define('PROXY_REDIR_HEADER_PREFIX', 'X-Accel-Redirect: /forums/uploads/xthreads_ul/');
 * example for lighttpd / mod_xsendfile
 *  define('PROXY_REDIR_HEADER_PREFIX', 'X-Sendfile: /forums/uploads/xthreads_ul/');
 *
 * defaults to empty string, which tunnels the file through PHP
 * note that using this option will cause a COUNT_DOWNLOADS setting of 2, to become 1 (can't count downloads after redirect header sent)
 */
define('PROXY_REDIR_HEADER_PREFIX', '');



/**********  OTHER  **********/

/**
 * Allow PHP in threadfields' display format, unviewable format etc; note that if you change this value after XThreads has been installed, you may need to rebuild your "threadfields" cache
 * 0=disable, 1=enable, 2=enable only if PHP in Templates plugin is activated (default)
 */
define('XTHREADS_ALLOW_PHP_THREADFIELDS', 2);

/**
 * This switch can be used to disable automatic template editing XThreads performs (will no longer call find_replace_templatesets())
 * This is only really useful if you enabled this before XThreads was installed (edit define in inc/xthreads/xt_install.php)
 */
define('XTHREADS_MODIFY_TEMPLATES', true);




// internal version tracker, used to determine whether an upgrade is required and shown in the AdminCP
// DO NOT MODIFY!
define('XTHREADS_INSTALLED_VERSION', 1.42);

Also ensure the file is writable (chmod 0666 to it).

(07-04-2011 10:20 PM)jim7777 Wrote: [ -> ]ok fixed the problem
i think its about those threads with Redirections / Moved thread but leave a redirection on the forum
or if not, those users who aren't registered / deleted users but their threads are still in the forum
Thanks for finding that.  I think I've fixed the issue and the fix will be in the next release.
Started working on this again.
Updated to v1.43:
  • fix bug where XThreads data wasn't removed when a draft thread is deleted (thanks to RateU for reporting)
  • fix bug on PHP < 5.2.1 with URL fetching (thanks to burntcav for reporting)
  • fix URL fetching with PHP safe mode enabled (thanks to Lorenzo for reporting)
  • URL fetching will also try to use supplied content-type header to determine extension if, and only if, none exists in the name, and a content-disposition header was not sent
  • fix bug with required multiline/textbox inputs which accept multiple values and users submitting without filling in the field (thanks to jim7777 for reporting)
  • fix bug for non-existent file attachments causing template parsing error (thanks to jim7777 for finding)
  • MySQL 5.5 support in installer
  • automatically fill in missing fields for editpost - this is primarily useful for adding custom forms which modify threadfields, since they no longer require copying the entire message/subject etc; note that this only works for the thread's first post
  • delete threadfields when forum is deleted
  • although currently somewhat useless, add xthreads_get_threadfields($tid) function to be usable in conditionals (or plugins); this function grabs and formats threadfields for specified tid and returns an array like $threadfields.  Note that care should be taken not to cause infinite recursion, if using this in conditionals
  • Quick Thread integration: $extra_threadfields is no longer forced into the Quick Thread template, and XThreads will modify the teplate instead
  • sockets URL fetcher now supports redirect parsing
  • ability to regenerate missing cache files if deleted somehow
  • other minor bug fixes

Some rather "fundamental" changes in some places - hopefully I didn't break anything because of that and not looking at this code for a while.
Thank you very much for the update, Yumi Smile
Thank you Zinga  - looks good. This one has piqued my curiosity though:

ZingaBurga Wrote:although currently somewhat useless, add xthreads_get_threadfields($tid) function to be usable in conditionals (or plugins); this function grabs and formats threadfields for specified tid and returns an array like $threadfields.  Note that care should be taken not to cause infinite recursion, if using this in conditionals

Could you give an example of how this could be used?
Not really, no, in fact, I'll probably be removing that function from conditionals in the next version (still usable via PHP code though).
Quick fix.
Updated to v1.2²:
  • fix bug preventing {$threadfields[...]} from working in conditionals on showthread; this fix also removes the (somewhat useless) ability to use xthreads_get_threadfields function in conditionals (thanks to RateU for reporting)
Filter Threads by prefix is not working anymore - data in "prefix" column has been moved  after 1.6.4 upgrade. Thread Prefixes are now stored as... files in cache? =S

PS: I´m using the latest version of Xthreads from this thread

Code:
MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
    1054 - Unknown column 'prefix' in 'where clause'
Query:
    SELECT tid,uid FROM mybb_posts WHERE uid='4' AND tid IN (30577,29718,28579,30613,29800,30150,30088,28946,29937,28573,23085,16140) AND (visible='1' OR visible='0') AND `prefix` = 13 


----------------

http://wiki.mybb.com/index.php/1.6.4#Per...http://wiki.mybb.com/index.php/1.6.4#Performan

Quote:Cache Stores

One of the larger changes was to move announcements and mod tools ('forumdisplay') as well as thread prefixes ('threadprefixes') into the datacache table. This eliminates further unnecessary queries if you're not using any of these and making sure their information is only retrieved when it is needed.

Please fix this (if it´s possible) in the next versions of Xthreads, Zinga
There is a fix for thread prefix filter (using the default MyBB thread prefix) in github:
https://github.com/zingaburga/XThreads-M...https://github.com/zingaburga/XThreads-MyBB-Plugin/commit/b4be99e700658787040c30f02e619d
Thanks for replying, Rateu. I´ll try the fix from Github in xt_forumdhooks.php

EDIT: it didn´t worked.
Anyway I´ll wait until the next Xthreads release. Thanks Smile
Reference URL's