From a28cbfa660f2ff982f1cdcee41c09cec772d84af Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Sun, 16 Dec 2007 14:54:06 +0100 Subject: BUGFIX: time display used wrong timezones. also optimized things a bit Got rid of a few db-queries for getting the right timezone. The timezone was also set after the timefunction was called and therefore the timezone didn't have any effect. --- functions.php | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index 16ca508..c835f89 100644 --- a/functions.php +++ b/functions.php @@ -390,26 +390,6 @@ function display_cards($me,$myturn) return; } -function return_timezone($offset) -{ - switch($offset) - { - case '1': - $zone = "Europe/Berlin"; - break; - case '-8': - $zone = "America/Vancouver"; - break; - case '13': - $zone = "Pacific/Auckland"; - break; - default: - $zone = "Europe/London"; - } - - return $zone; -} - function have_suit($cards,$c) { global $CARDS; @@ -669,7 +649,8 @@ function display_table () " Hand.sickness as sickness, ". " Hand.point_call, ". " User.last_login, ". - " Hand.hash ". + " Hand.hash, ". + " User.timezone ". "FROM Hand ". "LEFT JOIN User ON User.id=Hand.user_id ". "WHERE Hand.game_id='".$gameid."' ". @@ -685,12 +666,12 @@ function display_table () $party = $r[3]; $sickness = $r[4]; $call = $r[5]; - $lastlogin = strtotime($r[6]); $hash = $r[7]; + $timezone = $r[8]; + date_default_timezone_set($timezone); + $timenow = strtotime(date("Y-m-d H:i:s")); + $lastlogin = strtotime($r[6]); - $offset = DB_get_user_timezone($user); - $zone = return_timezone($offset); - date_default_timezone_set($zone); echo "
\n"; if(!$debug) @@ -790,7 +771,7 @@ function display_table () } echo "
\n"; - echo " local time\n"; + echo " local time\n"; echo " last login\n"; echo "
\n"; -- cgit v1.2.3-18-g5258