vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Limit [SIZE] tag (https://vborg.vbsupport.ru/showthread.php?t=55694)

forumdude 07-28-2003 10:43 PM

Limit [SIZE] tag
 
I was looking around for a hack to limit how large users can make their text size via the vb [SIZE] tag.

I was looking at the preg_replace() function (
http://us4.php.net/manual/en/function.preg-replace.php ).

I'm not sure what to do because the size tag can be done in two different ways making the replace statement more difficult:

PHP Code:

[SIZE=4]Blah[/SIZE]
[
SIZE=+4]Blah[/SIZE

Size=4
Size=+4


Any help would be appreciated. Size=100 in signatures gets old quick. :(


Thanks!

Zachery 07-29-2003 11:48 AM

<font size="100">test</font>

html limits dont go past +4 as far as i understood

cirisme 07-29-2003 01:21 PM

PHP Code:

[disable]$message preg_replace("/\[size=\+(\d+)\](.+)\[\/size\]/siU""[size=\\1]\\2[/size]"$message);
$message preg_replace("/\[size=(4|5|6|7|8|9|10|11|12|13)\](.+)\[\/size\]/siU""[size=3]\\2[/size]"$message);[/disable

is what I use to limit it to 3. It makes the + useless. I use it in new reply, new thread, and edit post. Where is kind of irrelevant, as long as it is before $message is saved into the db. ;)

Just experiment with positioning. :)

forumdude 08-04-2003 11:59 AM

hmmm. I suppose that's a good start but it didn't work completely on my site.

Size=100 still went through (or anything over 13) and some of the other sizes I tried ended up as this character:

Gary King 08-04-2003 05:19 PM

Quote:

Today at 08:59 AM forumdude said this in Post #4
hmmm. I suppose that's a good start but it didn't work completely on my site.


Size=100 still went through (or anything over 13) and some of the other sizes I tried ended up as this character: 

Didn't work completely? What's wrong with the code supplied by cirisme?

cirisme 08-04-2003 06:37 PM

Quote:

Today at 06:59 AM forumdude said this in Post #4
hmmm. I suppose that's a good start but it didn't work completely on my site.


Size=100 still went through (or anything over 13) and some of the other sizes I tried ended up as this character: 


I just realized that the other day(after a member used 15), so I updated my code to handle it:

PHP Code:

[disable]$message preg_replace("/\[size=\+(\d+)\](.+)\[\/size\]/siU""[size=\\1]\\2[/size]"$message);
$message preg_replace("/\[size=(4|5|6|7|8|9|\d\d|\d\d\d)\](.+)\[\/size\]/siU""[size=3]\\2[/size]"$message);[/disable

When I get time, I plan on updating and testing this: (it should work, but I haven't tested it just yet :surprised: )

PHP Code:

[disable]$message preg_replace("/\[size=\+?[4-999]\](.+)\[\/size\]/siU""[size=3]\\1[/size]"$message);[/disable

It will go to size 999, but you could make it go higher ;)

cirisme 08-04-2003 06:51 PM

Just tested it, and this works well:

PHP Code:

[disable]$message preg_replace("/\[size=\+?[4-9]*\](.+)\[\/size\]/siU""[size=3]\\1[/size]"$message);[/disable

Enjoy :)

forumdude 08-04-2003 08:07 PM

Quote:

Today at 03:51 PM cirisme said this in Post #7
Just tested it, and this works well:

PHP Code:

[disable]$message preg_replace("/\[size=\+?[4-9]*\](.+)\[\/size\]/siU""[size=3]\\1[/size]"$message);[/disable

Enjoy :)

I tried that code as well and had problems.


Try the statement:

PHP Code:

 I go to some fast food place and get super [size=+4]size 5[/size]. 

Size 5 gets replaced with .

cirisme 08-04-2003 09:26 PM

Make sure you change the \1 to have double slashes(\\1), apparently vb.org's php tags mess up the double slashes.

forumdude 08-04-2003 09:34 PM

Ahhh thanks.

My only consideration now would be if someone enters the number 1000000 for the size.

Hehehe.

Nice site btw. I registered there under Ibuprofen. Good reading for sure.


All times are GMT. The time now is 05:51 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.01226 seconds
  • Memory Usage 1,755KB
  • 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
  • (7)bbcode_php_printable
  • (3)bbcode_quote_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