Code Duplication    Length = 16-16 lines in 2 locations

admin/categories.php 2 locations

@@ 712-727 (lines=16) @@
709
        $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 250, 250);
710
        if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
711
            $filename = $uploader->getMediaName();
712
        } else {
713
            $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET title = '$p_title', active='$p_active', pid='$p_pid', allowlist='$p_allowlist', showpopular='$p_showpopular' WHERE cid = $p_catid";
714
            $xoopsDB->query($sql) or $eh->show('0013');
715
716
            if ($p_descr) {
717
                if ($descr_exists === true) {
718
                    $sql2 = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . " SET text='$p_descr' WHERE cid = $p_catid";
719
                } else {
720
                    $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq');
721
                    $sql2  = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $p_catid, $p_descr, '1', time());
722
                }
723
                $xoopsDB->query($sql2) or $eh->show('0013');
724
            }
725
            redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED);
726
            exit();
727
        }
728
        $uploader->setPrefix('efqdir');
729
        if ($uploader->upload()) {
730
            $savedfilename = $uploader->getSavedFileName();
@@ 745-760 (lines=16) @@
742
            }
743
            redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED);
744
            exit();
745
        } else {
746
            echo $uploader->getErrors();
747
            $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET title = '$p_title', active='$p_active', pid='$p_pid', allowlist='$p_allowlist', showpopular='$p_showpopular' WHERE cid = $p_catid";
748
            $xoopsDB->query($sql) or $eh->show('0013');
749
            if ($p_descr) {
750
                if ($descr_exists === true) {
751
                    $sql2 = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . " SET text='$p_descr' WHERE cid = $p_catid";
752
                } else {
753
                    $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq');
754
                    $sql2  = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $p_catid, $p_descr, '1', time());
755
                }
756
                $xoopsDB->query($sql2) or $eh->show('0013');
757
            }
758
            redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED);
759
            exit();
760
        }
761
    }
762
    redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_NOT_UPDATED);
763
    exit();