From 4da2def4643c300cb3d4f2110e02f6898b1fe318 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 7 Oct 2012 18:00:36 +0000 Subject: [PATCH] automatic conversation of American Olson timezone names with 3 /-separated parts to a form without the middle part, eg. America/Buenos_Aires can be used instead of America/Argentina/Buenos_Aires --- calendar/inc/class.calendar_timezones.inc.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/calendar/inc/class.calendar_timezones.inc.php b/calendar/inc/class.calendar_timezones.inc.php index a3045b9572..bf14d22406 100644 --- a/calendar/inc/class.calendar_timezones.inc.php +++ b/calendar/inc/class.calendar_timezones.inc.php @@ -101,6 +101,17 @@ class calendar_timezones self::$tz_cache[$id] = egw_db::strip_array_keys($data,'tz_'); } } + // check if we can find a 3-part America timezone eg. check 'America/Argentina/Buenos_Aires' for 'America/Buenos_Aires' + if (!isset($id) && stripos($tzid, 'America/') === 0 && count($parts = explode('/', $tzid)) == 2) + { + if (($data = $GLOBALS['egw']->db->select(self::TABLE,'*',array( + 'tz_tzid LIKE '.$GLOBALS['egw']->db->quote($parts[0].'/%/'.$part[1]), + ),__LINE__,__FILE__,false,'','calendar')->fetch())) + { + $id = $data['tz_id']; + self::$tz_cache[$id] = egw_db::strip_array_keys($data,'tz_'); + } + } if (isset($id) && $what != 'id') { return self::id2tz($id,$what); @@ -415,7 +426,7 @@ if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE_ { $GLOBALS['egw_info'] = array( 'flags' => array( - 'currentapp' => 'calendar', + 'currentapp' => 'login', ) ); include('../../header.inc.php');