Code Duplication    Length = 4-4 lines in 3 locations

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

@@ 949-952 (lines=4) @@
946
		foreach ($events as &$event)
947
		{
948
			// convert timezone id of event to tzid (iCal id like 'Europe/Berlin')
949
			if (empty($event['tzid']) && (!$event['tz_id'] || !($event['tzid'] = calendar_timezones::id2tz($event['tz_id']))))
950
			{
951
				$event['tzid'] = Api\DateTime::$server_timezone->getName();
952
			}
953
			// database returns timestamps as string, convert them to integer
954
			// to avoid misinterpretation by Api\DateTime as Ymd string
955
			// (this will fail on 32bit systems for times > 2038!)

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

@@ 1261-1264 (lines=4) @@
1258
			if (isset($event[$ts])) $event[$ts] = $event[$ts] ? $this->date2ts($event[$ts],true) : 0;
1259
		}
1260
		// convert tzid name to integer tz_id, of set user default
1261
		if (empty($event['tzid']) || !($event['tz_id'] = calendar_timezones::tz2id($event['tzid'])))
1262
		{
1263
			$event['tz_id'] = calendar_timezones::tz2id($event['tzid'] = Api\DateTime::$user_timezone->getName());
1264
		}
1265
		// same with the recur exceptions
1266
		if (isset($event['recur_exception']) && is_array($event['recur_exception']))
1267
		{
@@ 2321-2324 (lines=4) @@
2318
			if (in_array($egwEvent['id'], $matchingEvents)) continue;
2319
2320
			// convert timezone id of event to tzid (iCal id like 'Europe/Berlin')
2321
			if (!$egwEvent['tz_id'] || !($egwEvent['tzid'] = calendar_timezones::id2tz($egwEvent['tz_id'])))
2322
			{
2323
				$egwEvent['tzid'] = Api\DateTime::$server_timezone->getName();
2324
			}
2325
			if (!isset(self::$tz_cache[$egwEvent['tzid']]))
2326
			{
2327
				self::$tz_cache[$egwEvent['tzid']] = calendar_timezones::DateTimeZone($egwEvent['tzid']);