Passed
Pull Request — master (#88)
by Michael
02:56
created

Downloads::getNewEnreg()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Tdmdownloads;
4
5
use XoopsModules\Tag\FormTag;
6
7
/**
8
 * TDMDownload
9
 *
10
 * You may not change or alter any portion of this comment or credits
11
 * of supporting developers from this source code or any supporting source code
12
 * which is considered copyrighted (c) material of the original comment or credit authors.
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
 *
17
 * @copyright   Gregory Mage (Aka Mage)
18
 * @license     GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
19
 * @author      Gregory Mage (Aka Mage)
20
 */
21
22
/**
23
 * Class Downloads
24
 * @package XoopsModules\Tdmdownloads
25
 */
26
class Downloads extends \XoopsObject
27
{
28
    // constructor
29
30
    public function __construct()
31
    {
32
        $this->initVar('lid', \XOBJ_DTYPE_INT, null, false, 11);
33
34
        $this->initVar('cid', \XOBJ_DTYPE_INT, null, false, 5);
35
36
        $this->initVar('title', \XOBJ_DTYPE_TXTBOX, null, false);
37
38
        $this->initVar('url', \XOBJ_DTYPE_TXTBOX, null, false);
39
40
        $this->initVar('homepage', \XOBJ_DTYPE_TXTBOX, null, false);
41
42
        $this->initVar('version', \XOBJ_DTYPE_TXTBOX, null, false);
43
44
        $this->initVar('size', \XOBJ_DTYPE_TXTBOX, null, false);
45
46
        $this->initVar('platform', \XOBJ_DTYPE_TXTBOX, null, false);
47
48
        $this->initVar('description', \XOBJ_DTYPE_TXTAREA, null, false);
49
50
        // Pour autoriser le html
51
52
        $this->initVar('dohtml', \XOBJ_DTYPE_INT, 1, false);
53
54
        $this->initVar('logourl', \XOBJ_DTYPE_TXTBOX, null, false);
55
56
        $this->initVar('submitter', \XOBJ_DTYPE_INT, null, false, 11);
57
58
        $this->initVar('status', \XOBJ_DTYPE_INT, null, false, 2);
59
60
        $this->initVar('date', \XOBJ_DTYPE_INT, null, false, 10);
61
62
        $this->initVar('hits', \XOBJ_DTYPE_INT, null, false, 10);
63
64
        $this->initVar('rating', \XOBJ_DTYPE_OTHER, null, false, 10);
65
66
        $this->initVar('votes', \XOBJ_DTYPE_INT, null, false, 11);
67
68
        $this->initVar('comments', \XOBJ_DTYPE_INT, null, false, 11);
69
70
        $this->initVar('top', \XOBJ_DTYPE_INT, null, false, 2);
71
72
        $this->initVar('paypal', \XOBJ_DTYPE_TXTBOX, null, false);
73
74
        //pour les jointures:
75
76
        $this->initVar('cat_title', \XOBJ_DTYPE_TXTBOX, null, false);
77
78
        $this->initVar('cat_imgurl', \XOBJ_DTYPE_TXTBOX, null, false);
79
    }
80
81
    /**
82
     * @param null $db
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $db is correct as it would always require null to be passed?
Loading history...
83
     * @return int
84
     */
85
    public function getNewEnreg($db = null)
86
    {
87
        $newEnreg = 0;
88
89
        /** @var \XoopsMySQLDatabase $db */
90
91
        if (null !== $db) {
92
            $newEnreg = $db->getInsertId();
93
        }
94
95
        return $newEnreg;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $newEnreg also could return the type string which is incompatible with the documented return type integer.
Loading history...
96
    }
97
98
    /**
99
     * @param array $donnee
100
     * @param bool  $erreur
101
     * @param bool  $action
102
     * @return \XoopsThemeForm
103
     */
104
    public function getForm($donnee = [], $erreur = false, $action = false)
105
    {
106
        global $xoopsModule, $xoopsUser;
107
108
        /** @var \XoopsModules\Tdmdownloads\Helper $helper */
109
110
        $helper = \XoopsModules\Tdmdownloads\Helper::getInstance();
111
112
        /** @var \XoopsModules\Tdmdownloads\Utility $utility */
113
114
        $utility = new \XoopsModules\Tdmdownloads\Utility();
115
116
        $moduleDirName = \basename(\dirname(__DIR__));
117
118
        if (!$action) {
119
            $action = $_SERVER['REQUEST_URI'];
120
        }
121
122
        //permission pour uploader
123
124
        /** @var \XoopsGroupPermHandler $grouppermHandler */
125
        $grouppermHandler = \xoops_getHandler('groupperm');
126
127
        $groups = \is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
128
129
        if ($xoopsUser) {
130
            $perm_upload = true;
131
132
            if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
133
                $perm_upload = $grouppermHandler->checkRight('tdmdownloads_ac', 32, $groups, $xoopsModule->getVar('mid'));
134
            }
135
        } else {
136
            $perm_upload = $grouppermHandler->checkRight('tdmdownloads_ac', 32, $groups, $xoopsModule->getVar('mid'));
137
        }
138
139
        //nom du formulaire selon l'action (editer ou ajouter):
140
141
        $title = $this->isNew() ? \sprintf(_AM_TDMDOWNLOADS_FORMADD) : \sprintf(_AM_TDMDOWNLOADS_FORMEDIT);
142
143
        //création du formulaire
144
145
        $form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
146
147
        $form->setExtra('enctype="multipart/form-data"');
148
149
        //titre
150
151
        $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_FORMTITLE, 'title', 50, 255, $this->getVar('title')), true);
0 ignored issues
show
Bug introduced by
It seems like $this->getVar('title') 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 ignore-type  annotation

151
        $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_FORMTITLE, 'title', 50, 255, /** @scrutinizer ignore-type */ $this->getVar('title')), true);
Loading history...
152
153
        // fichier
154
155
        $fichier = new \XoopsFormElementTray(_AM_TDMDOWNLOADS_FORMFILE, '<br><br>');
156
157
        $url = $this->isNew() ? 'http://' : $this->getVar('url');
158
159
        $formurl = new \XoopsFormText(_AM_TDMDOWNLOADS_FORMURL, 'url', 75, 255, $url);
160
161
        $fichier->addElement($formurl, false);
162
163
        if ($perm_upload) {
164
            $fichier->addElement(new \XoopsFormFile(_AM_TDMDOWNLOADS_FORMUPLOAD, 'attachedfile', $helper->getConfig('maxuploadsize')), false);
165
        }
166
167
        $form->addElement($fichier);
168
169
        //catégorie
170
171
        /** @var \XoopsModules\Tdmdownloads\CategoryHandler $categoryHandler */
172
173
        $categoryHandler = \XoopsModules\Tdmdownloads\Helper::getInstance()->getHandler('Category');
174
175
        $categories = $utility->getItemIds('tdmdownloads_submit', $moduleDirName);
176
177
        $criteria = new \CriteriaCompo();
178
179
        $criteria->setSort('cat_weight ASC, cat_title');
180
181
        $criteria->setOrder('ASC');
182
183
        if ($xoopsUser) {
184
            if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
185
                $criteria->add(new \Criteria('cat_cid', '(' . \implode(',', $categories) . ')', 'IN'));
186
            }
187
        } else {
188
            $criteria->add(new \Criteria('cat_cid', '(' . \implode(',', $categories) . ')', 'IN'));
189
        }
190
191
        $downloadscatArray = $categoryHandler->getAll($criteria);
192
193
        if (empty($downloadscatArray)) {
194
            \redirect_header('index.php', 2, \_NOPERM);
195
        }
196
197
        $mytree = new \XoopsModules\Tdmdownloads\Tree($downloadscatArray, 'cat_cid', 'cat_pid');
198
199
        $form->addElement($mytree->makeSelectElement('cid', 'cat_title', '--', $this->getVar('cid'), true, 0, '', _AM_TDMDOWNLOADS_FORMINCAT), true);
0 ignored issues
show
Bug introduced by
It seems like $this->getVar('cid') can also be of type array and array; however, parameter $selected of XoopsObjectTree::makeSelectElement() 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 ignore-type  annotation

199
        $form->addElement($mytree->makeSelectElement('cid', 'cat_title', '--', /** @scrutinizer ignore-type */ $this->getVar('cid'), true, 0, '', _AM_TDMDOWNLOADS_FORMINCAT), true);
Loading history...
200
201
        //affichage des champs
202
203
        /** @var \XoopsModules\Tdmdownloads\FieldHandler $fieldHandler */
204
205
        $fieldHandler = \XoopsModules\Tdmdownloads\Helper::getInstance()->getHandler('Field');
206
207
        $criteria = new \CriteriaCompo();
208
209
        $criteria->setSort('weight ASC, title');
210
211
        $criteria->setOrder('ASC');
212
213
        /** @var \XoopsModules\Tdmdownloads\Downloads[] $downloads_field */
214
215
        $downloads_field = $fieldHandler->getAll($criteria);
216
217
        foreach (\array_keys($downloads_field) as $i) {
218
            /** @var \XoopsModules\Tdmdownloads\Field[] $downloads_field */
219
220
            if (1 == $downloads_field[$i]->getVar('status_def')) {
221
                if (1 == $downloads_field[$i]->getVar('fid')) {
222
                    //page d'accueil
223
224
                    if (1 == $downloads_field[$i]->getVar('status')) {
225
                        $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_FORMHOMEPAGE, 'homepage', 50, 255, $this->getVar('homepage')));
226
                    } else {
227
                        $form->addElement(new \XoopsFormHidden('homepage', ''));
228
                    }
229
                }
230
231
                if (2 == $downloads_field[$i]->getVar('fid')) {
232
                    //version
233
234
                    if (1 == $downloads_field[$i]->getVar('status')) {
235
                        $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_FORMVERSION, 'version', 10, 255, $this->getVar('version')));
236
                    } else {
237
                        $form->addElement(new \XoopsFormHidden('version', ''));
238
                    }
239
                }
240
241
                if (3 == $downloads_field[$i]->getVar('fid')) {
242
                    //taille du fichier
243
244
                    if (1 == $downloads_field[$i]->getVar('status')) {
245
                        $size_value_arr = \explode(' ', $this->getVar('size'));
246
247
                        $aff_size = new \XoopsFormElementTray(_AM_TDMDOWNLOADS_FORMSIZE, '');
248
249
                        $aff_size->addElement(new \XoopsFormText('', 'sizeValue', 13, 13, $size_value_arr[0]));
250
251
                        if (!\array_key_exists(1, $size_value_arr)) {
252
                            $size_value_arr[1] = 'K';
253
                        }
254
255
                        $type = new \XoopsFormSelect('', 'sizeType', $size_value_arr[1]);
256
257
                        $typeArray = [
258
                            'B' => _AM_TDMDOWNLOADS_BYTES,
259
                            'K' => _AM_TDMDOWNLOADS_KBYTES,
260
                            'M' => _AM_TDMDOWNLOADS_MBYTES,
261
                            'G' => _AM_TDMDOWNLOADS_GBYTES,
262
                            'T' => _AM_TDMDOWNLOADS_TBYTES,
263
                        ];
264
265
                        $type->addOptionArray($typeArray);
266
267
                        $aff_size->addElement($type);
268
269
                        $form->addElement($aff_size);
270
                    } else {
271
                        $form->addElement(new \XoopsFormHidden('size', ''));
272
273
                        $form->addElement(new \XoopsFormHidden('type_size', ''));
274
                    }
275
                }
276
277
                if (4 == $downloads_field[$i]->getVar('fid')) {
278
                    //plateforme
279
280
                    if (1 == $downloads_field[$i]->getVar('status')) {
281
                        $platformselect = new \XoopsFormSelect(_AM_TDMDOWNLOADS_FORMPLATFORM, 'platform', \explode('|', $this->getVar('platform')), 5, true);
282
283
                        $platformArray = \explode('|', $helper->getConfig('platform'));
0 ignored issues
show
Bug introduced by
It seems like $helper->getConfig('platform') can also be of type null; however, parameter $string of explode() 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 ignore-type  annotation

283
                        $platformArray = \explode('|', /** @scrutinizer ignore-type */ $helper->getConfig('platform'));
Loading history...
284
285
                        foreach ($platformArray as $platform) {
286
                            $platformselect->addOption((string)$platform, $platform);
287
                        }
288
289
                        $form->addElement($platformselect, false);
290
                    } else {
291
                        $form->addElement(new \XoopsFormHidden('platform', ''));
292
                    }
293
                }
294
            } else {
295
                $contenu = '';
296
297
                $contenu_iddata = '';
298
299
                $fieldName = 'champ' . $downloads_field[$i]->getVar('fid');
300
301
                /** @var \XoopsModules\Tdmdownloads\FielddataHandler $fielddataHandler */
302
303
                $fielddataHandler = \XoopsModules\Tdmdownloads\Helper::getInstance()->getHandler('Fielddata');
304
305
                $criteria = new \CriteriaCompo();
306
307
                $criteria->add(new \Criteria('lid', $this->getVar('lid')));
0 ignored issues
show
Bug introduced by
It seems like $this->getVar('lid') 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 ignore-type  annotation

307
                $criteria->add(new \Criteria('lid', /** @scrutinizer ignore-type */ $this->getVar('lid')));
Loading history...
308
309
                $criteria->add(new \Criteria('fid', $downloads_field[$i]->getVar('fid')));
310
311
                $downloadsfielddata = $fielddataHandler->getAll($criteria);
312
313
                foreach (\array_keys($downloadsfielddata) as $j) {
314
                    /** @var \XoopsModules\Tdmdownloads\Fielddata[] $downloadsfielddata */
315
316
                    if ($erreur) {
317
                        $contenu = $donnee[$fieldName];
318
                    } else {
319
                        if (!$this->isNew()) {
320
                            $contenu = $downloadsfielddata[$j]->getVar('data');
321
                        }
322
                    }
323
324
                    $contenu_iddata = $downloadsfielddata[$j]->getVar('iddata');
325
                }
326
327
                $iddata = 'iddata' . $downloads_field[$i]->getVar('fid');
328
329
                if (!$this->isNew()) {
330
                    $form->addElement(new \XoopsFormHidden($iddata, $contenu_iddata));
331
                }
332
333
                if (1 == $downloads_field[$i]->getVar('status')) {
334
                    $form->addElement(new \XoopsFormText($downloads_field[$i]->getVar('title'), $fieldName, 50, 255, $contenu));
0 ignored issues
show
Bug introduced by
It seems like $downloads_field[$i]->getVar('title') can also be of type array and array; however, parameter $caption 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 ignore-type  annotation

334
                    $form->addElement(new \XoopsFormText(/** @scrutinizer ignore-type */ $downloads_field[$i]->getVar('title'), $fieldName, 50, 255, $contenu));
Loading history...
335
                } else {
336
                    $form->addElement(new \XoopsFormHidden($fieldName, ''));
337
                }
338
            }
339
        }
340
341
        //description
342
343
        $editorConfigs = [];
344
345
        $editorConfigs['name'] = 'description';
346
347
        $editorConfigs['value'] = $this->getVar('description', 'e');
348
349
        $editorConfigs['rows'] = 20;
350
351
        $editorConfigs['cols'] = 100;
352
353
        $editorConfigs['width'] = '100%';
354
355
        $editorConfigs['height'] = '400px';
356
357
        $editorConfigs['editor'] = $helper->getConfig('editor');
358
359
        $form->addElement(new \XoopsFormEditor(_AM_TDMDOWNLOADS_FORMTEXTDOWNLOADS, 'description', $editorConfigs), true);
360
361
        //tag
362
363
        if (1 == $helper->getConfig('usetag') && \class_exists(FormTag::class)) {
364
            $tagId = $this->isNew() ? 0 : $this->getVar('lid');
365
366
            if ($erreur) {
367
                $tagId = $donnee['TAG'];
368
            }
369
370
            $form->addElement(new \XoopsModules\Tag\FormTag('tag', 60, 255, $tagId, 0));
371
        }
372
373
        //image
374
375
        if ($helper->getConfig('useshots')) {
376
            $uploaddir = XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/images/shots/' . $this->getVar('logourl');
377
378
            $categoryImage = $this->getVar('logourl') ?: 'blank.gif';
379
380
            if (!\is_file($uploaddir)) {
381
                $categoryImage = 'blank.gif';
382
            }
383
384
            $uploadirectory = '/uploads/' . $moduleDirName . '/images/shots';
385
386
            $imgtray = new \XoopsFormElementTray(_AM_TDMDOWNLOADS_FORMIMG, '<br>');
387
388
            $imgpath = \sprintf(_AM_TDMDOWNLOADS_FORMPATH, $uploadirectory);
389
390
            $imageselect = new \XoopsFormSelect($imgpath, 'logo_img', $categoryImage);
391
392
            $topics_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadirectory);
393
394
            foreach ($topics_array as $image) {
395
                $imageselect->addOption($image, $image);
396
            }
397
398
            $imageselect->setExtra("onchange='showImgSelected(\"image3\", \"logo_img\", \"" . $uploadirectory . '", "", "' . XOOPS_URL . "\")'");
399
400
            $imgtray->addElement($imageselect, false);
401
402
            $imgtray->addElement(new \XoopsFormLabel('', "<br><img src='" . XOOPS_URL . '/' . $uploadirectory . '/' . $categoryImage . "' name='image3' id='image3' alt=''>"));
403
404
            $fileseltray = new \XoopsFormElementTray('', '<br>');
405
406
            if ($perm_upload) {
407
                $fileseltray->addElement(new \XoopsFormFile(_AM_TDMDOWNLOADS_FORMUPLOAD, 'attachedimage', $helper->getConfig('maxuploadsize')), false);
408
            }
409
410
            $imgtray->addElement($fileseltray);
411
412
            $form->addElement($imgtray);
413
        }
414
415
        // pour changer de poster et pour ne pas mettre à jour la date:
416
417
        if ($xoopsUser) {
418
            if ($xoopsUser->isAdmin($xoopsModule->mid())) {
419
                // auteur
420
421
                if ($this->isNew()) {
422
                    $submitter = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
423
424
                    $donnee['date_update'] = 0;
425
                } else {
426
                    $submitter = $this->getVar('submitter');
427
428
                    $v_date = $this->getVar('date');
429
                }
430
431
                if ($erreur) {
432
                    $date_update = $donnee['date_update'];
433
434
                    $v_status = $donnee['status'];
435
436
                    $submitter = $donnee['submitter'];
437
                } else {
438
                    $date_update = 'N';
439
440
                    $v_status = 1;
441
                }
442
443
                $form->addElement(new \XoopsFormSelectUser(_AM_TDMDOWNLOADS_FORMSUBMITTER, 'submitter', true, $submitter, 1, false), true);
444
445
                // date
446
447
                if (!$this->isNew()) {
448
                    $selection_date = new \XoopsFormElementTray(_AM_TDMDOWNLOADS_FORMDATEUPDATE);
449
450
                    $date = new \XoopsFormRadio('', 'date_update', $date_update);
451
452
                    $options = [
453
                        'N' => _AM_TDMDOWNLOADS_FORMDATEUPDATE_NO . ' (' . \formatTimestamp($v_date, 's') . ')',
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $v_date does not seem to be defined for all execution paths leading up to this point.
Loading history...
454
                        'Y' => _AM_TDMDOWNLOADS_FORMDATEUPDATE_YES,
455
                    ];
456
457
                    $date->addOptionArray($options);
458
459
                    $selection_date->addElement($date);
460
461
                    $selection_date->addElement(new \XoopsFormTextDateSelect('', 'date', '', \time()));
0 ignored issues
show
Bug introduced by
'' 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 ignore-type  annotation

461
                    $selection_date->addElement(new \XoopsFormTextDateSelect('', 'date', /** @scrutinizer ignore-type */ '', \time()));
Loading history...
462
463
                    $form->addElement($selection_date);
464
                }
465
466
                $status = new \XoopsFormCheckBox(_AM_TDMDOWNLOADS_FORMSTATUS, 'status', $v_status);
467
468
                $status->addOption(1, _AM_TDMDOWNLOADS_FORMSTATUS_OK);
469
470
                $form->addElement($status);
471
472
                //permissions pour télécharger
473
474
                if (2 == $helper->getConfig('permission_download')) {
475
                    /** @var \XoopsMemberHandler $memberHandler */
476
                    $memberHandler = \xoops_getHandler('member');
477
                    $group_list = $memberHandler->getGroupList();
478
479
                    /** @var \XoopsGroupPermHandler $grouppermHandler */
480
                    $grouppermHandler = \xoops_getHandler('groupperm');
481
482
                    $full_list = \array_keys($group_list);
483
484
                    global $xoopsModule;
485
486
                    if (!$this->isNew()) {
487
                        $item_ids_download = $grouppermHandler->getGroupIds('tdmdownloads_download_item', $this->getVar('lid'), $xoopsModule->getVar('mid'));
488
489
                        $item_ids_downloa = \array_values($item_ids_download);
0 ignored issues
show
Unused Code introduced by
The assignment to $item_ids_downloa is dead and can be removed.
Loading history...
490
491
                        $item_news_can_download_checkbox = new \XoopsFormCheckBox(_AM_TDMDOWNLOADS_FORMPERMDOWNLOAD, 'item_download[]', $item_ids_download);
492
                    } else {
493
                        $item_news_can_download_checkbox = new \XoopsFormCheckBox(_AM_TDMDOWNLOADS_FORMPERMDOWNLOAD, 'item_download[]', $full_list);
494
                    }
495
496
                    $item_news_can_download_checkbox->addOptionArray($group_list);
497
498
                    $form->addElement($item_news_can_download_checkbox);
499
                }
500
            }
501
        }
502
503
        //paypal
504
505
        if (true === $helper->getConfig('use_paypal')) {
506
            $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_FORMPAYPAL, 'paypal', 50, 255, $this->getVar('paypal')), false);
507
        } else {
508
            $form->addElement(new \XoopsFormHidden('paypal', ''));
509
        }
510
511
        // captcha
512
513
        $form->addElement(new \XoopsFormCaptcha(), true);
514
515
        // pour passer "lid" si on modifie la catégorie
516
517
        if (!$this->isNew()) {
518
            $form->addElement(new \XoopsFormHidden('lid', $this->getVar('lid')));
0 ignored issues
show
Bug introduced by
It seems like $this->getVar('lid') 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 ignore-type  annotation

518
            $form->addElement(new \XoopsFormHidden('lid', /** @scrutinizer ignore-type */ $this->getVar('lid')));
Loading history...
519
520
            $form->addElement(new \XoopsFormHidden('downloads_modified', true));
0 ignored issues
show
Bug introduced by
true of type true is incompatible with the type string expected by parameter $value of XoopsFormHidden::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

520
            $form->addElement(new \XoopsFormHidden('downloads_modified', /** @scrutinizer ignore-type */ true));
Loading history...
521
        }
522
523
        //pour enregistrer le formulaire
524
525
        $form->addElement(new \XoopsFormHidden('op', 'save_downloads'));
526
527
        //bouton d'envoi du formulaire
528
529
        $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', 'submit', false));
530
531
        return $form;
532
    }
533
}
534