added validation of timezone. This solves strtotime returning -1 because of a
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 15 Oct 2002 12:30:12 +0000 (12:30 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 15 Oct 2002 12:30:12 +0000 (12:30 +0000)
non valid date format.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3859 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/date.php

index f38deda1bd2006eb0e769ec6bffbca62eec7949c..7dc02e182962e6854dac04c91b7e1e5184a1dc86 100644 (file)
@@ -272,6 +272,10 @@ function getTimeStamp($dateParts) {
      * Since the day of week is optional, this check is needed.
      */
 
+    /* validate zone before we uses strtotime */
+    if (isset($dateParts[6]) && $dateParts[6]{0} != '(') {
+        $dateParts[6] = '('.$dateParts[6].')';
+    }
     $string = implode (' ', $dateParts);
 
     if (! isset($dateParts[4])) {
@@ -284,7 +288,6 @@ function getTimeStamp($dateParts) {
     if (intval(trim($dateParts[0])) > 0) {
         return getGMTSeconds(strtotime($string), $dateParts[4]);
     }
-
     return getGMTSeconds(strtotime($string), $dateParts[5]);
 }