X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fcore.php;h=b7def03ef0cf9b7554fff4bb7b81ae343dc7e850;hb=1d10d3fd659fa8eb7c663d6bb599bc8bbc0feeb3;hp=e9766b858e002cd578342bfac70afc6df3313174;hpb=b62f88580b5d5a12e804094ddc46033b62a8dbff;p=platal.git diff --git a/modules/core.php b/modules/core.php index e9766b8..b7def03 100644 --- a/modules/core.php +++ b/modules/core.php @@ -21,36 +21,52 @@ class CoreModule extends PLModule { - function menu_entries() - { - return array(); - } - function handlers() { return array( - '403' => $this->make_hook('handler_403', AUTH_PUBLIC, ''), - '404' => $this->make_hook('handler_404', AUTH_PUBLIC, ''), + '403' => $this->make_hook('403', AUTH_PUBLIC), + '404' => $this->make_hook('404', AUTH_PUBLIC), + 'purge_cache' => $this->make_hook('purge_cache', AUTH_COOKIE, 'admin'), + + 'valid.html' => $this->make_hook('valid', AUTH_PUBLIC), + 'favicon.ico' => $this->make_hook('favicon', AUTH_PUBLIC), ); } - function handler_auth(&$page) + function handler_valid(&$page) { - return PL_OK; + readfile($page->compile_dir.'/valid.html'); + exit; } function handler_403(&$page) { - header('HTTP/1.0 403 Forbidden'); + header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); $page->changeTpl('403.tpl'); - return PL_OK; } function handler_404(&$page) { - header('HTTP/1.0 404 Not Found'); + header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); $page->changeTpl('404.tpl'); - return PL_OK; + } + + function handler_favicon(&$page) + { + $data = file_get_contents(dirname(__FILE__).'/../htdocs/images/favicon.png'); + header('Content-Type: image/png'); + echo $data; + exit; + } + + function handler_purge_cache(&$page) + { + require_once 'wiki.inc.php'; + + $page->clear_compiled_tpl(); + wiki_clear_all_cache(); + + http_redirect(empty($_SERVER['HTTP_REFERER']) ? './' : $_SERVER['HTTP_REFERER']); } }