2023-07-11, 08:22 PM
I need help figuring out how to allow CSS style tags in posts. I don't want to allow javascript, just CSS. I found an old fix for this but the coding is different for 1.8 and I'm not sure what to do. Could someone please assist? I understand there are risks involved (that's why I only want to allow CSS and not javascript). Users on my forum use css for post formatting and they're already getting around the built-in limits by saving their stylesheets on google drive. It would be MUCH MUCH simpler to just allow it in the post.
I'm pretty sure the code is located in inc/class_parser.php
but I'm not sure how to edit this section to correctly allow and display the css instead of showing it as plaintext. Could someone help please? is that all I need to edit to fix this or something else?
Example of what I want to fix: user puts in their post something like the below code. It should run the css but instead it is showing the css as plaintext. I want to fix this please :
I'm pretty sure the code is located in inc/class_parser.php
// Replace base, meta,script and style tags in our post - these are > dangerous <
$message = preg_replace('#<(/?)(base|meta|script|style)([^>]*)>#i', '<$1$2$3>', $message);
$message = $this->fix_javascript($message);
$find = array("<br />\n", "<br>\n");
$replace = array("\n", "\n");
$message = str_replace($find, $replace, $message);
}
but I'm not sure how to edit this section to correctly allow and display the css instead of showing it as plaintext. Could someone help please? is that all I need to edit to fix this or something else?
Example of what I want to fix: user puts in their post something like the below code. It should run the css but instead it is showing the css as plaintext. I want to fix this please :
<style type="text/css">.bluetable {
width: 700px;
padding: 100px 50px 50px 50px;
background: #0d1335;
color: #3c5cac; }</style>
<div class="bluetable"> text example here example </div>