aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..9541b14
--- /dev/null
+++ b/index.php
@@ -0,0 +1,44 @@
+<?php
+ require("top.php");
+
+ $start = 0;
+ $show = 5;
+ if(isset($_GET['start'])) $start = $_GET['start'];
+ if(isset($_GET['show'])) $show = $_GET['show'];
+
+ $ls = explode("\n", `ls -1t {$blogPosts}`);
+
+ function hide($var) {
+ return(!preg_match('/^\./', $var));
+ }
+ array_filter($ls, "hide");
+
+ $limitedls = array_slice($ls, $start, $show);
+ foreach($limitedls as $file) {
+ if ($file === "") continue;
+
+ echo "<a id=\"$file\">";
+ echo "<div>\n";
+ echo "<a class=\"title\" href=\"{$blogRoot}post/" . urlencode($file) . "\">$file <span id=\"perma\">[Permalink]</span></a>\n";
+
+ $stat = stat("{$blogPosts}$file");
+ $date = date('d-m-Y H:i T', $stat['mtime']);
+ echo "<span class=\"date\">$date</span>\n";
+ echo "<br><br>\n";
+
+ $post = file_get_contents("{$blogPosts}$file");
+ $post = preg_replace('/\n/', "<br>\n", $post);
+ echo $post;
+ echo "</div>\n</a>\n\n";
+ }
+
+ echo "<div id=\"title\">\n";
+ $older = $start + $show;
+ $newer = $start - $show;
+ if ($newer >= 0) echo "<a class=\"toplink\" href=\"{$blogRoot}?start=$newer&show=$show\">Newer</a>\n";
+ if ($older <= (count($ls) - 2)) echo "<a class=\"toplink\" href=\"{$blogRoot}?start=$older&show=$show\">Older</a>\n";
+ echo "</div>\n";
+?>
+</body>
+
+</html>