BUGFIX: local time should now work correctly
authorArun Persaud <arun@nubati.net>
Sun, 16 Dec 2007 23:44:09 +0000 (00:44 +0100)
committerArun Persaud <arun@nubati.net>
Sun, 16 Dec 2007 23:51:18 +0000 (00:51 +0100)
had to reset the timezone to the local time. added a config parameter to store the local timezone.

config.php_template
functions.php
output.php

index fb84a51d04270b41e331b01cb021036d9a710bd2..761d889498dd14e7625e122187e305076bc53613 100644 (file)
@@ -27,6 +27,8 @@
     /* used as the reply email in each email */
     $EMAIL_REPLY="";
 
-    /* this should point to your index.file */
+    /* this should point to your index.file, probably without the http:// to avoid extra requests */
     $host = "http://.../index.php"
+
+    $defaulttimezone = date_default_timezone_get();
 ?>
\ No newline at end of file
index c835f89897906c6f188690f70bacb022bcc5bf1f..b1ed09fabf0c5df3f92be136aa2bd0042845748d 100644 (file)
@@ -640,7 +640,7 @@ function can_call($what,$hash)
 
 function display_table ()
 {
-  global $gameid, $GT, $debug,$host;
+  global $gameid, $GT, $debug,$host,$defaulttimezone;
 
   $result = mysql_query("SELECT  User.fullname as name,".
                        "        Hand.position as position, ".
@@ -668,10 +668,10 @@ function display_table ()
       $call      = $r[5];
       $hash      = $r[7];
       $timezone  = $r[8];
+      date_default_timezone_set($defaulttimezone);
+      $lastlogin = strtotime($r[6]);
       date_default_timezone_set($timezone);
       $timenow   = strtotime(date("Y-m-d H:i:s"));
-      $lastlogin = strtotime($r[6]);
-
 
       echo "  <div class=\"table".($pos-1)."\">\n";
       if(!$debug)
index 5d84d46c50f227d7b41690e665c16c1df13db5dc..98bfb9d12a2ce06bc2954e52b22bb36aeaae9dc3 100644 (file)
@@ -366,6 +366,7 @@ function output_footer()
 
 function output_status()
 {
+  global $defaulttimezone;
    if(isset($_SESSION["name"]))
      {
        $name = $_SESSION["name"];
@@ -379,10 +380,11 @@ function output_status()
        /* last logon time */
        $myid  = DB_get_userid_by_name($name);
        $zone  = DB_get_user_timezone($myid);
-       date_default_timezone_set($zone);
 
        $time     = DB_get_user_timestamp($myid);
+       date_default_timezone_set($defaulttimezone);
        $unixtime = strtotime($time);
+       date_default_timezone_set($zone);
 
        echo "<div class=\"lastlogin\">last login: ".date("r",$unixtime)."</div>";
      };