Browse Source

Let wiki.php render server.php

pull/31/head
Blade of Darkness 3 months ago
parent
commit
1b9c4e87af
  1. 1
      .htaccess
  2. 81
      includes/server.php
  3. 1
      wiki.php

1
.htaccess

@ -1,6 +1,5 @@
RewriteEngine On
RewriteRule ^$ main [QSA]
RewriteRule ^index\.php$ wiki.php?page=main [QSA]
RewriteRule ^server$ includes/server.php [QSA,L]
RewriteCond %{REQUEST_URI} !(/includes/|/media/|tilde.json|humans.txt|/webmail/|/favicon.ico|/~|githook|sitemap.xml)
RewriteRule ^([^\d]+)/?$ wiki.php?page=$1 [QSA]

81
includes/server.php

@ -1,68 +1,4 @@
<?php
/*
This code is licensed under the AGPL 3 or later by ubergeek (https://tildegit.org/ubergeek)
Parsedown is licensed under the MIT license.
*/
include('../config.php');
include('../parsedown-1.7.3/Parsedown.php');
include('../parsedown-extra-0.7.1/ParsedownExtra.php');
if(isset($_GET['page']))
$page = $_GET['page'];
else
$page = "server";
if(isset($_GET['style']))
$site_style = $_GET['style'];
$Parsedown = new Parsedown();
$Parsedown->setMarkupEscaped(true);
$ParsedownExtra = new ParsedownExtra();
if (empty($site_style))
$site_style="site";
$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/server.md");
$footer = file_get_contents("$doc_root/includes/footer.md");
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'>
</head>
<body>
<!-- Begin Header -->
<div id='header'>";
print $Parsedown->text($header);
print "
</div>
<!-- End Header -->
";
print "<hr>
<div id='body'>
<!-- Begin Sidebar -->
<div id='sidebar'>
";
echo $Parsedown->text($sidebar);
print " </div>
<!-- End Sidebar -->
<!-- Begin Body -->
<div id='content'>";
echo $ParsedownExtra->text($content);
// Monitoring section
$hosts="all";
@ -109,21 +45,4 @@ echo "\n</table>\n";
fclose($f);
// End monitoring section
print " </div>
<!-- End Body -->
</div>
<!-- Begin Footer -->
<div id='footer'>
<hr>
";
echo $Parsedown->text($footer);
print " </div>
<!-- End Footer -->
</body>
</html>";
?>

1
wiki.php

@ -66,6 +66,7 @@ echo $ParsedownExtra->text($content);
switch ($page)
{
case 'users':
case 'server':
require "includes/$page.php";
}

Loading…
Cancel
Save