This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/handle_404/main.php
shish a625fcd787 the bulk of theme engine 2.0; it's still rough, but it works
git-svn-id: file:///home/shish/svn/shimmie2/trunk@201 7f39781d-f577-437e-ae19-be835c7a54ca
2007-06-30 01:19:11 +00:00

20 lines
607 B
PHP

<?php
class Handle404 extends Extension {
public function receive_event($event) {
if(is_a($event, 'PageRequestEvent')) {
global $page;
// hax.
if($page->mode == "page" && (!isset($page->blocks) || count($page->blocks) == 0)) {
$h_pagename = html_escape($event->page);
header("HTTP/1.0 404 Page Not Found");
$page->set_title("404");
$page->set_heading("404 - No Handler Found");
$page->add_block(new NavBlock());
$page->add_block(new Block("Explanation", "No handler could be found for the page '$h_pagename'"));
}
}
}
}
add_event_listener(new Handle404(), 99);
?>