From c92e9055fbffabddc7aed9ea399baf4dde78424e Mon Sep 17 00:00:00 2001 From: prozacx Date: Sat, 11 Feb 2006 23:06:00 +0000 Subject: [PATCH] Print an error page when templates can not be opened git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@645 726aef4b-f618-498e-8847-2d620e286838 --- modules/webadmin.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp index 4d4904f4..129c119d 100644 --- a/modules/webadmin.cpp +++ b/modules/webadmin.cpp @@ -164,21 +164,24 @@ void CWebAdminSock::PrintPage(CString& sPageRet, const CString& sTmplName) { sPageRet.clear(); // @todo possibly standardize the location of meta files such as these skins // @todo give an option for changing the current skin from 'default' + CString sTmpl; + + if (IsAdmin()) { + sTmpl = GetSkinDir(); + } + + sTmpl += sTmplName; + if (!m_Template.SetFile(GetSkinDir() + sTmplName)) { - CString sTmpl; - - if (IsAdmin()) { - sTmpl = GetSkinDir(); - } - - sTmpl += sTmplName; - sPageRet = CHTTPSock::GetErrorPage(404, "Not Found", "The template for this page [" + sTmpl + "] was not found."); return; } stringstream oStr; - m_Template.Print(oStr); + if (!m_Template.Print(oStr)) { + sPageRet = CHTTPSock::GetErrorPage(403, "Forbidden", "The template for this page [" + sTmpl + "] can not be opened."); + return; + } sPageRet = oStr.str(); }