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:
@@ -1244,6 +1244,7 @@ void App::FilterContent()
|
||||
// !! IMPROVE ME may some kind of html_filtered.reserve() here? (optimization)
|
||||
TemplatesFunctions::html_filter.Filter(req.out_main_stream.Str(), html_filtered);
|
||||
req.out_main_stream.Str(std::move(html_filtered)); // !! IMPROVE ME we do not have Str(&&) method
|
||||
log << log3 << "App: html in the main stream has been filtered" << logend;
|
||||
}
|
||||
|
||||
if( filter_json )
|
||||
@@ -1255,6 +1256,8 @@ void App::FilterContent()
|
||||
TemplatesFunctions::html_filter.Filter(stream.Str(), html_filtered);
|
||||
stream.Str(std::move(html_filtered));
|
||||
}
|
||||
|
||||
log << log3 << "App: html in json out streams have been filtered" << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,20 @@ void Item::Clear()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* we're using the HtmlFilter only for those contents
|
||||
*
|
||||
*/
|
||||
bool Item::CanContentBeHtmlFiltered(Item::ContentType ct)
|
||||
{
|
||||
return ct == ct_text || ct == ct_formatted_text || ct == ct_html || ct == ct_bbcode;
|
||||
}
|
||||
|
||||
bool Item::CanContentBeHtmlFiltered()
|
||||
{
|
||||
return CanContentBeHtmlFiltered(content_type);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ struct Item
|
||||
ct_formatted_text,
|
||||
ct_html,
|
||||
ct_bbcode,
|
||||
ct_other, // no auto-formatting is applied
|
||||
};
|
||||
|
||||
ContentType content_type;
|
||||
@@ -134,6 +135,10 @@ struct Item
|
||||
void Clear();
|
||||
|
||||
|
||||
static bool CanContentBeHtmlFiltered(Item::ContentType ct);
|
||||
bool CanContentBeHtmlFiltered();
|
||||
|
||||
|
||||
private:
|
||||
// used by the database
|
||||
long content_id; // content id in 'content' table
|
||||
|
||||
@@ -753,6 +753,12 @@ bool System::CanUseBBCode(long user_id)
|
||||
}
|
||||
|
||||
|
||||
// !! IMPROVE ME change to a better name
|
||||
bool System::CanUseOther(long user_id)
|
||||
{
|
||||
return IsSuperUser(user_id) || IsMemberOfGroup(user_id, L"allow_other");
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool System::IsSuperUser(long user_id)
|
||||
@@ -1399,6 +1405,7 @@ bool System::AddCommonFileToVar(const wchar_t * file_path, const wchar_t * url,
|
||||
file_content_item.type = Item::file;
|
||||
file_content_item.html_template = config->templates_index_raw;
|
||||
file_content_item.content = file_content;
|
||||
file_content_item.content_type = Item::ct_other;
|
||||
|
||||
return AddFile(file_content_item, false) == WINIX_ERR_OK;
|
||||
}
|
||||
|
||||
@@ -158,6 +158,7 @@ public:
|
||||
|
||||
bool CanUseHtml(long user_id);
|
||||
bool CanUseBBCode(long user_id);
|
||||
bool CanUseOther(long user_id);
|
||||
|
||||
bool IsSuperUser(long user_id);
|
||||
bool IsMemberOfGroup(long user_id, const wchar_t * group_name);
|
||||
|
||||
Reference in New Issue
Block a user