Code Duplication    Length = 9-9 lines in 2 locations

class/APCal.php 2 locations

@@ 3571-3579 (lines=9) @@
3568
                //$last_caldate = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_POST['last_caldate'] ) ;
3569
                $new_caldate = $start_date ?: date('Y-n-j', $start);
3570
                //$this->redirect( "smode=$last_smode&caldate=$new_caldate" ) ;
3571
                if (isset($_POST['saveas'])) {
3572
                    $result = $GLOBALS['xoopsDB']->query("SELECT * FROM {$this->pic_table} WHERE event_id={$_POST['event_oldid']}");
3573
                    while ($pic = $GLOBALS['xoopsDB']->fetchObject($result)) {
3574
                        $GLOBALS['xoopsDB']->query("INSERT INTO {$this->pic_table}(event_id, picture, main_pic) VALUES ({$event_id}, '{$pic->picture}', {$pic->main_pic})");
3575
                    }
3576
                    $this->savepictures($event_id);
3577
                } else {
3578
                    $this->savepictures($event_id);
3579
                }
3580
            } else {
3581
                $sql = "INSERT INTO $this->table SET $set_str , rrule='$rrule' , sequence=0, gmlat='{$_POST['gmlat']}', gmlong='{$_POST['gmlong']}', gmzoom='{$_POST['gmzoom']}'";
3582
                if (!$GLOBALS['xoopsDB']->query($sql)) {
@@ 3605-3613 (lines=9) @@
3602
                //$this->redirect( "smode=$last_smode&caldate=$last_caldate" ) ;
3603
3604
                // Save pictures
3605
                if (isset($_POST['saveas'])) {
3606
                    $result = $GLOBALS['xoopsDB']->query("SELECT * FROM {$this->pic_table} WHERE event_id={$_POST['event_oldid']}");
3607
                    while ($pic = $GLOBALS['xoopsDB']->fetchObject($result)) {
3608
                        $GLOBALS['xoopsDB']->query("INSERT INTO {$this->pic_table}(event_id, picture, main_pic) VALUES ({$event_id}, '{$pic->picture}', {$pic->main_pic})");
3609
                    }
3610
                    $this->savepictures($event_id);
3611
                } else {
3612
                    $this->savepictures($event_id);
3613
                }
3614
3615
                // added by goffy for registration online automatically redirect to form for set up parameters for online registration, if online registration is selected
3616
                $ro_redirect = $_POST['ro_activate'];