diff options
author | Luke Bratch <l_bratch@yahoo.co.uk> | 2014-07-25 10:38:54 +0100 |
---|---|---|
committer | Luke Bratch <l_bratch@yahoo.co.uk> | 2014-07-25 10:38:54 +0100 |
commit | bd73ff4c4c3283f4c8f9e45df5d31bd71d9a8242 (patch) | |
tree | e393876de175acd0a002ed1227dbe5fad3afa50d /index.php | |
parent | bb5e67eb0f7599683cdaf6f2f693e7b5c7aff56c (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.php | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -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"; |