mirror of
https://github.com/ThunixdotNet/wiki.git
synced 2026-01-24 12:20:19 +00:00
Handle 404 gracefully
This commit is contained in:
3
includes/404.md
Normal file
3
includes/404.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# 404
|
||||||
|
|
||||||
|
This page ("$page") does not exist.
|
||||||
10
wiki.php
10
wiki.php
@@ -7,14 +7,11 @@ Parsedown is licensed under the MIT license.
|
|||||||
include('config.php');
|
include('config.php');
|
||||||
include('parsedown-1.7.3/Parsedown.php');
|
include('parsedown-1.7.3/Parsedown.php');
|
||||||
|
|
||||||
$page = $_GET['page'];
|
$page = isset($_GET['page']) ? $_GET['page'] : 'main';
|
||||||
|
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new Parsedown();
|
||||||
$Parsedown->setSafeMode(true);
|
$Parsedown->setSafeMode(true);
|
||||||
|
|
||||||
if ( $page == "") {
|
|
||||||
$page = "main";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($_GET['style']))
|
if(isset($_GET['style']))
|
||||||
$site_style = $_GET['style'];
|
$site_style = $_GET['style'];
|
||||||
else
|
else
|
||||||
@@ -22,7 +19,8 @@ else
|
|||||||
|
|
||||||
$header = file_get_contents("includes/header.md");
|
$header = file_get_contents("includes/header.md");
|
||||||
$sidebar = file_get_contents("includes/sidebar.md");
|
$sidebar = file_get_contents("includes/sidebar.md");
|
||||||
$content = file_get_contents("articles/$page.md");
|
$content_file = "articles/$page.md";
|
||||||
|
$content = file_exists($content_file) ? file_get_contents($content_file) : str_replace('$page', "$page", file_get_contents("includes/404.md"));
|
||||||
$footer = file_get_contents("includes/footer.md");
|
$footer = file_get_contents("includes/footer.md");
|
||||||
|
|
||||||
print "<!DOCTYPE html>
|
print "<!DOCTYPE html>
|
||||||
|
|||||||
Reference in New Issue
Block a user