Add [cmd:allowinclude]
Pages must specify whether they want to be included or not. Otherwise there too many surprises possibe, enforcing access restrictions will get more complicated
This commit is contained in:
parent
86890660f4
commit
2102cf4e6b
@ -6,7 +6,11 @@ std::string DynamicContentIncludePage::render()
|
|||||||
auto rev = revisionDao->getCurrentForPage(this->argument);
|
auto rev = revisionDao->getCurrentForPage(this->argument);
|
||||||
if(rev)
|
if(rev)
|
||||||
{
|
{
|
||||||
return rev->content;
|
/* Quite dirty */
|
||||||
|
if(rev->content.find("[cmd:allowinclude]1[") != std::string::npos)
|
||||||
|
{
|
||||||
|
return rev->content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ std::string Parser::parse(const PageDao &pagedao, UrlProvider &provider, const s
|
|||||||
std::string result;
|
std::string result;
|
||||||
// we don't care about commands, but we nevertheless replace them with empty strings
|
// we don't care about commands, but we nevertheless replace them with empty strings
|
||||||
std::regex tagfinder(
|
std::regex tagfinder(
|
||||||
R"(\[(b|i|u|li||ul|ol|code|blockquote|img|link|wikilink|h\d|cmd:visible|cmd:rename|cmd:redirect|cmd:pagetitle|category|dynamic:postlist|dynamic:includepage|dynamic:getvar|dynamic:setvar)*?\]((\s|\S)*?)\[/\1])");
|
R"(\[(b|i|u|li||ul|ol|code|blockquote|img|link|wikilink|h\d|cmd:visible|cmd:rename|cmd:redirect|cmd:pagetitle|cmd:allowinclude|category|dynamic:postlist|dynamic:includepage|dynamic:getvar|dynamic:setvar)*?\]((\s|\S)*?)\[/\1])");
|
||||||
result = utils::regex_callback_replacer(
|
result = utils::regex_callback_replacer(
|
||||||
tagfinder, content,
|
tagfinder, content,
|
||||||
[&](std::smatch &match)
|
[&](std::smatch &match)
|
||||||
|
Loading…
Reference in New Issue
Block a user