From 1845b6f52caa1f81e14101d836f1f3a3400f6e08 Mon Sep 17 00:00:00 2001 From: prozacx Date: Sat, 11 Feb 2006 22:17:29 +0000 Subject: [PATCH] Print an error page when templates do not exist git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@644 726aef4b-f618-498e-8847-2d620e286838 --- modules/webadmin.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp index 2e76f08e..4d4904f4 100644 --- a/modules/webadmin.cpp +++ b/modules/webadmin.cpp @@ -143,10 +143,14 @@ private: CString CWebAdminSock::GetSkinDir() { CString sModPath = CZNC::Get().FindModPath(m_pModule->GetModName()); // @todo store the path to the module at load time and store it in a member var which can be used here + // Remove the file.so portion from the path while (!sModPath.empty() && sModPath.Right(1) != "/") { sModPath.RightChomp(); } + // Remove the last / + sModPath.RightChomp(); + CString sSkinDir = sModPath + "/" + m_pModule->GetModName() + "/skins/" + m_pModule->GetSkinName() + "/"; if (CDir::Exists(sSkinDir)) { @@ -161,6 +165,15 @@ void CWebAdminSock::PrintPage(CString& sPageRet, const CString& sTmplName) { // @todo possibly standardize the location of meta files such as these skins // @todo give an option for changing the current skin from 'default' 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; }