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)
-   -   Replace Text (https://vborg.vbsupport.ru/showthread.php?t=50116)

Darax The Good 06-07-2003 08:10 AM

I shoved the code from stri_replace into the handler for the text replacer and it works. Now the trick is-how do I get this to execute before the censor?

Darax The Good 06-07-2003 08:26 AM

okay, I'm calling the handler function from the CensorText(). This allows the hack to work for titles too. There might be perf implications that I'm not aware of.

limey 06-08-2003 05:19 AM

darax: the bit of [code ]?[/code ] is a mistake...its not in the functions file. Its meant to place that code above the ? at the end of the file.

Darax The Good 06-08-2003 08:37 AM

coo limey-I tried that and bugger it didn't work, so I just put the code straight into the first function.

I'm not sure if anyone would care what I did, but I essentially replaced the swearbot. I call the below function toward the beginning of CensorText- I have a feeling you'll see a lot of ****'s there, but on the board we're setting up, we replace s... with poop, etc. If anything falls through the swearbot will catch it.

Code:

function CustomTextReplace($text){
        //
        //These two arrays should be obvious-but please take care that MyStrings has a counterpart in MyReplacements, or crash
        //
        $MyStrings = array(1=> "++++","++++","ass","+++++", "penis", "Garp",
        7=>"promoteme", "kingsofchaos", "facial", "rotten.com", "outwar",
        12=>"druglords", "goatse", "dildo",  "nigger", "pussy",
        17=>"++++++", "somethingawful",  "Kazaa", "imesh",
        21=>"Grokster", "feetman", "XoloX");
        $MyReplacements = array(1=>"poop", "fark", "mule", "turkey", "chicken", "Flavor Dog",
        7=>"teamxbox", "teamxbox", "manicure", "teamxbox.com", "teamxbox",
        12=>"teamxbox", "teamxbox", "Bilbo Baggins", "I am a total moron", "kitten",
        17=>"cat", "teamxbox", "(I would like to point out that I buy my music)", "what",
        21=>"(stealing music is wrong BTW)", "what", "what");

        $a=1;
        //
        //Loop through the strings-can we use a foreach here?
        //
        while($MyStrings[$a] <> ""){
               
                //
                //This section of code I got from vb.org, I know it scans the string and replaces
                //but I'm not sure how...
                //
                $parts = explode( strtolower($MyStrings[$a]), strtolower($text) );
                $pos = 0;

                //
                //This is especially cryptic...key...part? What?
                //
                foreach( $parts as $key=>$part )
                {
                        $parts[ $key ] = substr($text, $pos, strlen($part));
                        $pos += strlen($part) + strlen($MyStrings[$a]);
                }
                $text=join( $MyReplacements[$a], $parts);
                $a++;       
        }
        //
        //And Back We Go
        //       
        return $text;
       
}


ryancooper 06-19-2003 10:03 PM

OK I got this working but when it puts the link in I get the code on the screen? check it out: http://talkdisney.com/forums/showthr...384#post189384

amykhar 06-19-2003 10:49 PM

You have HTML turned off in the forum. Either change the code to replace to vbb, or turn on HTML.

ryancooper 06-19-2003 11:16 PM

Amy Thank you for your response. I have altered the code to VBB but it still gives me the code?

Also I get a error when I try to change the image to a [img] tag

could you post the vbb version?

I am turning on html for the mean time!

:banana: Thanks!!

limey 06-23-2003 03:10 PM

Yeh the VB code version would be great. This was my problem as well.

Not turning on HTML that is.

limey 06-25-2003 03:22 PM

So does anyone know how to convert to VB code?

limey 06-29-2003 05:47 PM

nothing on this eh?


All times are GMT. The time now is 06:33 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.01064 seconds
  • Memory Usage 1,738KB
  • 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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