wiki.php/wiki.php

103 lines
2.4 KiB
PHP
Raw Normal View History

2019-07-01 01:18:23 +00:00
<?php
2019-07-04 16:27:10 +00:00
/*
This code is Copyright(c) 2019 by ubergeek under the AGPL 3 or later.
2019-07-04 16:27:10 +00:00
Parsedown is licensed under the MIT license.
ParsedownExtra is licensed under the MIT license.
2019-07-04 16:27:10 +00:00
*/
2019-07-01 01:18:23 +00:00
include('config.php');
include('parsedown/Parsedown.php');
include('parsedownextra/ParsedownExtra.phgp');
2019-07-01 01:18:23 +00:00
$page = $_GET['page'];
$style = $_GET['style'];
2019-07-04 16:27:10 +00:00
$Parsedown = new Parsedown();
2019-07-04 16:31:20 +00:00
$Parsedown->setSafeMode(true);
2019-07-01 01:18:23 +00:00
2023-04-07 17:23:46 +00:00
$page = htmlentities($page);
$style = htmlentities($style);
2019-07-01 01:18:23 +00:00
if ( $page == "") {
2023-04-07 17:23:46 +00:00
$page = "main";
}
if (!file_exists("$doc_root/articles/$page.md")) {
$page = "main";
}
2019-07-01 01:18:23 +00:00
if ( $style == "") {
2023-04-07 17:23:46 +00:00
if ( $site_style == "") {
$site_style="site";
}
}
else {
2023-04-07 17:23:46 +00:00
if (file_exists("$doc_root/includes/$style.md")) {
$site_style=$style;
}
else {
$site_style="site";
}
}
2019-07-04 16:27:10 +00:00
$header = file_get_contents("$doc_root/includes/header.md");
$sidebar = file_get_contents("$doc_root/includes/sidebar.md");
$content = file_get_contents("$doc_root/articles/$page.md");
$footer = file_get_contents("$doc_root/includes/footer.md");
2019-07-01 01:18:23 +00:00
print "<!DOCTYPE html>
<html lang='en'>
<head>
<title>$site_name - $page</title>
<link rel='stylesheet' type='text/css' href='$site_root/includes/$site_style.css'>
2019-07-01 01:18:23 +00:00
</head>
<body>
<!-- Begin Header -->
<div id='header'>";
2019-07-04 16:27:10 +00:00
print $Parsedown->text($header);
print "
</div>
<!-- End Header -->
";
2019-07-01 01:18:23 +00:00
print "<hr>
<div id='body'>
<!-- Begin Sidebar -->
<div id='sidebar'>
";
2019-07-04 16:27:10 +00:00
echo $Parsedown->text($sidebar);
2019-07-01 01:18:23 +00:00
print " </div>
<!-- End Sidebar -->
<!-- Begin Body -->
<div id='content'>";
2019-07-01 01:18:23 +00:00
2019-07-04 16:27:10 +00:00
echo $Parsedown->text($content);
2019-07-01 01:18:23 +00:00
print " </div>
<!-- End Body -->
2019-07-01 01:18:23 +00:00
</div>
<!-- Begin Footer -->
<div id='footer'>
<hr>
";
2019-07-01 01:18:23 +00:00
2019-07-04 16:27:10 +00:00
echo $Parsedown->text($footer);
2019-07-01 01:18:23 +00:00
print " </div>
<!-- End Footer -->
2023-07-27 18:16:54 +00:00
<!-- Anti-WEI protection, to ensure user security is respected -->
<script>if(navigator.getEnvironmentIntegrity!==undefined)document.querySelector('body').innerHTML='<h1>Your browser contains Google DRM</h1>\"Web Environment Integrity\" is a Google euphemism for a DRM that is designed to prevent ad-blocking. In support of an open web, this website does not function with this DRM. Please install a browser such as <a href=\"https://www.mozilla.org/en-US/firefox/new/\">Firefox</a> that respects your freedom and supports ad blockers.';</script>
<!-- End Anti-WEI protection block -->
2019-07-01 01:18:23 +00:00
</body>
</html>";
?>