diff options
Diffstat (limited to 'cgi')
-rw-r--r-- | cgi/formatting.py | 7 | ||||
-rw-r--r-- | cgi/post.py | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/cgi/formatting.py b/cgi/formatting.py index 33495a3..cb512ab 100644 --- a/cgi/formatting.py +++ b/cgi/formatting.py @@ -336,6 +336,13 @@ def close_html(message): return message[:l] +def remove_html(message): + string = message.replace("<br />", "\n") + string = re.sub(r"<.*?>", '', string) + string = string.replace("\n", "<br />") + return string + + def sanitize_html(message, decode=True): """ Clean the code and allow only a few safe tags. diff --git a/cgi/post.py b/cgi/post.py index 264f207..b80b17d 100644 --- a/cgi/post.py +++ b/cgi/post.py @@ -1117,6 +1117,8 @@ def regenerateNews(): def regenerateTrash(): posts = FetchAll("SELECT posts.id AS id, timestamp_formatted, posts.message AS message, boards.name AS board FROM `posts` INNER JOIN `boards` ON boardid = boards.id WHERE IS_DELETED = 2 ORDER BY `timestamp` DESC") + for i in range(len(posts)): + posts[i]["message"] = formatting.remove_html(posts[i]["message"]) template_values = {'posts': posts} page_rendered = renderTemplate('trash.html', template_values) |