From 420ceb49b53a8fa9d8ba8443e42e50cd7bd7cea9 Mon Sep 17 00:00:00 2001 From: Philip Wittamore Date: Sun, 12 Jul 2026 11:08:50 +0200 Subject: update --- index.php | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100755 index.php (limited to 'index.php') diff --git a/index.php b/index.php new file mode 100755 index 0000000..433c0ee --- /dev/null +++ b/index.php @@ -0,0 +1,149 @@ + + + + + + + + + + + + Bloggings + + +
+

Bloggings

+ + +
+
+ +isDir() && !$dirinfo->isDot()) { + $years[] = $dirinfo->getFilename(); + } +} +rsort($years); +// iterate through years +if (is_array($years)) { + foreach ($years as $key => $year) { + $items = []; + $thisdir = new DirectoryIterator("./articles/" . $year); + // iterate through files + foreach ($thisdir as $file) { + if (!$file->isDot()) { + $flag = ""; + $articledate = date("Y-m-d"); + $filemodified = date( + "Y-m-d", + filemtime("./articles/" . $year . "/" . $file), + ); + $content = file_get_contents($file->getPathname()); + # get first h3 + preg_match("/

(.*?)<\/h3>/s", $content, $date); + if (isset($date[1]) && strtotime($date[1])) { + $articledate = date("Y-m-d", strtotime($date[1])); + } + if ( + $articledate >= + date("Y-m-d", strtotime(date("Y-m-d") . " - 2 days")) + ) { + $flag = " New"; + } + preg_match("/

(.*?)<\/h2>/s", $content, $titre); + $title = "?"; + if (isset($titre[1])) { + $title = ucfirst($titre[1]); + } + + $items[] = + '\n"; + } + } + + rsort($items); + + echo "
\n"; + echo "

" . $year . "

\n"; + + foreach ($items as $key => $val) { + if ($key == 0) { + if ($year == date("Y")) { + preg_match("'href=\"(.*?)\"'si", $val, $match); + if ($match) { + $content = file_get_contents($match[1], false, null, 1); + preg_match( + "'\(.*?)<\/article\>'si", + $content, + $article, + ); + if ($article) { + # print latest article contents + echo $article[1] . "\n

\n"; + } + } + } + echo "
    \n"; + } + # print link to article + echo $val; + } + echo "
\n"; + echo "
\n"; + } +} else { + echo "Not an array"; +} +?> + +

+ + + + + + + + + + + + + + + + + + + + -- cgit v1.3.1