Added a check in sqimap_login to verify $onetimepad is set. Not sure why
[squirrelmail.git] / functions / date.php
index 8a1e551b98b5dd4bcc6e7280e9f92b41e839c4e2..7401ecbf34b637f9341ed2098487fe5a870faa9a 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * date.php
  *
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Takes a date and parses it into a usable format.  The form that a
@@ -14,7 +14,7 @@
  * $Id$
  */
 
-require_once( '../functions/constants.php' );
+require_once(SM_PATH . 'functions/constants.php');
 
 /* corrects a time stamp to be the local time */
 function getGMTSeconds($stamp, $gmt) {
@@ -68,7 +68,6 @@ function getGMTSeconds($stamp, $gmt) {
         case 'KST':
             $gmt = '+0900';     
             break;
-            break;
     }
     
     if (substr($gmt, 0, 1) == '-') {
@@ -273,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] && $dateParts[6]{0} != '(') {
+        $dateParts[6] = '('.$dateParts[6].')';
+    }
     $string = implode (' ', $dateParts);
 
     if (! isset($dateParts[4])) {
@@ -285,7 +288,6 @@ function getTimeStamp($dateParts) {
     if (intval(trim($dateParts[0])) > 0) {
         return getGMTSeconds(strtotime($string), $dateParts[4]);
     }
-
     return getGMTSeconds(strtotime($string), $dateParts[5]);
 }