XThreads
Author Message
My Spiel
XThreads is one of my larger plugins which I have been working on for a while.  Originally planned to release it inline with MyBB 1.6, but who knows when that'll be out.  It perhaps doesn't include everything I wanted it to, but does have most of the things (plus I want to move onto other projects).

What does it do?
Take a look at RateU's forum for some nice ideas of what it can do.  I also have some more basic examples here of what can be done with XThreads.  I'm pretty sure there are many other applications of this plugin, but those examples just give you some simple ideas.

The basic idea is giving you the ability to define custom fields for your threads, and providing methods to give you a lot of flexibility with customising forums.

Warning: I'm not going to bother with "beta" labels and so on.  I've done some testing on this myself, but it's by no means extensive.  Use this at your own risk.

Installation Instructions: standard installation procedures apply - you can find them in the announcement here.
You may need to CHMOD the uploads/xthreads_ul/ folder to 0777 after uploading the files (probably won't though).

Upgrade Instructions: unless stated otherwise, the general procedure for upgrades is to simply upload the new files, then visit your AdminCP.  In there, you'll be presented with a notice to run the upgrade - just follow what it says from there on.

Usage Instructions: this is a complex plugin, and unfortunately, you're probably going to have to figure this out yourself, depending on what you want to achieve with this plugin.  HTML and CSS knowledge is strongly recommended; you should also be familiar with MyBB's template system.  Some demonstrations can be found here - hopefully these will give you a good idea of how things work.  I suggest looking at the thread descriptions example, as this is fairly easy to understand (IMO).  If you can understand how everything works, there, perhaps try out the gallery example.

Known conflicting plugins
- MyPlaza Turbo -
If you are using MyPlaza Turbo, note that the author decided to use a particularly odd method to implement certain functionality, practically destroying compatibility with any plugin which hooks into the forum add/edit routines.  I've included a patch to address this issue - you need to replace inc/myplaza/myplaza_admin_plugin.php with the following file (it's unlikely that this will be committed as the author has decided to discontinue development)

.php  myplaza_admin_plugin.php (Size: 56.27 KB / Downloads: 1242)

- PL9 Forum Icons -
Affects certain functionality.  See here for a solution.

- PHP in Templates, v1.4 or older -
Similar to PL9 Forum Icons - solution is just to update to the latest version.

- MyAdvertisements - (update: older versions only, later versions may not conflict)
Affects some thread functionality, see here for a solution.

- Group Post CSS -
See here http://mybbhacks.zingaburga.com/showthre...17#pid5917

All bug reports, suggestions, criticisms are appreciated (though I may not always implement suggestions) so please feel free to post them.
If you find this plugin useful, I would be grateful if you could give some token of appreciation for the work that has gone into this, and perhaps post some example usages you've come up with in the XThreads forum to help others get an idea of what can be achieve with this plugin (and for my own interest's sake Tongue).


Github: https://github.com/zingaburga/XThreads-MyBB-Plugin
Note: do NOT use the Github version, unless you know what you're doing
Changelogs: v1.10, v1.20, v1.21, v1.22, v1.23, v1.24, v1.25, v1.26, v1.27, v1.30, v1.31, v1.32, v1.337, v1.40, v1.41, v1.42, v1.43, v1.44, v1.45, v1.46, v1.47, v1.50, v1.51, v1.52, v1.53, v1.60, v1.61, v1.62, v1.63, v1.64, v1.65, v1.66, v1.67, v1.68
(This post was last modified: 12-25-2015 12:46 PM by ZiNgA BuRgA.)
Find all posts by this user
Quote this message in a reply
Download: xthreads-1.68.7z (114.53 KB)
Plugin Version: 1.68
Last Updated: 12-25-2015, 12:46 PM

Downloads: 6,853
MyBB Compatibility: 1.4.x, 1.6.x, 1.8.x
Plugin License: GPLv3
Uploader: ZiNgA BuRgA
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,338
Joined: Jan 2008
Post: #431
RE: XThreads
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?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).


My Blog
(This post was last modified: 07-11-2011 10:29 AM by ZiNgA BuRgA.)
07-11-2011 10:28 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,338
Joined: Jan 2008
Post: #432
RE: XThreads
(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.

My Blog
07-15-2011 04:38 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,338
Joined: Jan 2008
Post: #433
RE: XThreads
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.

My Blog
07-16-2011 09:58 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,325
Joined: Mar 2010
Post: #434
RE: XThreads
Thank you very much for the update, Yumi Smile

07-17-2011 02:54 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*******
Posts: 1,009
Joined: Apr 2010
Post: #435
RE: XThreads
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?


[Image: leelink.gif]
MYBB1.6 & XThreads
07-17-2011 01:27 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,338
Joined: Jan 2008
Post: #436
RE: XThreads
Not really, no, in fact, I'll probably be removing that function from conditionals in the next version (still usable via PHP code though).

My Blog
07-17-2011 03:38 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,338
Joined: Jan 2008
Post: #437
RE: XThreads
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)

My Blog
07-18-2011 08:39 AM
Find all posts by this user Quote this message in a reply
AglioEoliO Offline
Junior Member
**
Posts: 39
Joined: Jan 2008
Post: #438
RE: XThreads
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:
1
2
3
4
5
6
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...ce_Changes

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
(This post was last modified: 07-28-2011 11:53 PM by AglioEoliO.)
07-28-2011 11:52 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,325
Joined: Mar 2010
Post: #439
RE: XThreads
There is a fix for thread prefix filter (using the default MyBB thread prefix) in github:
https://github.com/zingaburga/XThreads-M...6164e80708

07-29-2011 06:33 AM
Find all posts by this user Quote this message in a reply
AglioEoliO Offline
Junior Member
**
Posts: 39
Joined: Jan 2008
Post: #440
RE: XThreads
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
(This post was last modified: 07-29-2011 07:38 PM by AglioEoliO.)
07-29-2011 11:06 AM
Find all posts by this user Quote this message in a reply


Forum Jump: