Code Duplication    Length = 25-26 lines in 2 locations

admin/upload.php 1 location

@@ 49-74 (lines=26) @@
46
        }
47
        break;
48
49
    case 'delfile':
50
51
        if (1 == XoopsRequest::getInt('confirm', '', 'POST')) { // isset($_POST['confirm']) && $_POST['confirm'] == 1) {
52
            $filetodelete = XOOPS_ROOT_PATH . '/' . XoopsRequest::getString('uploadpath', '', 'POST') . '/' . XoopsRequest::getString('videofile', '', 'POST');
53
            if (file_exists($filetodelete)) {
54
                chmod($filetodelete, 0666);
55
                if (@unlink($filetodelete)) {
56
                    redirect_header('upload.php', 1, _AM_XOOPSTUBE_VIDEO_FILEDELETED);
57
                } else {
58
                    redirect_header('upload.php', 1, _AM_XOOPSTUBE_VIDEO_FILEERRORDELETE);
59
                }
60
            }
61
        } else {
62
            //            if (empty($_POST['videofile'])) {
63
            if (!XoopsRequest::getString('videofile', '', 'POST')) {
64
                redirect_header('upload.php', 1, _AM_XOOPSTUBE_VIDEO_NOFILEERROR);
65
            }
66
            xoops_cp_header();
67
            xoops_confirm(array(
68
                              'op'         => 'delfile',
69
                              'uploadpath' => XoopsRequest::getString('uploadpath', '', 'POST'),
70
                              'videofile'  => XoopsRequest::getString('videofile', '', 'POST'),
71
                              'confirm'    => 1
72
                          ), 'upload.php', _AM_XOOPSTUBE_VIDEO_DELETEFILE . '<br><br>' . XoopsRequest::getString('videofile', '', 'POST'), _AM_XOOPSTUBE_BDELETE);
73
        }
74
        break;
75
76
    case 'default':
77
    default:

admin/vupload.php 1 location

@@ 46-70 (lines=25) @@
43
        }
44
        break;
45
46
    case 'delfile':
47
        if (1 == XoopsRequest::getInt('confirm', '', 'POST')) { //isset($_POST['confirm']) && $_POST['confirm'] == 1) {
48
            $filetodelete = XOOPS_ROOT_PATH . '/' . XoopsRequest::getString('uploadpath', '', 'POST') . '/' . XoopsRequest::getString('videofile', '', 'POST');
49
            if (file_exists($filetodelete)) {
50
                chmod($filetodelete, 0666);
51
                if (@unlink($filetodelete)) {
52
                    redirect_header('vupload.php', 1, _AM_XOOPSTUBE_VUPLOAD_FILEDELETED);
53
                } else {
54
                    redirect_header('vupload.php', 1, _AM_XOOPSTUBE_VUPLOAD_FILEERRORDELETE);
55
                }
56
            }
57
        } else {
58
            //            if (empty($_POST['videofile'])) {
59
            if (!XoopsRequest::getString('videofile', '', 'POST')) {
60
                redirect_header('vupload.php', 1, _AM_XOOPSTUBE_VUPLOAD_NOFILEERROR);
61
            }
62
            xoops_cp_header();
63
            xoops_confirm(array(
64
                              'op'         => 'delfile',
65
                              'uploadpath' => XoopsRequest::getString('uploadpath', '', 'POST'),
66
                              'videofile'  => XoopsRequest::getString('videofile', '', 'POST'),
67
                              'confirm'    => 1
68
                          ), 'vupload.php', _AM_XOOPSTUBE_VUPLOAD_DELETEFILE . '<br><br>' . XoopsRequest::getString('videofile', '', 'POST'), _AM_XOOPSTUBE_BDELETE);
69
        }
70
        break;
71
72
    case 'default':
73
    default: