Forráskód Böngészése

Fix two time zone calculation bugs, thanks to david white for the
excellent analysis; verified by me to be correct solutions.
Closes: #1063879

Thijs Kinkhorst 20 éve
szülő
commit
300f1e105d
2 módosított fájl, 11 hozzáadás és 2 törlés
  1. 1 0
      ChangeLog
  2. 10 2
      functions/date.php

+ 1 - 0
ChangeLog

@@ -155,6 +155,7 @@ Version 1.5.1 -- CVS
   - LDAP backend will use internal squirrelmail charset conversion functions
     instead of php xml extension. Fixes bug #655137.
   - Added Wood theme and Silver Steel theme by Pavel Spatny and Simple Green theme
+  - Fix two time zone calculation bugs, thanks to David White
 
 Version 1.5.0
 --------------------

+ 10 - 2
functions/date.php

@@ -349,8 +349,16 @@ function getDateString( $stamp ) {
     if ($invert_time) {
         $dateZ = - $dateZ;
     }
+
+    // calculate when it was midnight and when it will be,
+    // in order to display dates differently if they're 'today'
     $midnight = $now - ($now % 86400) - $dateZ;
-    $nextmid = $midnight + 86400 - $dateZ;
+    // this is to correct if after calculations midnight is more than
+    // one whole day away.
+    if ($now - $midnight > 86400) {
+        $midnight += 86400;
+    }
+    $nextmid = $midnight + 86400;
 
     if (($show_full_date == 1) || ($nextmid < $stamp)) {
         $date_format = _("M j, Y");
@@ -447,4 +455,4 @@ function getTimeStamp($dateParts) {
       return ($mtime);
    }
 */
-?>
+?>