custom stylesheet loses newlines

Development-related discussion, including bundled plugins
User avatar
gmargo
Bear Rating Disaster
Bear Rating Disaster
Posts: 62
Joined: 08 Jan 2012, 22:33
Location: Silicon Valley

custom stylesheet loses newlines

Postby gmargo » 07 Feb 2012, 22:06

I've been using a custom stylesheet to highlight the current article's headline. It's not fancy; just in case you're interested, here it is:

Code: Select all

.even.Selected a.title {
    font-size : 120%;
    font-weight : bold;
    color: #1155CC;
}

.odd.Selected a.title {
    font-size : 120%;
    font-weight : bold;
    color: #1155CC;
}

But I have found that editing the "custom stylesheet" on the preferences page is difficult because the newlines get stripped out.

There is code to replace newlines with html breaks, but then the db_escape_string() routine strips the html breaks back out. One way to fix this is shown below; just don't strip tags. An alternative might be to make a special case for $key == "USER_STYLESHEET". Another alternative it to not replace newlines with breaks.


Code: Select all

diff --git a/classes/rpc.php b/classes/rpc.php
index ef89a21..e03a597 100644
--- a/classes/rpc.php
+++ b/classes/rpc.php
@@ -213,7 +213,7 @@ class RPC extends Protected_Handler {
       $value = str_replace("\n", "<br/>", $_REQUEST['value']);
 
       $key = db_escape_string($_REQUEST["key"]);
-      $value = db_escape_string($value);
+      $value = db_escape_string($value, $strip_tags=false);
 
       set_pref($this->link, $key, $value);
 

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: custom stylesheet loses newlines

Postby fox » 13 Feb 2012, 13:38

Sorry for the delay, thanks for reporting this. Should be fixed in trunk.


Return to “Development”

Who is online

Users browsing this forum: No registered users and 2 guests