![]() |
[SQL] - vB Code
This hack is more or less Selfexplaining as we use it since a long time on vb.org :).
Credits go to Chen Avinadav for the original version for vBulletin 2. It allows you and your users to use [ SQL] Tags to highlight special SQL Tags and so on. example: [SQL] SELECT * FROM user LEFT JOIN userfield USING(userid) [/sql] most of the queries are working perfectly, just nested quotes can make problems, i'll try to fix these, soon :) Enjoy |
Yay i wondered where that was :) Cheers Xenon!! Im guessing you got Chen's permission :p lol
|
Quote:
(but as i have rewritten it strongly for vb.org and vb3, that was just a formality, the code itself is more or less in my brain now ;)) |
Thanks for releasing this Xenon, its somthing I've wanted for a while now :)
|
:)
i know there are not that much boards out which need this hack, but if at least one can use it i'm glad :) |
i've uploaded a slightly modificated version as it seems, the old one made problems with newreply and the newer vb-versions..
|
This works perfect, sir! ;) Thank you.
I finally figured out what the problem was when you and I tried to get this to run on vB2 (remember the nightmare?). The variable $bbuserinfo I was using in the if statement wasn't made global. Once I did that with this version of your hack, I can use my block code hack with it. |
:)
i use a different block code hack now ;) but yeah i remember that nice conversation ;) |
Hmmm - Nice:)
Now that you have been so kind, make a [disable] tag :p Satan |
How would we add a button in the editor for this?
A disable tag would be excellent! I really miss that one. ;) |
Quote:
|
Quote:
|
Quote:
by the way...if anyone want to replace the word--SQL query to phrase variable just open the file(functions_bbcodeparse_custom_created.php) find PHP Code:
PHP Code:
|
Quote:
I had already done this but why did you add the $stylevar and $vboptions to it? |
@Bob: if you want to use other variables within the template you have to add them as well, he just made an all in one thing ;)
@Chris: hmm, i can think of it, maybe i'll do it ;) @Bob2: hmm, you have to add it o the main JS scripts, but as i don't know JS i cannot answer this :) |
Quote:
because i paste it from another file and LAZY to edit the code:o:o |
Quote:
|
Quote:
The disable tags would be great if you decide you want to do it. ;) Wouldn't there be a way to just make a bbcode for the sql tags, without having to add the code that is? That allows buttons to be entered in the editor. ;) |
Quote:
also i'm a purist, so i don't use the editors, a plain textbox is really enough for me ;) |
Do you use it over the board or somewhere in the admin panel as well?
|
just on the board
|
If you want to be able to use the new codemaxlines variable that is in RC3 so the boxes won't ever go past the point that the others do now, you need to add:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
seems there are changes in rc3 i never noticed ^^
|
Nice Hack Xenon :)
Was wondering how when vb.org used to run vb2 people got the sql code to work, didn't even know it existed for vb2. Even though most places won't find this useful I find it interesting. Cheers, g-force2k2 |
the vb2 version was written by Chen just for vb.org and was never released :)
i just ported it over to vb3, optimized it and then asked chen if i could release it. i know that there are not much boards which can use it, but if at least one other board can use it, it was worth the release :) |
Quote:
It took me a while with the padding not working right when following the other bbcode templates for the sql template. Then it hit me with the stylevar[cellpadding] variable they were using. I had hardcoded it into the template, but it is easier this way if you ever want to do a global change. The blockcodeheight is new in RC3 and doesn't quite work right yet. I reported it over to vb.com and they are wroking on it, I guess. ;) I even got the sql box (as well as the others) set up with the double-click that they had for vB2, totally revamped for vB3. It makes it alot easier now that the boxes are smaller. ;) |
well i use a codebox height coded myself on vb.org, that'S why i have not noticed the rc3's as i have not reverted the templates ;)
i'll add your fixes into my next installfile :) |
Can you share your height code until RC3 gets theirs working right? ;)
If you want the double-click code for it, let me know. It works different with the pre tags than it did as a replacement with the td tags. You can use the same template as one of the other bbcodes with that stuff added to the install file. No more having to hard-code it. ;) Oh, and we also added a SQL button to the editors. Just had to add something to 2 templates. Didn't have to mess with any js files. This vB3 is GREAT!!! ;) |
Don't forget the add the SQL template to the showthread.php and the showpost.php, too. ;)
|
hmm, i think the height hack isn't that perfect, too.
at least sometimes it does things it shouldn't do ;) but i'll look at it at all :) |
is there any posibility how can i add this as a...icon in bbcode's icons ?
Boofo, i have seen that on your site...share ? |
Evil made the icon. I suppose we could share it with you. ;)
|
I've uploaded a new version now.
all yu have to do is to replace the functions file, i've just optimized the parser a bit :) |
Wow, is this a dangerous hack. The DROP TABLE function comes to mind and scares me.
|
erm, this hack does not execute any SQL statement, it just displays it in a highlighted way. exactly as the [php] tag doesn't execute PHP code
|
Quote:
|
*gg*
no problem, everyone knows such days ;) |
Add New BB Code
Title? Tag? Replacement ? Example? Use {option} yes or no Button Image (Optional) to same plase as [php] is how do i make this hapen ???????? |
read the install file, such codes cannot be done via the ACP, it needs file changes :)
|
alll code and SQL is same now
if ($vboptions['allowedbbcodes'] & ALLOW_BBCODE_CODE) { // [SQL] $bbcodes['custom']['find']['[sql]'] = '#\[sql\](.*)\[/sql\]#esiU'; $bbcodes['custom']['replace']['[sql]'] = "handle_bbcode_sql('\\1')"; $bbcodes['custom']['recurse']['sql'][0] = array('handler' => 'handle_bbcode_sql'); } what is this to SQL CODE define('ALLOW_BBCODE_BASIC', 1); define('ALLOW_BBCODE_COLOR', 2); define('ALLOW_BBCODE_SIZE', 4); define('ALLOW_BBCODE_FONT', 8); define('ALLOW_BBCODE_ALIGN', 16); define('ALLOW_BBCODE_LIST', 32); define('ALLOW_BBCODE_URL', 64); define('ALLOW_BBCODE_CODE', 128); define('ALLOW_BBCODE_PHP', 256); define('ALLOW_BBCODE_HTML', 512); |
All times are GMT. The time now is 11:02 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|