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 | namespace XoopsModules\Mymodule2; |
||||||
| 4 | |||||||
| 5 | /* |
||||||
| 6 | You may not change or alter any portion of this comment or credits |
||||||
| 7 | of supporting developers from this source code or any supporting source code |
||||||
| 8 | which is considered copyrighted (c) material of the original comment or credit authors. |
||||||
| 9 | |||||||
| 10 | This program is distributed in the hope that it will be useful, |
||||||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||||
| 13 | */ |
||||||
| 14 | |||||||
| 15 | /** |
||||||
| 16 | * My Module 2 module for xoops |
||||||
| 17 | * |
||||||
| 18 | * @copyright 2020 XOOPS Project (https://xooops.org) |
||||||
| 19 | * @license GPL 2.0 or later |
||||||
| 20 | * @package mymodule2 |
||||||
| 21 | * @since 1.0 |
||||||
| 22 | * @min_xoops 2.5.9 |
||||||
| 23 | * @author TDM XOOPS - Email:<[email protected]> - Website:<http://xoops.org> |
||||||
| 24 | */ |
||||||
| 25 | |||||||
| 26 | use XoopsModules\Mymodule2; |
||||||
| 27 | |||||||
| 28 | defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||||||
| 29 | |||||||
| 30 | /** |
||||||
| 31 | * Class Object Testfields |
||||||
| 32 | */ |
||||||
| 33 | class Testfields extends \XoopsObject |
||||||
| 34 | { |
||||||
| 35 | /** |
||||||
| 36 | * Constructor |
||||||
| 37 | * |
||||||
| 38 | * @param null |
||||||
| 39 | */ |
||||||
| 40 | public function __construct() |
||||||
| 41 | { |
||||||
| 42 | $this->initVar('tf_id', XOBJ_DTYPE_INT); |
||||||
| 43 | $this->initVar('tf_text', XOBJ_DTYPE_TXTBOX); |
||||||
| 44 | $this->initVar('tf_textarea', XOBJ_DTYPE_TXTBOX); |
||||||
| 45 | $this->initVar('tf_dhtml', XOBJ_DTYPE_TXTBOX); |
||||||
| 46 | $this->initVar('tf_checkbox', XOBJ_DTYPE_INT); |
||||||
| 47 | $this->initVar('tf_yesno', XOBJ_DTYPE_INT); |
||||||
| 48 | $this->initVar('tf_selectbox', XOBJ_DTYPE_TXTBOX); |
||||||
| 49 | $this->initVar('tf_user', XOBJ_DTYPE_INT); |
||||||
| 50 | $this->initVar('tf_color', XOBJ_DTYPE_TXTBOX); |
||||||
| 51 | $this->initVar('tf_imagelist', XOBJ_DTYPE_TXTBOX); |
||||||
| 52 | $this->initVar('tf_urlfile', XOBJ_DTYPE_TXTBOX); |
||||||
| 53 | $this->initVar('tf_uplimage', XOBJ_DTYPE_TXTBOX); |
||||||
| 54 | $this->initVar('tf_uplfile', XOBJ_DTYPE_TXTBOX); |
||||||
| 55 | $this->initVar('tf_textdateselect', XOBJ_DTYPE_TXTBOX); |
||||||
| 56 | $this->initVar('tf_selectfile', XOBJ_DTYPE_TXTBOX); |
||||||
| 57 | $this->initVar('tf_status', XOBJ_DTYPE_INT); |
||||||
| 58 | } |
||||||
| 59 | |||||||
| 60 | /** |
||||||
| 61 | * @static function &getInstance |
||||||
| 62 | * |
||||||
| 63 | * @param null |
||||||
| 64 | */ |
||||||
| 65 | public static function getInstance() |
||||||
| 66 | { |
||||||
| 67 | static $instance = false; |
||||||
| 68 | if (!$instance) { |
||||||
| 69 | $instance = new self(); |
||||||
| 70 | } |
||||||
| 71 | } |
||||||
| 72 | |||||||
| 73 | /** |
||||||
| 74 | * The new inserted $Id |
||||||
| 75 | * @return inserted id |
||||||
|
0 ignored issues
–
show
|
|||||||
| 76 | */ |
||||||
| 77 | public function getNewInsertedIdTestfields() |
||||||
| 78 | { |
||||||
| 79 | $newInsertedId = $GLOBALS['xoopsDB']->getInsertId(); |
||||||
| 80 | return $newInsertedId; |
||||||
| 81 | } |
||||||
| 82 | |||||||
| 83 | /** |
||||||
| 84 | * @public function getForm |
||||||
| 85 | * @param bool $action |
||||||
| 86 | * @return XoopsThemeForm |
||||||
|
0 ignored issues
–
show
|
|||||||
| 87 | */ |
||||||
| 88 | public function getFormTestfields($action = false) |
||||||
| 89 | { |
||||||
| 90 | $helper = \XoopsModules\Mymodule2\Helper::getInstance(); |
||||||
| 91 | if (false === $action) { |
||||||
| 92 | $action = $_SERVER['REQUEST_URI']; |
||||||
| 93 | } |
||||||
| 94 | // Permissions for uploader |
||||||
| 95 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||||
| 96 | $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||||||
| 97 | if ($GLOBALS['xoopsUser']) { |
||||||
| 98 | if (!$GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) { |
||||||
| 99 | $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; |
||||||
|
0 ignored issues
–
show
The method
checkRight() 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...
|
|||||||
| 100 | } else { |
||||||
| 101 | $permissionUpload = true; |
||||||
| 102 | } |
||||||
| 103 | } else { |
||||||
| 104 | $permissionUpload = $grouppermHandler->checkRight('upload_groups', 32, $groups, $GLOBALS['xoopsModule']->getVar('mid')) ? true : false; |
||||||
| 105 | } |
||||||
| 106 | // Title |
||||||
| 107 | $title = $this->isNew() ? sprintf(_AM_MYMODULE2_TESTFIELD_ADD) : sprintf(_AM_MYMODULE2_TESTFIELD_EDIT); |
||||||
| 108 | // Get Theme Form |
||||||
| 109 | xoops_load('XoopsFormLoader'); |
||||||
| 110 | $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
||||||
| 111 | $form->setExtra('enctype="multipart/form-data"'); |
||||||
| 112 | // Form Text TfText |
||||||
| 113 | $form->addElement(new \XoopsFormText( _AM_MYMODULE2_TESTFIELD_TEXT, 'tf_text', 50, 255, $this->getVar('tf_text') )); |
||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('tf_text') can also be of type array and array; however, parameter $value of XoopsFormText::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 114 | // Form Text Area TfTextarea |
||||||
| 115 | $form->addElement(new \XoopsFormTextArea( _AM_MYMODULE2_TESTFIELD_TEXTAREA, 'tf_textarea', $this->getVar('tf_textarea'), 4, 47 )); |
||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('tf_textarea') can also be of type array and array; however, parameter $value of XoopsFormTextArea::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 116 | // Form editor TfDhtml |
||||||
| 117 | $editorConfigs = []; |
||||||
| 118 | $editorConfigs['name'] = 'tf_dhtml'; |
||||||
| 119 | $editorConfigs['value'] = $this->getVar('tf_dhtml', 'e'); |
||||||
| 120 | $editorConfigs['rows'] = 5; |
||||||
| 121 | $editorConfigs['cols'] = 40; |
||||||
| 122 | $editorConfigs['width'] = '100%'; |
||||||
| 123 | $editorConfigs['height'] = '400px'; |
||||||
| 124 | $editorConfigs['editor'] = $helper->getConfig('editor_dhtml'); |
||||||
| 125 | $form->addElement(new \XoopsFormEditor( _AM_MYMODULE2_TESTFIELD_DHTML, 'tf_dhtml', $editorConfigs)); |
||||||
| 126 | // Form Check Box TfCheckbox |
||||||
| 127 | $tfCheckbox = $this->isNew() ? 0 : $this->getVar('tf_checkbox'); |
||||||
| 128 | $checkTfCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_TESTFIELD_CHECKBOX, 'tf_checkbox', $tfCheckbox); |
||||||
| 129 | $checkTfCheckbox->addOption(1, _AM_MYMODULE2_TESTFIELD_CHECKBOX); |
||||||
| 130 | $form->addElement($checkTfCheckbox); |
||||||
| 131 | // Form Radio Yes/No TfYesno |
||||||
| 132 | $tfYesno = $this->isNew() ? 0 : $this->getVar('tf_yesno'); |
||||||
| 133 | $form->addElement(new \XoopsFormRadioYN( _AM_MYMODULE2_TESTFIELD_YESNO, 'tf_yesno', $tfYesno)); |
||||||
|
0 ignored issues
–
show
It seems like
$tfYesno can also be of type array and array; however, parameter $value of XoopsFormRadioYN::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 134 | // Testfields handler |
||||||
| 135 | $testfieldsHandler = $helper->getHandler('testfields'); |
||||||
| 136 | // Form Select Testfields |
||||||
| 137 | $tfSelectboxSelect = new \XoopsFormSelect( _AM_MYMODULE2_TESTFIELD_SELECTBOX, 'tf_selectbox', $this->getVar('tf_selectbox')); |
||||||
| 138 | $tfSelectboxSelect->addOption('Empty'); |
||||||
| 139 | $tfSelectboxSelect->addOptionArray($testfieldsHandler->getList()); |
||||||
|
0 ignored issues
–
show
The method
getList() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsModuleHandler or XoopsImageHandler or XoopsRankHandler or XoopsCommentHandler or XoopsTplsetHandler or XoopsAvatarHandler or XoopsBlockHandler or XoopsImagesetHandler or XoopsPersistableObjectHandler or XoopsImagecategoryHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 140 | $form->addElement($tfSelectboxSelect); |
||||||
| 141 | // Form Select User TfUser |
||||||
| 142 | $form->addElement(new \XoopsFormSelectUser( _AM_MYMODULE2_TESTFIELD_USER, 'tf_user', false, $this->getVar('tf_user') )); |
||||||
| 143 | // Form Color Picker TfColor |
||||||
| 144 | $form->addElement(new \XoopsFormColorPicker( _AM_MYMODULE2_TESTFIELD_COLOR, 'tf_color', $this->getVar('tf_color') ), true); |
||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('tf_color') can also be of type array and array; however, parameter $value of XoopsFormColorPicker::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 145 | // Form Frameworks Image Files TfImagelist |
||||||
| 146 | $getTfImagelist = $this->getVar('tf_imagelist'); |
||||||
| 147 | $tfImagelist = $getTfImagelist ? $getTfImagelist : 'blank.gif'; |
||||||
| 148 | $imageDirectory = '/Frameworks/moduleclasses/icons/32'; |
||||||
| 149 | $imageTray = new \XoopsFormElementTray(_AM_MYMODULE2_TESTFIELD_IMAGELIST, '<br>' ); |
||||||
| 150 | $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE2_TESTFIELD_IMAGELIST_UPLOADS, ".{$imageDirectory}/"), 'tf_imagelist', $tfImagelist, 5); |
||||||
| 151 | $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); |
||||||
| 152 | foreach($imageArray as $image1) { |
||||||
| 153 | $imageSelect->addOption("{$image1}", $image1); |
||||||
| 154 | } |
||||||
| 155 | $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_tf_imagelist\", \"tf_imagelist\", \"".$imageDirectory."\", \"\", \"".XOOPS_URL."\")'"); |
||||||
| 156 | $imageTray->addElement($imageSelect, false); |
||||||
| 157 | $imageTray->addElement(new \XoopsFormLabel('', "<br><img src='".XOOPS_URL."/".$imageDirectory."/".$tfImagelist."' name='imglabel_tf_imagelist' id='imglabel_tf_imagelist' alt='' style='max-width:100px' />")); |
||||||
| 158 | // Form File |
||||||
| 159 | $fileSelectTray = new \XoopsFormElementTray('', '<br>' ); |
||||||
| 160 | $fileSelectTray->addElement(new \XoopsFormFile( _AM_MYMODULE2_FORM_UPLOAD_NEW, 'tf_imagelist', $helper->getConfig('maxsize_image') )); |
||||||
| 161 | $fileSelectTray->addElement(new \XoopsFormLabel('')); |
||||||
| 162 | $imageTray->addElement($fileSelectTray); |
||||||
| 163 | $form->addElement($imageTray); |
||||||
| 164 | // Form Url Text File TfUrlfile |
||||||
| 165 | $formUrlFile = new \XoopsFormElementTray(_AM_MYMODULE2_TESTFIELD_URLFILE, '<br><br>' ); |
||||||
| 166 | $formUrl = $this->isNew() ? '' : $this->getVar('tf_urlfile'); |
||||||
| 167 | $formText = new \XoopsFormText( _AM_MYMODULE2_TESTFIELD_URLFILE_UPLOADS, 'tf_urlfile', 75, 255, $formUrl ); |
||||||
| 168 | $formUrlFile->addElement($formText); |
||||||
| 169 | $formUrlFile->addElement(new \XoopsFormFile( _AM_MYMODULE2_FORM_UPLOAD, 'tf_urlfile', $helper->getConfig('maxsize_file') )); |
||||||
| 170 | $form->addElement($formUrlFile); |
||||||
| 171 | // Form Image TfUplimage |
||||||
| 172 | // Form Image TfUplimage: Select Uploaded Image |
||||||
| 173 | $getTfUplimage = $this->getVar('tf_uplimage'); |
||||||
| 174 | $tfUplimage = $getTfUplimage ? $getTfUplimage : 'blank.gif'; |
||||||
| 175 | $imageDirectory = '/uploads/mymodule2/images/testfields'; |
||||||
| 176 | $imageTray = new \XoopsFormElementTray(_AM_MYMODULE2_TESTFIELD_UPLIMAGE, '<br>' ); |
||||||
| 177 | $imageSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE2_TESTFIELD_UPLIMAGE_UPLOADS, ".{$imageDirectory}/"), 'tf_uplimage', $tfUplimage, 5); |
||||||
| 178 | $imageArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $imageDirectory ); |
||||||
| 179 | foreach($imageArray as $image1) { |
||||||
| 180 | $imageSelect->addOption("{$image1}", $image1); |
||||||
| 181 | } |
||||||
| 182 | $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_tf_uplimage\", \"tf_uplimage\", \"".$imageDirectory."\", \"\", \"".XOOPS_URL."\")'"); |
||||||
| 183 | $imageTray->addElement($imageSelect, false); |
||||||
| 184 | $imageTray->addElement(new \XoopsFormLabel('', "<br><img src='".XOOPS_URL."/".$imageDirectory."/".$tfUplimage."' name='imglabel_tf_uplimage' id='imglabel_tf_uplimage' alt='' style='max-width:100px' />")); |
||||||
| 185 | // Form Image TfUplimage: Upload new image |
||||||
| 186 | if ($permissionUpload) { |
||||||
| 187 | $maxsize = $helper->getConfig('maxsize_image'); |
||||||
| 188 | $imageTray->addElement(new \XoopsFormFile( '<br>' . _AM_MYMODULE2_FORM_UPLOAD_NEW, 'tf_uplimage', $maxsize )); |
||||||
| 189 | $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
||||||
| 190 | $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); |
||||||
| 191 | $imageTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); |
||||||
| 192 | } else { |
||||||
| 193 | $imageTray->addElement(new \XoopsFormHidden( 'tf_uplimage', $tfUplimage )); |
||||||
| 194 | } |
||||||
| 195 | $form->addElement($imageTray, ); |
||||||
| 196 | // Form File TfUplfile |
||||||
| 197 | $tfUplfile = $this->isNew() ? '' : $this->getVar('tf_uplfile'); |
||||||
| 198 | if ($permissionUpload) { |
||||||
| 199 | $fileUploadTray = new \XoopsFormElementTray(_AM_MYMODULE2_TESTFIELD_UPLFILE, '<br>' ); |
||||||
| 200 | $fileDirectory = '/uploads/mymodule2/files/testfields'; |
||||||
| 201 | if (!$this->isNew()) { |
||||||
| 202 | $fileUploadTray->addElement(new \XoopsFormLabel(sprintf(_AM_MYMODULE2_TESTFIELD_UPLFILE_UPLOADS, ".{$fileDirectory}/"), $tfUplfile)); |
||||||
|
0 ignored issues
–
show
It seems like
$tfUplfile can also be of type array and array; however, parameter $value of XoopsFormLabel::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 203 | } |
||||||
| 204 | $maxsize = $helper->getConfig('maxsize_file'); |
||||||
| 205 | $fileUploadTray->addElement(new \XoopsFormFile( '', 'tf_uplfile', $maxsize )); |
||||||
| 206 | $fileUploadTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
||||||
| 207 | $form->addElement($fileUploadTray, ); |
||||||
| 208 | } else { |
||||||
| 209 | $form->addElement(new \XoopsFormHidden( 'tf_uplfile', $tfUplfile )); |
||||||
|
0 ignored issues
–
show
It seems like
$tfUplfile can also be of type array and array; however, parameter $value of XoopsFormHidden::__construct() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 210 | } |
||||||
| 211 | // Form Text Date Select TfTextdateselect |
||||||
| 212 | $tfTextdateselect = $this->isNew() ? 0 : $this->getVar('tf_textdateselect'); |
||||||
| 213 | $form->addElement(new \XoopsFormTextDateSelect( _AM_MYMODULE2_TESTFIELD_TEXTDATESELECT, 'tf_textdateselect', '', $tfTextdateselect )); |
||||||
|
0 ignored issues
–
show
'' of type string is incompatible with the type integer expected by parameter $size of XoopsFormTextDateSelect::__construct().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 214 | // Form File TfSelectfile |
||||||
| 215 | // Form File TfSelectfile: Select Uploaded File |
||||||
| 216 | $getTfSelectfile = $this->getVar('tf_selectfile'); |
||||||
| 217 | $tfSelectfile = $getTfSelectfile ? $getTfSelectfile : 'blank.gif'; |
||||||
| 218 | $fileDirectory = '/uploads/mymodule2/files/testfields'; |
||||||
| 219 | $fileTray = new \XoopsFormElementTray(_AM_MYMODULE2_TESTFIELD_SELECTFILE, '<br>' ); |
||||||
| 220 | $fileSelect = new \XoopsFormSelect( sprintf(_AM_MYMODULE2_TESTFIELD_SELECTFILE_UPLOADS, ".{$fileDirectory}/"), 'tf_selectfile', $tfSelectfile, 5); |
||||||
| 221 | $fileArray = \XoopsLists::getImgListAsArray( XOOPS_ROOT_PATH . $fileDirectory ); |
||||||
| 222 | foreach($fileArray as $file1) { |
||||||
| 223 | $fileSelect->addOption("{$file1}", $file1); |
||||||
| 224 | } |
||||||
| 225 | $fileTray->addElement($fileSelect, false); |
||||||
| 226 | // Form File TfSelectfile: Upload new file |
||||||
| 227 | if ($permissionUpload) { |
||||||
| 228 | $maxsize = $helper->getConfig('maxsize_file'); |
||||||
| 229 | $fileTray->addElement(new \XoopsFormFile( '<br>' . _AM_MYMODULE2_FORM_UPLOAD_NEW, 'tf_selectfile', $maxsize )); |
||||||
| 230 | $fileTray->addElement(new \XoopsFormLabel(_AM_MYMODULE2_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . _AM_MYMODULE2_FORM_UPLOAD_SIZE_MB)); |
||||||
| 231 | } else { |
||||||
| 232 | $fileTray->addElement(new \XoopsFormHidden( 'tf_selectfile', $tfSelectfile )); |
||||||
| 233 | } |
||||||
| 234 | $form->addElement($fileTray, ); |
||||||
| 235 | // Form Select Testfields |
||||||
| 236 | $tfStatusSelect = new \XoopsFormSelect( _AM_MYMODULE2_TESTFIELD_STATUS, 'tf_status', $this->getVar('tf_status')); |
||||||
| 237 | $tfStatusSelect->addOption(Constants::STATUS_NONE, _AM_MYMODULE2_STATUS_NONE); |
||||||
| 238 | $tfStatusSelect->addOption(Constants::STATUS_OFFLINE, _AM_MYMODULE2_STATUS_OFFLINE); |
||||||
| 239 | $tfStatusSelect->addOption(Constants::STATUS_SUBMITTED, _AM_MYMODULE2_STATUS_SUBMITTED); |
||||||
| 240 | $tfStatusSelect->addOption(Constants::STATUS_APPROVED, _AM_MYMODULE2_STATUS_APPROVED); |
||||||
| 241 | $form->addElement($tfStatusSelect); |
||||||
| 242 | // Permissions |
||||||
| 243 | $memberHandler = xoops_getHandler('member'); |
||||||
| 244 | $groupList = $memberHandler->getGroupList(); |
||||||
|
0 ignored issues
–
show
The method
getGroupList() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 245 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||||
| 246 | $fullList[] = array_keys($groupList); |
||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
| 247 | if (!$this->isNew()) { |
||||||
| 248 | $groupsIdsApprove = $grouppermHandler->getGroupIds('mymodule2_approve_testfields', $this->getVar('tf_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
||||||
|
0 ignored issues
–
show
The method
getGroupIds() 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...
|
|||||||
| 249 | $groupsIdsApprove[] = array_values($groupsIdsApprove); |
||||||
| 250 | $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_testfields[]', $groupsIdsApprove); |
||||||
| 251 | $groupsIdsSubmit = $grouppermHandler->getGroupIds('mymodule2_submit_testfields', $this->getVar('tf_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
||||||
| 252 | $groupsIdsSubmit[] = array_values($groupsIdsSubmit); |
||||||
| 253 | $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_testfields[]', $groupsIdsSubmit); |
||||||
| 254 | $groupsIdsView = $grouppermHandler->getGroupIds('mymodule2_view_testfields', $this->getVar('tf_id'), $GLOBALS['xoopsModule']->getVar('mid')); |
||||||
| 255 | $groupsIdsView[] = array_values($groupsIdsView); |
||||||
| 256 | $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_testfields[]', $groupsIdsView); |
||||||
| 257 | } else { |
||||||
| 258 | $groupsCanApproveCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_APPROVE, 'groups_approve_testfields[]', $fullList); |
||||||
| 259 | $groupsCanSubmitCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_SUBMIT, 'groups_submit_testfields[]', $fullList); |
||||||
| 260 | $groupsCanViewCheckbox = new \XoopsFormCheckBox( _AM_MYMODULE2_PERMISSIONS_VIEW, 'groups_view_testfields[]', $fullList); |
||||||
| 261 | } |
||||||
| 262 | // To Approve |
||||||
| 263 | $groupsCanApproveCheckbox->addOptionArray($groupList); |
||||||
| 264 | $form->addElement($groupsCanApproveCheckbox); |
||||||
| 265 | // To Submit |
||||||
| 266 | $groupsCanSubmitCheckbox->addOptionArray($groupList); |
||||||
| 267 | $form->addElement($groupsCanSubmitCheckbox); |
||||||
| 268 | // To View |
||||||
| 269 | $groupsCanViewCheckbox->addOptionArray($groupList); |
||||||
| 270 | $form->addElement($groupsCanViewCheckbox); |
||||||
| 271 | // To Save |
||||||
| 272 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||||||
| 273 | $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
||||||
| 274 | return $form; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 275 | } |
||||||
| 276 | |||||||
| 277 | /** |
||||||
| 278 | * Get Values |
||||||
| 279 | * @param null $keys |
||||||
|
0 ignored issues
–
show
|
|||||||
| 280 | * @param null $format |
||||||
|
0 ignored issues
–
show
|
|||||||
| 281 | * @param null$maxDepth |
||||||
| 282 | * @return array |
||||||
| 283 | */ |
||||||
| 284 | public function getValuesTestfields($keys = null, $format = null, $maxDepth = null) |
||||||
| 285 | { |
||||||
| 286 | $helper = \XoopsModules\Mymodule2\Helper::getInstance(); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 287 | $ret = $this->getValues($keys, $format, $maxDepth); |
||||||
| 288 | $ret['id'] = $this->getVar('tf_id'); |
||||||
| 289 | $ret['text'] = $this->getVar('tf_text'); |
||||||
| 290 | $ret['textarea'] = strip_tags($this->getVar('tf_textarea')); |
||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('tf_textarea') can also be of type array and array; however, parameter $str of strip_tags() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 291 | $ret['dhtml'] = strip_tags($this->getVar('tf_dhtml')); |
||||||
| 292 | $ret['checkbox'] = $this->getVar('tf_checkbox'); |
||||||
| 293 | $ret['yesno'] = $this->getVar('tf_yesno'); |
||||||
| 294 | $ret['yesno_text'] = (int)$this->getVar('tf_yesno') > 0 ? _YES : _NO; |
||||||
| 295 | $ret['selectbox'] = $this->getVar('tf_selectbox'); |
||||||
| 296 | $ret['user'] = \XoopsUser::getUnameFromId($this->getVar('tf_user')); |
||||||
| 297 | $ret['color'] = $this->getVar('tf_color'); |
||||||
| 298 | $ret['imagelist'] = $this->getVar('tf_imagelist'); |
||||||
| 299 | $ret['urlfile'] = $this->getVar('tf_urlfile'); |
||||||
| 300 | $ret['uplimage'] = $this->getVar('tf_uplimage'); |
||||||
| 301 | $ret['uplfile'] = $this->getVar('tf_uplfile'); |
||||||
| 302 | $ret['textdateselect'] = formatTimeStamp($this->getVar('tf_textdateselect'), 's'); |
||||||
| 303 | $ret['selectfile'] = $this->getVar('tf_selectfile'); |
||||||
| 304 | $ret['status'] = $this->getVar('tf_status'); |
||||||
| 305 | return $ret; |
||||||
| 306 | } |
||||||
| 307 | |||||||
| 308 | /** |
||||||
| 309 | * Returns an array representation of the object |
||||||
| 310 | * |
||||||
| 311 | * @return array |
||||||
| 312 | */ |
||||||
| 313 | public function toArrayTestfields() |
||||||
| 314 | { |
||||||
| 315 | $ret = []; |
||||||
| 316 | $vars = $this->getVars(); |
||||||
| 317 | foreach(array_keys($vars) as $var) { |
||||||
| 318 | $ret[$var] = $this->getVar('"{$var}"'); |
||||||
| 319 | } |
||||||
| 320 | return $ret; |
||||||
| 321 | } |
||||||
| 322 | } |
||||||
| 323 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths