Code Duplication    Length = 4-8 lines in 3 locations

calendar/inc/class.calendar_so.inc.php 3 locations

@@ 406-412 (lines=7) @@
403
			}
404
			if (!(int)$recur_date && $event['recur_type'] != MCAL_RECUR_NONE)
405
			{
406
				foreach($this->db->select($this->dates_table, 'cal_id,cal_start', array(
407
					'cal_id' => $ids,
408
					'recur_exception' => true,
409
				), __LINE__, __FILE__, false, 'ORDER BY cal_id,cal_start', 'calendar') as $row)
410
				{
411
					$events[$row['cal_id']]['recur_exception'][] = $row['cal_start'];
412
				}
413
				break;	// as above select read all exceptions (and I dont think too short uid problem still exists)
414
			}
415
			// make sure we fetch only real exceptions (deleted occurrences of a series should not show up)
@@ 419-426 (lines=8) @@
416
			if (($recur_date &&	$event['recur_type'] != MCAL_RECUR_NONE))
417
			{
418
				//_debug_array(__METHOD__.__LINE__.' recur_date:'.$recur_date.' check cal_start:'.$event['start']);
419
				foreach($this->db->select($this->dates_table, 'cal_id,cal_start', array(
420
					'cal_id' => $event['id'],
421
					'cal_start' => $event['start'],
422
					'recur_exception' => true,
423
				), __LINE__, __FILE__, false, '', 'calendar') as $row)
424
				{
425
					$isException[$row['cal_id']] = true;
426
				}
427
				if ($isException[$event['id']])
428
				{
429
					if (!$this->db->select($this->cal_table, 'COUNT(*)', array(
@@ 480-483 (lines=4) @@
477
		}
478
479
		// custom fields
480
		foreach($this->db->select($this->extra_table,'*',array('cal_id'=>$ids),__LINE__,__FILE__,false,'','calendar') as $row)
481
		{
482
			$events[$row['cal_id']]['#'.$row['cal_extra_name']] = $row['cal_extra_value'];
483
		}
484
485
		// alarms
486
		if (is_array($ids))