XoopsModules25x /
xoopstube
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * XoopsTube - a multicategory video management module |
||
| 4 | * |
||
| 5 | * Based upon WF-Links |
||
| 6 | * |
||
| 7 | * File: admin/vupload.php |
||
| 8 | * |
||
| 9 | * @copyright http://www.xoops.org/ The XOOPS Project |
||
| 10 | * @copyright XOOPS_copyrights.txt |
||
| 11 | * @copyright http://www.impresscms.org/ The ImpressCMS Project |
||
| 12 | * @license GNU General Public License (GPL) |
||
| 13 | * a copy of the GNU license is enclosed. |
||
| 14 | * ---------------------------------------------------------------------------------------------------------- |
||
| 15 | * @package WF-Links |
||
| 16 | * @since 1.03 |
||
| 17 | * @author John N |
||
| 18 | * ---------------------------------------------------------------------------------------------------------- |
||
| 19 | * XoopsTube |
||
| 20 | * @since 1.00 |
||
| 21 | * @author McDonald |
||
| 22 | * @version $Id$ |
||
| 23 | */ |
||
| 24 | |||
| 25 | include_once __DIR__ . '/admin_header.php'; |
||
| 26 | |||
| 27 | global $xoopsModuleConfig; |
||
| 28 | |||
| 29 | $op = (isset($_REQUEST['op']) && !empty($_REQUEST['op'])) ? $_REQUEST['op'] : ''; |
||
| 30 | $rootpath = (isset($_GET['rootpath'])) ? intval($_GET['rootpath']) : 0; |
||
| 31 | |||
| 32 | switch (strtolower($op)) { |
||
| 33 | case 'vupload': |
||
| 34 | if ($_FILES['uploadfile']['name'] != '') { |
||
| 35 | View Code Duplication | if (file_exists(XOOPS_ROOT_PATH . '/' . $_POST['uploadpath'] . '/' . $_FILES['uploadfile']['name'])) { |
|
| 36 | redirect_header('vupload.php', 2, _AM_XOOPSTUBE_VUPLOAD_VIDEOEXIST); |
||
| 37 | } |
||
| 38 | $allowed_mimetypes = 'media/aac, media/flv, media/mp3, media/mp4'; |
||
| 39 | xtubeUploadFiles($_FILES, $_POST['uploadpath'], $allowed_mimetypes, 'vupload.php', 1, 0); |
||
| 40 | redirect_header('vupload.php', 2, _AM_XOOPSTUBE_VUPLOAD_VIDEOUPLOAD); |
||
| 41 | exit(); |
||
| 42 | } else { |
||
| 43 | redirect_header('vupload.php', 2, _AM_XOOPSTUBE_VUPLOAD_NOVIDEOEXIST); |
||
| 44 | exit(); |
||
| 45 | } |
||
| 46 | break; |
||
| 47 | |||
| 48 | View Code Duplication | case "delfile": |
|
| 49 | if (isset($_POST['confirm']) && $_POST['confirm'] == 1) { |
||
| 50 | $filetodelete = XOOPS_ROOT_PATH . '/' . $_POST['uploadpath'] . '/' . $_POST['videofile']; |
||
| 51 | if (file_exists($filetodelete)) { |
||
| 52 | chmod($filetodelete, 0666); |
||
| 53 | if (@unlink($filetodelete)) { |
||
| 54 | redirect_header('vupload.php', 1, _AM_XOOPSTUBE_VUPLOAD_FILEDELETED); |
||
| 55 | } else { |
||
| 56 | redirect_header('vupload.php', 1, _AM_XOOPSTUBE_VUPLOAD_FILEERRORDELETE); |
||
| 57 | } |
||
| 58 | } |
||
| 59 | exit(); |
||
| 60 | } else { |
||
| 61 | if (empty($_POST['videofile'])) { |
||
| 62 | redirect_header('vupload.php', 1, _AM_XOOPSTUBE_VUPLOAD_NOFILEERROR); |
||
| 63 | exit(); |
||
| 64 | } |
||
| 65 | xoops_cp_header(); |
||
| 66 | xoops_confirm( |
||
| 67 | array( |
||
| 68 | 'op' => 'delfile', |
||
| 69 | 'uploadpath' => $_POST['uploadpath'], |
||
| 70 | 'videofile' => $_POST['videofile'], |
||
| 71 | 'confirm' => 1 |
||
| 72 | ), |
||
| 73 | 'vupload.php', |
||
| 74 | _AM_XOOPSTUBE_VUPLOAD_DELETEFILE . '<br /><br />' . $_POST['videofile'], |
||
| 75 | _AM_XOOPSTUBE_BDELETE |
||
| 76 | ); |
||
| 77 | } |
||
| 78 | break; |
||
| 79 | |||
| 80 | case 'default': |
||
| 81 | default: |
||
| 82 | $displayimage = ''; |
||
| 83 | xoops_cp_header(); |
||
| 84 | $aboutAdmin = new ModuleAdmin(); |
||
| 85 | echo $aboutAdmin->addNavigation('vupload.php'); |
||
| 86 | |||
| 87 | $dirarray = array(1 => $xoopsModuleConfig['videodir']); |
||
| 88 | $namearray = array(1 => _AM_XOOPSTUBE_VUPLOAD_CATVIDEO); |
||
| 89 | $listarray = array(1 => _AM_XOOPSTUBE_VUPLOAD_FCATVIDEO); |
||
| 90 | |||
| 91 | //xtubeRenderAdminMenu( _AM_XOOPSTUBE_VUPLOADS ); |
||
|
0 ignored issues
–
show
|
|||
| 92 | |||
| 93 | View Code Duplication | if ($rootpath > 0) { |
|
| 94 | echo '<div><b> ' . _AM_XOOPSTUBE_VUPLOAD_FUPLOADPATH . '</b> ' . XOOPS_ROOT_PATH . '/' . $dirarray[$rootpath] . '</div>'; |
||
| 95 | echo '<div><b> ' . _AM_XOOPSTUBE_VUPLOAD_FUPLOADURL . '</b> ' . XOOPS_URL . '/' . $dirarray[$rootpath] . '</div><br />'; |
||
| 96 | } |
||
| 97 | $pathlist = (isset($listarray[$rootpath])) ? $namearray[$rootpath] : ''; |
||
| 98 | $namelist = (isset($listarray[$rootpath])) ? $namearray[$rootpath] : ''; |
||
| 99 | |||
| 100 | $iform = new XoopsThemeForm(_AM_XOOPSTUBE_VUPLOAD_FUPLOADVIDEOTO . $pathlist, 'op', xoops_getenv('PHP_SELF')); |
||
| 101 | $iform->setExtra('enctype="multipart/form-data"'); |
||
| 102 | ob_start(); |
||
| 103 | $iform->addElement(new XoopsFormHidden('dir', $rootpath)); |
||
| 104 | xtubeVGetDirSelectOption($namelist, $dirarray, $namearray); |
||
| 105 | $iform->addElement(new XoopsFormLabel(_AM_XOOPSTUBE_VUPLOAD_FOLDERSELECTION, ob_get_contents())); |
||
| 106 | ob_end_clean(); |
||
| 107 | |||
| 108 | if ($rootpath > 0) { |
||
| 109 | |||
| 110 | $file_array = & XoopstubeLists :: getListTypeAsArray( |
||
| 111 | XOOPS_ROOT_PATH . '/' . $dirarray[$rootpath], |
||
| 112 | $type = 'media' |
||
| 113 | ); |
||
| 114 | $indexfile_select = new XoopsFormSelect('', 'videofile', ''); |
||
| 115 | $indexfile_select->addOptionArray($file_array); |
||
| 116 | $indexfile_select->setExtra( |
||
| 117 | "onchange='showImgSelected(\"media\", \"videofile\", \"" . $dirarray[$rootpath] . "\", \"\", \"" . XOOPS_URL . "\")'" |
||
| 118 | ); |
||
| 119 | $indexfile_tray = new XoopsFormElementTray(_AM_XOOPSTUBE_VUPLOAD_FSHOWSELECTEDFILE, ' '); |
||
| 120 | $indexfile_tray->addElement($indexfile_select); |
||
| 121 | View Code Duplication | if (!empty($imgurl)) { |
|
| 122 | $indexfile_tray->addElement( |
||
| 123 | new XoopsFormLabel( |
||
| 124 | '', '<br /><br /><img src="' . XOOPS_URL . '/' . $dirarray[$rootpath] . '/' . $videofile . '" name="image" id="image" alt="" />' |
||
| 125 | ) |
||
| 126 | ); |
||
| 127 | } else { |
||
| 128 | $indexfile_tray->addElement( |
||
| 129 | new XoopsFormLabel( |
||
| 130 | '', '<br /><br /><img src="' . XOOPS_URL . '/uploads/blank.gif" name="image" id="image" alt="" />' |
||
| 131 | ) |
||
| 132 | ); |
||
| 133 | } |
||
| 134 | $iform->addElement($indexfile_tray); |
||
| 135 | |||
| 136 | $file_tray = new XoopsFormFile(_AM_XOOPSTUBE_VUPLOAD_FUPLOADVIDEO, 'uploadfile', 0); |
||
| 137 | $file_tray->setDescription( |
||
| 138 | '<span style="font-size: small;">' . _AM_XOOPSTUBE_VUPLOAD_FSHOWSELECTEDFILEDSC . '</span>' |
||
| 139 | ); |
||
| 140 | $iform->addElement($file_tray); |
||
| 141 | $iform->addElement(new XoopsFormHidden('uploadpath', $dirarray[$rootpath])); |
||
| 142 | $iform->addElement(new XoopsFormHidden('rootnumber', $rootpath)); |
||
| 143 | |||
| 144 | $dup_tray = new XoopsFormElementTray('', ''); |
||
| 145 | $dup_tray->addElement(new XoopsFormHidden('op', 'vupload')); |
||
| 146 | $butt_dup = new XoopsFormButton('', '', _AM_XOOPSTUBE_BUPLOAD, 'submit'); |
||
| 147 | $butt_dup->setExtra('onclick="this.form.elements.op.value=\'vupload\'"'); |
||
| 148 | $dup_tray->addElement($butt_dup); |
||
| 149 | |||
| 150 | $butt_dupct = new XoopsFormButton('', '', _AM_XOOPSTUBE_BDELETEVIDEO, 'submit'); |
||
| 151 | $butt_dupct->setExtra('onclick="this.form.elements.op.value=\'delfile\'"'); |
||
| 152 | $dup_tray->addElement($butt_dupct); |
||
| 153 | $iform->addElement($dup_tray); |
||
| 154 | } |
||
| 155 | $iform->display(); |
||
| 156 | } |
||
| 157 | include_once __DIR__ . '/admin_footer.php'; |
||
| 158 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.