From fb985ec5bbd77e138114f2aa35dc84ec45ce6426 Mon Sep 17 00:00:00 2001
From: garvinhicking <garvinhicking>
Date: Mon, 18 Jun 2007 11:57:15 +0000
Subject: [PATCH] Fix wrong timestamp generation when invalid archive dates are
 submitted, thanks to Deminy

---
 index.php | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/index.php b/index.php
index a9f33d5..b7bb327 100644
--- a/index.php
+++ b/index.php
@@ -137,7 +137,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
     $serendipity['GET']['action']     = 'read';
     $serendipity['GET']['hidefooter'] = true;
 
-    if ( !isset($year) ) {
+    if (!isset($year)) {
         $year = date('Y');
         $month = date('m');
         $day = date('j');
@@ -145,6 +145,18 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
         $serendipity['GET']['hidefooter'] = null;
     }
 
+    if (isset($year) && !is_numeric($year)) {
+        $year = date('Y');
+    }
+
+    if (isset($month) && !is_numeric($month)) {
+        $month = date('m');
+    }
+
+    if (isset($day) && !is_numeric($day)) {
+        $day = date('d');
+    }                
+
     switch($serendipity['calendar']) {
         case 'gregorian':
         default:
-- 
2.39.5