Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)

Reply
 
Thread Tools Display Modes
  #1  
Old 07-28-2003, 10:43 PM
forumdude's Avatar
forumdude forumdude is offline
 
Join Date: Nov 2001
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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!
Reply With Quote
  #2  
Old 07-29-2003, 11:48 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

html limits dont go past +4 as far as i understood
Reply With Quote
  #3  
Old 07-29-2003, 01:21 PM
cirisme cirisme is offline
 
Join Date: Jan 2003
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 08-04-2003, 11:59 AM
forumdude's Avatar
forumdude forumdude is offline
 
Join Date: Nov 2001
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Reply With Quote
  #5  
Old 08-04-2003, 05:19 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #6  
Old 08-04-2003, 06:37 PM
cirisme cirisme is offline
 
Join Date: Jan 2003
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 08-04-2003, 06:51 PM
cirisme cirisme is offline
 
Join Date: Jan 2003
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 08-04-2003, 08:07 PM
forumdude's Avatar
forumdude forumdude is offline
 
Join Date: Nov 2001
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 .
Reply With Quote
  #9  
Old 08-04-2003, 09:26 PM
cirisme cirisme is offline
 
Join Date: Jan 2003
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Make sure you change the \1 to have double slashes(\\1), apparently vb.org's php tags mess up the double slashes.
Reply With Quote
  #10  
Old 08-04-2003, 09:34 PM
forumdude's Avatar
forumdude forumdude is offline
 
Join Date: Nov 2001
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:20 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.05728 seconds
  • Memory Usage 2,268KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (7)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete