vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   [SQL] - vB Code (https://vborg.vbsupport.ru/showthread.php?t=59904)

Xenon 01-07-2004 10:00 PM

[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

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

Quote:

Originally Posted by MindTrix
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

Quote:

Originally Posted by Boofo
How would we add a button in the editor for this?

also want to know this:D

Boofo 01-10-2004 04:13 AM

Quote:

Originally Posted by squawell
also want to know this:D

Hello there, sir. ;) Where you been?

squawell 01-10-2004 09:59 AM

Quote:

Originally Posted by Boofo
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
PHP Code:

function handle_bbcode_sql($code


below it add:
PHP Code:

global $vboptions$vbphrase$stylevar

i test it,and it works...;)hope u guys like it

Boofo 01-10-2004 10:13 AM

Quote:

Originally Posted by squawell
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
PHP Code:

function handle_bbcode_sql($code


below it add:
PHP Code:

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

Quote:

Originally Posted by Boofo
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

Quote:

Originally Posted by squawell
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

Quote:

Originally Posted by Xenon
@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

Quote:

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:

PHP Code:

 // fetch height of block element
$blockheight fetch_block_height($code); 

right above:

PHP Code:

 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:

PHP Code:

 global $vbphrase$stylevar

right under

PHP Code:

 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

Quote:

Originally Posted by Xenon
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 :)

PET 04-06-2004 03:06 AM

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

Quote:

Originally Posted by Xenon
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);


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
  • Page Generation 0.01466 seconds
  • Memory Usage 1,827KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete