Adjust to new Template::getPage() returning value, not reference
このコミットが含まれているのは:
コミット
828d827c3d
@ -34,7 +34,7 @@ void Handler::setGeneralVars(TemplatePage &page)
|
||||
}
|
||||
Response Handler::errorResponse(std::string errortitle, std::string errormessage, int status)
|
||||
{
|
||||
TemplatePage &error = this->templ->getPage("error");
|
||||
TemplatePage error = this->templ->getPage("error");
|
||||
error.setVar("title", createPageTitle(errortitle));
|
||||
error.setVar("errortitle", errortitle);
|
||||
error.setVar("errormessage", errormessage);
|
||||
|
@ -32,7 +32,7 @@ Response HandlerAllCategories::handleRequest(const Request &r)
|
||||
"No categories",
|
||||
"This wiki does not have any categories defined yet or your query options did not yield any results");
|
||||
}
|
||||
TemplatePage &searchPage = this->templ->getPage("allcategories");
|
||||
TemplatePage searchPage = this->templ->getPage("allcategories");
|
||||
std::string body =
|
||||
this->templ->renderSearch(resultList, [&](std::string str) { return this->urlProvider->category(str); });
|
||||
searchPage.setVar("categorylist", body);
|
||||
|
@ -32,7 +32,7 @@ Response HandlerAllPages::handleRequest(const Request &r)
|
||||
{
|
||||
return errorResponse("No pages", "This wiki does not have any pages yet");
|
||||
}
|
||||
TemplatePage &searchPage = this->templ->getPage("allpages");
|
||||
TemplatePage searchPage = this->templ->getPage("allpages");
|
||||
std::string body = this->templ->renderSearch(resultList);
|
||||
searchPage.setVar("pagelist", body);
|
||||
searchPage.setVar("title", createPageTitle("All pages"));
|
||||
|
@ -33,7 +33,7 @@ Response HandlerCategory::handleRequest(const Request &r)
|
||||
}
|
||||
QueryOption qo = queryOption(r);
|
||||
auto resultList = categoryDao->fetchMembers(categoryname, qo);
|
||||
TemplatePage &searchPage = this->templ->getPage("show_category");
|
||||
TemplatePage searchPage = this->templ->getPage("show_category");
|
||||
std::string body = this->templ->renderSearch(resultList);
|
||||
searchPage.setVar("pagelist", body);
|
||||
searchPage.setVar("categoryname", categoryname);
|
||||
|
@ -55,7 +55,7 @@ Response HandlerLogin::handleRequest(const Request &r)
|
||||
{
|
||||
page = "index";
|
||||
}
|
||||
TemplatePage &loginTemplatePage = this->templ->getPage("login");
|
||||
TemplatePage loginTemplatePage = this->templ->getPage("login");
|
||||
setGeneralVars(loginTemplatePage);
|
||||
loginTemplatePage.setVar("loginurl", urlProvider->login(page));
|
||||
loginTemplatePage.setVar("title", createPageTitle("Login"));
|
||||
|
@ -63,8 +63,9 @@ void HandlerPage::setPageVars(TemplatePage &page, std::string pagename)
|
||||
if(!pagename.empty())
|
||||
{
|
||||
std::string headerlinks;
|
||||
TemplatePage &headerlink = this->templ->getPage("_headerlink");
|
||||
auto addHeaderLink = [&headerlinks, &headerlink](std::string href, std::string value) {
|
||||
TemplatePage headerlink = this->templ->getPage("_headerlink");
|
||||
auto addHeaderLink = [&headerlinks, &headerlink](std::string href, std::string value)
|
||||
{
|
||||
headerlink.setVar("href", href);
|
||||
headerlink.setVar("value", value);
|
||||
headerlinks += headerlink.render();
|
||||
|
@ -121,7 +121,7 @@ Response HandlerPageEdit::handleRequest(PageDao &pageDao, std::string pagename,
|
||||
}
|
||||
}
|
||||
|
||||
TemplatePage &templatePage = this->templ->getPage("page_creation");
|
||||
TemplatePage templatePage = this->templ->getPage("page_creation");
|
||||
templatePage.setVar("actionurl", urlProvider->editPage(pagename));
|
||||
templatePage.setVar("content", body);
|
||||
setPageVars(templatePage, pagename);
|
||||
|
@ -128,7 +128,7 @@ Response HandlerPageView::handleRequest(PageDao &pageDao, std::string pagename,
|
||||
return errorResponse("Database error", "While trying to fetch revision, a database error occured");
|
||||
}
|
||||
|
||||
TemplatePage &page = this->templ->getPage(templatepartname);
|
||||
TemplatePage page = this->templ->getPage(templatepartname);
|
||||
|
||||
Parser parser;
|
||||
Response result;
|
||||
|
@ -37,7 +37,7 @@ Response HandlerSearch::handleRequest(const Request &r)
|
||||
{
|
||||
return errorResponse("No results", "Your search for " + q + " did not yield any results.");
|
||||
}
|
||||
TemplatePage &searchPage = this->templ->getPage("search");
|
||||
TemplatePage searchPage = this->templ->getPage("search");
|
||||
std::string body = this->templ->renderSearch(resultList);
|
||||
searchPage.setVar("pagelist", body);
|
||||
searchPage.setVar("searchterm", q);
|
||||
|
@ -51,7 +51,7 @@ Response HandlerUserSettings::handleRequest(const Request &r)
|
||||
}
|
||||
}
|
||||
|
||||
TemplatePage &userSettingsPage = this->templ->getPage("usersettings");
|
||||
TemplatePage userSettingsPage = this->templ->getPage("usersettings");
|
||||
setGeneralVars(userSettingsPage);
|
||||
userSettingsPage.setVar("usersettingsurl", urlProvider->userSettings());
|
||||
userSettingsPage.setVar("title", createPageTitle("User settings - " + this->userSession->user.login));
|
||||
|
@ -59,7 +59,7 @@ Response RequestWorker::processRequest(const Request &r)
|
||||
if(session.loggedIn && session.csrf_token != r.post("csrf_token"))
|
||||
{
|
||||
// TODO: this is code duplication
|
||||
TemplatePage &error = this->templ->getPage("error");
|
||||
TemplatePage error = this->templ->getPage("error");
|
||||
error.setVar("errortitle", "Invalid csrf token");
|
||||
error.setVar("errormessage", "Invalid csrf token");
|
||||
return {403, error.render()};
|
||||
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする