login: replace http authentication by cookie system
[minimedit.git] / page.inc.php
1 <?php
2 include_once './head.inc.php';
3
4 print "<header>\n";
5 ob_start();
6 include './menu.html';
7 $nav = ob_get_clean();
8 $nav = preg_replace_callback('{<a href="([^"]+)">(.*?)</a>}', function ($m) {
9         $request = $_SERVER['REQUEST_URI'];
10         $html = $request == $m[1] ? $m[2] : $m[0]; # text or full link
11         return $m[1] == substr($request, 0, strlen($m[1])) ? "<b>$html</b>" : $html;
12 }, $nav);
13 print $nav;
14 print "</header>\n\n";
15
16 print '<div class="article">'."\n\n";
17
18 register_shutdown_function(function () {
19         print "</div>\n\n";
20         include 'foot.inc.php';
21         print "</body></html>\n";
22 });
23
24 include "./$Page.html";
25 if (file_exists("$Page.php")) include_once("./$Page.php");
26