1 | <?php |
||||
2 | |||||
3 | declare(strict_types=1); |
||||
4 | |||||
5 | namespace XoopsModules\Suico; |
||||
6 | |||||
7 | /** |
||||
8 | * Extended User Profile |
||||
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 (c) 2000-2016 XOOPS Project (www.xoops.org) |
||||
18 | * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) |
||||
19 | * @package profile |
||||
20 | * @since 2.3.0 |
||||
21 | * @author Jan Pedersen |
||||
22 | * @author Taiwen Jiang <[email protected]> |
||||
23 | */ |
||||
24 | // defined('XOOPS_ROOT_PATH') || exit("XOOPS root path not defined"); |
||||
25 | |||||
26 | /** |
||||
27 | * @package kernel |
||||
28 | * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
||||
29 | */ |
||||
30 | class Category extends \XoopsObject |
||||
31 | { |
||||
32 | public function __construct() |
||||
33 | { |
||||
34 | $this->initVar('cat_id', \XOBJ_DTYPE_INT, null, true); |
||||
35 | $this->initVar('cat_title', \XOBJ_DTYPE_TXTBOX); |
||||
36 | $this->initVar('cat_description', \XOBJ_DTYPE_TXTAREA); |
||||
37 | $this->initVar('cat_weight', \XOBJ_DTYPE_INT); |
||||
38 | } |
||||
39 | |||||
40 | /** |
||||
41 | * Get {@link XoopsThemeForm} for adding/editing categories |
||||
42 | * |
||||
43 | * @param mixed $action URL to submit to or false for $_SERVER['REQUEST_URI'] |
||||
44 | * |
||||
45 | * @return object |
||||
46 | */ |
||||
47 | public function getForm($action = false) |
||||
48 | { |
||||
49 | if (false === $action) { |
||||
50 | $action = $_SERVER['REQUEST_URI']; |
||||
51 | } |
||||
52 | $title = $this->isNew() ? \sprintf(_AM_SUICO_ADD, _AM_SUICO_CATEGORY) : \sprintf(_AM_SUICO_EDIT, _AM_SUICO_CATEGORY); |
||||
53 | include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
||||
54 | $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
||||
55 | $form->addElement(new \XoopsFormText(_AM_SUICO_TITLE, 'cat_title', 35, 255, $this->getVar('cat_title'))); |
||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
56 | if (!$this->isNew()) { |
||||
57 | //Load groups |
||||
58 | $form->addElement(new \XoopsFormHidden('id', $this->getVar('cat_id'))); |
||||
0 ignored issues
–
show
It seems like
$this->getVar('cat_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
Loading history...
|
|||||
59 | } |
||||
60 | $form->addElement(new \XoopsFormTextArea(_AM_SUICO_DESCRIPTION, 'cat_description', $this->getVar('cat_description', 'e'))); |
||||
0 ignored issues
–
show
It seems like
$this->getVar('cat_description', '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
Loading history...
|
|||||
61 | $form->addElement(new \XoopsFormText(_AM_SUICO_WEIGHT, 'cat_weight', 35, 35, $this->getVar('cat_weight', 'e'))); |
||||
62 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||||
63 | $form->addElement(new \XoopsFormButton('', 'submit', \_SUBMIT, 'submit')); |
||||
64 | return $form; |
||||
65 | } |
||||
66 | } |
||||
67 |