vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Preventing !!!!!!! ??????? (https://vborg.vbsupport.ru/showthread.php?t=81869)

oldengine 05-22-2005 06:29 PM

Preventing !!!!!!! ???????
 
Is there any way to knock out multiple punctuation like this??????????????

Damn, I hate posts like this!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Or sentences ~~~~~~~~~~~~~~ full of this.

akanevsky 05-22-2005 06:45 PM

Of course. Use:
$searcharray = array("/([!]*)/si", "/([?]*)/si", "/([~]*)/si");
$replacearray = array("!", "?", "~");

$txt = preg_replace($searcharray, $replacearray, $txt);

oldengine 05-22-2005 07:20 PM

Thank you for the tools! I'll see if I can apply them properly. :)

I would presume that functions_newpost.php would be a likely place to insert this. Picking the right spot might be tricky.

akanevsky 05-22-2005 08:03 PM

In functions_bbcodeparse, find:

PHP Code:

// ###################### Start bbcodeparse2 #######################
function parse_bbcode2($bbcode$dohtml$dobbimagecode$dosmilies$dobbcode$iswysiwyg 0$donl2br 1$doresize 1)
{
// parses text for vB code, smilies and censoring

    
global $DB_site$vboptions$bbuserinfo$templatecache$smiliecache;
    global 
$html_allowed

Add after:

PHP Code:

$searcharray = array("/([!]*)/si""/([?]*)/si""/([~]*)/si");
$replacearray = array("!""?""~");

$bbcode preg_replace($searcharray$replacearray$bbcode); 


oldengine 05-23-2005 01:29 AM

Text entered:

Title: This is a test!!!

Results: ~?~!~?~T~?~!~?~h~?~!~?~i~?~!~?~s~?~!~?~ ~?~!~?~i~?~!~?~s~?~!~?~ ~?~!~?~a~?~!~?~ ~?~!~?~t~?~!~?~e~?~!~?~s~?~!~?~t~?~!~?~.~?~!~?~ ~?~!~?~ ~?~!~?~!~?~ ~?~!~?~?~!~?~?~!~?~?~!~?~?~!~?~?~!~?~?~!~?~ ~?~!~?~~?~!~?~~?~!~?~~?~!~?~~?~!~?~~?~!~?~~?~!~?~

If you really look inside the above string, you'll see: This is a test!!!

For some reason, it comes back with a string like the above.

akanevsky 05-23-2005 08:25 AM

My code is not supposed to parse those complicated strings of yours.
It is supposed to eliminate "!!!!!!!!!", "??????????" and "~~~~~~~~"...

Marco van Herwaarden 05-23-2005 09:43 AM

Moved to vB3

Zero Tolerance 05-23-2005 03:06 PM

This should fix the problem, find inside functions_bbcodeparse.php:
PHP Code:

$searcharray = array("/([!]*)/si""/([?]*)/si""/([~]*)/si"); 

Replace With:
PHP Code:

$searcharray = array("/([!]+)/si""/([?]+)/si""/([~]+)/si"); 

Save & Upload.

After testing the string:
Quote:

OMG!!!!!!1!!!!!1~~~~~~~~~~1~~~~~~~~~~~~~~?????!!!? ????!!!
The output was:
Quote:

OMG!1!1~1~?!?!
Eliminating all repeating characters (?, ~, !) to a single char. :)

- Zero Tolerance

oldengine 05-24-2005 12:37 AM

Excellent! Thank you Dark Visor and Zero Tolerance!

Elenna 03-19-2007 11:10 PM

What file(s) should I modify in 3.6.5 to have this work?


All times are GMT. The time now is 02:06 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.01578 seconds
  • Memory Usage 1,743KB
  • 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
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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