Changing files to use the $page->add_http_header() method instead.

This commit is contained in:
green-ponies (jgen) 2011-08-30 16:38:46 -04:00
parent bd31bcd79a
commit c30c898c4e
9 changed files with 26 additions and 24 deletions

View file

@ -159,8 +159,8 @@ class DanbooruApi implements Extension
{
$fp = fopen($url, "r");
if(!$fp) {
header("HTTP/1.0 409 Conflict");
header("X-Danbooru-Errors: fopen read error");
$page->add_http_header("HTTP/1.0 409 Conflict");
$page->add_http_header("X-Danbooru-Errors: fopen read error");
}
$data = "";
@ -193,8 +193,8 @@ class DanbooruApi implements Extension
$filename = basename($url);
} else
{ // Nothing was specified at all
header("HTTP/1.0 409 Conflict");
header("X-Danbooru-Errors: no input files");
$page->add_http_header("HTTP/1.0 409 Conflict");
$page->add_http_header("X-Danbooru-Errors: no input files");
return;
}
@ -206,8 +206,8 @@ class DanbooruApi implements Extension
{
if(strtolower($_REQUEST['md5']) != $hash)
{
header("HTTP/1.0 409 Conflict");
header("X-Danbooru-Errors: md5 mismatch");
$page->add_http_header("HTTP/1.0 409 Conflict");
$page->add_http_header("X-Danbooru-Errors: md5 mismatch");
return;
}
}
@ -217,11 +217,11 @@ class DanbooruApi implements Extension
// Does it exist already?
$existing = Image::by_hash($hash);
if(!is_null($existing)) {
header("HTTP/1.0 409 Conflict");
header("X-Danbooru-Errors: duplicate");
$page->add_http_header("HTTP/1.0 409 Conflict");
$page->add_http_header("X-Danbooru-Errors: duplicate");
$existinglink = make_link("post/view/" . $existing->id);
if($danboorup_kludge) $existinglink=make_http($existinglink);
header("X-Danbooru-Location: $existinglink");
$page->add_http_header("X-Danbooru-Location: $existinglink");
return; // wut!
}
@ -246,21 +246,21 @@ class DanbooruApi implements Extension
// Did we POST or GET this call?
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
header("X-Danbooru-Location: $newid");
$page->add_http_header("X-Danbooru-Location: $newid");
}
else
header("Location: $newid");
$page->add_http_header("Location: $newid");
}
catch(UploadException $ex) {
// Did something screw up?
header("HTTP/1.0 409 Conflict");
header("X-Danbooru-Errors: exception - " . $ex->getMessage());
$page->add_http_header("HTTP/1.0 409 Conflict");
$page->add_http_header("X-Danbooru-Errors: exception - " . $ex->getMessage());
return;
}
} else
{
header("HTTP/1.0 409 Conflict");
header("X-Danbooru-Errors: authentication error");
$page->add_http_header("HTTP/1.0 409 Conflict");
$page->add_http_header("X-Danbooru-Errors: authentication error");
return;
}
}
@ -387,7 +387,7 @@ class DanbooruApi implements Extension
if(($event->get_arg(1) == 'post') && ($event->get_arg(2) == 'show'))
{
$fixedlocation = make_link("post/view/" . $event->get_arg(3));
header("Location: $fixedlocation");
$page->add_http_header("Location: $fixedlocation");
}
}

View file

@ -14,8 +14,9 @@ class Handle404 extends SimpleExtension {
// hax.
if($page->mode == "page" && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) {
$h_pagename = html_escape(implode('/', $event->args));
header("HTTP/1.0 404 Page Not Found");
log_debug("handle_404", "Hit 404: $h_pagename");
$page->add_http_header("HTTP/1.0 404 Page Not Found",5);
$page->set_title("404");
$page->set_heading("404 - No Handler Found");
$page->add_block(new NavBlock());

View file

@ -283,7 +283,8 @@ class Upload implements Extension {
if($event->image_id == -1) {
throw new UploadException("File type not recognised");
}
header("X-Shimmie-Image-ID: ".int_escape($event->image_id));
//header("X-Shimmie-Image-ID: ".int_escape($event->image_id));
$page->add_http_header("X-Shimmie-Image-ID: ".int_escape($event->image_id));
}
catch(UploadException $ex) {
$this->theme->display_upload_error($page, "Error with ".html_escape($file['name']),

View file

@ -10,7 +10,7 @@ class Themelet {
public function display_permission_denied(Page $page) {
header("HTTP/1.0 403 Permission Denied");
$page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page");
}

View file

@ -18,7 +18,7 @@ class Themelet {
* A specific, common error message
*/
public function display_permission_denied(Page $page) {
header("HTTP/1.0 403 Permission Denied");
$page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page");
}

View file

@ -18,7 +18,7 @@ class Themelet {
* A specific, common error message
*/
public function display_permission_denied(Page $page) {
header("HTTP/1.0 403 Permission Denied");
$page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page");
}

View file

@ -18,7 +18,7 @@ class Themelet {
* A specific, common error message
*/
public function display_permission_denied(Page $page) {
header("HTTP/1.0 403 Permission Denied");
$page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page");
}

View file

@ -16,7 +16,7 @@ class Themelet {
* A specific, common error message
*/
public function display_permission_denied(Page $page) {
header("HTTP/1.0 403 Permission Denied");
$page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page");
}

View file

@ -18,7 +18,7 @@ class Themelet {
* A specific, common error message
*/
public function display_permission_denied(Page $page) {
header("HTTP/1.0 403 Permission Denied");
$page->add_http_header("HTTP/1.0 403 Permission Denied");
$this->display_error($page, "Permission Denied", "You do not have permission to access this page");
}