aboutsummaryrefslogtreecommitdiff
path: root/blog/index.php
blob: 7c8ccfb54223743b25b388803a11ab9b37a5dc4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!--?php 
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
?-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <?php 
      $stag = $_GET["tag"];
      $nostag = empty($stag);
    ?>
    <?php include($_SERVER['DOCUMENT_ROOT'] . '/boilerplate.php'); ?>
    <title><?php if(!$nostag) { echo("#$stag | ");} ?> isoblog | isopod.cool v4</title>
    <link href="/style.css" rel="stylesheet" type="text/css" media="all">
  </head>
  <body>
    <?php include($_SERVER['DOCUMENT_ROOT'] . '/header.php'); ?>
    <main>
      <h2><?php if(!$nostag) { echo("#$stag");} else { echo("isoblog"); } ?></h2>
      <p class="h2caption">inane ramblings</p>
      <nav class="pagenav">
        <ul>
          <li><a href="blog.atom">atom feed</a></li>
          <?php
            $content = simplexml_load_file("blog.atom");
            $year = "-69420";
            $yc = 0;
            foreach($content->entry as $entry) {
              $nyr = substr($entry->published, 0, 4);
              if($nyr != $year) {
                $year = $nyr;
                echo "<li><a href='#$year'>$year</a></li>";
              }
            }
          ?>
        </ul>
      </nav>
      <?php
        if(!$nostag) {
          echo "<p class='backlink'><a href='.'>All articles</a></p>";
        }
        echo "<ul id='articles'>";
        $year = "-69420";
        $yc = 0;
        foreach($content->entry as $entry) {
          
          $pfilt = false;
          if(!$nostag) {
            foreach($entry->category as $cat) {
              $term = $cat["term"];
              if($stag == $term) {
                $pfilt = true;
              }
            }
          }

          if($pfilt or $nostag) { 
            $nyr = substr($entry->published, 0, 4);
            if($nyr != $year) {
              $year = $nyr;
              echo "<li><h3 id='$year'>$year</h3></li>";
            }
            $dt = substr($entry->published, 0, 10);
            $ti = $entry->title;
            $wn = "";
            if(preg_match('/2022-0(5|4)-(21|25|13)/', $dt)) {
              $wn = "title=\"This post is on the archived v2 version of the site. It will not load if you don't have Javascript enabled, and expect jank if viewing on mobile. You have been warned.\" ";
            }
            $cats = "";
            foreach($entry->category as $cat) {
              $term = $cat["term"];
              $cats = $cats."<a class='entrytag' href='?tag=".$term."'>".$term."</a>";
            }
            
            echo "<li class='blogentry'><time class='entrydate'>".$dt."</time><h4 class='entrytitle'><a ".$wn."href='".$entry->link["href"]."'>".$ti."</h4></a><p class='entrysummary'>".$entry->summary."</p><p>".$cats."</p></li>";
          }
        }
        echo "</ul>";
      ?>
    </main>
    <?php include($_SERVER['DOCUMENT_ROOT'] . '/footer.php'); ?>
  </body>
</html>