Code Duplication    Length = 17-17 lines in 3 locations

admin/downloads.php 1 location

@@ 670-686 (lines=17) @@
667
        } else {
668
            $obj->setVar('size', $_POST['size'] . ' ' . $_POST['type_size']);
669
            // Pour le fichier
670
            if (isset($_POST['xoops_upload_file'][0])) {
671
                $uploader = new XoopsMediaUploader($uploaddir_downloads, explode('|',$xoopsModuleConfig['mimetype']), $xoopsModuleConfig['maxuploadsize'], null, null);
672
                if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
673
                    if ($xoopsModuleConfig['newnamedownload']) {
674
                        $uploader->setPrefix($xoopsModuleConfig['prefixdownloads']) ;
675
                    }
676
                    $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
677
                    if (!$uploader->upload()) {
678
                        $errors = $uploader->getErrors();
679
                        redirect_header("javascript:history.go(-1)",3, $errors);
680
                    } else {
681
                        $obj->setVar('url', $uploadurl_downloads . $uploader->getSavedFileName());
682
                    }
683
                } else {
684
                    $obj->setVar('url', $_REQUEST['url']);
685
                }
686
            }
687
            // Pour l'image
688
            if (isset($_POST['xoops_upload_file'][1])) {
689
                $uploader_2 = new XoopsMediaUploader($uploaddir_shots, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), $xoopsModuleConfig['maxuploadsize'], null, null);

modfile.php 1 location

@@ 146-162 (lines=17) @@
143
        } else {
144
            $obj->setVar('size', $_POST['size'] . ' ' . $_POST['type_size']);
145
            // Pour le fichier
146
            if (isset($_POST['xoops_upload_file'][0])) {
147
                $uploader = new XoopsMediaUploader($uploaddir_downloads, explode('|',$xoopsModuleConfig['mimetype']), $xoopsModuleConfig['maxuploadsize'], null, null);
148
                if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
149
                    if ($xoopsModuleConfig['newnamedownload']) {
150
                        $uploader->setPrefix($xoopsModuleConfig['prefixdownloads']) ;
151
                    }
152
                    $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
153
                    if (!$uploader->upload()) {
154
                        $errors = $uploader->getErrors();
155
                        redirect_header("javascript:history.go(-1)",3, $errors);
156
                    } else {
157
                        $obj->setVar('url', $uploadurl_downloads . $uploader->getSavedFileName());
158
                    }
159
                } else {
160
                    $obj->setVar('url', $_REQUEST['url']);
161
                }
162
            }
163
            // Pour l'image
164
            if (isset($_POST['xoops_upload_file'][1])) {
165
                $uploader_2 = new XoopsMediaUploader($uploaddir_shots, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), $xoopsModuleConfig['maxuploadsize'], null, null);

submit.php 1 location

@@ 139-155 (lines=17) @@
136
        } else {
137
            $obj->setVar('size', $_POST['size'] . ' ' . $_POST['type_size']);
138
            // Pour le fichier
139
            if (isset($_POST['xoops_upload_file'][0])) {
140
                $uploader = new XoopsMediaUploader($uploaddir_downloads, explode('|',$xoopsModuleConfig['mimetype']), $xoopsModuleConfig['maxuploadsize'], null, null);
141
                if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
142
                    if ($xoopsModuleConfig['newnamedownload']) {
143
                        $uploader->setPrefix($xoopsModuleConfig['prefixdownloads']) ;
144
                    }
145
                    $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
146
                    if (!$uploader->upload()) {
147
                        $errors = $uploader->getErrors();
148
                        redirect_header("javascript:history.go(-1)",3, $errors);
149
                    } else {
150
                        $obj->setVar('url', $uploadurl_downloads . $uploader->getSavedFileName());
151
                    }
152
                } else {
153
                    $obj->setVar('url', $_REQUEST['url']);
154
                }
155
            }
156
            // Pour l'image
157
            if (isset($_POST['xoops_upload_file'][1])) {
158
                $uploader_2 = new XoopsMediaUploader($uploaddir_shots, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), $xoopsModuleConfig['maxuploadsize'], null, null);