vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   PHP Tag Slashes String Parsing Fix (https://vborg.vbsupport.ru/showthread.php?t=54066)

Boofo 06-08-2003 10:00 PM

PHP Tag Slashes String Parsing Fix
 
PHP Tag Slashes String Parsing Fix
(By Boofo)

Thanks goes out to Firefly for not giving me an answer to my original request on how to fix this problem with the php tags. It forced me to figure it out for myself. ;)

What this hack does:
For anyone that uses php tags a lot, you'll know what this hack does. The phphighlite function does not handle slashes very well. And since only the php tags use that function, when you use the code tags there is no problem with the slashes being parsed right. This hack fixes that for any tags that use [ and ] (i.e. preg_replace statements). It has nothing to do with BBCode, but the way the php tags handle slashes (\). This hack keeps you from having to use \\\\[ to get a \[ in the php tags.

Files to modify: 1 (functions.php)
Templates to modify: None
Templates to add: None
Queries to run: None
Install time: 1 minute

Please click the install button if you find this hack useful.

Lethal 06-09-2003 11:44 AM

cool thanks

Boofo 06-09-2003 11:48 AM

You're very welcome. ;)

gmarik 06-09-2003 12:16 PM

Still doen't get the point. I do use uch php code. What's the matter? Is there a way, to embed php in templates? Filburt's hack does not works on 2.3

Boofo 06-09-2003 12:23 PM

If you try to put something like:

$message[message] = trim(preg_replace("~\[quote\](.*)\[/quote\]~si", "", $message[message]));

between php tags, you will have to change the \[ and \] to \\\[ and \\\] to make it parse right. With this hack, you no longer have to do that. The hack will automatically do this for you.

cirisme 06-09-2003 12:40 PM

Has vb.org fixed this... let's find out! ;)

PHP Code:

$message[message] = trim(preg_replace("~\[quote\](.*)\[/quote\]~si"""$message[message])); 


Boofo 06-09-2003 12:49 PM

Chen fixed it here a while back. I decided to release my fix for it after I came across this problem on my site.

shovel 06-09-2003 12:56 PM

So Bob, this will fix any further additions to tags (that use slashes) correct? You won't have to change any former function strings i.e. preg_replace()? If so, you have my install. :)

Boofo 06-09-2003 01:01 PM

This will take care of it. The only thing you might have to do is go back and take out any extra slashes you added before to make the code look right. If you never added any extra slashes, then you are all set. ;)

shovel 06-09-2003 01:21 PM

Only once, and it seems to be working fine now. Great fix Bob. :)


All times are GMT. The time now is 09:00 PM.

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.01378 seconds
  • Memory Usage 1,726KB
  • 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
  • (1)bbcode_php_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
  • (10)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