XoopsModules25x /
wfdownloads
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\Wfdownloads; |
||||||||
| 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 | * Wfdownloads module |
||||||||
| 17 | * |
||||||||
| 18 | * @copyright XOOPS Project (https://xoops.org) |
||||||||
| 19 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||||||||
| 20 | * @package wfdownload |
||||||||
| 21 | * @since 3.23 |
||||||||
| 22 | * @author Xoops Development Team |
||||||||
| 23 | */ |
||||||||
| 24 | |||||||||
| 25 | use XoopsModules\Wfdownloads; |
||||||||
| 26 | |||||||||
| 27 | /* |
||||||||
| 28 | CREATE TABLE wfdownloads_mimetypes ( |
||||||||
| 29 | mime_id int(11) NOT NULL auto_increment, |
||||||||
| 30 | mime_ext varchar(60) NOT NULL default '', |
||||||||
| 31 | mime_types text NOT NULL, |
||||||||
| 32 | mime_name varchar(255) NOT NULL default '', |
||||||||
| 33 | mime_admin int(1) NOT NULL default '1', |
||||||||
| 34 | mime_user int(1) NOT NULL default '0', |
||||||||
| 35 | KEY mime_id (mime_id) |
||||||||
| 36 | ) ENGINE=MyISAM; |
||||||||
| 37 | */ |
||||||||
| 38 | |||||||||
| 39 | require_once \dirname(__DIR__) . '/include/common.php'; |
||||||||
| 40 | |||||||||
| 41 | /** |
||||||||
| 42 | * Class Mimetype |
||||||||
| 43 | */ |
||||||||
| 44 | class Mimetype extends \XoopsObject |
||||||||
| 45 | { |
||||||||
| 46 | /** |
||||||||
| 47 | * @access public |
||||||||
| 48 | */ |
||||||||
| 49 | public $helper; |
||||||||
| 50 | public $db; |
||||||||
| 51 | |||||||||
| 52 | /** |
||||||||
| 53 | * @param int|null $id |
||||||||
| 54 | */ |
||||||||
| 55 | public function __construct($id = null) |
||||||||
| 56 | { |
||||||||
| 57 | /** @var \XoopsModules\Wfdownloads\Helper $this ->helper */ |
||||||||
| 58 | $this->helper = Helper::getInstance(); |
||||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||||
| 59 | $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); |
||||||||
|
0 ignored issues
–
show
|
|||||||||
| 60 | $this->initVar('mime_id', \XOBJ_DTYPE_INT); |
||||||||
|
0 ignored issues
–
show
The method
initVar() does not exist on XoopsModules\Wfdownloads\Helper. Did you maybe mean init()?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||||
| 61 | $this->initVar('mime_ext', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 62 | $this->initVar('mime_types', \XOBJ_DTYPE_TXTAREA, ''); |
||||||||
| 63 | $this->initVar('mime_name', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 64 | $this->initVar('mime_admin', \XOBJ_DTYPE_INT, true); // boolean |
||||||||
| 65 | $this->initVar('mime_user', \XOBJ_DTYPE_INT, false); // boolean |
||||||||
| 66 | |||||||||
| 67 | if (null !== $id) { |
||||||||
| 68 | $item = $this->helper->getHandler('Item')->get($id); |
||||||||
| 69 | foreach ($item->vars as $k => $v) { |
||||||||
| 70 | $this->assignVar($k, $v['value']); |
||||||||
|
0 ignored issues
–
show
The method
assignVar() does not exist on XoopsModules\Wfdownloads\Helper.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||||
| 71 | } |
||||||||
| 72 | } |
||||||||
| 73 | } |
||||||||
| 74 | |||||||||
| 75 | /** |
||||||||
| 76 | * @param bool $action |
||||||||
| 77 | * |
||||||||
| 78 | * @return \XoopsThemeForm |
||||||||
| 79 | */ |
||||||||
| 80 | public function getForm($action = false) |
||||||||
| 81 | { |
||||||||
| 82 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||||||
| 83 | |||||||||
| 84 | if (!$action) { |
||||||||
| 85 | $action = $_SERVER['REQUEST_URI']; |
||||||||
| 86 | } |
||||||||
| 87 | $title = $this->isNew() ? \_AM_WFDOWNLOADS_MIME_CREATEF : \_AM_WFDOWNLOADS_MIME_MODIFYF; |
||||||||
| 88 | |||||||||
| 89 | $form = new \XoopsThemeForm($title, 'form_error', $action, 'post', true); |
||||||||
| 90 | $form->setExtra('enctype="multipart/form-data"'); |
||||||||
| 91 | // mime_ext |
||||||||
| 92 | $mime_ext_text = new \XoopsFormText(\_AM_WFDOWNLOADS_MIME_EXTF, 'mime_ext', 5, 60, $this->getVar('mime_ext', 'e')); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('mime_ext', 'e') 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...
|
|||||||||
| 93 | $mime_ext_text->setDescription(\_AM_WFDOWNLOADS_MIME_EXTF_DESC); |
||||||||
| 94 | $form->addElement($mime_ext_text, true); |
||||||||
| 95 | // mime_name |
||||||||
| 96 | $mime_name_text = new \XoopsFormText(\_AM_WFDOWNLOADS_MIME_NAMEF, 'mime_name', 50, 255, $this->getVar('mime_name', 'e')); |
||||||||
| 97 | $mime_name_text->setDescription(\_AM_WFDOWNLOADS_MIME_NAMEF_DESC); |
||||||||
| 98 | $form->addElement($mime_name_text, true); |
||||||||
| 99 | // mime_type |
||||||||
| 100 | $mime_type_textarea = new \XoopsFormTextArea(\_AM_WFDOWNLOADS_MIME_TYPEF, 'mime_type', $this->getVar('mime_types', 'e')); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('mime_types', '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...
|
|||||||||
| 101 | $mime_type_textarea->setDescription(\_AM_WFDOWNLOADS_MIME_TYPEF_DESC); |
||||||||
| 102 | $form->addElement($mime_type_textarea, 7, 60); |
||||||||
|
0 ignored issues
–
show
7 of type integer is incompatible with the type boolean expected by parameter $required of XoopsForm::addElement().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The call to
XoopsForm::addElement() has too many arguments starting with 60.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. Loading history...
|
|||||||||
| 103 | // mime_admin |
||||||||
| 104 | $madmin_radio = new \XoopsFormRadioYN(\_AM_WFDOWNLOADS_MIME_ADMINF, 'mime_admin', $this->getVar('mime_admin', 'e')); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('mime_admin', 'e') 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...
|
|||||||||
| 105 | $form->addElement($madmin_radio); |
||||||||
| 106 | // mime_user |
||||||||
| 107 | $muser_radio = new \XoopsFormRadioYN(\_AM_WFDOWNLOADS_MIME_USERF, 'mime_user', $this->getVar('mime_user', 'e')); |
||||||||
| 108 | $form->addElement($muser_radio); |
||||||||
| 109 | // op |
||||||||
| 110 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||||||||
| 111 | // buttons |
||||||||
| 112 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||||
| 113 | if ($this->isNew()) { |
||||||||
| 114 | $butt_create = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_CREATE, 'submit'); |
||||||||
| 115 | $butt_create->setExtra('onclick="this.form.elements.op.value=\'mimetype.save\'"'); |
||||||||
| 116 | $buttonTray->addElement($butt_create); |
||||||||
| 117 | $butt_clear = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_CLEAR, 'reset'); |
||||||||
| 118 | $buttonTray->addElement($butt_clear); |
||||||||
| 119 | $butt_cancel = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_CANCEL, 'button'); |
||||||||
| 120 | $butt_cancel->setExtra('onclick="history.go(-1)"'); |
||||||||
| 121 | $buttonTray->addElement($butt_cancel); |
||||||||
| 122 | } else { |
||||||||
| 123 | $form->addElement(new \XoopsFormHidden('mime_id', $this->getVar('mime_id'))); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('mime_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...
|
|||||||||
| 124 | $butt_create = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_MODIFY, 'submit'); |
||||||||
| 125 | $butt_create->setExtra('onclick="this.form.elements.op.value=\'mimetype.save\'"'); |
||||||||
| 126 | $buttonTray->addElement($butt_create); |
||||||||
| 127 | $butt_cancel = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_CANCEL, 'button'); |
||||||||
| 128 | $butt_cancel->setExtra('onclick="history.go(-1)"'); |
||||||||
| 129 | $buttonTray->addElement($butt_cancel); |
||||||||
| 130 | } |
||||||||
| 131 | $form->addElement($buttonTray); |
||||||||
| 132 | |||||||||
| 133 | return $form; |
||||||||
| 134 | } |
||||||||
| 135 | } |
||||||||
| 136 |