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?

dbirosel 03-19-2007 11:41 PM

Great help on that request. You guys should add that to the Mod Database!

TheMilkCarton 03-20-2007 03:10 PM

Quote:

Originally Posted by oldengine (Post 657433)
Excellent! Thank you Dark Visor and Zero Tolerance!

Hahaha. Who is Dark Visor? :p Edit: Oh, that was two years ago? Maybe he had his name changed.. whoops. :o

Anyway.. my question. Is there any way to limit it so that it only starts limiting after so many characters? I think turning ?? into ? is a little too strict.

Perhaps something that turns ?????? into ???

I just realized this thread was started 2 years ago.. but someone bumped it so I might as well ask. :)

Elenna 03-20-2007 04:48 PM

Sorry, that was me that bumped :) I'm not sure if I'm blind, but I'm not seeing the functions_bbcodeparse file. Has it been renamed or encorporated elsewhere?

I, too, would like for it to limit only after a certain amount, like MilkCarton suggested. Could this work with periods too? I know that ... and .... are gramatically appropriate, but I'd like to shorted ................. to ... .

Dismounted 03-21-2007 05:47 AM

Off the top of my head, create a new plugin at 'parse_bbcode' or 'bbcode_parse' (forgot which one it is :p) and insert;
PHP Code:

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

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


TheMilkCarton 03-21-2007 12:51 PM

Thanks Dismounted.. but what about changing '????????' to '???' Is this something that would be too difficult to code? :)

Edit: I couldn't get what you said to work. Although, there were only "bbcode_parse_start" and "bbcode_parse_complete" Unless I didn't see just plain old bbcode_parse

Elenna 03-21-2007 02:50 PM

Thanks very much! I'd like to give this a try - but I admit I'm pretty dumb and new with vB. Which file should I edit to add in the code above?

Dismounted 03-22-2007 06:42 AM

Quote:

Originally Posted by TheMilkCarton (Post 1208767)
Thanks Dismounted.. but what about changing '????????' to '???' Is this something that would be too difficult to code? :)

Edit: I couldn't get what you said to work. Although, there were only "bbcode_parse_start" and "bbcode_parse_complete" Unless I didn't see just plain old bbcode_parse

1./ Find:
PHP Code:

$replacearray = array("!""?""~"); 

Replace With:
PHP Code:

$replacearray = array("!!!""???""~~~"); 

2./ bbcode_parse_complete

Quote:

Originally Posted by Elenna (Post 1208853)
Thanks very much! I'd like to give this a try - but I admit I'm pretty dumb and new with vB. Which file should I edit to add in the code above?

Note 'plugin'. AdminCP > Plugins & Products > Add New Plugin > Pretty self-explanitory from there.

TheMilkCarton 03-22-2007 08:26 AM

Well, I would figure that much, but the code you told me to put into the plugin doesn't work.. at all. :)

I've tried every combo of !!! and ??? and nothing ever changes.

Dismounted 03-22-2007 10:17 AM

The variables have probably changed. I'll have a look.

TheMilkCarton 03-22-2007 11:20 AM

Also, with
Code:

$replacearray = array("!!!", "???", "~~~");
wouldn't it actually turn '!!' into '!!!' , '!!!' would stay the same, and then finally, '!!!!' would change to '!!!' I'd like to do it without lengthening !! or ??

Maybe I'm just misunderstanding the PHP involved.. :) I'm not much of a coder just yet. haha

Dismounted 03-23-2007 09:07 AM

Changing the regex would fix that, but I'm too tired atm :p.

Elenna 03-27-2007 02:22 AM

Any luck finding the correct variables?

oldengine 07-25-2010 12:32 PM

Bumping this for more info now that I'm into 3.8.6.

My users still present the issue.

functions_bbcodeparse.php is no longer part of the system.


All times are GMT. The time now is 08:35 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.01690 seconds
  • Memory Usage 1,775KB
  • 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
  • (7)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (23)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