Mercurial > SimpleWebPresenter
changeset 91:1d4c980f4255
Change the way headers are set.
Disabled validation for non-html pages.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Thu, 18 Oct 2012 00:28:48 +0200 |
| parents | aafc23919e79 |
| children | f468365813c9 |
| files | Flag.inc Page.inc Sitemap.inc |
| diffstat | 3 files changed, 17 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Flag.inc Wed Oct 17 21:23:02 2012 +0200 +++ b/Flag.inc Thu Oct 18 00:28:48 2012 +0200 @@ -66,6 +66,12 @@ return false; } + function mayValidate() + { + return false; + } + + /** * Produce the actual content */ @@ -79,7 +85,7 @@ } else { $flag = new PageContent($flag); - $flag->addHeader("Content-Type: image/png"); + $flag->setHeader('Content-Type', 'image/png'); return $flag; } }
--- a/Page.inc Wed Oct 17 21:23:02 2012 +0200 +++ b/Page.inc Thu Oct 18 00:28:48 2012 +0200 @@ -18,9 +18,9 @@ $this->content = $content; } - function addHeader($txt) + function setHeader($headername, $value) { - array_push($this->headers, $txt); + $this->headers[$headername] = $value; } function __toString() @@ -160,8 +160,8 @@ function display() { $res = $this->genPage(); - foreach ($res->headers as $header) { - header($header); + foreach ($res->headers as $header => $value) { + header("${header}: ${value}"); } print $res; }
--- a/Sitemap.inc Wed Oct 17 21:23:02 2012 +0200 +++ b/Sitemap.inc Thu Oct 18 00:28:48 2012 +0200 @@ -33,6 +33,11 @@ return false; } + function mayValidate() + { + return false; + } + function generateContent() { /// The final output variable $out = '<?xml version="1.0" encoding="UTF-8"?>'; @@ -104,7 +109,7 @@ $out .= '</urlset>'; $res = new PageContent($out); - $res->addHeader('Content-type: application/xml'); + $res->setHeader('Content-type', 'application/xml'); return $res; } }
