News:

Wondering if this will always be free?  See why free is better.

Main Menu

2.0.8 [HTML] BBCode Problem

Started by SirAlahn, July 03, 2014, 08:35:06 PM

Previous topic - Next topic

SirAlahn

I recently updated my forum from SMF 2.0.7 to 2.0.8. Prior to the update, users with the admin permission set could post html using the html bbcode tag. I am aware that letting other users utilize this tag is a security issue, and I am not looking to enable it for standard members. However, my co-admin and I used the tag quite often in order to format posts in ways that bbcode simply does not support. Since the update, the html code no longer works properly. It does not parse all of the code, leaving a disorganized mess when it is actually posted. Dohtml does not work at all, though it did not previously either.

For example, this is one of the pieces of html we were trying to use:
[html]<div style="color:#fffaf7; background-color:#252d2f; width:450px; font-family: goudy old style; font-size:20px; text-transform:uppercase; letter-spacing:4px; text-align: center; border-radius: 5px;">Dragon Lengths</div>
<div style="color:#b29600; background-color:#ffef99; width:420px; font-size:12px; text-align: left; border-radius: 5px;">Length = 42M</div>[/html]

In 2.0.7, this code created the desired div. Now, in 2.0.8, it gives the impression of working properly. All of the code disappears from the submitted post as though it parsed, but without actually enacting any changes. Posting the above code in dohtml simply gives me the raw code, as does posting the html without any tags around it.

Most curiously, posts that were formatted prior to the update still display properly -- but if we try to post again with the same code, or edit and save changes to those properly-formatted posts, the code breaks for them as well.

I have attempted to search both Google and the SMF forum for similar issues or solutions, but I've been unable to find anything relevant. Any help with this problem would be greatly appreciated.

SirAlahn

Bumping this since it hasn't been addressed and I'm still looking for a solution. If anyone has any ideas, they would be very welcome.

Steve

I don't know enough about this to help you but I do know that it works on my 2.0.8 (and I upgraded as you did) so whoever answers will probably want to know what mods you have installed. :)
DO NOT pm me for support unless asked to!

margarett

I have been trying to check this but haven't find the time yet :(

As Steve says, a list of mods would help.
Furthermore, can you backup all your files and load a fresh set of files?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

I am able to reproduce your issue. So I'll ask our devs to take a look at it ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

NanoSector

#5
Seems to be a slight difference between 2.0.8 patched and a fresh install that may cause this.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

radu81

That's not a public topic NanoSector
sorry for my bad english

NanoSector

It's not, but any developer looking here should be able to view it.
ETA: Removed topic link.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Illori

can you provide a screenshot for when this does not work correctly?

margarett

OK, we have a fix for you.

Please open Sources/Subs-Post.php and find:
$htmlfunc = create_function('$m', 'return \'[html]\' . strtr(un_htmlspecialchars("$m[1]"), array("\n" => \'&#13;\', \' \' => \' &#32;\', \'[\' => \'&#91;\', \']\' => \'&#93;\')) . \'[/html]\';');
(Line 239 on a clean file)
Replace with:
$htmlfunc = create_function('$m', 'return \'[html]\' . strtr(un_htmlspecialchars("$m[1]"), array("\n" => \'&#13;\', \'  \' => \' &#32;\', \'[\' => \'&#91;\', \']\' => \'&#93;\')) . \'[/html]\';');
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Steve

Amazing how such a tiny difference can cause such a problem ...
DO NOT pm me for support unless asked to!

Arantor

And this is why I asked for testing prior to the patch being released.
Holder of controversial views, all of which my own.


Illori

Quote from: ‽ on July 07, 2014, 05:27:22 PM
And this is why I asked for testing prior to the patch being released.

with things as they are in the patch, i had no issues with the code the op posted...

Arantor

Hmmm, interesting, this is actually an edit originally from 2.0.7 but was missing in some versions and so was included again in 2.0.8, so it could easily be either. (But what I supplied in both cases was the corrected version, so I'm curious as to at what point it got broken)
Holder of controversial views, all of which my own.


Illori

Quote from: ‽ on July 07, 2014, 05:38:57 PM
Hmmm, interesting, this is actually an edit originally from 2.0.7 but was missing in some versions and so was included again in 2.0.8, so it could easily be either. (But what I supplied in both cases was the corrected version, so I'm curious as to at what point it got broken)

so it is correct with 1 or 2 spaces?

Arantor

2 spaces as per margarett's replace code. As per the .xml I supplied:

<operation error="ignore"><!-- Some 2.0.7 packages missed 2.0.7 Operation #13. Here it is. -->
<search position="replace"><![CDATA[ if (allowedTo('admin_forum'))
$parts[$i] = preg_replace('~\[html\](.+?)\[/html\]~ise', '\'[html]\' . strtr(un_htmlspecialchars(\'$1\'), array("\n" => \'\', \'  \' => \' \', \'[\' => \'[\', \']\' => \']\')) . \'[/html]\'', $parts[$i]);
]]></search>
<add><![CDATA[ if (allowedTo('admin_forum'))
{
static $htmlfunc = null;
if ($htmlfunc === null)
$htmlfunc = create_function('$m', 'return \'[html]\' . strtr(un_htmlspecialchars("$m[1]"), array("\n" => \'\', \'  \' => \' \', \'[\' => \'[\', \']\' => \']\')) . \'[/html]\';');
$parts[$i] = preg_replace_callback('~\[html\](.+?)\[/html\]~is', $htmlfunc, $parts[$i]);
}
]]></add>
</operation>


And that was copy/pasted from 2.0.7 (fixed) patch when I prepared it.
Holder of controversial views, all of which my own.


SirAlahn

Quote from: margarett on July 07, 2014, 09:06:24 AM
OK, we have a fix for you.

Please open Sources/Subs-Post.php and find:
$htmlfunc = create_function('$m', 'return \'[html]\' . strtr(un_htmlspecialchars("$m[1]"), array("\n" => \'&#13;\', \' \' => \' &#32;\', \'[\' => \'&#91;\', \']\' => \'&#93;\')) . \'[/html]\';');
(Line 239 on a clean file)
Replace with:
$htmlfunc = create_function('$m', 'return \'[html]\' . strtr(un_htmlspecialchars("$m[1]"), array("\n" => \'&#13;\', \'  \' => \' &#32;\', \'[\' => \'&#91;\', \']\' => \'&#93;\')) . \'[/html]\';');

Thank you so much! This worked perfectly. All our html is working fine now.

In case it's still relevant, this is the list of mods I have installed and currently active.

Member Awards 3.0    
Tidy Child Boards  1.4.1    
Progress Bar BBCode (CSS3 version) 1.2
SimpleColorizer 1.1    
Secondary Custom Title    1.0.0    
SMFPacks Alerts Pro 2.0.8    
Add size info to Avatar upload 1.1    
Users Online Today 2.0.3    
Stop Spammer    2.3.9    
Enhancements to reattribute posts 1.5.5    
KeyCAPTCHA for SMF 2.7    
Username BBCode0 1.2    
SMF Theme Changer 1.0.1    
Spoiler BBCode    1.1.3    
Member Group Icons 1.3
TinyPortal 1.107    
Edit All Message Titles 0.1.1    
Avatar Rounded Corners 1.0    
Show Unread Private Messages 1.2    
SubAccounts Mod 1.0.1    
Custom BBCode 2.03    
Custom Form Mod 1.7    
Default Avatar    2.3    
Group Color to CSS Class 1.0    
Enhancements to reattribute posts 1.5.6    
PM Settings 1.0.1    
Order Custom Profile Fields 1.1.1    

{OCS}PaPa-D

I was having the same problem, thank you for the easy fix for a frustrating problem!

...Seal...,

fsctmikado

Thank you so much, that also solved my problem with embedding a YouTube Video...
Petra

breweruk

Brillant, the fix worked for me too. Thanks so much. David

Advertisement: