'; }*/ if (!empty($_POST['FormPassword'])) { require 'config/config.php'; $FormPassword = htmlspecialchars($_POST['FormPassword']); if (password_verify($FormPassword, $passProtect)) { $_SESSION['login'] = true; } else { $_SESSION['login'] = false; } } if (empty($_SESSION['login']) or $_SESSION['login'] !== true) { $body = '
'; } else { $dir = $_GET['dir'] ?? ''; $file = $_GET['file'] ?? ''; $body = ''; 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'; } } /* sed -E 's/[0-9]{2}:[0-9]{2}//' new.md > test.md sed '/^$/d' test.md > new.md */ $content = file_get_contents('content/' . urldecode($dir) . '/' . urldecode($file) . '.md'); $options = array('selectors' => array('h2', 'h3'), 'setBreaksEnabled' => true, 'setSafeMode' => true); $content = preg_replace('/([0-9]{2}):([0-9]{2})/i', '', $content); $content = preg_replace('/\[([0-9]{2})\/([0-9]{2})\/([0-9]{4}) ]/i', '', $content); $content = preg_replace('/\[([0-9]{2})\/([0-9]{2}) ]/i', '', $content); $content = str_replace('Morgane Mongin', '

', $content); $content = str_replace('Adrien Passos', '

', $content); $content = str_replace('morganemongin', '

', $content); $content = str_replace('knah-tsaeb', '

', $content); $Parsedown = new ExtendParsedownToc($options); $body = $Parsedown->setMarkupEscaped(false) ->setSafeMode(false) ->setBreaksEnabled(false) ->text($content); $toc = $Parsedown->contentsList(); #$body = str_replace("[ ]", '', $body); #$body = str_replace("[x]", '', $body); $body = str_replace("", ' ⬆️', $body); $body = str_replace("", ' ⬆️', $body); $menu = makeMenu($dir); $lastMod = date("d-m-Y H:i", filemtime('content/' . urldecode($dir) . '/' . urldecode($file) . '.md')); } require 'tpl/header.html'; require 'tpl/aside.html'; require 'tpl/main.html'; require 'tpl/footer.html';