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 3 module for xoops |
||||||
| 14 | * |
||||||
| 15 | * @copyright 2020 XOOPS Project (https://xooops.org) |
||||||
| 16 | * @license GPL 2.0 or later |
||||||
| 17 | * @package mymodule3 |
||||||
| 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\Mymodule3; |
||||||
| 25 | use XoopsModules\Mymodule3\Constants; |
||||||
| 26 | |||||||
| 27 | require __DIR__ . '/header.php'; |
||||||
| 28 | xoops_loadLanguage('admin', 'mymodule3'); |
||||||
| 29 | // It recovered the value of argument op in URL$ |
||||||
| 30 | $op = Request::getString('op', 'form'); |
||||||
| 31 | // Template |
||||||
| 32 | $GLOBALS['xoopsOption']['template_main'] = 'mymodule3_submit.tpl'; |
||||||
| 33 | include_once XOOPS_ROOT_PATH . '/header.php'; |
||||||
| 34 | $GLOBALS['xoTheme']->addStylesheet( $style, null ); |
||||||
| 35 | $permissionsHandler = $helper->getHandler('permissions'); |
||||||
| 36 | $permSubmit = $permissionsHandler->getPermGlobalSubmit(); |
||||||
| 37 | // Redirection if not permissions |
||||||
| 38 | if ($permSubmit === false) { |
||||||
| 39 | redirect_header('index.php', 2, _NOPERM); |
||||||
| 40 | exit(); |
||||||
| 41 | } |
||||||
| 42 | switch($op) { |
||||||
| 43 | case 'form': |
||||||
| 44 | default: |
||||||
| 45 | // Navigation |
||||||
| 46 | $navigation = _MA_MYMODULE3_SUBMIT_PROPOSER; |
||||||
| 47 | $GLOBALS['xoopsTpl']->assign('navigation', $navigation); |
||||||
| 48 | // Title of page |
||||||
| 49 | $title = _MA_MYMODULE3_SUBMIT_PROPOSER . ' - '; |
||||||
| 50 | $title .= $GLOBALS['xoopsModule']->name(); |
||||||
| 51 | $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $title); |
||||||
| 52 | // Description |
||||||
| 53 | $GLOBALS['xoTheme']->addMeta( 'meta', 'description', strip_tags(_MA_MYMODULE3_SUBMIT_PROPOSER)); |
||||||
| 54 | // Form Create |
||||||
| 55 | $testfieldsObj = $testfieldsHandler->create(); |
||||||
| 56 | $form = $testfieldsObj->getFormTestfields(); |
||||||
| 57 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||||
| 58 | break; |
||||||
| 59 | case 'save': |
||||||
| 60 | // Security Check |
||||||
| 61 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||||
| 62 | redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||||||
| 63 | } |
||||||
| 64 | $testfieldsObj = $testfieldsHandler->create(); |
||||||
| 65 | $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); |
||||||
| 66 | $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); |
||||||
| 67 | $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); |
||||||
| 68 | $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); |
||||||
| 69 | $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); |
||||||
| 70 | $testfieldsObj->setVar('tf_selectbox', Request::getInt('tf_selectbox', 0)); |
||||||
| 71 | $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); |
||||||
| 72 | $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); |
||||||
| 73 | // Set Var tf_imagelist |
||||||
| 74 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||
| 75 | $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', |
||||||
| 76 | $helper->getConfig('mimetypes_image'), |
||||||
| 77 | $helper->getConfig('maxsize_image'), null, null); |
||||||
| 78 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
||||||
| 79 | //$uploader->setPrefix(tf_imagelist_); |
||||||
| 80 | //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); |
||||||
| 81 | if (!$uploader->upload()) { |
||||||
| 82 | $errors = $uploader->getErrors(); |
||||||
| 83 | redirect_header('javascript:history.go(-1).php', 3, $errors); |
||||||
| 84 | } else { |
||||||
| 85 | $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); |
||||||
| 86 | } |
||||||
| 87 | } else { |
||||||
| 88 | $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); |
||||||
| 89 | } |
||||||
| 90 | $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); |
||||||
| 91 | // Set Var tf_urlfile |
||||||
| 92 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||
| 93 | $filename = $_FILES['tf_urlfile']['name']; |
||||||
| 94 | $imgNameDef = Request::getString('tf_text'); |
||||||
| 95 | $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', |
||||||
| 96 | $helper->getConfig('mimetypes_file'), |
||||||
| 97 | $helper->getConfig('maxsize_file'), null, null); |
||||||
| 98 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { |
||||||
| 99 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||||||
| 100 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||||||
| 101 | $uploader->setPrefix($imgName); |
||||||
| 102 | $uploader->fetchMedia($_POST['xoops_upload_file'][1]); |
||||||
| 103 | if (!$uploader->upload()) { |
||||||
| 104 | $errors = $uploader->getErrors(); |
||||||
| 105 | } else { |
||||||
| 106 | $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); |
||||||
| 107 | } |
||||||
| 108 | } else { |
||||||
| 109 | if ($filename > '') { |
||||||
| 110 | $uploaderErrors = $uploader->getErrors(); |
||||||
| 111 | } |
||||||
| 112 | $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); |
||||||
| 113 | } |
||||||
| 114 | // Set Var tf_uplimage |
||||||
| 115 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||
| 116 | $filename = $_FILES['tf_uplimage']['name']; |
||||||
| 117 | $imgMimetype = $_FILES['tf_uplimage']['type']; |
||||||
| 118 | $imgNameDef = Request::getString('tf_text'); |
||||||
| 119 | $uploaderErrors = ''; |
||||||
| 120 | $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/', |
||||||
| 121 | $helper->getConfig('mimetypes_image'), |
||||||
| 122 | $helper->getConfig('maxsize_image'), null, null); |
||||||
| 123 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { |
||||||
| 124 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||||||
| 125 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||||||
| 126 | $uploader->setPrefix($imgName); |
||||||
| 127 | $uploader->fetchMedia($_POST['xoops_upload_file'][2]); |
||||||
| 128 | if (!$uploader->upload()) { |
||||||
| 129 | $uploaderErrors = $uploader->getErrors(); |
||||||
| 130 | } else { |
||||||
| 131 | $savedFilename = $uploader->getSavedFileName(); |
||||||
| 132 | $maxwidth = (int)$helper->getConfig('maxwidth_image'); |
||||||
| 133 | $maxheight = (int)$helper->getConfig('maxheight_image'); |
||||||
| 134 | if ($maxwidth > 0 && $maxheight > 0) { |
||||||
| 135 | // Resize image |
||||||
| 136 | $imgHandler = new Mymodule3\Common\Resizer(); |
||||||
| 137 | $imgHandler->sourceFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
||||||
| 138 | $imgHandler->endFile = MYMODULE3_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
||||||
| 139 | $imgHandler->imageMimetype = $imgMimetype; |
||||||
| 140 | $imgHandler->maxWidth = $maxwidth; |
||||||
| 141 | $imgHandler->maxHeight = $maxheight; |
||||||
| 142 | $result = $imgHandler->resizeImage(); |
||||||
| 143 | } |
||||||
| 144 | $testfieldsObj->setVar('tf_uplimage', $savedFilename); |
||||||
| 145 | } |
||||||
| 146 | } else { |
||||||
| 147 | if ($filename > '') { |
||||||
| 148 | $uploaderErrors = $uploader->getErrors(); |
||||||
| 149 | } |
||||||
| 150 | $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); |
||||||
| 151 | } |
||||||
| 152 | // Set Var tf_uplfile |
||||||
| 153 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||
| 154 | $filename = $_FILES['tf_uplfile']['name']; |
||||||
| 155 | $imgNameDef = Request::getString('tf_text'); |
||||||
| 156 | $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', |
||||||
| 157 | $helper->getConfig('mimetypes_file'), |
||||||
| 158 | $helper->getConfig('maxsize_file'), null, null); |
||||||
| 159 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { |
||||||
| 160 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||||||
| 161 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||||||
| 162 | $uploader->setPrefix($imgName); |
||||||
| 163 | $uploader->fetchMedia($_POST['xoops_upload_file'][3]); |
||||||
| 164 | if (!$uploader->upload()) { |
||||||
| 165 | $errors = $uploader->getErrors(); |
||||||
| 166 | } else { |
||||||
| 167 | $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); |
||||||
| 168 | } |
||||||
| 169 | } else { |
||||||
| 170 | if ($filename > '') { |
||||||
| 171 | $uploaderErrors = $uploader->getErrors(); |
||||||
| 172 | } |
||||||
| 173 | $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); |
||||||
| 174 | } |
||||||
| 175 | $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); |
||||||
| 176 | $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); |
||||||
| 177 | // Set Var tf_selectfile |
||||||
| 178 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||
| 179 | $filename = $_FILES['tf_selectfile']['name']; |
||||||
| 180 | $imgNameDef = Request::getString('tf_text'); |
||||||
| 181 | $uploader = new \XoopsMediaUploader(MYMODULE3_UPLOAD_FILES_PATH . '/testfields/', |
||||||
| 182 | $helper->getConfig('mimetypes_file'), |
||||||
| 183 | $helper->getConfig('maxsize_file'), null, null); |
||||||
| 184 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { |
||||||
| 185 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||||||
| 186 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||||||
| 187 | $uploader->setPrefix($imgName); |
||||||
| 188 | $uploader->fetchMedia($_POST['xoops_upload_file'][4]); |
||||||
| 189 | if (!$uploader->upload()) { |
||||||
| 190 | $errors = $uploader->getErrors(); |
||||||
| 191 | } else { |
||||||
| 192 | $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); |
||||||
| 193 | } |
||||||
| 194 | } else { |
||||||
| 195 | if ($filename > '') { |
||||||
| 196 | $uploaderErrors = $uploader->getErrors(); |
||||||
| 197 | } |
||||||
| 198 | $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); |
||||||
| 199 | } |
||||||
| 200 | $tfPassword = Request::getString('tf_password', ''); |
||||||
| 201 | if ('' !== $tfPassword) { |
||||||
| 202 | $testfieldsObj->setVar('tf_password', password_hash($tfPassword, PASSWORD_DEFAULT)); |
||||||
| 203 | } |
||||||
| 204 | $testfieldsObj->setVar('tf_country_list', Request::getString('tf_country_list', '')); |
||||||
| 205 | $testfieldsObj->setVar('tf_language', Request::getString('tf_language', '')); |
||||||
| 206 | $testfieldsObj->setVar('tf_radio', Request::getInt('tf_radio', 0)); |
||||||
| 207 | $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); |
||||||
| 208 | $testfieldDatetimeArr = Request::getArray('tf_datetime'); |
||||||
| 209 | $testfieldDatetime = strtotime($testfieldDatetimeArr['date']) + (int)$testfieldDatetimeArr['time']; |
||||||
| 210 | $testfieldsObj->setVar('tf_datetime', $testfieldDatetime); |
||||||
| 211 | $testfieldsObj->setVar('tf_combobox', Request::getInt('tf_combobox', 0)); |
||||||
| 212 | // Insert Data |
||||||
| 213 | if ($testfieldsHandler->insert($testfieldsObj)) { |
||||||
| 214 | $newTfId = $testfieldsObj->getNewInsertedIdTestfields(); |
||||||
| 215 | $permId = isset($_REQUEST['tf_id']) ? $tfId : $newTfId; |
||||||
| 216 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||||
| 217 | $mid = $GLOBALS['xoopsModule']->getVar('mid'); |
||||||
| 218 | // Permission to view_testfields |
||||||
| 219 | $grouppermHandler->deleteByModule($mid, 'mymodule3_view_testfields', $permId); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 220 | if (isset($_POST['groups_view_testfields'])) { |
||||||
| 221 | foreach($_POST['groups_view_testfields'] as $onegroupId) { |
||||||
| 222 | $grouppermHandler->addRight('mymodule3_view_testfields', $permId, $onegroupId, $mid); |
||||||
|
0 ignored issues
–
show
The method
addRight() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsGroupPermHandler or XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 223 | } |
||||||
| 224 | } |
||||||
| 225 | // Permission to submit_testfields |
||||||
| 226 | $grouppermHandler->deleteByModule($mid, 'mymodule3_submit_testfields', $permId); |
||||||
| 227 | if (isset($_POST['groups_submit_testfields'])) { |
||||||
| 228 | foreach($_POST['groups_submit_testfields'] as $onegroupId) { |
||||||
| 229 | $grouppermHandler->addRight('mymodule3_submit_testfields', $permId, $onegroupId, $mid); |
||||||
| 230 | } |
||||||
| 231 | } |
||||||
| 232 | // Permission to approve_testfields |
||||||
| 233 | $grouppermHandler->deleteByModule($mid, 'mymodule3_approve_testfields', $permId); |
||||||
| 234 | if (isset($_POST['groups_approve_testfields'])) { |
||||||
| 235 | foreach($_POST['groups_approve_testfields'] as $onegroupId) { |
||||||
| 236 | $grouppermHandler->addRight('mymodule3_approve_testfields', $permId, $onegroupId, $mid); |
||||||
| 237 | } |
||||||
| 238 | } |
||||||
| 239 | if ('' !== $uploaderErrors) { |
||||||
| 240 | redirect_header('testfields.php?op=edit&tf_id=' . $tfId, 5, $uploaderErrors); |
||||||
| 241 | } else { |
||||||
| 242 | redirect_header('testfields.php?op=list', 2, _MA_MYMODULE3_FORM_OK); |
||||||
| 243 | } |
||||||
| 244 | } |
||||||
| 245 | // Get Form Error |
||||||
| 246 | $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); |
||||||
| 247 | $form = $testfieldsObj->getFormTestfields(); |
||||||
| 248 | $GLOBALS['xoopsTpl']->assign('form', $form->display()); |
||||||
| 249 | break; |
||||||
| 250 | } |
||||||
| 251 | // Breadcrumbs |
||||||
| 252 | $xoBreadcrumbs[] = ['title' => _MA_MYMODULE3_SUBMIT]; |
||||||
| 253 | require __DIR__ . '/footer.php'; |
||||||
| 254 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.