Code Duplication    Length = 12-12 lines in 2 locations

admin/categories.php 1 location

@@ 584-595 (lines=12) @@
581
        if ($_POST['xoops_upload_file'][$i] != '') {
582
            $medianame = $_POST['xoops_upload_file'][$i];
583
            if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) {
584
                if (!$uploader->upload()) {
585
                    $err[] = $uploader->getErrors();
586
                } else {
587
                    $savedfilename = $uploader->getSavedFileName();
588
                    $ticket        = uniqid(mt_rand(), 1);
589
                    //Rename the uploaded file to the same name in a different location that does not have 777 rights or 755.
590
                    rename('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '', '' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/uploads/' . $savedfilename . '');
591
                    //Delete the uploaded file from the initial upload folder if it is still present in that folder.
592
                    if (file_exists('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '')) {
593
                        unlink('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '');
594
                    }
595
                }
596
            }
597
        }
598
    }

edit.php 1 location

@@ 102-113 (lines=12) @@
99
            if ($_POST['xoops_upload_file'][$i] !== '') {
100
                $medianame = $_POST['xoops_upload_file'][$i];
101
                if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) {
102
                    if (!$uploader->upload()) {
103
                        $err[] = $uploader->getErrors();
104
                    } else {
105
                        $savedfilename = $uploader->getSavedFileName();
106
                        $ticket        = uniqid(mt_rand(), 1);
107
                        //Rename the uploaded file to the same name in a different location that does not have 777 rights or 755.
108
                        rename('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '', '' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/uploads/' . $savedfilename . '');
109
                        //Delete the uploaded file from the initial upload folder if it is still present in that folder.
110
                        if (file_exists('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '')) {
111
                            unlink('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '');
112
                        }
113
                    }
114
                    if ($p_title != $p_ini_title) {
115
                        $sql = 'UPDATE ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . " SET logourl = '" . $savedfilename . '\' WHERE itemid = \'' . $post_itemid . '\'';
116
                    } else {