static.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <link rel="stylesheet" href="/style.css" />
  7. <title>Bloggings</title>
  8. </head>
  9. <body>
  10. <header>
  11. <center>
  12. <h1>Bloggings</h1>
  13. <img src="images/shadocks-pumping-300.gif" alt="shadocks pumping">
  14. <br><br>
  15. <a href="index.html">Blog</a>&nbsp;|&nbsp;<a
  16. href="https://shaarli.wittamore.com" target="_blank">Links</a>&nbsp;|&nbsp;<a
  17. href="https://git.wittamore.com" target="_blank">Git</a>&nbsp;|&nbsp;<a
  18. href="search.php">Search</a>&nbsp;|&nbsp;<a
  19. href="https://wittamore-com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en-GB&_x_tr_pto=wapp"
  20. >FR</a
  21. > </center>
  22. <hr />
  23. </header>
  24. <h1>Static Pages</h1>
  25. <!-- list start -->
  26. <?php
  27. // iterate through years
  28. $items = [];
  29. echo "<ul>";
  30. // iterate through files
  31. $i = 0;
  32. $thisdir = new DirectoryIterator("./static");
  33. foreach ($thisdir as $file) {
  34. if ($file != "." && $file != "..") {
  35. $i++;
  36. $content = file_get_contents($file->getPathname());
  37. preg_match("/<h5>(.*?)<\/h5>/s", $content, $date);
  38. $filedate = date("Y-m-d");
  39. if (isset($date[1]) && strtotime($date[1])) {
  40. $filedate = date("Y-m-d", strtotime($date[1]));
  41. }
  42. preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
  43. $title = "?";
  44. if (isset($titre[1])) {
  45. $title = ucfirst($titre[1]);
  46. }
  47. $items[$i][0] = $i;
  48. $items[$i][1] = $file->getPathname();
  49. $items[$i][2] = $title;
  50. }
  51. }
  52. $values = array_column($items, 2);
  53. array_multisort($values, SORT_ASC, $items);
  54. $i = 0;
  55. while ($i < count($items)) {
  56. echo "<li>" .
  57. '<a href="' .
  58. $items[$i][1] .
  59. '">' .
  60. $items[$i][2] .
  61. "</a></li>";
  62. $i++;
  63. }
  64. echo "</ul>";
  65. ?>
  66. <!-- list end -->
  67. <p>&nbsp;</p>
  68. <hr />
  69. <center>
  70. <h5>
  71. A minimalist blog by
  72. <a
  73. href="mailto:%70%68%69%6C%69%70%40%77%69%74%74%61%6D%6F%72%65%2E%63%6F%6D"
  74. >Philip Wittamore</a
  75. >
  76. </h5>
  77. </center>
  78. </body>
  79. </html>