Code Duplication    Length = 9-9 lines in 2 locations

class/APCal.php 2 locations

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