Browse Source

Let wiki.php render users.php

pull/31/head
Blade of Darkness 3 months ago
parent
commit
a6ae512417
  1. 1
      .htaccess
  2. 0
      articles/users.md
  3. 82
      includes/users.php
  4. 6
      wiki.php

1
.htaccess

@ -1,7 +1,6 @@
RewriteEngine On
RewriteRule ^$ main [QSA]
RewriteRule ^index\.php$ wiki.php?page=main [QSA]
RewriteRule ^users$ includes/users.php [QSA,L]
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]

0
articles/userdir.md → articles/users.md

82
includes/users.php

@ -1,68 +1,4 @@
<?php
/*
This code is licensed under the AGPL 3 or later by ubergeek (https://tildegit.org/ubergeek)
Parsedown and Parsedown Extra 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 = "users";
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/userdir.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);
print "<!-- Begin autogen userdir list -->";
print "<ul style='list-style: none; margin-left: -40px;'>";
foreach (glob("/home/*") as $user):
@ -73,22 +9,4 @@ foreach (glob("/home/*") as $user):
endforeach;
print "</ul></div>
<!-- End Autgen userdir list -->";
print " </div>
<!-- End Body -->
</div>
<!-- Begin Footer -->
<div id='footer'>
<hr>
";
echo $Parsedown->text($footer);
print " </div>
<!-- End Footer -->
</body>
</html>";
?>

6
wiki.php

@ -63,6 +63,12 @@ print " </div>
echo $ParsedownExtra->text($content);
switch ($page)
{
case 'users':
require "includes/$page.php";
}
print " </div>
<!-- End Body -->

Loading…
Cancel
Save