The page class now supports both HTML headers and HTTP headers.
From the comment: FIXME: should be $page->blah
This commit is contained in:
parent
19a3a5a6f9
commit
bd31bcd79a
@ -109,6 +109,7 @@ class Page {
|
|||||||
var $subheading = "";
|
var $subheading = "";
|
||||||
var $quicknav = "";
|
var $quicknav = "";
|
||||||
var $html_headers = array();
|
var $html_headers = array();
|
||||||
|
var $http_headers = array();
|
||||||
var $blocks = array();
|
var $blocks = array();
|
||||||
/** @publicsection */
|
/** @publicsection */
|
||||||
|
|
||||||
@ -144,8 +145,9 @@ class Page {
|
|||||||
/**
|
/**
|
||||||
* Add a http header to be sent to the client.
|
* Add a http header to be sent to the client.
|
||||||
*/
|
*/
|
||||||
public function add_header($line) {
|
public function add_http_header($line, $position=50) {
|
||||||
die("Function is not impliemented yet.");
|
while(isset($this->http_headers[$position])) $position++;
|
||||||
|
$this->http_headers[$position] = $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,8 +167,16 @@ class Page {
|
|||||||
public function display() {
|
public function display() {
|
||||||
global $page;
|
global $page;
|
||||||
|
|
||||||
header("Content-type: {$this->type}");
|
add_http_header("Content-type: {$this->type}", 1);
|
||||||
header("X-Powered-By: SCore-".SCORE_VERSION);
|
add_http_header("X-Powered-By: SCore-".SCORE_VERSION, 2);
|
||||||
|
|
||||||
|
if (!headers_sent()) {
|
||||||
|
foreach($this->http_headers as $head){
|
||||||
|
header($head);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "Error: Headers have already been sent to the client.";
|
||||||
|
}
|
||||||
|
|
||||||
switch($this->mode) {
|
switch($this->mode) {
|
||||||
case "page":
|
case "page":
|
||||||
|
@ -367,13 +367,13 @@ class ImageIO extends SimpleExtension {
|
|||||||
}
|
}
|
||||||
$gmdate_mod = gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT';
|
$gmdate_mod = gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT';
|
||||||
|
|
||||||
// FIXME: should be $page->blah
|
|
||||||
if($if_modified_since == $gmdate_mod) {
|
if($if_modified_since == $gmdate_mod) {
|
||||||
header("HTTP/1.0 304 Not Modified");
|
$page->add_http_header("HTTP/1.0 304 Not Modified",3);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
header("Last-Modified: $gmdate_mod");
|
/* FIXME: The Expires date Needs to be admin-configurable */
|
||||||
header("Expires: Fri, 2 Sep 2101 12:42:42 GMT"); // War was beginning
|
$page->add_http_header("Last-Modified: $gmdate_mod");
|
||||||
|
$page->add_http_header("Expires: Fri, 2 Sep 2101 12:42:42 GMT"); // War was beginning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user