login/pass: error messages below page title
[minimedit.git] / page.inc.php
1 <?php
2 include_once 'head.inc.php';
3
4 print "<header>\n";
5 $menu = new ArchiveArticle('menu.inc.html');
6 ob_start();
7 if ($User and property_exists($User, 'login') and $User->login) {
8         print '<div class="login"><p>';
9         printf('<span title="ingelogd">%s <a href="%s">%s</a></span>',
10                 '<span class="icon icon-user">&#x1F464;</span>',
11                 '/login', $User->login
12         );
13         print "</p></div>\n";
14 }
15 $menu->place['login'] = ob_get_clean();
16 $nav = $menu->render();
17
18 $nav = preg_replace_callback('{<a href="([^"]+)">(.*?)</a>}', function ($m) {
19         $request = $_SERVER['REQUEST_URI'];
20         $html = $request == $m[1] ? $m[2] : $m[0]; # text or full link
21         return $m[1] == substr($request, 0, strlen($m[1])) ? "<b>$html</b>" : $html;
22 }, $nav);
23 print $nav;
24 print "</header>\n\n";
25
26 register_shutdown_function(function () {
27         print '<footer>';
28         @include 'footer.inc.html';
29         print "</footer>\n";
30         print "</body></html>\n";
31 });
32