MyBB Hacks

Full Version: X-Threads Capability Vs. Plugin Capability
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I see the vastness of what X-Threads can do by itself as a plugin and then with a couple of code edits it just goes into a whole new world, but I've seen some responses where you've said "I don't think X-Threads can do that, you may need a plugin." So, my question is, what's the difference between the capabilities of X-Threads and a Plugin? What is it exactly that X-Threads can't do that would require a plugin and is there a future release of X-Threads that intends to bypass this in some way to give X-Threads even more power over the MyBB system?

For example, I've seen some plugins that let you edit the files of other plugins, etc. etc., why not edit X-Threads to be the Plugin that can modulize plugins within itself? Like, take a plugin, and make it part of X-threads?

Of course I don't mean just take someone else's plugin and import it into X-Threads, what I mean though is give X-Threads plugin capabiity that has like a secondary module (like the Custom Thread Fields module) that you can do something similar, but add "thread fields" that are plugin-enhanced, that are capable of acting like plugins and being able to be tied then into the X-Threads fields. This way when you go through trying to do this or that in X-Threads and find something that X-Threads isn't able to do, you can use that secondary module to tie into the plugin system and utilize what you need directly from X-Threads.

Is something like this possible? I would be SIMPLY FREAKING AMAZED if it is and if you guys could work on that then X-Threads would for sure be the only plugin I'd ever want or need. Currently I have a lot of plugins installed to do various things here and there, but I'd rather not have them installed. I wish I could do all of these things through something simple like X-Threads and not have to worry about security issues etc. etc.
Do you mean like "XThreads module?"

If so, I think this post will give you some information about it:

http://mybbhacks.zingaburga.com/showthre...http://mybbhacks.zingaburga.com/showthread.php?tid=503&pid=42

(12-08-2010 09:00 PM)ZiNgA BuRgA Wrote: [ -> ]Some plugin API?  I'm thinking of deferring this.
Hmm...no, not entirely. This is backwards from what I'm thinking. I don't want to export x-thread things as potential plugins that don't have to rely on "x-threads" to function. What I'm saying is it'd be really nice to have X-Thread have the capability to make a new module in the admin cp that will allow x-threads to function as though it's a "plugin manager" and be able to insert portions of code into MyBB as if they were their own plugins.

Let me see if I can't explain it better, maybe even diagram it some.

MyBB has a plugin system right? That's so that people can write scripts and codes to manipulate the inner parts of MyBB in a way that MyBB by itself can't do. For example, we could do all the things we do now without the Plugin X-Threads. Now WITH X-Threads we are able to manipulate MyBB in ways that it's normally not capable of doing. However, X-Threads is still limited in its ability because there are some functions it doesn't reach to or would require another plugin to do (use my request for my training forum and needing to calculate prices).

So what I'm saying is:

Create another module in the ACP (much like the Custom Thread Fields) which would allow X-Threads to input individual codes into MyBB that would function like a plugin.

I think the best possible example I'm trying to give would be what's known as a "Virtual Computer". A virtual computer is ALL software, it's an emulated computer WITHIN another computer. It emulates a processor, monitor, ram etc. etc. So you can turn this virtual computer on within your own computer and it works just like a real computer. (Here, check this out: http://www.virtualbox.org/ and this http://www.youtube.com/watch?v=9-DiPRrE3Bg)

Use X-Threads in a similar way. In this I mean, use X-Threads to EMULATE plugins by giving it the functionality to input individual portions of code and then be able to call the code within MyBB's templates. X-Threads would be the only real plugin, but you'd be able to use X-Threads to host other codes in the same way you use it to create custom thread fields.

I hope this made sense and isn't too confusing. It sounds like it would take a lot of work to figure out and do, but I'm not too sure about that, I'm thinking this would be relatively easy to handle if you worked it the right way.

Then again I'm not a coder and I don't know MyBB's internal systems well enough to say if this would be an easy job or not.
Essentially XThreads is meant to be a fairly abstract concept of extending what can be done with threads.
It isn't really meant to implement specific behaviour, so some stuff it won't be able to do at its "generic level".

One of the advantages of XThreads is that it leverages off what already exists in MyBB, which means you get all the features of MyBB, including features added by other plugins.  That is, XThreads should work alongside existing plugins.  Want SEO URLs?  Install the Google SEO plugin.  XThreads requires no configuring at its end, and your link directory or whatever will have SEO URLs.  Whereas a dedicated link directory script probably won't have it, and even if it did, it would most likely require further modification from the user (to add new entries to the .htaccess file).  XThreads isn't meant to replace other plugins, it's meant to work alongside them.
(also, its working area is with threads, so, if you have stuff modifying a profile area for example, it's not going to do it)


I did do something similar to what you're saying with MyPlaza - it essentially had its own modules.
You can already have plugins which add-on to XThreads, though there's no official API for it at the moment.
Of course, the biggest issue with these things are that someone actually has to write them.
OMFG I DIDN'T KNOW THIS WAS GONNA BE THIS LONG....SORRY!!!!

I understand that xthreads is meant to work along side other plugins (and in fact, that's freaking AWESOME!!!!), but let's use this example.

I get plugin "Alpha" and install it and activate it. Turns out four months down the line plugin "Alpha" has an XSS vulnerability allowing an attacker to conduct a zero-day attack on my site, effectively rendering it inoperable. Now, let's say I had only installed plugin Alpha for it's capability to create an active clock in the postbit. Now, let's say that functionality was actually only a mere addition to the real plugin's feature presentation and let's say that the vulnerability originated elsewhere in the script for the plugin. I didn't even want (or use) the rest of the plugin, I just used that one part of the plugin for something else I was doing with xthreads and, if I had been able to extract this arbitrary code from the plugin and placed it directly into a plugin-emulating system within xthreads, the XSS vulnerability wouldn't be there and I'd get exactly what I wanted and needed and absolutely nothing more.

Of course that's entirely hypothetical. I don't know how to code worth a crap so, I couldn't tell you if this worked or not. I'm just throwing out ideas Tongue. That's what I do, I take things I'm interested in and I pick them apart and try to come up with the wildest ideas possible with them and see if they might work. A lot of times they're WAYYYY the heck off in left field, sometimes they're really good ideas but no one's willing to work on it, and sometimes they're just right and someone hops right on it. I truly wish I knew how to code php, because I would be able to at least assist in these and give my ideas a jump start at the very least.

For example, here's an idea:


When I was setting up the article gallery application on my forum I realized I had almost fifteen different forums that would be using this. It was very tedious and annoying having to go to each individual forum and do the same....exact....thing over and over again until I finally finished them all (same thing with these templates, why can't we find some way to make it where we could use one template for all forums and just tie the forms into them via the custom thread fields? The biggest problem is that some settings differ for each forum and unless they're the same you have no choice but to make a new template all over again and edit it....isn't there a way to make some kind of if/then statement in the templates that allows the template to be multi-functional with the custom thread fields? just a thought Tongue).

So why not just put a check box in all the forum setting areas where the xthreads options are that says "Enable XThreads Options in this forum" and you can select whether or not they're active, and that then ties into another module (like the custom thread fields) where you can (like the custom thread fields) then set ONE XThreads Options setting to be represented on MULTIPLE forums at once? And, because you checked the box "yes" in the area where the Xthreads options are currently, it's able to tie that code directly into it as if it never left. I hope you see what I'm saying, it's like this:


I have ten forums. I write a script out, it's 127 lines long. I can impliment this script into these ten forums TWO ways:

-1st method-

Forum 1: Place the script into this forum directly.
Forum 2: Place the script into this forum directly.
Forum 3: Place the script into this forum directly.
Forum 4: Place the script into this forum directly.
Forum 5: Place the script into this forum directly.
Forum 6: Place the script into this forum directly.
Forum 7: Place the script into this forum directly.
Forum 8: Place the script into this forum directly.
Forum 9: Place the script into this forum directly.
Forum 10: Place the script into this forum directly.

-2nd Method-

XThreads Option Module: Place the script here and select which forums to place it in.

Forum 1: Check "Yes", which calls the XThreads Options via a string variable.
Forum 2: Check "Yes", which calls the XThreads Options via a string variable.
Forum 3: Check "Yes", which calls the XThreads Options via a string variable.
Forum 4: Check "Yes", which calls the XThreads Options via a string variable.
Forum 5: Check "Yes", which calls the XThreads Options via a string variable.
Forum 6: Check "Yes", which calls the XThreads Options via a string variable.
Forum 7: Check "Yes", which calls the XThreads Options via a string variable.
Forum 8: Check "Yes", which calls the XThreads Options via a string variable.
Forum 9: Check "Yes", which calls the XThreads Options via a string variable.
Forum 10: Check "Yes", which calls the XThreads Options via a string variable.


Now I only have to put the script in once, I only have to edit one thing. This reduces workflow by like over a hundred steps, depending on what settings you put in the Xthreads Options settings.

I'm simply trying to simplify MyBB as much as possible. For me, I like everything to be as quick and smooth as possible, making 15 separate templates for 15 separate forums and 15 separate Xthreads Options for 15 separate forums is very tedious and time consuming. If you were able to simply do this, OMG that would be freaking AHMAHZHING!!!!


What I'm talking about with the "Plugin Emulation" within XThreads, I'm not sure that's even possible, that's just an off-the-wall idea, but it would be lovely if it were possible. Perhaps if you used a similar idea of just having XThreads already tie into every single part and function of MyBB and call it with something like {$xthreadsplgn}, you could then go into xthreads and input pieces of code into xthreads directly and just tell them from a list to be located here, here, and here in MyBB, which could possibly emulate a plugin if done properly. I don't know, this idea's a bit confusing even for me because I truthfully don't know what the heck I'm talking about with this emulation stuff..lol, I'm not sure it's even possible. I'm pretty positive the whole Xthreads Options idea and combining multiple templates is possible, but again, I'm not sure of that either.

I'm not a coder, I just want to make that clear Tongue I just toss ideas out, I'm a thinker, not a coder. I'd love to be a coder though Tongue Biggrin
I don't think your idea is possible.  Sandboxing kills interactability.  Besides, if there was some magical way to stop exploits, it would make sense to have this in the MyBB core rather than this plugin.  I doubt PHP even has much of an ability to do this.

And emulation is simply infeasible.  If you've played with console emulators, I'm sure you'll know.  As an example, a 3MHz SNES console can require an absurd amount of computing power to emulate, using a low level emulator like bsnes (the recommended requirements are a Intel Core 2 Duo or AMD Phenom class CPU).  And this is with a compiled language BTW.  A purely interpreted language like PHP is going to be far slower.

(12-17-2010 12:34 PM)MasterZuFu Wrote: [ -> ]When I was setting up the article gallery application on my forum I realized I had almost fifteen different forums that would be using this. It was very tedious and annoying having to go to each individual forum and do the same....exact....thing over and over again until I finally finished them all (same thing with these templates, why can't we find some way to make it where we could use one template for all forums and just tie the forms into them via the custom thread fields?
If they're very similar, you shouldn't need to.  Thread fields can be applied to multiple forums.  Forums can use the same template prefix, and you can specify multiple prefixes so that they mostly use the same templates.

(12-17-2010 12:34 PM)MasterZuFu Wrote: [ -> ]The biggest problem is that some settings differ for each forum and unless they're the same you have no choice but to make a new template all over again and edit it....isn't there a way to make some kind of if/then statement in the templates that allows the template to be multi-functional with the custom thread fields? just a thought Tongue).
Template Conditionals
Lol, you took my analogy of emulation a little too literal Tongue lol, but it's ok because your first statement kind of ruled it out. I kind of though "Plugin Emulation" would be a little too over the top to be possible, oh well lol.

Thread fields can be applied to multiple forums, yes, but XThread Options can NOT be applied to multiple forums and are punched in directly when going to "Edit Forum Settings".

I didn't think about the template conditionals. Please tell me if this will work with template conditionals:


I have on my site two versions of the Trading Forum. Each has different categories. Here are their separate templates:


Trading Forum:

Code:
<table border="0" cellspacing="{$GLOBALS['theme']['borderwidth']}" cellpadding="{$GLOBALS['theme']['tablespace']}" class="tborder" style="clear: both;">
	<tr><td class="thead"><strong>Filter &amp; Search Trade</strong></td></tr>
	<tr>
		<td class="trow1" align="center">
			<form action="forumdisplay.php" method="get">
				<select name="filtertf_trdfcat">
					<option value="Hardware">Hardware</option>
					<option value="Software">Software</option>
					<option value="Other">Other</option>
				</select>
				<select name="filtertf_trdftnt">
					<option value="Buy">Buy</option>
					<option value="Sell">Sale</option>
				</select>
				<select name="filtertf_trdfcond">
					<option value="New">New</option>
					<option value="Used">Used</option>
				</select>
				<select name="filtertf_trdfpayment">
					<option value="PayPal">PayPal</option>
					<option value="AlertPay">AlertPay</option>
					<option value="Wire Transfer">Wire Transfer</option>
				</select>
				<select name="filtertf_trdfstatus">
					<option value="Open">Open</option>
					<option value="Closed">Closed</option>
				</select>
				<input type="text" class="textbox" name="search" size="35" value="{$searchval}" /> {$gobutton}
				<input type="hidden" name="fid" value="{$fid}" />
				<input type="hidden" name="sortby" value="{$sortby}" />
				<input type="hidden" name="order" value="{$sortordernow}" />
				<input type="hidden" name="datecut" value="{$datecut}" />
			</form>

		</td>
	</tr>
</table>
<br />


Training Forum

Code:
<table border="0" cellspacing="{$GLOBALS['theme']['borderwidth']}" cellpadding="{$GLOBALS['theme']['tablespace']}" class="tborder" style="clear: both;">
	<tr><td class="thead"><strong>Filter &amp; Search Trade</strong></td></tr>
	<tr>
		<td class="trow1" align="center">
			<form action="forumdisplay.php" method="get">
				<select name="filtertf_trdfcat">
					<option value="Certification">Certification</option>
					<option value="Programming">Programming</option>
					<option value="Networking">Networking</option>
					<option value="Security">Security</option>
					<option value="Web Design">Web Design</option>
					<option value="Penetration Testing">Penetration Testing</option>
					<option value="Server Management">Server Management</option>
					<option value="Malware/Virus">Malware/Virus</option>
				</select>
				<select name="filtertf_trdftnt">
					<option value="Buy">Buy</option>
					<option value="Sell">Sale</option>
				</select>
				<select name="filtertf_trdfcond">
					<option value="New">New</option>
					<option value="Used">Used</option>
				</select>
				<select name="filtertf_trdfpayment">
					<option value="PayPal">PayPal</option>
					<option value="AlertPay">AlertPay</option>
					<option value="Wire Transfer">Wire Transfer</option>
				</select>
				<select name="filtertf_trdfstatus">
					<option value="Open">Open</option>
					<option value="Closed">Closed</option>
				</select>
				<input type="text" class="textbox" name="search" size="35" value="{$searchval}" /> {$gobutton}
				<input type="hidden" name="fid" value="{$fid}" />
				<input type="hidden" name="sortby" value="{$sortby}" />
				<input type="hidden" name="order" value="{$sortordernow}" />
				<input type="hidden" name="datecut" value="{$datecut}" />
			</form>

		</td>
	</tr>
</table>
<br />



How can I use template conditionals to combine both of these templates into one so that they can be used by either the Trading or the Training forum?

Stick an if around the part that's different:

Code:
<if $fid == 2 then>
stuff for forum with fid of 2
<elseif $fid == 3 then>
stuff for forum with fid of 3
<elseif $fid == 4 then>
stuff for forum with fid of 4
<else>
stuff for any other forum
</if>

(12-17-2010 02:32 PM)ZiNgA BuRgA Wrote: [ -> ]Stick an if around the part that's different:

Code:
<if $fid == 2 then>
stuff for forum with fid of 2
<elseif $fid == 3 then>
stuff for forum with fid of 3
<elseif $fid == 4 then>
stuff for forum with fid of 4
<else>
stuff for any other forum
</if>


I love this site Smile
Reference URL's