'send_bug' => $this->make_hook('bug', AUTH_COOKIE),
'purge_cache' => $this->make_hook('purge_cache', AUTH_COOKIE, 'admin'),
'kill_sessions' => $this->make_hook('kill_sessions', AUTH_COOKIE, 'admin'),
+ 'sql_errors' => $this->make_hook('sqlerror', AUTH_COOKIE, 'admin'),
'get_rights' => $this->make_hook('get_rights', AUTH_MDP, 'admin'),
'wiki_help' => $this->make_hook('wiki_help', AUTH_PUBLIC),
function handler_favicon(&$page)
{
- $data = file_get_contents(dirname(__FILE__).'/../htdocs/images/favicon.ico');
+ global $globals;
+ $data = file_get_contents($globals->spoolroot . '/htdocs/images/favicon.ico');
header('Content-Type: image/x-icon');
echo $data;
exit;
function handler_robotstxt(&$page)
{
global $globals;
- if (!$globals->core->restricted_platal) {
- return PL_NOT_FOUND;
+
+ $disallowed_uris = array();
+ if ($globals->core->restricted_platal) {
+ $disallowed_uris[] = '/';
+ } else if (!empty($globals->core->robotstxt_disallowed_uris)) {
+ $disallowed_uris = preg_split('/[\s,]+/',
+ $globals->core->robotstxt_disallowed_uris,
+ -1, PREG_SPLIT_NO_EMPTY);
}
- header('Content-Type: text/plain');
- echo "User-agent: *\n";
- echo "Disallow: /\n";
- exit;
+ if (count($disallowed_uris) > 0) {
+ header('Content-Type: text/plain');
+ echo "User-agent: *\n";
+ foreach ($disallowed_uris as $uri) {
+ echo "Disallow: $uri\n";
+ }
+ exit;
+ }
+ return PL_NOT_FOUND;
}
function handler_purge_cache(&$page)
function handler_wiki_preview(&$page, $action = 'title')
{
header('Content-Type: text/html; charset=utf-8');
- $text = Get::v('text');
+ $text = Env::v('text');
echo MiniWiki::wikiToHtml($text, $action == 'title');
exit;
}
+
+ function handler_sqlerror(&$page, $clear = null) {
+ global $globals;
+ $file = @fopen($globals->spoolroot . '/spool/tmp/query_errors', 'r');
+ if ($file !== false) {
+ echo '<html><body>';
+ fpassthru($file);
+ fclose($file);
+ echo '</html></body>';
+ }
+ if ($clear == 'clear') {
+ @unlink($globals->spoolroot . '/spool/tmp/query_errors');
+ }
+ exit;
+ }
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: