Code Duplication    Length = 4-4 lines in 2 locations

class/APCal.php 2 locations

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