8chan/smart-build: includable 404.php

This commit is contained in:
czaks 2015-04-07 01:44:55 +02:00
parent ac693427f8
commit 51b93e643d
3 changed files with 9 additions and 1 deletions

View File

@ -198,6 +198,8 @@ $config['spam']['unicode'] = false;
$config['twig_cache'] = false; $config['twig_cache'] = false;
$config['report_captcha'] = true; $config['report_captcha'] = true;
$config['page_404'] = 'page_404';
// 8chan specific mod pages // 8chan specific mod pages
require '8chan-mod-config.php'; require '8chan-mod-config.php';
@ -206,4 +208,3 @@ require_once 'instance-functions.php';
// Load database credentials // Load database credentials
require "secrets.php"; require "secrets.php";

View File

@ -18,3 +18,7 @@ function max_posts_per_hour($post) {
return ($r['count'] > $config['hour_max_threads']); return ($r['count'] > $config['hour_max_threads']);
} }
} }
function page_404() {
include('404.php');
}

View File

@ -147,6 +147,9 @@ function die_404() { global $config;
header("Status: 404 Not Found"); header("Status: 404 Not Found");
echo "<h1>404 Not Found</h1><p>Page doesn't exist<hr><address>vichan</address>"; echo "<h1>404 Not Found</h1><p>Page doesn't exist<hr><address>vichan</address>";
} }
elseif (is_callable($config['page_404'])) {
$config['page_404']();
}
else { else {
header("Location: ".$config['page_404']); header("Location: ".$config['page_404']);
} }