txmodxoops /
tdmcreate
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 | * My Module 2 module for xoops |
||
| 14 | * |
||
| 15 | * @copyright 2020 XOOPS Project (https://xooops.org) |
||
| 16 | * @license GPL 2.0 or later |
||
| 17 | * @package mymodule2 |
||
| 18 | * @since 1.0 |
||
| 19 | * @min_xoops 2.5.9 |
||
| 20 | * @author TDM XOOPS - Email:<[email protected]> - Website:<http://xoops.org> |
||
| 21 | */ |
||
| 22 | |||
| 23 | use Xmf\Request; |
||
| 24 | use XoopsModules\Mymodule2; |
||
| 25 | use XoopsModules\Mymodule2\Constants; |
||
| 26 | |||
| 27 | require __DIR__ . '/header.php'; |
||
| 28 | $op = Request::getString('op', 'form'); |
||
| 29 | $lid = Request::getInt('lid'); |
||
| 30 | $GLOBALS['xoopsOption']['template_main'] = 'mymodule2_testfields.tpl'; |
||
| 31 | include_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 32 | // Define Stylesheet |
||
| 33 | $GLOBALS['xoTheme']->addStylesheet( $style, null ); |
||
| 34 | switch($op) { |
||
| 35 | case 'form': |
||
| 36 | default: |
||
| 37 | // Navigation |
||
| 38 | $navigation = _MA_MYMODULE2_RATE; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 39 | $GLOBALS['xoopsTpl']->assign('navigation', $navigation); |
||
| 40 | // Title of page |
||
| 41 | $title = _MA_MYMODULE2_RATE . ' - '; |
||
| 42 | $title .= $GLOBALS['xoopsModule']->name(); |
||
| 43 | $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); |
||
| 44 | // Description |
||
| 45 | $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE2_RATE)); |
||
| 46 | // Form Create |
||
| 47 | $testfieldsObj = $testfieldsHandler->create(); |
||
| 48 | $form = $testfieldsObj->getFormTestfields(); |
||
| 49 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 50 | |||
| 51 | break; |
||
| 52 | case 'save': |
||
| 53 | // Security Check |
||
| 54 | if ($GLOBALS['xoopsSecurity']->check()) { |
||
| 55 | redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 56 | } |
||
| 57 | $testfieldsObj = $testfieldsHandler->create(); |
||
| 58 | $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); |
||
| 59 | $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); |
||
| 60 | $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); |
||
| 61 | $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); |
||
| 62 | $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); |
||
| 63 | $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', '')); |
||
| 64 | $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); |
||
| 65 | $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); |
||
| 66 | // Set Var tf_imagelist |
||
| 67 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||
| 68 | $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', |
||
| 69 | $helper->getConfig('mimetypes_image'), |
||
| 70 | $helper->getConfig('maxsize_image'), null, null); |
||
| 71 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
||
| 72 | //$uploader->setPrefix(tf_imagelist_); |
||
| 73 | //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); |
||
| 74 | if (!$uploader->upload()) { |
||
| 75 | $errors = $uploader->getErrors(); |
||
| 76 | redirect_header('javascript:history.go(-1).php', 3, $errors); |
||
| 77 | } else { |
||
| 78 | $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); |
||
| 79 | } |
||
| 80 | } else { |
||
| 81 | $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); |
||
| 82 | } |
||
| 83 | $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); |
||
| 84 | // Set Var tf_urlfile |
||
| 85 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||
| 86 | $filename = $_FILES['tf_urlfile']['name']; |
||
| 87 | $imgNameDef = Request::getString('tf_text'); |
||
| 88 | $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
||
| 89 | $helper->getConfig('mimetypes_file'), |
||
| 90 | $helper->getConfig('maxsize_file'), null, null); |
||
| 91 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { |
||
| 92 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||
| 93 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||
| 94 | $uploader->setPrefix($imgName); |
||
| 95 | $uploader->fetchMedia($_POST['xoops_upload_file'][1]); |
||
| 96 | if (!$uploader->upload()) { |
||
| 97 | $errors = $uploader->getErrors(); |
||
| 98 | } else { |
||
| 99 | $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); |
||
| 100 | } |
||
| 101 | } else { |
||
| 102 | if ($filename > '') { |
||
| 103 | $uploaderErrors = $uploader->getErrors(); |
||
| 104 | } |
||
| 105 | $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); |
||
| 106 | } |
||
| 107 | // Set Var tf_uplimage |
||
| 108 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||
| 109 | $filename = $_FILES['tf_uplimage']['name']; |
||
| 110 | $imgMimetype = $_FILES['tf_uplimage']['type']; |
||
| 111 | $imgNameDef = Request::getString('tf_text'); |
||
| 112 | $uploaderErrors = ''; |
||
| 113 | $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', |
||
| 114 | $helper->getConfig('mimetypes_image'), |
||
| 115 | $helper->getConfig('maxsize_image'), null, null); |
||
| 116 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { |
||
| 117 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||
| 118 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||
| 119 | $uploader->setPrefix($imgName); |
||
| 120 | $uploader->fetchMedia($_POST['xoops_upload_file'][2]); |
||
| 121 | if (!$uploader->upload()) { |
||
| 122 | $uploaderErrors = $uploader->getErrors(); |
||
| 123 | } else { |
||
| 124 | $savedFilename = $uploader->getSavedFileName(); |
||
| 125 | $maxwidth = (int)$helper->getConfig('maxwidth_image'); |
||
| 126 | $maxheight = (int)$helper->getConfig('maxheight_image'); |
||
| 127 | if ($maxwidth > 0 && $maxheight > 0) { |
||
| 128 | // Resize image |
||
| 129 | $imgHandler = new Mymodule2\Common\Resizer(); |
||
| 130 | $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
||
| 131 | $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
||
| 132 | $imgHandler->imageMimetype = $imgMimetype; |
||
| 133 | $imgHandler->maxWidth = $maxwidth; |
||
| 134 | $imgHandler->maxHeight = $maxheight; |
||
| 135 | $result = $imgHandler->resizeImage(); |
||
| 136 | } |
||
| 137 | $testfieldsObj->setVar('tf_uplimage', $savedFilename); |
||
| 138 | } |
||
| 139 | } else { |
||
| 140 | if ($filename > '') { |
||
| 141 | $uploaderErrors = $uploader->getErrors(); |
||
| 142 | } |
||
| 143 | $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); |
||
| 144 | } |
||
| 145 | // Set Var tf_uplfile |
||
| 146 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||
| 147 | $filename = $_FILES['tf_uplfile']['name']; |
||
| 148 | $imgNameDef = Request::getString('tf_text'); |
||
| 149 | $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
||
| 150 | $helper->getConfig('mimetypes_file'), |
||
| 151 | $helper->getConfig('maxsize_file'), null, null); |
||
| 152 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { |
||
| 153 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||
| 154 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||
| 155 | $uploader->setPrefix($imgName); |
||
| 156 | $uploader->fetchMedia($_POST['xoops_upload_file'][3]); |
||
| 157 | if (!$uploader->upload()) { |
||
| 158 | $errors = $uploader->getErrors(); |
||
| 159 | } else { |
||
| 160 | $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); |
||
| 161 | } |
||
| 162 | } else { |
||
| 163 | if ($filename > '') { |
||
| 164 | $uploaderErrors = $uploader->getErrors(); |
||
| 165 | } |
||
| 166 | $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); |
||
| 167 | } |
||
| 168 | $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); |
||
| 169 | $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); |
||
| 170 | // Set Var tf_selectfile |
||
| 171 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||
| 172 | $filename = $_FILES['tf_selectfile']['name']; |
||
| 173 | $imgNameDef = Request::getString('tf_text'); |
||
| 174 | $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
||
| 175 | $helper->getConfig('mimetypes_file'), |
||
| 176 | $helper->getConfig('maxsize_file'), null, null); |
||
| 177 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { |
||
| 178 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||
| 179 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||
| 180 | $uploader->setPrefix($imgName); |
||
| 181 | $uploader->fetchMedia($_POST['xoops_upload_file'][4]); |
||
| 182 | if (!$uploader->upload()) { |
||
| 183 | $errors = $uploader->getErrors(); |
||
| 184 | } else { |
||
| 185 | $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); |
||
| 186 | } |
||
| 187 | } else { |
||
| 188 | if ($filename > '') { |
||
| 189 | $uploaderErrors = $uploader->getErrors(); |
||
| 190 | } |
||
| 191 | $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); |
||
| 192 | } |
||
| 193 | $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); |
||
| 194 | // Insert Data |
||
| 195 | if ($testfields1->insert($testfieldsObj)) { |
||
| 196 | redirect_header('index.php', 2, _MA_MYMODULE2_FORM_OK); |
||
| 197 | } |
||
| 198 | // Get Form Error |
||
| 199 | $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); |
||
| 200 | $form = $testfieldsObj->getFormTestfields(); |
||
| 201 | $GLOBALS['xoopsTpl']->assign('form', $form->display()); |
||
| 202 | |||
| 203 | break; |
||
| 204 | } |
||
| 205 | // Breadcrumbs |
||
| 206 | $xoBreadcrumbs[] = ['title' => RATE_MA_MYMODULE2_]; |
||
|
0 ignored issues
–
show
|
|||
| 207 | require __DIR__ . '/footer.php'; |
||
| 208 |