ggoffy /
wgevents
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 declare(strict_types=1); |
||||
| 2 | |||||
| 3 | namespace XoopsModules\Wgevents; |
||||
| 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 | * wgEvents module for xoops |
||||
| 17 | * |
||||
| 18 | * @copyright 2021 XOOPS Project (https://xoops.org) |
||||
| 19 | * @license GPL 2.0 or later |
||||
| 20 | * @package wgevents |
||||
| 21 | * @since 1.0.0 |
||||
| 22 | * @min_xoops 2.5.11 Beta1 |
||||
| 23 | * @author Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com |
||||
| 24 | */ |
||||
| 25 | |||||
| 26 | use XoopsModules\Wgevents; |
||||
| 27 | use XoopsModules\Wgevents\Helper; |
||||
| 28 | |||||
| 29 | \defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||||
| 30 | |||||
| 31 | /** |
||||
| 32 | * Class Object Textblock |
||||
| 33 | */ |
||||
| 34 | class Textblock extends \XoopsObject |
||||
| 35 | { |
||||
| 36 | /** |
||||
| 37 | * @var int |
||||
| 38 | */ |
||||
| 39 | public $start = 0; |
||||
| 40 | |||||
| 41 | /** |
||||
| 42 | * @var int |
||||
| 43 | */ |
||||
| 44 | public $limit = 0; |
||||
| 45 | |||||
| 46 | /** |
||||
| 47 | * Constructor |
||||
| 48 | * |
||||
| 49 | */ |
||||
| 50 | public function __construct() |
||||
| 51 | { |
||||
| 52 | $this->initVar('id', \XOBJ_DTYPE_INT); |
||||
| 53 | $this->initVar('catid', \XOBJ_DTYPE_INT); |
||||
| 54 | $this->initVar('name', \XOBJ_DTYPE_TXTBOX); |
||||
| 55 | $this->initVar('text', \XOBJ_DTYPE_OTHER); |
||||
| 56 | $this->initVar('class', \XOBJ_DTYPE_INT); |
||||
| 57 | $this->initVar('weight', \XOBJ_DTYPE_INT); |
||||
| 58 | $this->initVar('datecreated', \XOBJ_DTYPE_INT); |
||||
| 59 | $this->initVar('submitter', \XOBJ_DTYPE_INT); |
||||
| 60 | } |
||||
| 61 | |||||
| 62 | /** |
||||
| 63 | * @static function &getInstance |
||||
| 64 | * |
||||
| 65 | */ |
||||
| 66 | public static function getInstance() |
||||
| 67 | { |
||||
| 68 | static $instance = false; |
||||
| 69 | if (!$instance) { |
||||
| 70 | $instance = new self(); |
||||
| 71 | } |
||||
| 72 | } |
||||
| 73 | |||||
| 74 | /** |
||||
| 75 | * The new inserted $Id |
||||
| 76 | * @return inserted id |
||||
|
0 ignored issues
–
show
|
|||||
| 77 | */ |
||||
| 78 | public function getNewInsertedId() |
||||
| 79 | { |
||||
| 80 | return $GLOBALS['xoopsDB']->getInsertId(); |
||||
| 81 | } |
||||
| 82 | |||||
| 83 | /** |
||||
| 84 | * @public function getForm |
||||
| 85 | * @param bool $action |
||||
| 86 | * @return \XoopsThemeForm |
||||
| 87 | */ |
||||
| 88 | public function getForm($action = false) |
||||
| 89 | { |
||||
| 90 | $helper = Helper::getInstance(); |
||||
| 91 | //$categoryHandler = $helper->getHandler('Category'); |
||||
| 92 | $textblockHandler = $helper->getHandler('Textblock'); |
||||
| 93 | |||||
| 94 | if (!$action) { |
||||
| 95 | $action = $_SERVER['REQUEST_URI']; |
||||
| 96 | } |
||||
| 97 | $isAdmin = (\is_object($GLOBALS['xoopsUser']) && \is_object($GLOBALS['xoopsModule'])) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
||||
| 98 | // Title |
||||
| 99 | $title = $this->isNew() ? \_MA_WGEVENTS_TEXTBLOCK_ADD : \_MA_WGEVENTS_TEXTBLOCK_EDIT; |
||||
| 100 | // Get Theme Form |
||||
| 101 | \xoops_load('XoopsFormLoader'); |
||||
| 102 | $form = new \XoopsThemeForm($title, 'formTextblock', $action, 'post', true); |
||||
| 103 | $form->setExtra('enctype="multipart/form-data"'); |
||||
| 104 | // Form Table categories |
||||
| 105 | /* for the moment textblocks are valid for all categories |
||||
| 106 | $evCatidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_EVENT_CATID, 'catid', $this->getVar('catid')); |
||||
| 107 | $evCatidSelect->addOptionArray($categoryHandler->getList()); |
||||
| 108 | $form->addElement($evCatidSelect); |
||||
| 109 | */ |
||||
| 110 | // Form Text tbName |
||||
| 111 | $form->addElement(new \XoopsFormText(\_MA_WGEVENTS_TEXTBLOCK_NAME, 'name', 50, 255, $this->getVar('name'))); |
||||
|
0 ignored issues
–
show
It seems like
$this->getVar('name') 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...
|
|||||
| 112 | // Form Editor DhtmlTextArea tbText |
||||
| 113 | $editorConfigs = []; |
||||
| 114 | if ($isAdmin) { |
||||
| 115 | $editor = $helper->getConfig('editor_admin'); |
||||
| 116 | } else { |
||||
| 117 | $editor = $helper->getConfig('editor_user'); |
||||
| 118 | } |
||||
| 119 | $editorConfigs['name'] = 'text'; |
||||
| 120 | $editorConfigs['value'] = $this->getVar('text', 'e'); |
||||
| 121 | $editorConfigs['rows'] = 5; |
||||
| 122 | $editorConfigs['cols'] = 40; |
||||
| 123 | $editorConfigs['width'] = '100%'; |
||||
| 124 | $editorConfigs['height'] = '400px'; |
||||
| 125 | $editorConfigs['editor'] = $editor; |
||||
| 126 | $form->addElement(new \XoopsFormEditor(\_MA_WGEVENTS_TEXTBLOCK_TEXT, 'text', $editorConfigs)); |
||||
| 127 | // Form select tbClass |
||||
| 128 | $tbClass = $this->isNew() ? Constants::TEXTBLOCK_CLASS_PRIVATE : $this->getVar('class'); |
||||
| 129 | $tbclassSelect = new \XoopsFormSelect(\_MA_WGEVENTS_TEXTBLOCK_CLASS, 'class', $tbClass); |
||||
| 130 | $tbclassSelect->addOption(Constants::TEXTBLOCK_CLASS_PRIVATE, \_MA_WGEVENTS_TEXTBLOCK_CLASS_PRIVATE); |
||||
| 131 | $tbclassSelect->addOption(Constants::TEXTBLOCK_CLASS_PUBLIC, \_MA_WGEVENTS_TEXTBLOCK_CLASS_PUBLIC); |
||||
| 132 | $form->addElement($tbclassSelect); |
||||
| 133 | // Form Text tbWeight |
||||
| 134 | $tbWeight = $this->isNew() ? $textblockHandler->getNextWeight() : $this->getVar('weight'); |
||||
| 135 | $form->addElement(new \XoopsFormText(\_MA_WGEVENTS_WEIGHT, 'weight', 50, 255, $tbWeight)); |
||||
| 136 | // Form Text Date Select tbDatecreated |
||||
| 137 | $tbDatecreated = $this->isNew() ? \time() : $this->getVar('datecreated'); |
||||
| 138 | $form->addElement(new \XoopsFormTextDateSelect(\_MA_WGEVENTS_DATECREATED, 'datecreated', '', $tbDatecreated)); |
||||
|
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...
|
|||||
| 139 | // Form Select User tbSubmitter |
||||
| 140 | $uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; |
||||
| 141 | $tbSubmitter = $this->isNew() ? $uidCurrent : $this->getVar('submitter'); |
||||
| 142 | $form->addElement(new \XoopsFormSelectUser(\_MA_WGEVENTS_SUBMITTER, 'submitter', false, $tbSubmitter)); |
||||
| 143 | |||||
| 144 | // To Save |
||||
| 145 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||||
| 146 | $form->addElement(new \XoopsFormHidden('start', $this->start)); |
||||
| 147 | $form->addElement(new \XoopsFormHidden('limit', $this->limit)); |
||||
| 148 | $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); |
||||
| 149 | return $form; |
||||
| 150 | } |
||||
| 151 | |||||
| 152 | /** |
||||
| 153 | * Get Values |
||||
| 154 | * @param null $keys |
||||
|
0 ignored issues
–
show
|
|||||
| 155 | * @param null $format |
||||
|
0 ignored issues
–
show
|
|||||
| 156 | * @param null $maxDepth |
||||
|
0 ignored issues
–
show
|
|||||
| 157 | * @return array |
||||
| 158 | */ |
||||
| 159 | public function getValuesTextblocks($keys = null, $format = null, $maxDepth = null) |
||||
| 160 | { |
||||
| 161 | $helper = \XoopsModules\Wgevents\Helper::getInstance(); |
||||
| 162 | $utility = new \XoopsModules\Wgevents\Utility(); |
||||
| 163 | $ret = $this->getValues($keys, $format, $maxDepth); |
||||
| 164 | $editorMaxchar = $helper->getConfig('admin_maxchar'); |
||||
| 165 | $categoryHandler = $helper->getHandler('Category'); |
||||
| 166 | $categoryObj = $categoryHandler->get($this->getVar('catid')); |
||||
| 167 | $catName = ''; |
||||
| 168 | if (\is_object($categoryObj)) { |
||||
| 169 | $catName = $categoryObj->getVar('name'); |
||||
| 170 | } |
||||
| 171 | $ret['catname'] = $catName; |
||||
| 172 | $ret['text_text'] = $this->getVar('text', 'e'); |
||||
| 173 | $ret['text_short'] = $utility::truncateHtml($ret['text'], $editorMaxchar); |
||||
| 174 | $ret['cat_text'] = $this->getVar('catid'); |
||||
| 175 | $ret['class_text'] = Constants::TEXTBLOCK_CLASS_PUBLIC == $this->getVar('class') ? \_MA_WGEVENTS_TEXTBLOCK_CLASS_PUBLIC : \_MA_WGEVENTS_TEXTBLOCK_CLASS_PRIVATE; |
||||
| 176 | $ret['datecreated_text'] = \formatTimestamp($this->getVar('datecreated'), 's'); |
||||
| 177 | $ret['submitter_text'] = \XoopsUser::getUnameFromId($this->getVar('submitter')); |
||||
| 178 | return $ret; |
||||
| 179 | } |
||||
| 180 | |||||
| 181 | /** |
||||
| 182 | * Returns an array representation of the object |
||||
| 183 | * |
||||
| 184 | * @return array |
||||
| 185 | */ |
||||
| 186 | /* |
||||
| 187 | public function toArray() |
||||
| 188 | { |
||||
| 189 | $ret = []; |
||||
| 190 | $vars = $this->getVars(); |
||||
| 191 | foreach (\array_keys($vars) as $var) { |
||||
| 192 | $ret[$var] = $this->getVar($var); |
||||
| 193 | } |
||||
| 194 | return $ret; |
||||
| 195 | } |
||||
| 196 | */ |
||||
| 197 | } |
||||
| 198 |
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