summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorLuke Bratch <l_bratch@yahoo.co.uk>2014-07-25 10:38:54 +0100
committerLuke Bratch <l_bratch@yahoo.co.uk>2014-07-25 10:38:54 +0100
commitbd73ff4c4c3283f4c8f9e45df5d31bd71d9a8242 (patch)
treee393876de175acd0a002ed1227dbe5fad3afa50d /index.php
parentbb5e67eb0f7599683cdaf6f2f693e7b5c7aff56c (diff)
Add support for date ranges, YYYY-MM-DD or YYYY-MM-DD-hhmm or a Unix
timestamp
Diffstat (limited to 'index.php')
-rw-r--r--index.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/index.php b/index.php
index 37f6844..4a2bc13 100644
--- a/index.php
+++ b/index.php
@@ -95,7 +95,6 @@ if (isset($_GET['C'])) {
}
$listing = array();
-$listing[0] = array();
?>
<?php
@@ -139,6 +138,29 @@ while ($this_array = each($new_array)){
$value = $this_array['value'];
$key = $this_array['key'];
+ // Drop if outside (optional) date range
+ if (isset($_GET['from'])) {
+ $from = $_GET['from'];
+ // If $from has a -, assume not Unix time
+ if (strpos($from, "-") !== false) {
+ $from = strtotime($from);
+ }
+
+ if (isset($_GET['to'])) {
+ $to = $_GET['to'];
+ // If $to has a -, assume not Unix time
+ if (strpos($to, "-") !== false) {
+ $to = strtotime($to);
+ }
+ } else {
+ $to = time();
+ }
+
+ if ($key < $from || $key > $to) {
+ continue;
+ }
+ }
+
$fileparts = explode('.', strtolower($value));
$icon = "unknown";