Mercurial > SimpleWebPresenter
changeset 90:aafc23919e79
Validating errorPage.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Wed, 17 Oct 2012 21:23:02 +0200 |
| parents | fd39d7d5e9be |
| children | 1d4c980f4255 |
| files | FileCacheSet.inc common-functions.inc constants.inc |
| diffstat | 3 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/FileCacheSet.inc Wed Oct 17 20:43:25 2012 +0200 +++ b/FileCacheSet.inc Wed Oct 17 21:23:02 2012 +0200 @@ -66,7 +66,7 @@ { if (!file_exists($path)) { Logger::warn("${path} does not exist"); - errorPage("Resource is not available"); + errorPage("Resource is not available", 404); } array_push($this->files, $path);
--- a/common-functions.inc Wed Oct 17 20:43:25 2012 +0200 +++ b/common-functions.inc Wed Oct 17 21:23:02 2012 +0200 @@ -115,7 +115,15 @@ function errorPage($errorText, $errorCode = 403) { header(StatusCodes::httpHeaderFor($errorCode)); + print '<?xml version="1.0" encoding="UTF-8"?>'; + print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"><head>'; + + print '<title>' . StatusCodes::httpHeaderFor($errorCode) . '</title>'; + print '</head><body>'; print "<div id=\"page\"><h1>${errorText}</h1></div>"; + print '</body></html>'; + exit; }
--- a/constants.inc Wed Oct 17 20:43:25 2012 +0200 +++ b/constants.inc Wed Oct 17 21:23:02 2012 +0200 @@ -8,14 +8,14 @@ define(VERBOSITY_WARNING, 10); define(VERBOSITY_DEBUG, 100); -define(DEBUG_LEVEL, VERBOSITY_WARNING); +define(DEBUG_LEVEL, VERBOSITY_NONE); define(DUMP, 0); define(MAX_RECURSE, 50); define(CACHING, 1); define(VALIDATE, 0); -define(ABORT_ON_LOG, TRUE); +define(ABORT_ON_LOG, FALSE); if (DEBUG_LEVEL >= VERBOSITY_WARNING) {
