added: item content type: raw
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@549 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -63,36 +63,79 @@ void item_content_noescape(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void item_print_content(Info & i)
|
||||
void item_content_type_is(Info & i)
|
||||
{
|
||||
if( request.item.content_type == 0 ) // simple txt
|
||||
switch(request.item.content_type)
|
||||
{
|
||||
HtmlEscape(i.out, request.item.content);
|
||||
}
|
||||
else
|
||||
if( request.item.content_type == 1 ) // formatted txt
|
||||
{
|
||||
HtmlEscapeFormTxt(i.out, request.item.content);
|
||||
}
|
||||
else
|
||||
if( request.item.content_type == 2 ) // html
|
||||
{
|
||||
if( request.CanUseHtml(request.item.user_id) )
|
||||
i.out << request.item.content;
|
||||
else
|
||||
HtmlEscape(i.out, request.item.content);
|
||||
}
|
||||
else
|
||||
if( request.item.content_type == 3 ) // bbcode
|
||||
{
|
||||
if( request.CanUseBBCode(request.item.user_id) )
|
||||
HtmlEscape(i.out, request.item.content); // tutaj bedzie parsowanie bbcodu i tworzenie odpowiadajacego mu html-a
|
||||
else
|
||||
i.out << request.item.content;
|
||||
case Item::ct_text:
|
||||
i.out_string = "text";
|
||||
break;
|
||||
|
||||
case Item::ct_formatted_text:
|
||||
i.out_string = "formatted text";
|
||||
break;
|
||||
|
||||
case Item::ct_html:
|
||||
i.out_string = "html";
|
||||
break;
|
||||
|
||||
case Item::ct_bbcode:
|
||||
i.out_string = "bbcode";
|
||||
break;
|
||||
|
||||
case Item::ct_raw:
|
||||
i.out_string = "raw";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void item_print_content(std::ostringstream & out, const std::string & content, Item::ContentType content_type)
|
||||
{
|
||||
if( content_type == Item::ct_text )
|
||||
{
|
||||
HtmlEscape(out, content);
|
||||
}
|
||||
else
|
||||
if( content_type == Item::ct_formatted_text )
|
||||
{
|
||||
HtmlEscapeFormTxt(out, content);
|
||||
}
|
||||
else
|
||||
if( content_type == Item::ct_html )
|
||||
{
|
||||
if( request.CanUseHtml(request.item.user_id) )
|
||||
out << content;
|
||||
else
|
||||
HtmlEscape(out, content);
|
||||
}
|
||||
else
|
||||
if( content_type == Item::ct_bbcode )
|
||||
{
|
||||
if( request.CanUseBBCode(request.item.user_id) )
|
||||
out << content; // !! tutaj bedzie parsowanie bbcodu i tworzenie odpowiadajacego mu html-a
|
||||
else
|
||||
HtmlEscape(out, content);
|
||||
}
|
||||
else
|
||||
if( content_type == Item::ct_raw )
|
||||
{
|
||||
if( request.CanUseRaw(request.item.user_id) )
|
||||
out << content;
|
||||
else
|
||||
HtmlEscape(out, content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void item_print_content(Info & i)
|
||||
{
|
||||
item_print_content(i.out, request.item.content, request.item.content_type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void item_privileges(Info & i)
|
||||
{
|
||||
i.out << std::setbase(8) << request.item.privileges << std::setbase(10);
|
||||
@@ -212,6 +255,7 @@ void item_dates_equal(Info & i)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void item_run(Info & i)
|
||||
{
|
||||
if( !request.is_item )
|
||||
@@ -227,8 +271,12 @@ void item_run(Info & i)
|
||||
}
|
||||
|
||||
Ezc::Pattern * p = pattern_cacher.GetPattern(request.item);
|
||||
Ezc::Generator gen(i.out, *p, functions);
|
||||
std::ostringstream item_run_content;
|
||||
|
||||
Ezc::Generator gen(item_run_content, *p, functions);
|
||||
gen.Generate();
|
||||
|
||||
item_print_content(i.out, item_run_content.str(), request.item.content_type);
|
||||
}
|
||||
|
||||
|
||||
@@ -354,33 +402,10 @@ void item_tab_print_content(Info & i)
|
||||
if( item_index >= request.item_table.size() )
|
||||
return;
|
||||
|
||||
int type = request.item_table[item_index].content_type;
|
||||
std::string & content = request.item_table[item_index].content;
|
||||
Item::ContentType type = request.item_table[item_index].content_type;
|
||||
|
||||
if( type == 0 ) // simple txt
|
||||
{
|
||||
HtmlEscape(i.out, request.item_table[item_index].content);
|
||||
}
|
||||
else
|
||||
if( type == 1 ) // formatted txt
|
||||
{
|
||||
HtmlEscapeFormTxt(i.out, request.item_table[item_index].content);
|
||||
}
|
||||
else
|
||||
if( type == 2 ) // html
|
||||
{
|
||||
if( request.CanUseHtml(request.item_table[item_index].user_id) )
|
||||
i.out << request.item_table[item_index].content;
|
||||
else
|
||||
HtmlEscape(i.out, request.item_table[item_index].content);
|
||||
}
|
||||
else
|
||||
if( type == 3 ) // bbcode
|
||||
{
|
||||
if( request.CanUseBBCode(request.item_table[item_index].user_id) )
|
||||
HtmlEscape(i.out, request.item_table[item_index].content); // tutaj bedzie parsowanie bbcodu i tworzenie odpowiadajacego mu html-a
|
||||
else
|
||||
i.out << request.item_table[item_index].content;
|
||||
}
|
||||
item_print_content(i.out, content, type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user