View Full Version : [SQL] - vB Code
Xenon
01-07-2004, 10:00 PM
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:
SELECT *
FROM user
LEFT JOIN userfield USING(userid)
most of the queries are working perfectly, just nested quotes can make problems, i'll try to fix these, soon :)
Enjoy
MindTrix
01-08-2004, 04:09 PM
Yay i wondered where that was :) Cheers Xenon!! Im guessing you got Chen's permission :p lol
Xenon
01-08-2004, 08:14 PM
Yay i wondered where that was :) Cheers Xenon!! Im guessing you got Chen's permission :p lol
Yeah, even myself has to ask, and i have asked :)
(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 ;))
NTLDR
01-08-2004, 08:41 PM
Thanks for releasing this Xenon, its somthing I've wanted for a while now :)
Xenon
01-08-2004, 09:21 PM
:)
i know there are not that much boards out which need this hack, but if at least one can use it i'm glad :)
Xenon
01-08-2004, 10:05 PM
i've uploaded a slightly modificated version as it seems, the old one made problems with newreply and the newer vb-versions..
Boofo
01-09-2004, 03:59 PM
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.
Xenon
01-09-2004, 04:31 PM
:)
i use a different block code hack now ;)
but yeah i remember that nice conversation ;)
Chris M
01-09-2004, 11:44 PM
Hmmm - Nice:)
Now that you have been so kind, make a [disable] tag :p
Satan
Boofo
01-10-2004, 02:19 AM
How would we add a button in the editor for this?
A disable tag would be excellent! I really miss that one. ;)
squawell
01-10-2004, 04:10 AM
How would we add a button in the editor for this?
also want to know this:D
Boofo
01-10-2004, 04:13 AM
also want to know this:D
Hello there, sir. ;) Where you been?
squawell
01-10-2004, 09:59 AM
Hello there, sir. ;) Where you been?
Hello,Bob;)im come from Asia ........nice to meet u:D:D
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
function handle_bbcode_sql($code)
{
below it add:
global $vboptions, $vbphrase, $stylevar;
i test it,and it works...;)hope u guys like it
Boofo
01-10-2004, 10:13 AM
Hello,Bob;)im come from Asia ........nice to meet u:D:D
by the way...if anyone want to replace the word--SQL query to phrase
variable just open the file find
function handle_bbcode_sql($code)
{
below it add:
global $vboptions, $vbphrase, $stylevar;
i test it,and it works...;)hope u guys like it
Make sure you let them know which file to open. ;)
I had already done this but why did you add the $stylevar and $vboptions to it?
Xenon
01-10-2004, 10:46 AM
@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 :)
squawell
01-10-2004, 10:48 AM
Make sure you let them know which file to open. ;)
I had already done this but why did you add the $stylevar and $vboptions to it?
ok...ill edit my post above let others know;)
because i paste it from another file and LAZY to edit the code:o:o
Boofo
01-10-2004, 10:56 AM
ok...ill edit my post above let others know;)
because i paste it from another file and LAZY to edit the code:o:o
LOL Don't feel bad, I have done the same thing many times in the past. I had to also add $bbuserinfo to that line to allow my block codes hack to work. ;)
Boofo
01-10-2004, 11:02 AM
@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 :)
I was just razzin' him, Stefan. :)
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. ;)
Xenon
01-10-2004, 11:05 AM
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.
not that i know of, as you have to call some functions...
also i'm a purist, so i don't use the editors, a plain textbox is really enough for me ;)
gmarik
01-17-2004, 07:01 AM
Do you use it over the board or somewhere in the admin panel as well?
Xenon
01-17-2004, 06:32 PM
just on the board
Boofo
01-31-2004, 01:36 AM
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:
// fetch height of block element
$blockheight = fetch_block_height($code);
right above:
eval('$html = "' . fetch_template('bbcode_sql') . '";');
return $html;
in the included functions_bbcodeparse_custom_created.php that comes with this hack. If you also add:
global $vbphrase, $stylevar;
right under
function handle_bbcode_sql($code)
{
in the same file, you can use the same code for the sql template for the box as the code template (with a few small modifications, of course) instead of hard-coding everything. ;)
Xenon
02-01-2004, 04:31 PM
seems there are changes in rc3 i never noticed ^^
g-force2k2
02-01-2004, 04:38 PM
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
Xenon
02-01-2004, 04:41 PM
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 :)
Boofo
02-01-2004, 05:40 PM
seems there are changes in rc3 i never noticed ^^Just trying to help. ;)
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. ;)
Xenon
02-01-2004, 05:44 PM
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 :)
Boofo
02-01-2004, 05:49 PM
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!!! ;)
Boofo
02-02-2004, 12:42 AM
Don't forget the add the SQL template to the showthread.php and the showpost.php, too. ;)
Xenon
02-02-2004, 02:07 PM
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 ?
Boofo
04-06-2004, 12:57 PM
Evil made the icon. I suppose we could share it with you. ;)
Xenon
08-04-2004, 04:47 PM
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 :)
SamirDarji
08-31-2004, 05:59 PM
Wow, is this a dangerous hack. The DROP TABLE function comes to mind and scares me.
Xenon
09-01-2004, 11:46 AM
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
SamirDarji
09-02-2004, 01:59 AM
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
Oops! That makes more sense. Excuse my ignorance. I think I've been working too hard...
Xenon
09-02-2004, 05:39 PM
*gg*
no problem, everyone knows such days ;)
mikaelweb1
11-23-2004, 09:11 AM
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 ????????
Xenon
11-24-2004, 05:00 PM
read the install file, such codes cannot be done via the ACP, it needs file changes :)
mikaelweb
01-27-2005, 11:24 AM
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);
Xenon
01-27-2005, 04:18 PM
sorry?
i don't get you question
mikaelweb
01-27-2005, 04:29 PM
if i use [CODE] or [SQL all same
Xenon
01-27-2005, 04:42 PM
nope, code or sql are different tags.
BamaStangGuy
01-30-2005, 05:20 AM
Unless I am blind the instructions dont say anything about caching the bbcode_sql template
In showthread.php find:
'pollresult',
after add:
'bbcode_sql',
TKlingler
07-29-2005, 02:37 PM
Excuse me if me question still stupid for you, but I am a really newbie how knows nothing.
But witch is the correct directory for the file bbcode_sql and witch extension must it has(*.html or *.tpl)?
Andreas
07-29-2005, 03:00 PM
There is no File bbcode_sql, only a Template with this Name.
TKlingler
07-29-2005, 05:46 PM
There is no File bbcode_sql, only a Template with this Name
I did not know what I must do, I have all don from the read me but this i did not understand.
Whre or what I must do :knockedout:
akanevsky
10-22-2005, 06:57 PM
3.5 port please?
don't break your head with the SQL sysntax, i have already ported it, just not yet released ;)
Can't wait ;)
Thanks,
Mat
Xenon
10-23-2005, 03:18 PM
well, already ported but not yet released ;)
but you can use Andreas' HIGHLIGHT plugin which does actually the same, but for even more languages
akanevsky
10-23-2005, 03:26 PM
well, already ported but not yet released
why not? :P
Xenon
10-23-2005, 03:28 PM
to less time to write the instructions
(you can also call it lazyness ^^)
akanevsky
10-23-2005, 03:30 PM
indeed :) :P
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.