1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/z-push_ynh.git synced 2024-09-03 18:05:58 +02:00

Update to latest sources

This commit is contained in:
polytan02 2016-02-22 07:24:03 +00:00
parent 29545ebdc0
commit 5834e58c44

View file

@ -1229,8 +1229,30 @@ class TimezoneUtil {
*/
static public function getMSTZnameFromTZName($name) {
foreach (self::$mstzones as $mskey => $msdefs) {
if ($name == $msdefs[0])
if ($name == $msdefs[0]) {
return $msdefs[1];
}
}
// Not found? Then retrieve the correct TZName first and try again.
// That's ugly and needs a proper fix. But for now this method can convert
// - Europe/Berlin
// - W Europe Standard Time
// to "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"
// which is more correct than the hardcoded default of (GMT+00:00...)
$tzName = '';
foreach (self::$phptimezones as $tzn => $phptzs) {
if (in_array($name, $phptzs)) {
$tzName = $tzn;
break;
}
}
if ($tzName != '') {
foreach (self::$mstzones as $mskey => $msdefs) {
if ($tzName == $msdefs[0]) {
return $msdefs[1];
}
}
}
ZLog::Write(LOGLEVEL_WARN, sprintf("TimezoneUtil::getMSTZnameFromTZName() no MS name found for '%s'. Returning '(GMT) Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London'", $name));