header.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. require_once "../config/config.php";
  3. if (!isset($config["title"]))
  4. $config["title"] = "Tent";
  5. if (isset($title) && !empty($title))
  6. $title = $config["title"] . " · " . $title;
  7. else
  8. $title = $config["title"];
  9. header("Content-Security-Policy: default-src 'none'; form-action 'self'; img-src 'self' data:; media-src 'self'; style-src 'self' 'unsafe-inline'");
  10. ?>
  11. <!doctype html>
  12. <html lang="en">
  13. <head>
  14. <meta charset="utf-8">
  15. <meta name="viewport" content="width=device-width, initial-scale=1">
  16. <title><?= $title ?></title>
  17. <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⛺</text></svg>">
  18. <link rel="stylesheet" href="asset.php?file=style.css">
  19. </head>
  20. <body class="
  21. <?php
  22. if (isset($_COOKIE["theme"]) && in_array($_COOKIE["theme"], ["light", "dark"]))
  23. echo "theme-" . $_COOKIE["theme"];
  24. if (isset($_COOKIE["overflow"]) && $_COOKIE["overflow"] === "on")
  25. echo " overflow";
  26. ?>
  27. ">
  28. <header>
  29. <div class="wrapper">
  30. <a href="." title="Tent">
  31. </a>
  32. <form action="search.php">
  33. <input name="query" placeholder="Search..." required autofocus>
  34. </form>
  35. <?php
  36. $link = convert_tent_link("//" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
  37. if ($link)
  38. echo "<a href=\"" . $link . "\" title=\"Bandcamp\">🔗</a>";
  39. ?>
  40. <a href="settings.php" title="Settings">
  41. ⚙️
  42. </a>
  43. </div>
  44. </header>
  45. <main tabindex="-1">
  46. <div class="wrapper">