vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Replacement variables NOT case sensitive (https://vborg.vbsupport.ru/showthread.php?t=33125)

Jawelin 12-11-2001 12:56 PM

Hi. I found probably a bug in the replacement variable feature of VB 2.2.1 (and below, I guess).
You can find more information here in vb.org ...

Well, with a little studying, I found out the actual replacement code is in functions.php, here:
PHP Code:

  while ($var=$DB_site->fetch_array($vars)) {
    if (
$var['findword']!="") {
      
$newtext=str_replace($var['findword'],$var['replaceword'],$newtext);
    }
  } 

My question is: your own opinion, could I generate any side effect replaceing the above line with the following one ?
PHP Code:

      $newtext=str_replace(strtoupper($var['findword']),$var['replaceword'],strtoupper($newtext)); 

I.e., this way, the $newtext variable is assigned from the strtoupper($newtext) or - hopefully - all the findword occurrences are replaced into the original $newtext, which remains the same ?

:confused: :confused:

Thank you for any help.
Bye

Mark Hensler 12-11-2001 02:47 PM

No... your $newtext will be in all caps.

for case insensitive, try this:
PHP Code:

$newtext eregi_replace($var['findword'], $var['replaceword'], $newtext); 

eregi_replace() will put a higher load on your system than a simple str_replace.

PHP Docs: eregi_replace()

Jawelin 12-12-2001 01:56 PM

:(

No. I can't add load to cpu, already too high ...
(I'm on shared server... always about 4-7 % avg...)

A workaround: that function runs at displaying time; if I made something like at editing/insert time (even with eregi_replace()) ??
How many and where should I modify (add) the function ?

Thnx a lot.
Bye


All times are GMT. The time now is 03:51 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.01077 seconds
  • Memory Usage 1,722KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete