vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Fix for problem posting HTML entities as plain text (https://vborg.vbsupport.ru/showthread.php?t=105460)

Cap'n Steve 01-15-2006 10:00 PM

Fix for problem posting HTML entities as plain text
 
HTML Entities Fix 1.0 (ported from vBulletin 3.0)


What does this hack do?

The short explanation: It makes it so & entities aren't escaped when posting.

The long explanation: As you may know, HTML uses entities in the form of &(something); to represent certain characters. For example, & will show up as & in the browser. vBulletin escapes any of these that you post so they show up as plain text. However, to be compatible with languages other than English, any entities in the form of &#(number); can't be escaped. That means things like ' (that represents a '), can't be posted as plain text without inserting empty bbcode in the middle of it. That's an ugly workaround, so I came up with this hack. Now, if you want to post ', just post ' and it will show up properly in the browser.

Why would I want to use this?

Well, if your forum involves discussing HTML or programming, or perhaps making modifications for popular forum software, this will let your users post instructions with entities in a way that makes much more sense than the current way. (hint, hint)



Here are the instructions, it should work on all 3.5 versions:

In includes/class_core.php find
PHP Code:

        '/&(?!' . ($entities '#[0-9]+' '(#[0-9]+|[a-z]+)') . ';)/si'

Replace that with
PHP Code:

            //##################### Start HTML Entities Hack ###############################
            
'/&(?!' . ($entities '(#[0-9]+|amp)' '(#[0-9]+|[a-z]+)') . ';)/si',
            
//##################### End HTML Entities Hack ############################### 


EasyTarget 01-16-2006 05:09 AM

nice job

Snake 01-16-2006 09:29 AM

Excellent!

Reef 01-16-2006 12:21 PM

Thanks Cap. This should be included in future builds.

michaelbenson 02-26-2006 06:47 PM

Quote:

Originally Posted by Reef
Thanks Cap. This should be included in future builds.

I agree, perhaps this should be put forward in the vb.com suggestion forum?

Cap'n Steve 02-27-2006 05:01 AM

I originally reported this as a bug, but they either didn't get the point or just like it the way it is now.


All times are GMT. The time now is 02:39 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.01842 seconds
  • Memory Usage 1,725KB
  • 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
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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