diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-05-07 23:02:24 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-05-07 23:02:24 +0200 |
commit | d90aebe04f9db8233801b358c5074230ada466eb (patch) | |
tree | 1f8e5c53f1c1b473d1657496617344f894e85032 /index.php | |
parent | 462f75b7e0ba21a46f1498740b8840796381a6b1 (diff) | |
download | blog-d90aebe04f9db8233801b358c5074230ada466eb.tar.gz blog-d90aebe04f9db8233801b358c5074230ada466eb.tar.bz2 blog-d90aebe04f9db8233801b358c5074230ada466eb.zip |
added web files
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/index.php b/index.php new file mode 100644 index 0000000..9fdc8f3 --- /dev/null +++ b/index.php @@ -0,0 +1,112 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="stylesheet" href="/style.css"> + <link rel="icon" type="image/x-icon" href="/favicon.ico"> + <meta property="og:image" content="https://wittamore.com/images/bloggings.jpg"> + <meta property="og:image:type" content="image/jpg"> + <meta property="og:image:width" content="1024"> + <meta property="og:image:height" content="640"> + <title>Bloggings</title> +</head> +<body> + <header> + <h1>Bloggings</h1> + <p><b>Blog</b> | <a href="sticky.php">Sticky</a> | <a + href="search.php">Search</a> | <a + href="https://wittamore-com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en-GB&_x_tr_pto=wapp">Français</a> | <a + href="https://git.wittamore.com" target="_blank" title="Git">Git</a> | <a + href="https://wittamore.com/rss.xml" target="_blank" title="RSS">RSS</a> | <a + href="https://bsky.app/profile/wittamore.com" target="_blank">Bluesky</a></p> + <hr> + <p>This is my personal <a href="/articles/2023/minimalist-blog.html">minimalist blog</a>. + It has no Javascript, cookies or bloat, it won't track you or sell your soul and can be viewed in any browser. + <a href="/sticky/Mention-Legal.html">GDPR notice</a></p> + </header> + <!-- list start --> +<?php +// build reverse article subdirs (years) +$yeardirs = []; +$revyeardirs = []; +$articlesubdir = new DirectoryIterator("./articles/"); +foreach ($articlesubdir as $dirinfo) { + if ($dirinfo->isDir() && !$dirinfo->isDot()) { + $yeardirs[] = $dirinfo->getFilename(); + } +} +rsort($yeardirs); +// iterate through years +if (is_array($yeardirs)) { + foreach ($yeardirs as $key => $dirname) { + echo "<h2>" . $dirname . "</h2>"; + echo "<ul>"; + $items = []; + $thisdir = new DirectoryIterator("./articles/" . $dirname); + // iterate through files + foreach ($thisdir as $file) { + if (!$file->isDot()) { + $flag = ""; + $articledate = date("Y-m-d"); + $filemodified = date("Y-m-d", filemtime("./articles/".$dirname."/".$file)); + $content = file_get_contents($file->getPathname()); + preg_match("/<h5>(.*?)<\/h5>/s", $content, $date); + if (isset($date[1]) && strtotime($date[1])) { + $articledate = date("Y-m-d", strtotime($date[1])); + } + // 2025-04-18 was the last global update + if (($filemodified > $articledate) && + ($filemodified != "2025-04-18") && + ($filemodified >= date('Y-m-d', strtotime(date("Y-m-d"). ' - 7 days')))) $flag = "Updated"; + if ($articledate >= date('Y-m-d', strtotime(date("Y-m-d"). ' - 2 days'))) $flag = "New"; + preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre); + $title = "?"; + if (isset($titre[1])) { + $title = ucfirst($titre[1]); + } + + $items[] = + '<li style="list-style-type:none;">' . + substr($articledate, -5 ) . ' ' . + '<a target="blank" href="' . + $file->getPathname() . + '">' . + $title . + "</a><small><i> " . $flag . "</i></small></li>"; + } + } + + rsort($items); + foreach ($items as $key => $val) { + echo $val; + } + echo "</ul>"; + } +} else { + echo "Not an array"; +} +?> +<!-- list end --> + <p> </p> + <hr> + <p>§</p> +</body> +</html> + + + + + + + + + + + + + + + + + |