fixed: static files loaded to /var such as /var/ckeditor_winix.js were not properly returned
(html filter was used but they are mostly javascript files) added: new Item::ContentType: ct_other if an item has ct_other then the html filter is not used for the content git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1040 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -94,6 +94,10 @@ void config_base_url_common(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void config_is_html_filter_allowed(Info & i)
|
||||
{
|
||||
i.res = config->html_filter;
|
||||
}
|
||||
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
@@ -114,6 +114,9 @@ void item_content_type_is(Item & item, Info & i)
|
||||
else
|
||||
if( item.content_type == Item::ct_bbcode && i.par == L"bbcode" )
|
||||
i.res = true;
|
||||
else
|
||||
if( item.content_type == Item::ct_other && i.par == L"other" )
|
||||
i.res = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +128,9 @@ void item_content_type_is(Info & i)
|
||||
|
||||
void item_print_content(HtmlTextStream & out, const std::wstring & content, Item::ContentType content_type)
|
||||
{
|
||||
if( config->html_filter && !Item::CanContentBeHtmlFiltered(content_type) )
|
||||
out << R("<nofilter>");
|
||||
|
||||
if( content_type == Item::ct_text )
|
||||
{
|
||||
out << content;
|
||||
@@ -135,11 +141,6 @@ void item_print_content(HtmlTextStream & out, const std::wstring & content, Item
|
||||
HtmlEscapeFormTxt(out, content);
|
||||
}
|
||||
else
|
||||
if( content_type == Item::ct_html )
|
||||
{
|
||||
out << R(content);
|
||||
}
|
||||
else
|
||||
if( content_type == Item::ct_bbcode )
|
||||
{
|
||||
static std::wstring out_temp;
|
||||
@@ -149,6 +150,14 @@ void item_print_content(HtmlTextStream & out, const std::wstring & content, Item
|
||||
bbcode_parser.Filter(content.c_str(), out_temp);
|
||||
out << R(out_temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ct_html, ct_other
|
||||
out << R(content);
|
||||
}
|
||||
|
||||
if( config->html_filter && !Item::CanContentBeHtmlFiltered(content_type) )
|
||||
out << R("</nofilter>");
|
||||
}
|
||||
|
||||
|
||||
@@ -476,7 +485,10 @@ void item_admin_meta_tab_has_next(Info & i)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void item_can_content_be_html_filtered(Info & i)
|
||||
{
|
||||
i.res = cur->request->item.CanContentBeHtmlFiltered();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -211,14 +211,15 @@ void Templates::CreateFunctions()
|
||||
/*
|
||||
config
|
||||
*/
|
||||
ezc_functions.Insert("config_use_ssl", config_use_ssl);
|
||||
ezc_functions.Insert("config_use_ssl_static", config_use_ssl_static);
|
||||
ezc_functions.Insert("config_use_ssl_common", config_use_ssl_common);
|
||||
ezc_functions.Insert("config_url_proto", config_url_proto);
|
||||
ezc_functions.Insert("config_url_ssl_proto", config_url_ssl_proto);
|
||||
ezc_functions.Insert("config_base_url", config_base_url);
|
||||
ezc_functions.Insert("config_base_url_static", config_base_url_static);
|
||||
ezc_functions.Insert("config_base_url_common", config_base_url_common);
|
||||
ezc_functions.Insert("config_use_ssl", config_use_ssl);
|
||||
ezc_functions.Insert("config_use_ssl_static", config_use_ssl_static);
|
||||
ezc_functions.Insert("config_use_ssl_common", config_use_ssl_common);
|
||||
ezc_functions.Insert("config_url_proto", config_url_proto);
|
||||
ezc_functions.Insert("config_url_ssl_proto", config_url_ssl_proto);
|
||||
ezc_functions.Insert("config_base_url", config_base_url);
|
||||
ezc_functions.Insert("config_base_url_static", config_base_url_static);
|
||||
ezc_functions.Insert("config_base_url_common", config_base_url_common);
|
||||
ezc_functions.Insert("config_is_html_filter_allowed", config_is_html_filter_allowed);
|
||||
|
||||
|
||||
/*
|
||||
@@ -465,7 +466,8 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("item_admin_meta", item_admin_meta);
|
||||
ezc_functions.Insert("item_admin_meta_tab", item_admin_meta_tab);
|
||||
ezc_functions.Insert("item_admin_meta_tab_value", item_admin_meta_tab_value);
|
||||
ezc_functions.Insert("item_admin_meta_tab_has_next", item_admin_meta_tab_has_next);
|
||||
ezc_functions.Insert("item_admin_meta_tab_has_next", item_admin_meta_tab_has_next);
|
||||
ezc_functions.Insert("item_can_content_be_html_filtered", item_can_content_be_html_filtered);
|
||||
|
||||
ezc_functions.Insert("item_tab", item_tab);
|
||||
ezc_functions.Insert("item_tab_index", item_tab_index);
|
||||
@@ -678,6 +680,7 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("user_is_in_all_groups", user_is_in_all_groups);
|
||||
ezc_functions.Insert("user_can_use_html", user_can_use_html);
|
||||
ezc_functions.Insert("user_can_use_bbcode", user_can_use_bbcode);
|
||||
ezc_functions.Insert("user_can_use_other", user_can_use_other);
|
||||
ezc_functions.Insert("user_has_correct_time_zone",user_has_correct_time_zone);
|
||||
ezc_functions.Insert("user_time_zone_name", user_time_zone_name);
|
||||
ezc_functions.Insert("user_time_zone_id", user_time_zone_id);
|
||||
@@ -1042,7 +1045,7 @@ using namespace TemplatesFunctions;
|
||||
|
||||
Ezc::Pattern * index = 0;
|
||||
|
||||
if( !cur->request->last_item->html_template.empty() )
|
||||
if( (cur->request->function == &functions->fun_cat || cur->request->function == &functions->fun_run) && !cur->request->last_item->html_template.empty() )
|
||||
{
|
||||
index = SelectIndexPattern(cur->request->last_item->html_template);
|
||||
}
|
||||
|
@@ -111,6 +111,7 @@ namespace TemplatesFunctions
|
||||
void config_base_url(Info & i);
|
||||
void config_base_url_static(Info & i);
|
||||
void config_base_url_common(Info & i);
|
||||
void config_is_html_filter_allowed(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
@@ -359,6 +360,7 @@ namespace TemplatesFunctions
|
||||
void item_admin_meta_tab(Info & i);
|
||||
void item_admin_meta_tab_value(Info & i);
|
||||
void item_admin_meta_tab_has_next(Info & i);
|
||||
void item_can_content_be_html_filtered(Info & i);
|
||||
|
||||
void item_tab(Info & i);
|
||||
void item_tab_index(Info & i);
|
||||
@@ -573,6 +575,7 @@ namespace TemplatesFunctions
|
||||
void user_is_in_all_groups(Info & i);
|
||||
void user_can_use_html(Info & i);
|
||||
void user_can_use_bbcode(Info & i);
|
||||
void user_can_use_other(Info & i);
|
||||
void user_has_correct_time_zone(Info & i);
|
||||
void user_time_zone_name(Info & i);
|
||||
void user_time_zone_id(Info & i);
|
||||
|
@@ -128,6 +128,16 @@ void user_can_use_bbcode(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void user_can_use_other(Info & i)
|
||||
{
|
||||
if( !cur->session->puser )
|
||||
i.res = false;
|
||||
else
|
||||
i.res = system->CanUseOther(cur->session->puser->id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void user_has_correct_time_zone(Info & i)
|
||||
{
|
||||
if( cur->session->puser )
|
||||
|
Reference in New Issue
Block a user