summaryrefslogtreecommitdiffstats
path: root/functions.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2007-12-16 14:54:06 +0100
committerArun Persaud <arun@nubati.net>2007-12-16 22:33:43 +0100
commita28cbfa660f2ff982f1cdcee41c09cec772d84af (patch)
treee2c70082d93a44b373b6d57899590ac01dcc0d5c /functions.php
parent672791e22e1de68e278e2f0d5c6d7331d5994ecb (diff)
downloade-DoKo-a28cbfa660f2ff982f1cdcee41c09cec772d84af.tar.gz
e-DoKo-a28cbfa660f2ff982f1cdcee41c09cec772d84af.tar.bz2
e-DoKo-a28cbfa660f2ff982f1cdcee41c09cec772d84af.zip
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.
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php33
1 files changed, 7 insertions, 26 deletions
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 " <div class=\"table".($pos-1)."\">\n";
if(!$debug)
@@ -790,7 +771,7 @@ function display_table ()
}
echo " <br />\n";
- echo " <span title=\"".date("Y-m-d H:i:s")."\">local time</span>\n";
+ echo " <span title=\"".date("Y-m-d H:i:s",$timenow). "\">local time</span>\n";
echo " <span title=\"".date("Y-m-d H:i:s",$lastlogin)."\">last login</span>\n";
echo " </div>\n";