Code Duplication    Length = 4-4 lines in 2 locations

class/APCal.php 2 locations

@@ 2643-2646 (lines=4) @@
2640
            if ($xoopsTpl) {
2641
                $prevEvent = $GLOBALS['xoopsDB']->query("SELECT id,start FROM $this->table WHERE id<{$event->id} AND start={$event->start} ORDER BY id DESC LIMIT 0,1");
2642
                $prevEvent = $GLOBALS['xoopsDB']->fetchObject($prevEvent);
2643
                if (!$prevEvent) {
2644
                    $prevEvent = $GLOBALS['xoopsDB']->query("SELECT id,start FROM $this->table WHERE start<{$event->start} ORDER BY start DESC LIMIT 0,1");
2645
                    $prevEvent = $GLOBALS['xoopsDB']->fetchObject($prevEvent);
2646
                }
2647
                $prevEvent = $prevEvent ? $this->make_event_link($prevEvent->id) : false;
2648
                $xoopsTpl->assign('prevEvent', $prevEvent);
2649
@@ 2652-2655 (lines=4) @@
2649
2650
                $nextEvent = $GLOBALS['xoopsDB']->query("SELECT id,start FROM $this->table WHERE id>{$event->id} AND start={$event->start} ORDER BY id ASC LIMIT 0,1");
2651
                $nextEvent = $GLOBALS['xoopsDB']->fetchObject($nextEvent);
2652
                if (!$nextEvent) {
2653
                    $nextEvent = $GLOBALS['xoopsDB']->query("SELECT id,start FROM $this->table WHERE start>{$event->start} ORDER BY start ASC LIMIT 0,1");
2654
                    $nextEvent = $GLOBALS['xoopsDB']->fetchObject($nextEvent);
2655
                }
2656
                $nextEvent = $nextEvent ? $this->make_event_link($nextEvent->id) : false;
2657
                $xoopsTpl->assign('nextEvent', $nextEvent);
2658