From bcf6df91c85c03750ef576b10bac1e98c9d12a5b Mon Sep 17 00:00:00 2001 From: stekkel Date: Tue, 15 Oct 2002 12:30:12 +0000 Subject: [PATCH] added validation of timezone. This solves strtotime returning -1 because of a 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/date.php b/functions/date.php index f38deda1..7dc02e18 100644 --- a/functions/date.php +++ b/functions/date.php @@ -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]); } -- 2.25.1