XoopsModules25x /
wfdownloads
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | /* |
||
| 3 | You may not change or alter any portion of this comment or credits |
||
| 4 | of supporting developers from this source code or any supporting source code |
||
| 5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 6 | |||
| 7 | This program is distributed in the hope that it will be useful, |
||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 10 | */ |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Wfdownloads module |
||
| 14 | * |
||
| 15 | * @copyright XOOPS Project (https://xoops.org) |
||
| 16 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 17 | * @package wfdownload |
||
| 18 | * @since 3.23 |
||
| 19 | * @author Xoops Development Team |
||
| 20 | */ |
||
| 21 | |||
| 22 | use Xmf\Module\Admin; |
||
| 23 | use Xmf\Request; |
||
| 24 | use XoopsModules\Wfdownloads\{ |
||
| 25 | Helper, |
||
| 26 | Utility, |
||
| 27 | WfsLists |
||
| 28 | |||
| 29 | }; |
||
| 30 | /** @var Helper $helper */ |
||
| 31 | /** @var Utility $utility */ |
||
| 32 | |||
| 33 | $currentFile = basename(__FILE__); |
||
| 34 | require_once __DIR__ . '/admin_header.php'; |
||
| 35 | |||
| 36 | $op = Request::getString('op', 'indexpage.form'); |
||
| 37 | switch ($op) { |
||
| 38 | case 'indexpage.save': |
||
| 39 | // Get post parameters |
||
| 40 | $indexheading = $myts->addSlashes($_POST['indexheading']); |
||
| 41 | $indexheader = $myts->addSlashes($_POST['indexheader']); |
||
| 42 | $indexfooter = $myts->addSlashes($_POST['indexfooter']); |
||
| 43 | require_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||
| 44 | $allowedMimetypes = ['image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png']; |
||
| 45 | $maxFileSize = $helper->getConfig('maxfilesize'); |
||
| 46 | $maxImgWidth = $helper->getConfig('maximgwidth'); |
||
| 47 | $maxImgHeight = $helper->getConfig('maximgheight'); |
||
| 48 | $uploadDirectory = XOOPS_ROOT_PATH . '/' . $helper->getConfig('mainimagedir'); |
||
| 49 | $uploader = new XoopsMediaUploader($uploadDirectory, $allowedMimetypes, $maxFileSize, $maxImgWidth, $maxImgHeight); |
||
| 50 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
||
| 51 | $uploader->setTargetFileName('wfdownloads_' . uniqid(time(), true) . '--' . mb_strtolower($_FILES['uploadfile']['name'])); |
||
| 52 | $uploader->fetchMedia($_POST['xoops_upload_file'][0]); |
||
| 53 | if (!$uploader->upload()) { |
||
| 54 | $errors = $uploader->getErrors(); |
||
| 55 | redirect_header('<script>javascript:history.go(-1)</script>', 3, $errors); |
||
| 56 | } else { |
||
| 57 | $indeximage = $uploader->getSavedFileName(); |
||
| 58 | } |
||
| 59 | } else { |
||
| 60 | $indeximage = (isset($_POST['indeximage']) && 'blank.png' !== $_POST['indeximage']) ? $myts->addSlashes($_POST['indeximage']) : ''; |
||
| 61 | } |
||
| 62 | $nohtml = isset($_POST['nohtml']); |
||
| 63 | $nosmiley = isset($_POST['nosmiley']); |
||
| 64 | $noxcodes = isset($_POST['noxcodes']); |
||
| 65 | $noimages = isset($_POST['noimages']); |
||
| 66 | $nobreak = isset($_POST['nobreak']); |
||
| 67 | $indexheaderalign = $_POST['indexheaderalign']; |
||
| 68 | $indexfooteralign = $_POST['indexfooteralign']; |
||
| 69 | // Update db |
||
| 70 | $sql = "update {$GLOBALS['xoopsDB']->prefix('wfdownloads_indexpage')} set"; |
||
| 71 | $sql .= " indexheading='{$indexheading}',"; |
||
| 72 | $sql .= " indexheader='{$indexheader}',"; |
||
| 73 | $sql .= " indexfooter='{$indexfooter}',"; |
||
| 74 | $sql .= " indeximage='{$indeximage}',"; |
||
| 75 | $sql .= " indexheaderalign='{$indexheaderalign}',"; |
||
| 76 | $sql .= " indexfooteralign='{$indexfooteralign}',"; |
||
| 77 | $sql .= " nohtml='{$nohtml}',"; |
||
| 78 | $sql .= " nosmiley='{$nosmiley}',"; |
||
| 79 | $sql .= " noxcodes='{$noxcodes}',"; |
||
| 80 | $sql .= " noimages='{$noimages}',"; |
||
| 81 | $sql .= " nobreak='{$nobreak}' "; |
||
| 82 | $GLOBALS['xoopsDB']->query($sql); |
||
| 83 | redirect_header(WFDOWNLOADS_URL . '/admin/indexpage.php', 1, _AM_WFDOWNLOADS_IPAGE_UPDATED); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 84 | break; |
||
| 85 | case 'indexpage.form': |
||
| 86 | default: |
||
| 87 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 88 | |||
| 89 | $sql = 'SELECT indeximage, indexheading, indexheader, indexfooter, nohtml, nosmiley, noxcodes, noimages, nobreak, indexheaderalign, indexfooteralign'; |
||
| 90 | $sql .= " FROM {$GLOBALS['xoopsDB']->prefix('wfdownloads_indexpage')} "; |
||
| 91 | $result = $GLOBALS['xoopsDB']->query($sql); |
||
| 92 | [$indeximage, $indexheading, $indexheader, $indexfooter, $nohtml, $nosmiley, $noxcodes, $noimages, $nobreak, $indexheaderalign, $indexfooteralign] = $GLOBALS['xoopsDB']->fetchrow($result); |
||
| 93 | |||
| 94 | Utility::getCpHeader(); |
||
| 95 | $adminObject = Admin::getInstance(); |
||
| 96 | $adminObject->displayNavigation(basename(__FILE__)); |
||
| 97 | |||
| 98 | echo '<fieldset><legend>' . _AM_WFDOWNLOADS_IPAGE_INFORMATION . "</legend>\n"; |
||
| 99 | echo '<div>' . _AM_WFDOWNLOADS_MINDEX_PAGEINFOTXT . "</div>\n"; |
||
| 100 | echo "</fieldset>\n"; |
||
| 101 | |||
| 102 | $sform = new XoopsThemeForm(_AM_WFDOWNLOADS_IPAGE_MODIFY, 'op', xoops_getenv('SCRIPT_NAME'), 'post', true); |
||
| 103 | $sform->setExtra('enctype="multipart/form-data"'); |
||
| 104 | // indexpage: indexheading |
||
| 105 | $sform->addElement(new XoopsFormText(_AM_WFDOWNLOADS_IPAGE_CTITLE, 'indexheading', 60, 60, $indexheading), false); |
||
| 106 | // indexpage: indeximage |
||
| 107 | $indeximage_path = $indeximage ? $helper->getConfig('mainimagedir') . '/' . $indeximage : WFDOWNLOADS_IMAGE_URL . '/blank.png'; |
||
|
0 ignored issues
–
show
|
|||
| 108 | $indeximage_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_IPAGE_CIMAGE, '<br>'); |
||
| 109 | $indeximage_tray->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_DOWN_FUPLOADPATH, XOOPS_ROOT_PATH . '/' . $helper->getConfig('mainimagedir'))); |
||
| 110 | $indeximage_tray->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_DOWN_FUPLOADURL, XOOPS_URL . '/' . $helper->getConfig('mainimagedir'))); |
||
| 111 | $graph_array = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $helper->getConfig('mainimagedir'), 'images'); |
||
| 112 | $indeximage_select = new XoopsFormSelect('', 'indeximage', $indeximage); |
||
| 113 | $indeximage_select->addOptionArray($graph_array); |
||
| 114 | $indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"indeximage\", \"" . $helper->getConfig('mainimagedir') . '", "", "' . XOOPS_URL . "\")'"); |
||
| 115 | $indeximage_tray->addElement($indeximage_select, false); |
||
| 116 | $indeximage_tray->addElement(new XoopsFormLabel('', "<img src='" . XOOPS_URL . '/' . $indeximage_path . "' name='image' id='image' alt=''>")); |
||
| 117 | $indeximage_tray->addElement(new XoopsFormFile(_AM_WFDOWNLOADS_BUPLOAD, 'uploadfile', 0), false); |
||
| 118 | $sform->addElement($indeximage_tray); |
||
| 119 | // indexpage: indexheader |
||
| 120 | $sform->addElement(new XoopsFormDhtmlTextArea(_AM_WFDOWNLOADS_IPAGE_CHEADING, 'indexheader', $indexheader, 15, 60)); |
||
| 121 | // indexpage: indexheaderalign |
||
| 122 | $headeralign_select = new XoopsFormSelect(_AM_WFDOWNLOADS_IPAGE_CHEADINGA, 'indexheaderalign', $indexheaderalign); |
||
| 123 | $headeralign_select->addOptionArray(['left' => _AM_WFDOWNLOADS_IPAGE_CLEFT, 'right' => _AM_WFDOWNLOADS_IPAGE_CRIGHT, 'center' => _AM_WFDOWNLOADS_IPAGE_CCENTER]); |
||
| 124 | $sform->addElement($headeralign_select); |
||
| 125 | // indexpage: indexfooter |
||
| 126 | $sform->addElement(new XoopsFormDhtmlTextArea(_AM_WFDOWNLOADS_IPAGE_CFOOTER, 'indexfooter', $indexfooter, 15, 60)); |
||
| 127 | // indexpage: indexfooteralign |
||
| 128 | $footeralign_select = new XoopsFormSelect(_AM_WFDOWNLOADS_IPAGE_CFOOTERA, 'indexfooteralign', $indexfooteralign); |
||
| 129 | $footeralign_select->addOptionArray(['left' => _AM_WFDOWNLOADS_IPAGE_CLEFT, 'right' => _AM_WFDOWNLOADS_IPAGE_CRIGHT, 'center' => _AM_WFDOWNLOADS_IPAGE_CCENTER]); |
||
| 130 | $sform->addElement($footeralign_select); |
||
| 131 | // indexpage: nohtml, nosmailey, noxcodes, noimages, nobreak |
||
| 132 | $options_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_TEXTOPTIONS, '<br>'); |
||
| 133 | $html_checkbox = new XoopsFormCheckBox('', 'nohtml', $nohtml); |
||
| 134 | $html_checkbox->addOption(1, _AM_WFDOWNLOADS_ALLOWHTML); |
||
| 135 | $options_tray->addElement($html_checkbox); |
||
| 136 | $smiley_checkbox = new XoopsFormCheckBox('', 'nosmiley', $nosmiley); |
||
| 137 | $smiley_checkbox->addOption(1, _AM_WFDOWNLOADS_ALLOWSMILEY); |
||
| 138 | $options_tray->addElement($smiley_checkbox); |
||
| 139 | $xcodes_checkbox = new XoopsFormCheckBox('', 'noxcodes', $noxcodes); |
||
| 140 | $xcodes_checkbox->addOption(1, _AM_WFDOWNLOADS_ALLOWXCODE); |
||
| 141 | $options_tray->addElement($xcodes_checkbox); |
||
| 142 | $noimages_checkbox = new XoopsFormCheckBox('', 'noimages', $noimages); |
||
| 143 | $noimages_checkbox->addOption(1, _AM_WFDOWNLOADS_ALLOWIMAGES); |
||
| 144 | $options_tray->addElement($noimages_checkbox); |
||
| 145 | $breaks_checkbox = new XoopsFormCheckBox('', 'nobreak', $nobreak); |
||
| 146 | $breaks_checkbox->addOption(1, _AM_WFDOWNLOADS_ALLOWBREAK); |
||
| 147 | $options_tray->addElement($breaks_checkbox); |
||
| 148 | $sform->addElement($options_tray); |
||
| 149 | // form: button try |
||
| 150 | $buttonTray = new XoopsFormElementTray('', ''); |
||
| 151 | $hidden = new XoopsFormHidden('op', 'indexpage.save'); |
||
| 152 | $buttonTray->addElement($hidden); |
||
| 153 | $buttonTray->addElement(new XoopsFormButton('', 'post', _AM_WFDOWNLOADS_BSAVE, 'submit')); |
||
| 154 | $sform->addElement($buttonTray); |
||
| 155 | $sform->display(); |
||
| 156 | break; |
||
| 157 | } |
||
| 158 | require_once __DIR__ . '/admin_footer.php'; |
||
| 159 |