MyBB Community Forums

Full Version: Style tags removed in post - the fix is not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Problem: MyBB removes <style> in posts. I found a fix. The fix is not working.
Question: Help me fix this. Also, did anything change and is <style> handled somewhere else now?
Why this is important: I'm not asking for just one board, but rather for an entire community where there's a dozen people using it at any time, and specifically using this feature, too.


URL: http://rebelwindrpg.com/showthread.php?tid=35
Credentials:
username testaccount with a password of 1111111111 
Board Version: 1.6.X (getting specifics soon)

----------------------------------------------

Background & The Fix:
Since MyBB 1.6.10, the style tags in posts were removed. This is because MyBB made the decision to purposefully remove them out of the box.

Since then, someone found a fix for it, which I am reposting here for the purposes of redundancy in case it gets lost: http://www.rpgfix.com/resources/using-st...n-mybb.15/ posted by moosetracks114

In: inc/class_parser.php
Find, around line 117:
while(preg_match("#<s(cript|tyle)(.*)>(.*)</s(cript|tyle)(.*)>#is", $message))
Replace with:
while(preg_match("#<script(.*)>(.*)</script(.*)>#is", $message))
Find, around line 119:
$message = preg_replace("#<s(cript|tyle)(.*)>(.*)</s(cript|tyle)(.*)>#is", "&lt;s$1$2&gt;$3&lt;/s$4$5&gt;", $message);
Replace with:
$message = preg_replace("#<script(.*)>(.*)</script(.*)>#is", "&lt;s$1$2&gt;$3&lt;/s$4$5&gt;", $message);
Save and upload

What this does is remove blocking <style> blocks in posts.

HOWEVER.
It doesn't seem to be working anymore. See here:

[Image: 13p5gd6.png]

It's still meddling with the <style> tags by replacing parts with the generic < > html codes.

--------------

It seems like something else in MyBB is handling the <style> tags. Did something change, can you point me in the right direction. Anything useful would be helpful, here.
style elements should be in the head (eg. the headerinclude template); they are invalid within the body. If you want to use inline styles, use the style attribute on a particular element.
It seems that another mod made some changes somewhere to the class_parser.php and this is why it wasn't working. So a fresh copy of the file with the changes worked just fine.

(solved).