html code in editors (emacs, ckeditor...) is filtered now for normal users

(root is allowed to use any html code)


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@641 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-08-14 17:56:07 +00:00
parent d9f2e91806
commit ca4e53bb0f
11 changed files with 116 additions and 56 deletions

View File

@@ -409,12 +409,41 @@ return with_url;
}
void Functions::ReadItemFilterHtml(Item & item)
{
html_filter.BreakLines(0);
html_filter.TrimWhite(false);
html_filter.InsertTabs(0);
html_filter.CheckOrphans(HTMLFilter::lang_none);
html_filter.SafeMode(true);
html_filter.Filter(request->PostVar("itemcontent"), item.content);
}
void Functions::ReadItemContent(Item & item, const std::string & content_type)
{
bool is_root = request->session->puser && request->session->puser->super_user;
bool filter_html = (content_type == "2") && config->editors_html_safe_mode;
if( filter_html && is_root && config->editors_html_safe_mode_skip_root )
filter_html = false;
if( filter_html )
ReadItemFilterHtml(item);
else
request->PostVar("itemcontent", item.content);
}
void Functions::ReadItemContentWithType(Item & item)
{
item.content_type = Item::ct_formatted_text; // default is formatted text
request->PostVar("itemcontent", request->item.content);
request->PostVar("contenttype", temp);
ReadItemContent(item, temp);
// ct_text and ct_formatted_text can use everyone
if( temp == "0" )