From e7e64b1ada481710704c16bfb8ee4a7c337dc8f1 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Mon, 17 Dec 2007 00:44:09 +0100 Subject: [PATCH] BUGFIX: local time should now work correctly had to reset the timezone to the local time. added a config parameter to store the local timezone. --- config.php_template | 4 +++- functions.php | 6 +++--- output.php | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/config.php_template b/config.php_template index fb84a51..761d889 100644 --- a/config.php_template +++ b/config.php_template @@ -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 diff --git a/functions.php b/functions.php index c835f89..b1ed09f 100644 --- a/functions.php +++ b/functions.php @@ -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 "
\n"; if(!$debug) diff --git a/output.php b/output.php index 5d84d46..98bfb9d 100644 --- a/output.php +++ b/output.php @@ -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 "
last login: ".date("r",$unixtime)."
"; }; -- 2.25.1