view.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE html>
  2. <html lang="<?= LOCALE ?>"<?php if (!empty(SERVICE)) echo ' class="' . SERVICE . '"'; ?>>
  3. <head>
  4. <meta charset="utf-8">
  5. <title><?php
  6. foreach (array_reverse(TITLES_LINEAGE) as $id => $title)
  7. echo strip_tags($title) . (array_key_last(TITLES_LINEAGE) === $id ? '' : ' < ');
  8. ?></title>
  9. <?php
  10. foreach (glob('css/*.css') as $css_path)
  11. echo ' <link type="text/css" rel="stylesheet" media="screen" href="' . CONF['common']['prefix'] . '/' . $css_path . '">' . LF;
  12. ?>
  13. <meta name="viewport" content="width=device-width, initial-scale=1">
  14. </head>
  15. <body>
  16. <header>
  17. <p>
  18. <?php if (isset($_SESSION['id'])) { ?>
  19. <span aria-hidden="true"><?= ($_SESSION['type'] === 'approved') ? '👤' : '⏳' ?> </span><strong><?= (defined('DISPLAY_USERNAME') ? DISPLAY_USERNAME : '<em>?</em>') ?></strong> <a class="auth" href="<?= CONF['common']['prefix'] ?>/auth/logout"><?= _('Log out') ?></a>
  20. <?php } else { ?>
  21. <span aria-hidden="true">👻 </span><em><?= _('Anonymous') ?></em> <a class="auth" href="<?= redirUrl('auth/login') ?>"><?= _('Log in') ?></a>
  22. <?php } ?>
  23. </p>
  24. <nav>
  25. <?php
  26. foreach (TITLES_LINEAGE as $id => $title) {
  27. $lastTitle = (TITLES_LINEAGE[array_key_last(TITLES_LINEAGE)] === $title);
  28. echo '<ul><li>' . ($lastTitle ? '<h1>' : '') . '<a' . (($id === 0) ? ' class="niver"' : '') . ' href="' . CONF['common']['prefix'] . ($lastTitle ? '/' . PAGE_URL : '/' . implode('/', array_slice(PAGE_LINEAGE, 0, $id)) . (($lastTitle OR $id === 0) ? '' : '/')) . '">' . $title . '</a>' . ($lastTitle ? '</h1>' : '') . LF;
  29. }
  30. echo str_repeat('</li></ul>', count(TITLES_LINEAGE));
  31. ?>
  32. </nav>
  33. </header>
  34. <main>
  35. <?php
  36. require 'pg-view/' . PAGE_ADDRESS . '.php';
  37. if ($_POST === [] AND PAGE_METADATA['require-login'] ?? true !== false AND !isset($_SESSION['id']) AND PAGE_TERMINAL)
  38. echo '<p>' . sprintf(_('This form won\'t be accepted because you need to %slog in%s first.'), '<a class="auth" href="' . redirUrl('auth/login') . '">', '</a>') . '</p>';
  39. displayFinalMessage($data);
  40. ?>
  41. </main>
  42. <footer>
  43. <small><?= sprintf(_('%sSource code%s available under %s.'), '<a rel="external" href="https://code.antopie.org/niver/niver" class="niver">', '</a>', '<abbr title="Cooperative Nonviolent Public License No Attribution version 7 or more">CNPL-NAv7+</abbr>') ?></small>
  44. </footer>
  45. </body>
  46. </html>