diff --git a/include/class.config.php b/include/class.config.php index cb1f15d5c4f96447db712798a2a6a8bcfbd548ec..fa08a51272053ee4a64e1bf5345b0f8da8e8c0b2 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -258,18 +258,23 @@ class OsticketConfig extends Config { return $this->get('default_timezone'); } - function getTimezone() { + function getTimezone($user=false) { global $thisstaff, $thisclient; - if ($thisstaff) - $zone = $thisstaff->getTimezone(); - #elseif ($thisclient) - # $zone = $thisclient->getTimezone(); - else + $user = $user ?: $thisstaff; + + if (!$user && $thisclient) + $user = $thisclient->getAccount(); + + if ($user) + $zone = $user->getTimezone(); + + if (!$zone) $zone = $this->get('default_timezone'); if (!$zone) $zone = ini_get('date.timezone'); + return $zone; }