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\ { |
||||||
28 | Helper, |
||||||
0 ignored issues
–
show
|
|||||||
29 | Utility, |
||||||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
XoopsModules\Wgevents\Utility . Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
![]() |
|||||||
30 | Forms |
||||||
31 | }; |
||||||
32 | |||||||
33 | |||||||
34 | \defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||||||
35 | |||||||
36 | /** |
||||||
37 | * Class Object Event |
||||||
38 | */ |
||||||
39 | class Event extends \XoopsObject |
||||||
40 | { |
||||||
41 | /** |
||||||
42 | * @var int |
||||||
43 | */ |
||||||
44 | public $start = 0; |
||||||
45 | |||||||
46 | /** |
||||||
47 | * @var int |
||||||
48 | */ |
||||||
49 | public $limit = 0; |
||||||
50 | |||||||
51 | /** |
||||||
52 | * @var int |
||||||
53 | */ |
||||||
54 | public $idSource = 0; |
||||||
55 | |||||||
56 | /** |
||||||
57 | * @var string |
||||||
58 | */ |
||||||
59 | public $cats = ''; |
||||||
60 | |||||||
61 | /** |
||||||
62 | * Constructor |
||||||
63 | * |
||||||
64 | */ |
||||||
65 | public function __construct() |
||||||
66 | { |
||||||
67 | $this->initVar('id', \XOBJ_DTYPE_INT); |
||||||
68 | $this->initVar('catid', \XOBJ_DTYPE_INT); |
||||||
69 | $this->initVar('subcats', \XOBJ_DTYPE_OTHER); |
||||||
70 | $this->initVar('name', \XOBJ_DTYPE_TXTBOX); |
||||||
71 | $this->initVar('logo', \XOBJ_DTYPE_TXTBOX); |
||||||
72 | $this->initVar('desc', \XOBJ_DTYPE_OTHER); |
||||||
73 | $this->initVar('datefrom', \XOBJ_DTYPE_INT); |
||||||
74 | $this->initVar('dateto', \XOBJ_DTYPE_INT); |
||||||
75 | $this->initVar('allday', \XOBJ_DTYPE_INT); |
||||||
76 | $this->initVar('contact', \XOBJ_DTYPE_TXTAREA); |
||||||
77 | $this->initVar('email', \XOBJ_DTYPE_TXTBOX); |
||||||
78 | $this->initVar('url', \XOBJ_DTYPE_TXTBOX); |
||||||
79 | $this->initVar('location', \XOBJ_DTYPE_TXTAREA); |
||||||
80 | $this->initVar('locgmlat', \XOBJ_DTYPE_FLOAT); |
||||||
81 | $this->initVar('locgmlon', \XOBJ_DTYPE_FLOAT); |
||||||
82 | $this->initVar('locgmzoom', \XOBJ_DTYPE_INT); |
||||||
83 | $this->initVar('fee_type', \XOBJ_DTYPE_INT); |
||||||
84 | $this->initVar('fee', \XOBJ_DTYPE_OTHER); |
||||||
85 | $this->initVar('paymentinfo', \XOBJ_DTYPE_OTHER); |
||||||
86 | $this->initVar('register_use', \XOBJ_DTYPE_INT); |
||||||
87 | $this->initVar('register_from', \XOBJ_DTYPE_INT); |
||||||
88 | $this->initVar('register_to', \XOBJ_DTYPE_INT); |
||||||
89 | $this->initVar('register_max', \XOBJ_DTYPE_INT); |
||||||
90 | $this->initVar('register_listwait', \XOBJ_DTYPE_INT); |
||||||
91 | $this->initVar('register_autoaccept', \XOBJ_DTYPE_INT); |
||||||
92 | $this->initVar('register_notify', \XOBJ_DTYPE_TXTAREA); |
||||||
93 | $this->initVar('register_sendermail', \XOBJ_DTYPE_TXTBOX); |
||||||
94 | $this->initVar('register_sendername', \XOBJ_DTYPE_TXTBOX); |
||||||
95 | $this->initVar('register_signature', \XOBJ_DTYPE_TXTAREA); |
||||||
96 | $this->initVar('register_forceverif', \XOBJ_DTYPE_INT); |
||||||
97 | $this->initVar('status', \XOBJ_DTYPE_INT); |
||||||
98 | $this->initVar('galid', \XOBJ_DTYPE_TXTBOX); |
||||||
99 | $this->initVar('url_info', \XOBJ_DTYPE_TXTBOX); |
||||||
100 | $this->initVar('url_registration', \XOBJ_DTYPE_TXTBOX); |
||||||
101 | $this->initVar('identifier', \XOBJ_DTYPE_TXTBOX); |
||||||
102 | $this->initVar('groups', \XOBJ_DTYPE_TXTBOX); |
||||||
103 | $this->initVar('datecreated', \XOBJ_DTYPE_INT); |
||||||
104 | $this->initVar('submitter', \XOBJ_DTYPE_INT); |
||||||
105 | } |
||||||
106 | |||||||
107 | /** |
||||||
108 | * @static function &getInstance |
||||||
109 | * |
||||||
110 | */ |
||||||
111 | public static function getInstance() |
||||||
112 | { |
||||||
113 | static $instance = false; |
||||||
114 | if (!$instance) { |
||||||
115 | $instance = new self(); |
||||||
116 | } |
||||||
117 | } |
||||||
118 | |||||||
119 | /** |
||||||
120 | * The new inserted $Id |
||||||
121 | * @return int |
||||||
122 | */ |
||||||
123 | public function getNewInsertedId() |
||||||
124 | { |
||||||
125 | return $GLOBALS['xoopsDB']->getInsertId(); |
||||||
126 | } |
||||||
127 | |||||||
128 | /** |
||||||
129 | * @public function getForm |
||||||
130 | * @param bool $action |
||||||
131 | * @return \XoopsThemeForm |
||||||
132 | */ |
||||||
133 | public function getForm($action = false) |
||||||
134 | { |
||||||
135 | $helper = Helper::getInstance(); |
||||||
136 | |||||||
137 | $categoryHandler = $helper->getHandler('Category'); |
||||||
138 | $permissionsHandler = $helper->getHandler('Permission'); |
||||||
139 | |||||||
140 | $utility = new Utility(); |
||||||
141 | |||||||
142 | if (!$action) { |
||||||
143 | $action = $_SERVER['REQUEST_URI']; |
||||||
144 | } |
||||||
145 | $isAdmin = false; |
||||||
146 | $userUid = 0; |
||||||
147 | $userEmail = ''; |
||||||
148 | $userName = ''; |
||||||
149 | if (\is_object($GLOBALS['xoopsUser'])) { |
||||||
150 | if (\is_object($GLOBALS['xoopsModule'])) { |
||||||
151 | $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
||||||
152 | } |
||||||
153 | $userUid = $GLOBALS['xoopsUser']->uid(); |
||||||
154 | $userEmail = $GLOBALS['xoopsUser']->email(); |
||||||
155 | $userName = ('' !== (string)$GLOBALS['xoopsUser']->name()) ? $GLOBALS['xoopsUser']->name() : $GLOBALS['xoopsUser']->uname(); |
||||||
156 | } |
||||||
157 | |||||||
158 | $imgInfo = '<img class="wge-img-info" src="' . \WGEVENTS_ICONS_URL_24 . '/info.png" alt="img-info" title="%s">'; |
||||||
159 | |||||||
160 | // Title |
||||||
161 | $title = $this->isNew() ? \_MA_WGEVENTS_EVENT_ADD : \_MA_WGEVENTS_EVENT_EDIT; |
||||||
162 | if ($this->idSource > 0) { |
||||||
163 | $this->unsetNew(); |
||||||
164 | } |
||||||
165 | // Get Theme Form |
||||||
166 | \xoops_load('XoopsFormLoader'); |
||||||
167 | $form = new \XoopsThemeForm($title, 'formEvent', $action, 'post', true); |
||||||
168 | $form->setExtra('enctype="multipart/form-data"'); |
||||||
169 | // Form Text identifier |
||||||
170 | if (!$this->isNew()) { |
||||||
171 | if ($isAdmin) { |
||||||
172 | $form->addElement(new \XoopsFormText(\_MA_WGEVENTS_EVENT_IDENTIFIER, 'identifier', 50, 255, $this->getVar('identifier'))); |
||||||
0 ignored issues
–
show
It seems like
$this->getVar('identifier') 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
![]() |
|||||||
173 | } else { |
||||||
174 | $form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_EVENT_IDENTIFIER, $this->getVar('identifier'))); |
||||||
0 ignored issues
–
show
It seems like
$this->getVar('identifier') 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
![]() |
|||||||
175 | $form->addElement(new \XoopsFormHidden('identifier', (string)$this->getVar('identifier'))); |
||||||
176 | } |
||||||
177 | } |
||||||
178 | // Form Table categories |
||||||
179 | $evCatidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_EVENT_CATID, 'catid', $this->getVar('catid')); |
||||||
180 | $evCatidSelect->addOptionArray($categoryHandler->getAllCatsOnline(Constants::CATEGORY_TYPE_MAIN)); |
||||||
181 | $form->addElement($evCatidSelect); |
||||||
182 | // Form Table sub categories |
||||||
183 | // count sub categories |
||||||
184 | $catsSubOnline = $categoryHandler->getAllCatsOnline(Constants::CATEGORY_TYPE_SUB); |
||||||
185 | if (\count($catsSubOnline) > 0) { |
||||||
186 | $evSubCats = $this->isNew() ? [] : \unserialize($this->getVar('subcats'), ['allowed_classes' => false]); |
||||||
187 | $evSubCatsSelect = new \XoopsFormCheckBox(\_MA_WGEVENTS_EVENT_SUBCATS, 'subcats', $evSubCats); |
||||||
188 | $evSubCatsSelect->addOptionArray($catsSubOnline); |
||||||
189 | $form->addElement($evSubCatsSelect); |
||||||
190 | } |
||||||
191 | // Form Text evName |
||||||
192 | $form->addElement(new \XoopsFormText(\_MA_WGEVENTS_EVENT_NAME, 'name', 50, 255, $this->getVar('name')), true); |
||||||
193 | // Form Editor DhtmlTextArea evDesc |
||||||
194 | $editorConfigs = []; |
||||||
195 | if ($isAdmin) { |
||||||
196 | $editor = $helper->getConfig('editor_admin'); |
||||||
197 | } else { |
||||||
198 | $editor = $helper->getConfig('editor_user'); |
||||||
199 | } |
||||||
200 | $editorConfigs['name'] = 'desc'; |
||||||
201 | $editorConfigs['value'] = $this->getVar('desc', 'e'); |
||||||
202 | $editorConfigs['rows'] = 5; |
||||||
203 | $editorConfigs['cols'] = 40; |
||||||
204 | $editorConfigs['width'] = '100%'; |
||||||
205 | $editorConfigs['height'] = '400px'; |
||||||
206 | $editorConfigs['editor'] = $editor; |
||||||
207 | $form->addElement(new \XoopsFormEditor(\_MA_WGEVENTS_EVENT_DESC, 'desc', $editorConfigs)); |
||||||
208 | // Form Image evLogo |
||||||
209 | // Form Image evLogo: Select Uploaded Image |
||||||
210 | $getEvLogo = $this->getVar('logo'); |
||||||
211 | $evLogo = $getEvLogo ?: 'blank.gif'; |
||||||
212 | $imageDirectory = '/uploads/wgevents/events/logos/' . $userUid; |
||||||
213 | $folderUid = \XOOPS_ROOT_PATH . $imageDirectory; |
||||||
214 | if (!\file_exists($folderUid)) { |
||||||
215 | $utility::createFolder($folderUid); |
||||||
216 | \chmod($folderUid, 0777); |
||||||
217 | $file = \WGEVENTS_PATH . '/assets/images/blank.gif'; |
||||||
218 | $dest = $folderUid . '/blank.gif'; |
||||||
219 | $utility::copyFile($file, $dest); |
||||||
220 | } |
||||||
221 | $imageTray = new Forms\FormElementTray(\_MA_WGEVENTS_EVENT_LOGO, '<br>'); |
||||||
222 | $imageSelect = new \XoopsFormSelect(\_MA_WGEVENTS_EVENT_LOGO_UPLOADS, 'logo', $evLogo, 5); |
||||||
223 | $imageArray = \XoopsLists::getImgListAsArray(\XOOPS_ROOT_PATH . $imageDirectory); |
||||||
224 | foreach ($imageArray as $image1) { |
||||||
225 | $imageSelect->addOption(($image1), $image1); |
||||||
226 | } |
||||||
227 | $imageSelect->setExtra("onchange='showImgSelected(\"imglabel_logo\", \"logo\", \"" . $imageDirectory . '", "", "' . \XOOPS_URL . "\")'"); |
||||||
228 | $imageTray->addElement($imageSelect); |
||||||
229 | $imageTray->addElement(new \XoopsFormLabel('', "<br><img src='" . \XOOPS_URL . '/' . $imageDirectory . '/' . $evLogo . "' id='imglabel_logo' alt='' style='max-width:100px' >")); |
||||||
230 | // Form Image evLogo: Upload new image |
||||||
231 | $maxsize = $helper->getConfig('maxsize_image'); |
||||||
232 | $imageTray->addElement(new \XoopsFormFile('<br>' . \_AM_WGEVENTS_FORM_UPLOAD_NEW, 'logo', $maxsize)); |
||||||
233 | $imageTray->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_FORM_UPLOAD_SIZE, ($maxsize / 1048576) . ' ' . \_AM_WGEVENTS_FORM_UPLOAD_SIZE_MB)); |
||||||
234 | $imageTray->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_FORM_UPLOAD_IMG_WIDTH, $helper->getConfig('maxwidth_image') . ' px')); |
||||||
235 | $imageTray->addElement(new \XoopsFormLabel(\_AM_WGEVENTS_FORM_UPLOAD_IMG_HEIGHT, $helper->getConfig('maxheight_image') . ' px')); |
||||||
236 | $form->addElement($imageTray); |
||||||
237 | // Form Tray Datefrom |
||||||
238 | $evDatefromTray = new Forms\FormElementTray(\_MA_WGEVENTS_EVENT_DATEFROM, ' '); |
||||||
239 | // Text Date Select evDatefrom |
||||||
240 | $evDatefrom = ($this->isNew() && 0 === (int)$this->getVar('datefrom')) ? \time() : $this->getVar('datefrom'); |
||||||
241 | $evDatefromTray->addElement(new \XoopsFormDateTime('', 'datefrom', '', $evDatefrom), true); |
||||||
0 ignored issues
–
show
'' of type string is incompatible with the type integer expected by parameter $size of XoopsFormDateTime::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
242 | // Text Date Checkbox evAllday |
||||||
243 | $evAllday = $this->isNew() ? 0 : (int)$this->getVar('allday'); |
||||||
244 | $checkAllday = new \XoopsFormCheckBox('', 'allday', $evAllday); |
||||||
245 | $checkAllday->addOption(1, \_MA_WGEVENTS_EVENT_ALLDAY); |
||||||
246 | $checkAllday->setExtra(" onclick='toggleAllday()' "); |
||||||
247 | $evDatefromTray->addElement($checkAllday); |
||||||
248 | $form->addElement($evDatefromTray); |
||||||
249 | // Form Text Date Select evDateto |
||||||
250 | $evDateto = ($this->isNew() && 0 === (int)$this->getVar('dateto')) ? \time() : $this->getVar('dateto'); |
||||||
251 | $form->addElement(new \XoopsFormDateTime(\_MA_WGEVENTS_EVENT_DATETO, 'dateto', '', $evDateto)); |
||||||
252 | // Form Text evContact |
||||||
253 | $form->addElement(new \XoopsFormTextArea(\_MA_WGEVENTS_EVENT_CONTACT, 'contact', $this->getVar('contact', 'e'), 4, 30)); |
||||||
0 ignored issues
–
show
It seems like
$this->getVar('contact', 'e') 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
![]() |
|||||||
254 | // Form Text evEmail |
||||||
255 | $evEmail = new \XoopsFormText(\_MA_WGEVENTS_EVENT_EMAIL, 'email', 50, 255, $this->getVar('email')); |
||||||
256 | $evEmail->setExtra("onfocusout='emailValidation(\"email\", \"" . \sprintf(\_MA_WGEVENTS_INVALID_EMAIL, \_MA_WGEVENTS_EVENT_EMAIL) . "\")'"); |
||||||
257 | $form->addElement($evEmail); |
||||||
258 | // Form Text evUrl |
||||||
259 | $form->addElement(new \XoopsFormText(\_MA_WGEVENTS_EVENT_URL, 'url', 50, 255, $this->getVar('url'))); |
||||||
260 | // Location |
||||||
261 | // Form Editor TextArea evLocation |
||||||
262 | $evLocation = $this->isNew() ? '' : $this->getVar('location', 'e'); |
||||||
263 | $form->addElement(new \XoopsFormTextArea(\_MA_WGEVENTS_EVENT_LOCATION, 'location', $evLocation, 4, 50)); |
||||||
264 | |||||||
265 | if ($helper->getConfig('use_gmaps')) { |
||||||
266 | $gmapsTray = new Forms\FormElementTray('', '<br>'); |
||||||
267 | // Form Text evLocgmlat |
||||||
268 | $evLocgmlat = $this->isNew() ? '0.00' : $this->getVar('locgmlat'); |
||||||
269 | $gmapsTray->addElement(new \XoopsFormText(\_MA_WGEVENTS_EVENT_LOCGMLAT, 'locgmlat', 20, 50, $evLocgmlat)); |
||||||
270 | // Form Text evLocgmlon |
||||||
271 | $evLocgmlon = $this->isNew() ? '0.00' : $this->getVar('locgmlon'); |
||||||
272 | $gmapsTray->addElement(new \XoopsFormText(\_MA_WGEVENTS_EVENT_LOCGMLON, 'locgmlon', 20, 50, $evLocgmlon)); |
||||||
273 | // Form Text evLocgmzoom |
||||||
274 | $evLocgmzoom = $this->isNew() ? '10' : $this->getVar('locgmzoom'); |
||||||
275 | $gmapsTray->addElement(new \XoopsFormText(\_MA_WGEVENTS_EVENT_LOCGMZOOM, 'locgmzoom', 5, 50, $evLocgmzoom)); |
||||||
276 | // Form label |
||||||
277 | $locLabel = '<div class="row"><div class="col-sm-6">'; |
||||||
278 | $locLabel .= $gmapsTray->render(); |
||||||
279 | $locLabel .= '</div>'; |
||||||
280 | $locLabel .= '<div class="col-sm-6">'; |
||||||
281 | $locLabel .= "<button id='btnGetCoords' type='button' class='btn btn-primary' data-toggle='modal' data-target='#modalCoordsPicker'>" . \_MA_WGEVENTS_EVENT_GM_GETCOORDS . '</button>'; |
||||||
282 | $locLabel .= '</div></div>'; |
||||||
283 | $form->addElement(new \XoopsFormLabel('', $locLabel)); |
||||||
284 | } |
||||||
285 | // Form Text evFee |
||||||
286 | $default0 = '0' . $helper->getConfig('sep_comma') . '00'; |
||||||
287 | $evFeeArr = []; |
||||||
288 | if ($this->isNew()) { |
||||||
289 | $evFeeArr = [[$default0, '', 'placeholder' => \_MA_WGEVENTS_EVENT_FEE_DESC_PH]]; |
||||||
290 | } else { |
||||||
291 | $evFee = \json_decode($this->getVar('fee'), true); |
||||||
292 | foreach($evFee as $fee) { |
||||||
293 | $evFeeArr[] = [Utility::FloatToString((float)$fee[0]), $fee[1], 'placeholder' => \_MA_WGEVENTS_EVENT_FEE_DESC_PH]; |
||||||
294 | } |
||||||
295 | if (0 === \count($evFeeArr)) { |
||||||
296 | $evFeeArr = [[$default0, '', 'placeholder' => \_MA_WGEVENTS_EVENT_FEE_DESC_PH]]; |
||||||
297 | } |
||||||
298 | } |
||||||
299 | $evFeeTray = new Forms\FormElementTray(\_MA_WGEVENTS_EVENT_FEE, '<br>'); |
||||||
300 | $evFeeType = $this->isNew() ? Constants::FEETYPE_DECLARED : (int)$this->getVar('fee_type'); |
||||||
301 | $evFeeTypeRadio = new \XoopsFormRadio('', 'fee_type', $evFeeType); |
||||||
302 | $evFeeTypeRadio->addOption(Constants::FEETYPE_DECLARED, \_MA_WGEVENTS_EVENT_FEETYPE_DECLARED); |
||||||
303 | $evFeeTypeRadio->addOption(Constants::FEETYPE_FREE, \_MA_WGEVENTS_EVENT_FEETYPE_FREE); |
||||||
304 | $evFeeTypeRadio->addOption(Constants::FEETYPE_NONDECL, \_MA_WGEVENTS_EVENT_FEETYPE_NONDECL); |
||||||
305 | $evFeeTypeRadio->setExtra(" onchange='toggleFeeFields()' "); |
||||||
306 | $evFeeTray->addElement($evFeeTypeRadio); |
||||||
307 | $evFeeGroup = new Forms\FormTextDouble('', 'fee', 0, 0, ''); |
||||||
308 | $evFeeGroup->setElements($evFeeArr); |
||||||
309 | $evFeeGroup->setPlaceholder1(\_MA_WGEVENTS_EVENT_FEE_VAL_PH); |
||||||
310 | $evFeeGroup->setPlaceholder2(\_MA_WGEVENTS_EVENT_FEE_DESC_PH); |
||||||
311 | $evFeeGroup->setVisible(Constants::FEETYPE_DECLARED === $evFeeType); |
||||||
312 | $evFeeTray->addElement($evFeeGroup); |
||||||
313 | $form->addElement($evFeeTray); |
||||||
314 | // Form TextArea evPaymentinfo |
||||||
315 | $editorConfigs2 = []; |
||||||
316 | $editorConfigs2['name'] = 'paymentinfo'; |
||||||
317 | $editorConfigs2['value'] = $this->getVar('paymentinfo', 'e'); |
||||||
318 | $editorConfigs2['rows'] = 5; |
||||||
319 | $editorConfigs2['cols'] = 40; |
||||||
320 | $editorConfigs2['width'] = '100%'; |
||||||
321 | $editorConfigs2['height'] = '400px'; |
||||||
322 | $editorConfigs2['editor'] = $editor; |
||||||
323 | $form->addElement(new \XoopsFormEditor(\_MA_WGEVENTS_EVENT_PAYMENTINFO, 'paymentinfo', $editorConfigs2)); |
||||||
324 | |||||||
325 | // Start block registration options |
||||||
326 | $evRegister_use = $this->isNew() ? 0 : $this->getVar('register_use'); |
||||||
327 | if ($helper->getConfig('use_register')) { |
||||||
328 | // Form Radio Yes/No evRegister_use |
||||||
329 | $evRegisterUseRadio = new \XoopsFormRadioYN(\_MA_WGEVENTS_EVENT_REGISTER_USE, 'register_use', $evRegister_use); |
||||||
0 ignored issues
–
show
It seems like
$evRegister_use 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
![]() |
|||||||
330 | $evRegisterUseRadio->setExtra(" onclick='toggleRegistrationOpts()' "); |
||||||
331 | $form->addElement($evRegisterUseRadio); |
||||||
332 | $evReservUseTray = new \XoopsFormElementTray('', '<br>'); //double element tray is necessary for proper toggle |
||||||
333 | $evRegisterOptsTray = new Forms\FormElementTray('', '<br>', 'registeropttray'); |
||||||
334 | $evRegisterOptsTray->setClass('col-xs-12 col-sm-5 col-lg-5'); |
||||||
335 | if (!$evRegister_use) { |
||||||
336 | $evRegisterOptsTray->setHidden(); |
||||||
337 | } |
||||||
338 | // Form Text Date Select evRegisterfrom |
||||||
339 | $evRegisterfrom = $this->isNew() ? \time() : $this->getVar('register_from'); |
||||||
340 | $evRegisterOptsTray->addElement(new \XoopsFormDateTime(\_MA_WGEVENTS_EVENT_REGISTER_FROM, 'register_from', '', $evRegisterfrom)); |
||||||
341 | // Form Text Date Select evRegisterto |
||||||
342 | $evRegisterto = $this->isNew() ? \time() : $this->getVar('register_to'); |
||||||
343 | $evRegisterOptsTray->addElement(new \XoopsFormDateTime(\_MA_WGEVENTS_EVENT_REGISTER_TO, 'register_to', '', $evRegisterto)); |
||||||
344 | // Form Text evRegisterMax |
||||||
345 | $evRegisterMax = $this->isNew() ? 0 : $this->getVar('register_max'); |
||||||
346 | $captionRegisterMax = \_MA_WGEVENTS_EVENT_REGISTER_MAX . \sprintf($imgInfo, \_MA_WGEVENTS_EVENT_REGISTER_MAX_DESC); |
||||||
347 | $evRegisterOptsTray->addElement(new \XoopsFormText($captionRegisterMax, 'register_max', 5, 50, $evRegisterMax)); |
||||||
348 | // Form Radio Yes/No evRegisterListwait |
||||||
349 | $evRegisterListwait = $this->isNew() ? 0 : $this->getVar('register_listwait'); |
||||||
350 | $captionRegisterListwait = \_MA_WGEVENTS_EVENT_REGISTER_LISTWAIT . \sprintf($imgInfo, \_MA_WGEVENTS_EVENT_REGISTER_LISTWAIT_DESC); |
||||||
351 | $evRegisterOptsTray->addElement(new \XoopsFormRadioYN($captionRegisterListwait, 'register_listwait', $evRegisterListwait)); |
||||||
352 | // Form Select User evRegisterAutoaccept |
||||||
353 | $evRegisterAutoaccept = $this->isNew() ? 0 : $this->getVar('register_autoaccept'); |
||||||
354 | $captionRegisterAutoaccept = \_MA_WGEVENTS_EVENT_REGISTER_AUTOACCEPT . \sprintf($imgInfo, \_MA_WGEVENTS_EVENT_REGISTER_AUTOACCEPT_DESC); |
||||||
355 | $evRegisterOptsTray->addElement(new \XoopsFormRadioYN($captionRegisterAutoaccept, 'register_autoaccept', $evRegisterAutoaccept)); |
||||||
356 | // Form Editor TextArea evRegisterNotify |
||||||
357 | $evRegisterNotify = $this->isNew() ? $userEmail : $this->getVar('register_notify', 'e'); |
||||||
358 | $captionRegisterNotify = \_MA_WGEVENTS_EVENT_REGISTER_NOTIFY . \sprintf($imgInfo, \_MA_WGEVENTS_EVENT_REGISTER_NOTIFY_DESC); |
||||||
359 | $evRegisterOptsTray->addElement(new \XoopsFormTextArea($captionRegisterNotify, 'register_notify', $evRegisterNotify, 4, 30)); |
||||||
360 | // Form Text evRegisterSendermail |
||||||
361 | $evRegisterSendermailText = $this->isNew() ? $userEmail : $this->getVar('register_sendermail'); |
||||||
362 | $captionRegisterSendermail = \_MA_WGEVENTS_EVENT_REGISTER_SENDERMAIL . \sprintf($imgInfo, \_MA_WGEVENTS_EVENT_REGISTER_SENDERMAIL_DESC); |
||||||
363 | $evRegisterSendermail = new \XoopsFormText($captionRegisterSendermail, 'register_sendermail', 35, 255, $evRegisterSendermailText); |
||||||
364 | $evRegisterSendermail->setExtra("onfocusout='emailValidation(\"register_sendermail\", \"" . \sprintf(\_MA_WGEVENTS_INVALID_EMAIL, \_MA_WGEVENTS_EVENT_REGISTER_SENDERMAIL) . "\")'"); |
||||||
365 | $evRegisterOptsTray->addElement($evRegisterSendermail); |
||||||
366 | // Form Text evRegisterSendername |
||||||
367 | $evRegisterSendername = $this->isNew() ? $userName : $this->getVar('register_sendername'); |
||||||
368 | $captionRegisterSendername = \_MA_WGEVENTS_EVENT_REGISTER_SENDERNAME . \sprintf($imgInfo, \_MA_WGEVENTS_EVENT_REGISTER_SENDERNAME_DESC); |
||||||
369 | $evRegisterOptsTray->addElement(new \XoopsFormText($captionRegisterSendername, 'register_sendername', 35, 255, $evRegisterSendername)); |
||||||
370 | // Form Editor TextArea evRegisterSignature |
||||||
371 | $evRegisterSignature = $this->isNew() ? '' : $this->getVar('register_signature', 'e'); |
||||||
372 | $captionRegisterSignature = \_MA_WGEVENTS_EVENT_REGISTER_SIGNATURE . \sprintf($imgInfo, \_MA_WGEVENTS_EVENT_REGISTER_SIGNATURE_DESC); |
||||||
373 | $evRegisterOptsTray->addElement(new \XoopsFormTextArea($captionRegisterSignature, 'register_signature', $evRegisterSignature, 4, 30)); |
||||||
374 | // Form Radio Yes/No evRegisterListwait |
||||||
375 | $evRegisterForceverif = $this->isNew() ? 1 : $this->getVar('register_forceverif'); |
||||||
376 | $captionRegisterForceverif = \_MA_WGEVENTS_EVENT_REGISTER_FORCEVERIF . \sprintf($imgInfo, \_MA_WGEVENTS_EVENT_REGISTER_FORCEVERIF_DESC); |
||||||
377 | $evRegisterOptsTray->addElement(new \XoopsFormRadioYN($captionRegisterForceverif, 'register_forceverif', $evRegisterForceverif)); |
||||||
378 | |||||||
379 | $evReservUseTray->addElement($evRegisterOptsTray); |
||||||
380 | $form->addElement($evReservUseTray); |
||||||
381 | //$form->addElement(new \XoopsFormLabel('', $evReservUseTray)); |
||||||
382 | // End block registration options |
||||||
383 | } |
||||||
384 | if ($helper->getConfig('use_urlregistration')) { |
||||||
385 | // Form Text urlRegistration |
||||||
386 | $evUrlregistration = $this->getVar('url_registration'); |
||||||
387 | $evUrlregText = new Forms\FormText(\_MA_WGEVENTS_EVENT_URL_REGISTRATION, 'url_registration', 50, 255, $evUrlregistration); |
||||||
0 ignored issues
–
show
It seems like
$evUrlregistration can also be of type array and array ; however, parameter $value of XoopsModules\Wgevents\Fo...FormText::__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
![]() |
|||||||
388 | $evUrlregText->setPlaceholder(\_MA_WGEVENTS_EVENT_URL_REGISTRATION_PH); |
||||||
389 | if ($evRegister_use) { |
||||||
390 | $evUrlregText->setExtra('disabled'); |
||||||
391 | } |
||||||
392 | $form->addElement($evUrlregText); |
||||||
393 | } |
||||||
394 | // Form Select evGalid |
||||||
395 | if ($helper->getConfig('use_wggallery') && \class_exists('WggalleryCorePreload')) { |
||||||
396 | $helperGallery = \XoopsModules\Wggallery\Helper::getInstance(); |
||||||
0 ignored issues
–
show
The type
XoopsModules\Wggallery\Helper was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
397 | $albumsHandler = $helperGallery->getHandler('Albums'); |
||||||
398 | $evGalidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_EVENT_GALID, 'galid', $this->getVar('galid')); |
||||||
399 | $evGalidSelect->addOption(0, ' '); |
||||||
400 | $evGalidSelect->addOptionArray($albumsHandler->getList()); |
||||||
401 | $form->addElement($evGalidSelect); |
||||||
402 | } |
||||||
403 | // Form Select evGroups |
||||||
404 | if ($helper->getConfig('use_groups')) { |
||||||
405 | if ($this->isNew()) { |
||||||
406 | $groups = ['00000']; |
||||||
407 | } else { |
||||||
408 | $groups = \explode('|', $this->getVar('groups')); |
||||||
409 | } |
||||||
410 | $evGroupsSelect = new \XoopsFormSelect(\_MA_WGEVENTS_EVENT_GROUPS, 'groups', $groups, 5, true); |
||||||
411 | $evGroupsSelect->addOption('00000', \_MA_WGEVENTS_EVENT_GROUPS_ALL); |
||||||
412 | // Get groups |
||||||
413 | $memberHandler = \xoops_getHandler('member'); |
||||||
414 | $xoopsGroups = $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
![]() |
|||||||
415 | foreach ($xoopsGroups as $key => $group) { |
||||||
416 | if (3 !== (int)$key) { |
||||||
417 | $evGroupsSelect->addOption(substr('00000' . $key, -5), $group); |
||||||
418 | } |
||||||
419 | } |
||||||
420 | $form->addElement($evGroupsSelect, true); |
||||||
421 | } else { |
||||||
422 | $form->addElement(new \XoopsFormHidden('groups', '00000')); |
||||||
423 | } |
||||||
424 | // Form Select Status evStatus |
||||||
425 | // Form Text Date Select evDatecreated |
||||||
426 | // Form Select User evSubmitter |
||||||
427 | $permEventsApprove = $permissionsHandler->getPermEventsApprove(); |
||||||
428 | $permEventsApproveAuto = $permissionsHandler->getPermEventsApproveAuto(); |
||||||
429 | if ($this->isNew()) { |
||||||
430 | $evStatus = $permEventsApproveAuto ? Constants::STATUS_APPROVED : Constants::STATUS_SUBMITTED; |
||||||
431 | } else { |
||||||
432 | $evStatus = $this->getVar('status'); |
||||||
433 | } |
||||||
434 | $evDatecreated = $this->isNew() ? \time() : (int)$this->getVar('datecreated'); |
||||||
435 | $evSubmitter = $this->isNew() ? $userUid : (int)$this->getVar('submitter'); |
||||||
436 | if ($isAdmin) { |
||||||
437 | $evStatusSelect = new \XoopsFormSelect(\_MA_WGEVENTS_STATUS, 'status', $evStatus); |
||||||
438 | $evStatusSelect->addOption(Constants::STATUS_NONE, \_MA_WGEVENTS_STATUS_NONE); |
||||||
439 | $evStatusSelect->addOption(Constants::STATUS_OFFLINE, \_MA_WGEVENTS_STATUS_OFFLINE); |
||||||
440 | $evStatusSelect->addOption(Constants::STATUS_SUBMITTED, \_MA_WGEVENTS_STATUS_SUBMITTED); |
||||||
441 | $evStatusSelect->addOption(Constants::STATUS_APPROVED, \_MA_WGEVENTS_STATUS_APPROVED); |
||||||
442 | $evStatusSelect->addOption(Constants::STATUS_LOCKED, \_MA_WGEVENTS_STATUS_LOCKED); |
||||||
443 | $evStatusSelect->addOption(Constants::STATUS_CANCELED, \_MA_WGEVENTS_STATUS_CANCELED); |
||||||
444 | $form->addElement($evStatusSelect, true); |
||||||
445 | $form->addElement(new \XoopsFormTextDateSelect(\_MA_WGEVENTS_DATECREATED, 'datecreated', '', $evDatecreated)); |
||||||
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
![]() |
|||||||
446 | $form->addElement(new \XoopsFormSelectUser(\_MA_WGEVENTS_SUBMITTER, 'submitter', false, $evSubmitter)); |
||||||
447 | } else { |
||||||
448 | $form->addElement(new \XoopsFormHidden('status', $evStatus)); |
||||||
449 | $form->addElement(new \XoopsFormHidden('datecreated_int', $evDatecreated)); |
||||||
450 | $form->addElement(new \XoopsFormHidden('submitter', $evSubmitter)); |
||||||
451 | if (!$this->isNew() && $permEventsApprove) { |
||||||
452 | $evStatusSelect = new \XoopsFormSelect(\_MA_WGEVENTS_STATUS, 'status', $evStatus); |
||||||
453 | $evStatusSelect->addOption(Constants::STATUS_NONE, \_MA_WGEVENTS_STATUS_NONE); |
||||||
454 | $evStatusSelect->addOption(Constants::STATUS_OFFLINE, \_MA_WGEVENTS_STATUS_OFFLINE); |
||||||
455 | $evStatusSelect->addOption(Constants::STATUS_SUBMITTED, \_MA_WGEVENTS_STATUS_SUBMITTED); |
||||||
456 | $evStatusSelect->addOption(Constants::STATUS_APPROVED, \_MA_WGEVENTS_STATUS_APPROVED); |
||||||
457 | $form->addElement($evStatusSelect, true); |
||||||
458 | $form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_DATECREATED, \formatTimestamp($evDatecreated, 's'))); |
||||||
459 | $form->addElement(new \XoopsFormLabel(\_MA_WGEVENTS_SUBMITTER, \XoopsUser::getUnameFromId($evSubmitter))); |
||||||
460 | } |
||||||
461 | } |
||||||
462 | if ($this->idSource > 0 && $helper->getConfig('use_register')) { |
||||||
463 | $form->addElement(new \XoopsFormRadioYN(\_MA_WGEVENTS_EVENT_CLONE_QUESTION, 'clone_question', 1)); |
||||||
464 | $form->addElement(new \XoopsFormHidden('id_source', $this->idSource)); |
||||||
465 | } |
||||||
466 | if (!$this->isNew() && 0 === $this->idSource) { |
||||||
467 | $informModif = new \XoopsFormRadioYN(\_MA_WGEVENTS_EVENT_INFORM_MODIF, 'informModif', 0); |
||||||
468 | $informModif->setDescription(\_MA_WGEVENTS_EVENT_INFORM_MODIF_DESC); |
||||||
469 | $form->addElement($informModif); |
||||||
470 | } |
||||||
471 | // To Save |
||||||
472 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||||||
473 | $form->addElement(new \XoopsFormHidden('start', $this->start)); |
||||||
474 | $form->addElement(new \XoopsFormHidden('limit', $this->limit)); |
||||||
475 | $form->addElement(new \XoopsFormHidden('cats', $this->cats)); |
||||||
476 | // button tray |
||||||
477 | $buttonTray = new \XoopsFormElementTray(''); |
||||||
478 | $buttonBack = new Forms\FormButton('', 'confirm_back', \_CANCEL, 'button'); |
||||||
479 | $buttonBack->setExtra('onclick="history.go(-1);return true;"'); |
||||||
480 | $buttonBack->setClass('btn-danger'); |
||||||
481 | $buttonTray->addElement($buttonBack); |
||||||
482 | |||||||
483 | $buttonReset = new Forms\FormButton('', 'reset', \_RESET, 'reset'); |
||||||
484 | $buttonReset->setClass('btn-warning'); |
||||||
485 | $buttonTray->addElement($buttonReset); |
||||||
486 | |||||||
487 | $buttonSubmit = new Forms\FormButton('', '_submit', \_MA_WGEVENTS_SAVE, 'submit'); |
||||||
488 | $buttonSubmit->setClass('btn-primary'); |
||||||
489 | $buttonTray->addElement($buttonSubmit); |
||||||
490 | |||||||
491 | $buttonNext = new Forms\FormButton('', 'continue_questions', \_MA_WGEVENTS_CONTINUE_QUESTIONY, 'submit'); |
||||||
492 | $buttonNext->setClass('btn-primary'); |
||||||
493 | if (!$evRegister_use) { |
||||||
494 | $buttonNext->setHidden(); |
||||||
495 | } |
||||||
496 | $buttonTray->addElement($buttonNext); |
||||||
497 | $form->addElement($buttonTray); |
||||||
498 | |||||||
499 | return $form; |
||||||
500 | } |
||||||
501 | |||||||
502 | /** |
||||||
503 | * @public function getFormContactAll |
||||||
504 | * @param string $mailFrom |
||||||
505 | * @param string $mailSubject |
||||||
506 | * @param string $mailBody |
||||||
507 | * @param int $mailCopy |
||||||
508 | * @param bool $action |
||||||
509 | * @return \XoopsThemeForm |
||||||
510 | */ |
||||||
511 | public function getFormContactAll($mailFrom, $mailSubject, $mailBody = '', $mailCopy = 1, $action = false) |
||||||
512 | { |
||||||
513 | $helper = \XoopsModules\Wgevents\Helper::getInstance(); |
||||||
514 | $registrationHandler = $helper->getHandler('Registration'); |
||||||
515 | if (!$action) { |
||||||
516 | $action = $_SERVER['REQUEST_URI']; |
||||||
517 | } |
||||||
518 | // Get Theme Form |
||||||
519 | \xoops_load('XoopsFormLoader'); |
||||||
520 | $form = new \XoopsThemeForm(\_MA_WGEVENTS_CONTACT_ALL, 'formContactAll', $action, 'post', true); |
||||||
521 | $form->setExtra('enctype="multipart/form-data"'); |
||||||
522 | // Form Text mailFrom |
||||||
523 | $emailTray = new Forms\FormElementTray(\_MA_WGEVENTS_CONTACT_MAILFROM, '<br>'); |
||||||
524 | $email = new Forms\FormText('', 'mail_from', 50, 255, $mailFrom); |
||||||
525 | $email->setPlaceholder(\_MA_WGEVENTS_REGISTRATION_EMAIL_PLACEHOLDER); |
||||||
526 | $emailTray->addElement($email, true); |
||||||
527 | // Form select mailCopy |
||||||
528 | $emailRadio = new \XoopsFormRadioYN(\_MA_WGEVENTS_CONTACT_MAILCOPY, 'mail_copy', $mailCopy); |
||||||
529 | $emailTray->addElement($emailRadio); |
||||||
530 | $form->addElement($emailTray); |
||||||
531 | // Form Editor TextArea mailTo |
||||||
532 | $crRegistration = new \CriteriaCompo(); |
||||||
533 | $crRegistration->add(new \Criteria('evid', $this->getVar('id'))); |
||||||
0 ignored issues
–
show
It seems like
$this->getVar('id') can also be of type array and array ; however, parameter $value of Criteria::__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
![]() |
|||||||
534 | $numberRegCurr = $registrationHandler->getCount($crRegistration); |
||||||
535 | $mailToArr = []; |
||||||
536 | $mailTo = ''; |
||||||
537 | if ($numberRegCurr > 0) { |
||||||
538 | $registrationsAll = $registrationHandler->getAll($crRegistration); |
||||||
539 | foreach (\array_keys($registrationsAll) as $i) { |
||||||
540 | $mailToArr[$registrationsAll[$i]->getVar('email')] = $registrationsAll[$i]->getVar('email'); |
||||||
541 | } |
||||||
542 | } |
||||||
543 | foreach ($mailToArr as $mail) { |
||||||
544 | $mailTo .= $mail . PHP_EOL; |
||||||
545 | } |
||||||
546 | $mailToTextarea = new \XoopsFormTextArea(\_MA_WGEVENTS_CONTACT_MAILTO, 'mail_to', $mailTo, 5, 47); |
||||||
547 | $mailToTextarea->setExtra(" disabled='disabled'"); |
||||||
548 | $form->addElement($mailToTextarea); |
||||||
549 | // From Text Subject |
||||||
550 | $subject = \sprintf(\_MA_WGEVENTS_CONTACT_ALL_MAILSUBJECT_TEXT, $mailSubject); |
||||||
551 | $form->addElement(new \XoopsFormText(\_MA_WGEVENTS_CONTACT_MAILSUBJECT, 'mail_subject', 50, 255, $subject), true); |
||||||
552 | // Form Editor DhtmlTextArea mailBody |
||||||
553 | $editorConfigs = []; |
||||||
554 | $editor = $helper->getConfig('editor_user'); |
||||||
555 | $editorConfigs['name'] = 'mail_body'; |
||||||
556 | $editorConfigs['value'] = $mailBody; |
||||||
557 | $editorConfigs['rows'] = 10; |
||||||
558 | $editorConfigs['cols'] = 40; |
||||||
559 | $editorConfigs['width'] = '100%'; |
||||||
560 | $editorConfigs['height'] = '400px'; |
||||||
561 | $editorConfigs['editor'] = $editor; |
||||||
562 | $form->addElement(new \XoopsFormEditor(\_MA_WGEVENTS_CONTACT_MAILBODY, 'mail_body', $editorConfigs)); |
||||||
563 | // To Save |
||||||
564 | $form->addElement(new \XoopsFormHidden('evid', $this->getVar('id'))); |
||||||
0 ignored issues
–
show
It seems like
$this->getVar('id') 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
![]() |
|||||||
565 | $form->addElement(new \XoopsFormHidden('op', 'exec_contactall')); |
||||||
566 | $form->addElement(new \XoopsFormButtonTray('', \_MA_WGEVENTS_SEND_ALL, 'submit', '', false)); |
||||||
567 | $form->addElement(new \XoopsFormButton(\_MA_WGEVENTS_CONTACT_ALL_TEST, 'exec_contactall_test', \sprintf(\_MA_WGEVENTS_CONTACT_ALL_TEST_BTN , $mailFrom), 'submit')); |
||||||
568 | return $form; |
||||||
569 | } |
||||||
570 | |||||||
571 | /** |
||||||
572 | * Get Values |
||||||
573 | * @param null $keys |
||||||
0 ignored issues
–
show
|
|||||||
574 | * @param null $format |
||||||
0 ignored issues
–
show
|
|||||||
575 | * @param null $maxDepth |
||||||
0 ignored issues
–
show
|
|||||||
576 | * @return array |
||||||
577 | */ |
||||||
578 | public function getValuesEvents($keys = null, $format = null, $maxDepth = null) |
||||||
579 | { |
||||||
580 | $helper = \XoopsModules\Wgevents\Helper::getInstance(); |
||||||
581 | $utility = new \XoopsModules\Wgevents\Utility(); |
||||||
582 | $ret = $this->getValues($keys, $format, $maxDepth); |
||||||
583 | $adminMaxchar = $helper->getConfig('admin_maxchar'); |
||||||
584 | $userMaxchar = $helper->getConfig('user_maxchar'); |
||||||
585 | $eventDayname = $helper->getConfig('event_dayname'); |
||||||
586 | $categoryHandler = $helper->getHandler('Category'); |
||||||
587 | $eventHandler = $helper->getHandler('Event'); |
||||||
588 | $catId = (int)$this->getVar('catid'); |
||||||
589 | $categoryObj = $categoryHandler->get($catId); |
||||||
590 | $catName = ''; |
||||||
591 | $catLogo = ''; |
||||||
592 | if (\is_object($categoryObj)) { |
||||||
593 | $catName = $categoryObj->getVar('name'); |
||||||
594 | if ('blank.gif' !== (string)$categoryObj->getVar('logo')) { |
||||||
595 | $catLogo = $categoryObj->getVar('logo'); |
||||||
596 | } |
||||||
597 | } |
||||||
598 | $ret['catname'] = $catName; |
||||||
599 | $ret['catlogo'] = $catLogo; |
||||||
600 | $subcatsArr = []; |
||||||
601 | $subcats = \unserialize($this->getVar('subcats'), ['allowed_classes' => false]); |
||||||
602 | if (\is_array($subcats) && \count($subcats) > 0) { |
||||||
603 | foreach ($subcats as $subcat) { |
||||||
604 | $subcategoryObj = $categoryHandler->get($subcat); |
||||||
605 | // do not repeat main cat in sub cats even if it is checked there once more |
||||||
606 | if (\is_object($subcategoryObj) && $catId !== (int)$subcat) { |
||||||
607 | //if (\is_object($subcategoryObj)) { |
||||||
608 | $subcatsArr[$subcat]['id'] = $subcat; |
||||||
609 | $subcatsArr[$subcat]['name'] = $subcategoryObj->getVar('name'); |
||||||
610 | $subcatsArr[$subcat]['logo'] = $subcat; |
||||||
611 | if ('blank.gif' !== (string)$subcategoryObj->getVar('logo')) { |
||||||
612 | $subcatsArr[$subcat]['logo'] = $subcategoryObj->getVar('logo'); |
||||||
613 | } |
||||||
614 | } |
||||||
615 | } |
||||||
616 | } |
||||||
617 | $ret['subcats_arr'] = $subcatsArr; |
||||||
618 | $ret['name_clean'] = \htmlspecialchars($this->getVar('name'), ENT_QUOTES | ENT_HTML5); |
||||||
619 | $ret['desc_text'] = $this->getVar('desc', 'e'); |
||||||
620 | $ret['desc_short_admin'] = $utility::truncateHtml($ret['desc_text'], $adminMaxchar); |
||||||
621 | $ret['desc_short_user'] = $utility::truncateHtml($ret['desc_text'], $userMaxchar); |
||||||
622 | $ret['logoExist'] = ('blank.gif' !== (string)$this->getVar('logo') && 'blank.png' !== (string)$this->getVar('logo')); |
||||||
623 | $evAllday = (int)$this->getVar('allday'); |
||||||
624 | $ret['allday_single'] = 0; |
||||||
625 | if ($evAllday > 0) { |
||||||
626 | $datefrom_text = \formatTimestamp($this->getVar('datefrom'), 's'); |
||||||
627 | $dateto_text = \formatTimestamp($this->getVar('dateto'), 's'); |
||||||
628 | $ret['datefrom_text'] = $datefrom_text . ' ' . \_MA_WGEVENTS_EVENT_ALLDAY; |
||||||
629 | if ($datefrom_text === $dateto_text) { |
||||||
630 | //single allday |
||||||
631 | $ret['allday_single'] = 1; |
||||||
632 | $ret['dateto_text'] = ' '; |
||||||
633 | } else { |
||||||
634 | $ret['dateto_text'] = $dateto_text . ' ' . \_MA_WGEVENTS_EVENT_ALLDAY; |
||||||
635 | } |
||||||
636 | } else { |
||||||
637 | $ret['datefrom_text'] = \formatTimestamp($this->getVar('datefrom'), 'm'); |
||||||
638 | $ret['dateto_text'] = \formatTimestamp($this->getVar('dateto'), 'm'); |
||||||
639 | } |
||||||
640 | $ret['datefromto_text'] = $eventHandler->getDateFromToText($this->getVar('datefrom'), $this->getVar('dateto'), $evAllday); |
||||||
641 | $ret['datefrom_dayname'] = $this->getDayname($eventDayname, \formatTimestamp($this->getVar('datefrom'), 'w')); |
||||||
642 | $ret['dateto_dayname'] = $this->getDayname($eventDayname, \formatTimestamp($this->getVar('dateto'), 'w')); |
||||||
643 | $evLocation = $this->getVar('location', 'e'); |
||||||
644 | $ret['location_text'] = $evLocation; |
||||||
645 | if ($evLocation) { |
||||||
646 | $loc = preg_split("/\r\n|\n|\r/", $evLocation); |
||||||
647 | $ret['location_text_user'] = \implode('<br>', $loc); |
||||||
648 | } |
||||||
649 | $evContact = $this->getVar('contact', 'e'); |
||||||
650 | $ret['contact_text'] = $evContact; |
||||||
651 | if ($evContact) { |
||||||
652 | $contactLines = preg_split("/\r\n|\n|\r/", $evContact); |
||||||
653 | $ret['contact_text_user'] = \implode('<br>', $contactLines); |
||||||
654 | } |
||||||
655 | $evFeeType = $this->getVar('fee_type'); |
||||||
656 | $evFeeText = ''; |
||||||
657 | $evFeeShow = false; |
||||||
658 | switch ($evFeeType) { |
||||||
659 | case Constants::FEETYPE_DECLARED: |
||||||
660 | default: |
||||||
661 | $feetypeText = \_MA_WGEVENTS_EVENT_FEETYPE_DECLARED; |
||||||
662 | $evFee = \json_decode($this->getVar('fee'), true); |
||||||
663 | foreach($evFee as $fee) { |
||||||
664 | $evFeeText .= Utility::FloatToString((float)$fee[0]) . ' ' . $fee[1] . '<br>'; |
||||||
665 | } |
||||||
666 | $evFeeShow = true; |
||||||
667 | break; |
||||||
668 | case Constants::FEETYPE_FREE: |
||||||
669 | $feetypeText = \_MA_WGEVENTS_EVENT_FEETYPE_FREE; |
||||||
670 | $evFeeText = \_MA_WGEVENTS_EVENT_FEETYPE_FREE; |
||||||
671 | $evFeeShow = true; |
||||||
672 | break; |
||||||
673 | case Constants::FEETYPE_NONDECL: |
||||||
674 | $feetypeText = \_MA_WGEVENTS_EVENT_FEETYPE_NONDECL; |
||||||
675 | break; |
||||||
676 | } |
||||||
677 | $ret['feetype_text'] = $feetypeText; |
||||||
678 | $ret['fee_text'] = $evFeeText; |
||||||
679 | $ret['fee_show'] = $evFeeShow; |
||||||
680 | $ret['paymentinfo_text'] = \nl2br($this->getVar('paymentinfo', 'e')); |
||||||
681 | $ret['register_use_text'] = (int)$this->getVar('register_use') > 0 ? \_YES : \_NO; |
||||||
682 | $ret['register_from_text'] = ''; |
||||||
683 | $ret['register_from_dayname'] = ''; |
||||||
684 | if ($this->getVar('register_from') > 0) { |
||||||
685 | $ret['register_from_text'] = \formatTimestamp($this->getVar('register_from'), 'm'); |
||||||
686 | $ret['register_from_dayname'] = $this->getDayname($eventDayname, \formatTimestamp($this->getVar('register_from'), 'w')); |
||||||
687 | } |
||||||
688 | $ret['register_to_text'] = ''; |
||||||
689 | $ret['register_to_dayname'] = ''; |
||||||
690 | if ($this->getVar('register_to') > 0) { |
||||||
691 | $ret['register_to_text'] = \formatTimestamp($this->getVar('register_to'), 'm'); |
||||||
692 | $ret['register_to_dayname'] = $this->getDayname($eventDayname, \formatTimestamp($this->getVar('register_to'), 'w')); |
||||||
693 | } |
||||||
694 | $regMax = $this->getVar('register_max'); |
||||||
695 | $ret['register_max_text'] = $regMax > 0 ? $this->getVar('register_max') : \_MA_WGEVENTS_EVENT_REGISTER_MAX_UNLIMITED; |
||||||
696 | $ret['register_listwait_text'] = (int)$this->getVar('register_listwait') > 0 ? \_YES : \_NO; |
||||||
697 | $ret['register_autoaccept_text'] = (int)$this->getVar('register_autoaccept') > 0 ? \_YES : \_NO; |
||||||
698 | $evRegisterNotify = $this->getVar('register_notify', 'e'); |
||||||
699 | $ret['register_notify_text'] = $evRegisterNotify; |
||||||
700 | if ($evRegisterNotify) { |
||||||
701 | $notifyEmails = \preg_split("/\r\n|\n|\r/", $evRegisterNotify); |
||||||
702 | $ret['register_notify_user'] = \implode('<br>', $notifyEmails); |
||||||
703 | } |
||||||
704 | $ret['register_forceverif_text'] = (int)$this->getVar('register_forceverif') > 0 ? \_YES : \_NO; |
||||||
705 | $evGalid = (int)$this->getVar('galid'); |
||||||
706 | if ($evGalid > 0 && $helper->getConfig('use_wggallery') && \class_exists('WggalleryCorePreload')) { |
||||||
707 | $helperGallery = \XoopsModules\Wggallery\Helper::getInstance(); |
||||||
708 | $albumsHandler = $helperGallery->getHandler('Albums'); |
||||||
709 | $albumObj = $albumsHandler->get($evGalid); |
||||||
710 | if (\is_object($albumObj)) { |
||||||
711 | $ret['gallery_name'] = $albumObj->getVar('alb_name'); |
||||||
712 | $albLink = \XOOPS_URL . '/modules/wggallery/gallery.php?op=show&alb_id=' . $evGalid; |
||||||
713 | $albLink .= '&alb_pid=' .$albumObj->getVar('alb_pid'); |
||||||
714 | $ret['gallery_link'] = $albLink; |
||||||
715 | } else { |
||||||
716 | $evGalid = 0; |
||||||
717 | } |
||||||
718 | } |
||||||
719 | $ret['gallery_id'] = $evGalid; |
||||||
720 | $evGroups = $this->getVar('groups', 'e'); |
||||||
721 | $groups_text = ''; |
||||||
722 | if (0 === (int)$evGroups) { |
||||||
723 | $groups_text = \_MA_WGEVENTS_EVENT_GROUPS_ALL; |
||||||
724 | } else { |
||||||
725 | // Get groups |
||||||
726 | $groups_text .= '<ul>'; |
||||||
727 | $memberHandler = \xoops_getHandler('member'); |
||||||
728 | $xoopsGroups = $memberHandler->getGroupList(); |
||||||
729 | $groups = explode('|', $evGroups); |
||||||
730 | foreach ($groups as $group) { |
||||||
731 | $groups_text .= '<li>' . $xoopsGroups[(int)$group] . '</li>' ; |
||||||
732 | } |
||||||
733 | $groups_text .= '</ul>'; |
||||||
734 | } |
||||||
735 | $ret['groups_text'] = $groups_text; |
||||||
736 | $ret['status_text'] = Utility::getStatusText($this->getVar('status')); |
||||||
737 | $ret['datecreated_text'] = \formatTimestamp($this->getVar('datecreated'), 's'); |
||||||
738 | $ret['submitter_text'] = \XoopsUser::getUnameFromId($this->getVar('submitter')); |
||||||
739 | return $ret; |
||||||
740 | } |
||||||
741 | |||||||
742 | /** function to get day name |
||||||
743 | * @param $eventDayname (= module preference 'event_dayname') |
||||||
0 ignored issues
–
show
|
|||||||
744 | * @param $day (= weekday of date) |
||||||
745 | * @return string |
||||||
746 | */ |
||||||
747 | private function getDayname ($eventDayname, $day) { |
||||||
748 | switch ($eventDayname) { |
||||||
749 | case 0: |
||||||
750 | default: |
||||||
751 | $ret = ''; |
||||||
752 | break; |
||||||
753 | case Constants::DAYNAME_SHORT: |
||||||
754 | $daynames_short = [\_MA_WGEVENTS_CAL_MIN_SUNDAY, \_MA_WGEVENTS_CAL_MIN_MONDAY, \_MA_WGEVENTS_CAL_MIN_TUESDAY, \_MA_WGEVENTS_CAL_MIN_WEDNESDAY, \_MA_WGEVENTS_CAL_MIN_THURSDAY, \_MA_WGEVENTS_CAL_MIN_FRIDAY, \_MA_WGEVENTS_CAL_MIN_SATURDAY]; |
||||||
755 | $ret = $daynames_short[$day] . ' '; |
||||||
756 | break; |
||||||
757 | case Constants::DAYNAME_SHORTDOT: |
||||||
758 | $daynames_short = [\_MA_WGEVENTS_CAL_MIN_SUNDAY, \_MA_WGEVENTS_CAL_MIN_MONDAY, \_MA_WGEVENTS_CAL_MIN_TUESDAY, \_MA_WGEVENTS_CAL_MIN_WEDNESDAY, \_MA_WGEVENTS_CAL_MIN_THURSDAY, \_MA_WGEVENTS_CAL_MIN_FRIDAY, \_MA_WGEVENTS_CAL_MIN_SATURDAY]; |
||||||
759 | $ret = $daynames_short[$day] . '. '; |
||||||
760 | break; |
||||||
761 | case Constants::DAYNAME_SHORTCOMMA: |
||||||
762 | $daynames_short = [\_MA_WGEVENTS_CAL_MIN_SUNDAY, \_MA_WGEVENTS_CAL_MIN_MONDAY, \_MA_WGEVENTS_CAL_MIN_TUESDAY, \_MA_WGEVENTS_CAL_MIN_WEDNESDAY, \_MA_WGEVENTS_CAL_MIN_THURSDAY, \_MA_WGEVENTS_CAL_MIN_FRIDAY, \_MA_WGEVENTS_CAL_MIN_SATURDAY]; |
||||||
763 | $ret = $daynames_short[$day] . ', '; |
||||||
764 | break; |
||||||
765 | case Constants::DAYNAME_LONG: |
||||||
766 | $daynames_long = [\_MA_WGEVENTS_CAL_SUNDAY, \_MA_WGEVENTS_CAL_MONDAY, \_MA_WGEVENTS_CAL_TUESDAY, \_MA_WGEVENTS_CAL_WEDNESDAY, \_MA_WGEVENTS_CAL_THURSDAY, \_MA_WGEVENTS_CAL_FRIDAY, \_MA_WGEVENTS_CAL_SATURDAY]; |
||||||
767 | $ret = $daynames_long[$day] . ' '; |
||||||
768 | break; |
||||||
769 | } |
||||||
770 | |||||||
771 | return $ret; |
||||||
772 | } |
||||||
773 | |||||||
774 | /** |
||||||
775 | * Returns an array representation of the object |
||||||
776 | * |
||||||
777 | * @return array |
||||||
778 | */ |
||||||
779 | /* |
||||||
780 | public function toArray() |
||||||
781 | { |
||||||
782 | $ret = []; |
||||||
783 | $vars = $this->getVars(); |
||||||
784 | foreach (\array_keys($vars) as $var) { |
||||||
785 | $ret[$var] = $this->getVar($var); |
||||||
786 | } |
||||||
787 | return $ret; |
||||||
788 | } |
||||||
789 | */ |
||||||
790 | } |
||||||
791 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: