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 | xoops_loadLanguage('admin', 'mymodule2'); |
||||||
| 29 | // It recovered the value of argument op in URL$ |
||||||
| 30 | $op = Request::getString('op', 'form'); |
||||||
| 31 | // Template |
||||||
| 32 | $GLOBALS['xoopsOption']['template_main'] = 'mymodule2_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_MYMODULE2_SUBMIT_PROPOSER; |
||||||
| 47 | $GLOBALS['xoopsTpl']->assign('navigation', $navigation); |
||||||
| 48 | // Title of page |
||||||
| 49 | $title = _MA_MYMODULE2_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_MYMODULE2_SUBMIT_PROPOSER)); |
||||||
| 54 | // Form Create |
||||||
| 55 | $testfieldsObj = $testfieldsHandler->create(); |
||||||
| 56 | $form = $testfieldsObj->getFormTestfields(); |
||||||
| 57 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||||
| 58 | |||||||
| 59 | break; |
||||||
| 60 | case 'save': |
||||||
| 61 | // Security Check |
||||||
| 62 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||||
| 63 | redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||||||
| 64 | } |
||||||
| 65 | $testfieldsObj = $testfieldsHandler->create(); |
||||||
| 66 | $testfieldsObj->setVar('tf_text', Request::getString('tf_text', '')); |
||||||
| 67 | $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', '')); |
||||||
| 68 | $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', '')); |
||||||
| 69 | $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0)); |
||||||
| 70 | $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0)); |
||||||
| 71 | $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', '')); |
||||||
| 72 | $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0)); |
||||||
| 73 | $testfieldsObj->setVar('tf_color', Request::getString('tf_color', '')); |
||||||
| 74 | // Set Var tf_imagelist |
||||||
| 75 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||
| 76 | $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', |
||||||
| 77 | $helper->getConfig('mimetypes_image'), |
||||||
| 78 | $helper->getConfig('maxsize_image'), null, null); |
||||||
| 79 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
||||||
| 80 | //$uploader->setPrefix(tf_imagelist_); |
||||||
| 81 | //$uploader->fetchMedia($_POST['xoops_upload_file'][0]); |
||||||
| 82 | if (!$uploader->upload()) { |
||||||
| 83 | $errors = $uploader->getErrors(); |
||||||
| 84 | redirect_header('javascript:history.go(-1).php', 3, $errors); |
||||||
| 85 | } else { |
||||||
| 86 | $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName()); |
||||||
| 87 | } |
||||||
| 88 | } else { |
||||||
| 89 | $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist')); |
||||||
| 90 | } |
||||||
| 91 | $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile'])); |
||||||
| 92 | // Set Var tf_urlfile |
||||||
| 93 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||
| 94 | $filename = $_FILES['tf_urlfile']['name']; |
||||||
| 95 | $imgNameDef = Request::getString('tf_text'); |
||||||
| 96 | $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
||||||
| 97 | $helper->getConfig('mimetypes_file'), |
||||||
| 98 | $helper->getConfig('maxsize_file'), null, null); |
||||||
| 99 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) { |
||||||
| 100 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||||||
| 101 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||||||
| 102 | $uploader->setPrefix($imgName); |
||||||
| 103 | $uploader->fetchMedia($_POST['xoops_upload_file'][1]); |
||||||
| 104 | if (!$uploader->upload()) { |
||||||
| 105 | $errors = $uploader->getErrors(); |
||||||
| 106 | } else { |
||||||
| 107 | $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName()); |
||||||
| 108 | } |
||||||
| 109 | } else { |
||||||
| 110 | if ($filename > '') { |
||||||
| 111 | $uploaderErrors = $uploader->getErrors(); |
||||||
| 112 | } |
||||||
| 113 | $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile')); |
||||||
| 114 | } |
||||||
| 115 | // Set Var tf_uplimage |
||||||
| 116 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||
| 117 | $filename = $_FILES['tf_uplimage']['name']; |
||||||
| 118 | $imgMimetype = $_FILES['tf_uplimage']['type']; |
||||||
| 119 | $imgNameDef = Request::getString('tf_text'); |
||||||
| 120 | $uploaderErrors = ''; |
||||||
| 121 | $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', |
||||||
| 122 | $helper->getConfig('mimetypes_image'), |
||||||
| 123 | $helper->getConfig('maxsize_image'), null, null); |
||||||
| 124 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) { |
||||||
| 125 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||||||
| 126 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||||||
| 127 | $uploader->setPrefix($imgName); |
||||||
| 128 | $uploader->fetchMedia($_POST['xoops_upload_file'][2]); |
||||||
| 129 | if (!$uploader->upload()) { |
||||||
| 130 | $uploaderErrors = $uploader->getErrors(); |
||||||
| 131 | } else { |
||||||
| 132 | $savedFilename = $uploader->getSavedFileName(); |
||||||
| 133 | $maxwidth = (int)$helper->getConfig('maxwidth_image'); |
||||||
| 134 | $maxheight = (int)$helper->getConfig('maxheight_image'); |
||||||
| 135 | if ($maxwidth > 0 && $maxheight > 0) { |
||||||
| 136 | // Resize image |
||||||
| 137 | $imgHandler = new Mymodule2\Common\Resizer(); |
||||||
| 138 | $imgHandler->sourceFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
||||||
| 139 | $imgHandler->endFile = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename; |
||||||
| 140 | $imgHandler->imageMimetype = $imgMimetype; |
||||||
| 141 | $imgHandler->maxWidth = $maxwidth; |
||||||
| 142 | $imgHandler->maxHeight = $maxheight; |
||||||
| 143 | $result = $imgHandler->resizeImage(); |
||||||
| 144 | } |
||||||
| 145 | $testfieldsObj->setVar('tf_uplimage', $savedFilename); |
||||||
| 146 | } |
||||||
| 147 | } else { |
||||||
| 148 | if ($filename > '') { |
||||||
| 149 | $uploaderErrors = $uploader->getErrors(); |
||||||
| 150 | } |
||||||
| 151 | $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage')); |
||||||
| 152 | } |
||||||
| 153 | // Set Var tf_uplfile |
||||||
| 154 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||
| 155 | $filename = $_FILES['tf_uplfile']['name']; |
||||||
| 156 | $imgNameDef = Request::getString('tf_text'); |
||||||
| 157 | $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
||||||
| 158 | $helper->getConfig('mimetypes_file'), |
||||||
| 159 | $helper->getConfig('maxsize_file'), null, null); |
||||||
| 160 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) { |
||||||
| 161 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||||||
| 162 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||||||
| 163 | $uploader->setPrefix($imgName); |
||||||
| 164 | $uploader->fetchMedia($_POST['xoops_upload_file'][3]); |
||||||
| 165 | if (!$uploader->upload()) { |
||||||
| 166 | $errors = $uploader->getErrors(); |
||||||
| 167 | } else { |
||||||
| 168 | $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName()); |
||||||
| 169 | } |
||||||
| 170 | } else { |
||||||
| 171 | if ($filename > '') { |
||||||
| 172 | $uploaderErrors = $uploader->getErrors(); |
||||||
| 173 | } |
||||||
| 174 | $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile')); |
||||||
| 175 | } |
||||||
| 176 | $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect')); |
||||||
| 177 | $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp()); |
||||||
| 178 | // Set Var tf_selectfile |
||||||
| 179 | include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||
| 180 | $filename = $_FILES['tf_selectfile']['name']; |
||||||
| 181 | $imgNameDef = Request::getString('tf_text'); |
||||||
| 182 | $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', |
||||||
| 183 | $helper->getConfig('mimetypes_file'), |
||||||
| 184 | $helper->getConfig('maxsize_file'), null, null); |
||||||
| 185 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) { |
||||||
| 186 | $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename); |
||||||
| 187 | $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension; |
||||||
| 188 | $uploader->setPrefix($imgName); |
||||||
| 189 | $uploader->fetchMedia($_POST['xoops_upload_file'][4]); |
||||||
| 190 | if (!$uploader->upload()) { |
||||||
| 191 | $errors = $uploader->getErrors(); |
||||||
| 192 | } else { |
||||||
| 193 | $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName()); |
||||||
| 194 | } |
||||||
| 195 | } else { |
||||||
| 196 | if ($filename > '') { |
||||||
| 197 | $uploaderErrors = $uploader->getErrors(); |
||||||
| 198 | } |
||||||
| 199 | $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile')); |
||||||
| 200 | } |
||||||
| 201 | $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0)); |
||||||
| 202 | // Insert Data |
||||||
| 203 | if ($testfieldsHandler->insert($testfieldsObj)) { |
||||||
| 204 | $newTfId = $testfieldsObj->getNewInsertedIdTestfields(); |
||||||
| 205 | $permId = isset($_REQUEST['tf_id']) ? $tfId : $newTfId; |
||||||
| 206 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||||
| 207 | $mid = $GLOBALS['xoopsModule']->getVar('mid'); |
||||||
| 208 | // Permission to view_testfields |
||||||
| 209 | $grouppermHandler->deleteByModule($mid, 'mymodule2_view_testfields', $permId); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 210 | if (isset($_POST['groups_view_testfields'])) { |
||||||
| 211 | foreach($_POST['groups_view_testfields'] as $onegroupId) { |
||||||
| 212 | $grouppermHandler->addRight('mymodule2_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...
|
|||||||
| 213 | } |
||||||
| 214 | } |
||||||
| 215 | // Permission to submit_testfields |
||||||
| 216 | $grouppermHandler->deleteByModule($mid, 'mymodule2_submit_testfields', $permId); |
||||||
| 217 | if (isset($_POST['groups_submit_testfields'])) { |
||||||
| 218 | foreach($_POST['groups_submit_testfields'] as $onegroupId) { |
||||||
| 219 | $grouppermHandler->addRight('mymodule2_submit_testfields', $permId, $onegroupId, $mid); |
||||||
| 220 | } |
||||||
| 221 | } |
||||||
| 222 | // Permission to approve_testfields |
||||||
| 223 | $grouppermHandler->deleteByModule($mid, 'mymodule2_approve_testfields', $permId); |
||||||
| 224 | if (isset($_POST['groups_approve_testfields'])) { |
||||||
| 225 | foreach($_POST['groups_approve_testfields'] as $onegroupId) { |
||||||
| 226 | $grouppermHandler->addRight('mymodule2_approve_testfields', $permId, $onegroupId, $mid); |
||||||
| 227 | } |
||||||
| 228 | } |
||||||
| 229 | if ('' !== $uploaderErrors) { |
||||||
| 230 | redirect_header('testfields.php?op=edit&tf_id=' . $tfId, 5, $uploaderErrors); |
||||||
| 231 | } else { |
||||||
| 232 | redirect_header('testfields.php?op=list', 2, _MA_MYMODULE2_FORM_OK); |
||||||
| 233 | } |
||||||
| 234 | } |
||||||
| 235 | // Get Form Error |
||||||
| 236 | $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors()); |
||||||
| 237 | $form = $testfieldsObj->getFormTestfields(); |
||||||
| 238 | $GLOBALS['xoopsTpl']->assign('form', $form->display()); |
||||||
| 239 | |||||||
| 240 | break; |
||||||
| 241 | } |
||||||
| 242 | // Breadcrumbs |
||||||
| 243 | $xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_SUBMIT]; |
||||||
| 244 | require __DIR__ . '/footer.php'; |
||||||
| 245 |
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.