41 lines
1 KiB
PHP
41 lines
1 KiB
PHP
|
<?php
|
||
|
require 'vendor/autoload.php';
|
||
|
require 'apps/apps.php';
|
||
|
|
||
|
$dir = $_GET['dir'] ?? '';
|
||
|
$file = $_GET['file'] ?? '';
|
||
|
|
||
|
if (!empty($dir)) {
|
||
|
$dir = filter_input(INPUT_GET, 'dir', FILTER_SANITIZE_STRING);
|
||
|
}
|
||
|
|
||
|
if (isset($file)) {
|
||
|
$file = filter_input(INPUT_GET, 'file', FILTER_SANITIZE_STRING);
|
||
|
}
|
||
|
|
||
|
if (empty($file) || !file_exists('content/' . urldecode($dir) . '/' . urldecode($file) . '.md')) {
|
||
|
$dir = '';
|
||
|
if(file_exists('content/index.md')){
|
||
|
$file = 'index';
|
||
|
} else {
|
||
|
$file = 'default';
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$Parsedown = new ParsedownToc();
|
||
|
|
||
|
$content = file_get_contents('content/' . urldecode($dir) . '/' . urldecode($file) . '.md');
|
||
|
|
||
|
$Parsedown = new ParsedownToc();
|
||
|
$body = $Parsedown->text($content);
|
||
|
$toc = $Parsedown->contentsList();
|
||
|
|
||
|
$body = str_replace("[ ]", '<input type="checkbox" disabled>', $body);
|
||
|
$body = str_replace("[x]", '<input type="checkbox" checked disabled>', $body);
|
||
|
|
||
|
require 'tpl/header.html';
|
||
|
require 'tpl/aside.html';
|
||
|
require 'tpl/main.html';
|
||
|
require 'tpl/footer.html';
|