view.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php declare(strict_types=1); ?>
  2. <!DOCTYPE html>
  3. <html lang="<?= LOCALE ?>"<?= empty(SERVICE) ? '' : ' class="' . SERVICE . '"' ?>>
  4. <head>
  5. <meta charset="utf-8">
  6. <title><?php
  7. foreach (array_reverse(TITLES_LINEAGE) as $id => $title)
  8. echo strip_tags($title) . (array_key_last(TITLES_LINEAGE) === $id ? '' : ' < ');
  9. ?></title>
  10. <?php
  11. foreach (glob('css/*.css') as $css_path)
  12. echo ' <link type="text/css" rel="stylesheet" media="screen" href="' . CONF['common']['prefix'] . '/' . $css_path . '">' . LF;
  13. ?>
  14. <meta name="viewport" content="width=device-width, initial-scale=1">
  15. </head>
  16. <body>
  17. <header>
  18. <p class="auth">
  19. <?php if (isset($_SESSION['id'])) { ?>
  20. <span aria-hidden="true"><?= ($_SESSION['type'] === 'approved') ? '👤' : '⏳' ?> </span><strong><?= (defined('DISPLAY_USERNAME') ? DISPLAY_USERNAME : '<em>?</em>') ?></strong> <a href="<?= CONF['common']['prefix'] ?>/auth/logout"><?= _('Log out') ?></a><?= ($_SESSION['type'] === 'testing') ? '<br>' . _('You are using a testing account. It may be deleted anytime.') . ' <a href="' . CONF['common']['prefix'] . '/auth/#type">' . _('Read more') . '</a>' : '' ?>
  21. <?php } else { ?>
  22. <span aria-hidden="true">👻 </span><em><?= _('Anonymous') ?></em> <a href="<?= redirUrl('auth/login') ?>"><?= _('Log in') ?></a>
  23. <?php } ?>
  24. </p>
  25. <nav>
  26. <?php
  27. foreach (TITLES_LINEAGE as $id => $title) {
  28. $lastTitle = (TITLES_LINEAGE[array_key_last(TITLES_LINEAGE)] === $title);
  29. echo '<ul><li>' . ($lastTitle ? '<h1>' : '') . '<a' . (($id === 0) ? ' class="common"' : '') . ' href="' . CONF['common']['prefix'] . ($lastTitle ? '/' . PAGE_URL : '/' . implode('/', array_slice(PAGE_LINEAGE, 0, $id)) . (($lastTitle OR $id === 0) ? '' : '/')) . '">' . $title . '</a>' . ($lastTitle ? '</h1>' : '') . LF;
  30. }
  31. echo str_repeat('</li></ul>', count(TITLES_LINEAGE));
  32. ?>
  33. </nav>
  34. </header>
  35. <main>
  36. <?php
  37. if (CONF['common']['services']['auth'] === 'error' OR (in_array(SERVICE, SERVICES_USER, true) AND CONF['common']['services'][SERVICE] === 'error'))
  38. echo '<p><strong>' . _('This service is currently under maintenance. No action can be taken on it until an administrator finishes repairing it.') . '</strong></p>';
  39. require ROOT_PATH . '/pg-view/' . PAGE_ADDRESS . '.php';
  40. if ($_POST === [] AND (PAGE_METADATA['require-login'] ?? true) !== false AND !isset($_SESSION['id']) AND PAGE_TERMINAL)
  41. 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>';
  42. displayFinalMessage($data);
  43. ?>
  44. </main>
  45. <footer>
  46. <small><?= sprintf(_('Based on %s, available under %s.'), '<a rel="external" href="https://servnest.niv.re/" class="common"><span aria-hidden="true">🌳</span>&nbsp;ServNest</a>', '<abbr title="Cooperative Nonviolent Public License No Attribution version 7 or more">CNPL-NAv7+</abbr>') ?></small>
  47. </footer>
  48. </body>
  49. </html>