Code Duplication    Length = 4-4 lines in 3 locations

calendar/inc/class.calendar_bo.inc.php 1 location

@@ 838-841 (lines=4) @@
835
		foreach ($events as &$event)
836
		{
837
			// convert timezone id of event to tzid (iCal id like 'Europe/Berlin')
838
			if (empty($event['tzid']) && (!$event['tz_id'] || !($event['tzid'] = calendar_timezones::id2tz($event['tz_id']))))
839
			{
840
				$event['tzid'] = egw_time::$server_timezone->getName();
841
			}
842
			// database returns timestamps as string, convert them to integer
843
			// to avoid misinterpretation by egw_time as Ymd string
844
			// (this will fail on 32bit systems for times > 2038!)

calendar/inc/class.calendar_boupdate.inc.php 2 locations

@@ 1325-1328 (lines=4) @@
1322
			if (isset($event[$ts])) $event[$ts] = $event[$ts] ? $this->date2ts($event[$ts],true) : 0;
1323
		}
1324
		// convert tzid name to integer tz_id, of set user default
1325
		if (empty($event['tzid']) || !($event['tz_id'] = calendar_timezones::tz2id($event['tzid'])))
1326
		{
1327
			$event['tz_id'] = calendar_timezones::tz2id($event['tzid'] = egw_time::$user_timezone->getName());
1328
		}
1329
		// same with the recur exceptions
1330
		if (isset($event['recur_exception']) && is_array($event['recur_exception']))
1331
		{
@@ 2393-2396 (lines=4) @@
2390
			if (in_array($egwEvent['id'], $matchingEvents)) continue;
2391
2392
			// convert timezone id of event to tzid (iCal id like 'Europe/Berlin')
2393
			if (!$egwEvent['tz_id'] || !($egwEvent['tzid'] = calendar_timezones::id2tz($egwEvent['tz_id'])))
2394
			{
2395
				$egwEvent['tzid'] = egw_time::$server_timezone->getName();
2396
			}
2397
			if (!isset(self::$tz_cache[$egwEvent['tzid']]))
2398
			{
2399
				self::$tz_cache[$egwEvent['tzid']] = calendar_timezones::DateTimeZone($egwEvent['tzid']);