diff options
author | Nathan Lasseter <nathan@4574.co.uk> | 2012-10-10 20:03:21 +0100 |
---|---|---|
committer | Nathan Lasseter <nathan@4574.co.uk> | 2012-10-10 20:03:21 +0100 |
commit | 94c589ed55b20a581810e126b20fdc2d67c68221 (patch) | |
tree | 7d3d84aa3cc291417f667ee48a3fc120b95b2e43 /index.php |
Initial commit
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 44 |
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> |