1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 23:43:12 +02:00

Allow escaping brackets in webpanel templates and redirect users to the homepage when their session is not found

This commit is contained in:
Adam
2012-12-15 23:51:25 -05:00
parent 8e3ab0d10b
commit c49f03f985
2 changed files with 8 additions and 1 deletions
@@ -115,9 +115,12 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n
Anope::string finished;
bool escaped = false;
for (unsigned j = 0; j < buf.length(); ++j)
{
if (buf[j] == '{')
if (buf[j] == '\\' && j + 1 < buf.length() && (buf[j + 1] == '{' || buf[j + 1] == '}'))
escaped = true;
else if (buf[j] == '{' && !escaped)
{
size_t f = buf.substr(j).find('}');
if (f == Anope::string::npos)
@@ -241,6 +244,8 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n
}
else
{
escaped = false;
// If the if stack is empty or we are in a true statement
bool ifok = IfStack.empty() || IfStack.top();
bool forok = ForLoop::Stack.empty() || !ForLoop::Stack.back().finished(r);