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 | require_once \dirname(__DIR__) . '/include/common.php'; |
||||||
| 26 | |||||||
| 27 | /** |
||||||
| 28 | * Class Category |
||||||
| 29 | */ |
||||||
| 30 | class Category extends \XoopsObject |
||||||
| 31 | { |
||||||
| 32 | /** |
||||||
| 33 | * @access public |
||||||
| 34 | */ |
||||||
| 35 | public $helper; |
||||||
| 36 | public $db; |
||||||
| 37 | |||||||
| 38 | /** |
||||||
| 39 | * constructor |
||||||
| 40 | */ |
||||||
| 41 | public function __construct() |
||||||
| 42 | { |
||||||
| 43 | /** @var Helper $this ->helper */ |
||||||
| 44 | $this->helper = Helper::getInstance(); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 45 | $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 46 | $this->initVar('cid', \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...
|
|||||||
| 47 | $this->initVar('pid', \XOBJ_DTYPE_INT, 0); |
||||||
| 48 | $this->initVar('title', \XOBJ_DTYPE_TXTBOX, ''); |
||||||
| 49 | $this->initVar('imgurl', \XOBJ_DTYPE_TXTBOX, ''); |
||||||
| 50 | $this->initVar('description', \XOBJ_DTYPE_TXTAREA, ''); |
||||||
| 51 | $this->initVar('total', \XOBJ_DTYPE_INT, 0); |
||||||
| 52 | $this->initVar('summary', \XOBJ_DTYPE_TXTAREA, ''); |
||||||
| 53 | $this->initVar('spotlighttop', \XOBJ_DTYPE_INT, 0); |
||||||
| 54 | $this->initVar('spotlighthis', \XOBJ_DTYPE_INT, 0); |
||||||
| 55 | $this->initVar('dohtml', \XOBJ_DTYPE_INT, false); // boolean |
||||||
| 56 | $this->initVar('dosmiley', \XOBJ_DTYPE_INT, true); // boolean |
||||||
| 57 | $this->initVar('doxcode', \XOBJ_DTYPE_INT, true); // boolean |
||||||
| 58 | $this->initVar('doimage', \XOBJ_DTYPE_INT, true); // boolean |
||||||
| 59 | $this->initVar('dobr', \XOBJ_DTYPE_INT, true); // boolean |
||||||
| 60 | $this->initVar('weight', \XOBJ_DTYPE_INT, 0); |
||||||
| 61 | // Formulize module support (2006/05/04) jpc - start |
||||||
| 62 | $this->initVar('formulize_fid', \XOBJ_DTYPE_INT, 0); |
||||||
| 63 | } |
||||||
| 64 | |||||||
| 65 | /** |
||||||
| 66 | * @param string $method |
||||||
| 67 | * @param array $args |
||||||
| 68 | * |
||||||
| 69 | * @return mixed |
||||||
| 70 | */ |
||||||
| 71 | public function __call($method, $args) |
||||||
| 72 | { |
||||||
| 73 | $arg = $args[0] ?? null; |
||||||
| 74 | |||||||
| 75 | return $this->getVar($method, $arg); |
||||||
| 76 | } |
||||||
| 77 | |||||||
| 78 | /** |
||||||
| 79 | * @param bool $action |
||||||
| 80 | * |
||||||
| 81 | * @return \XoopsThemeForm |
||||||
| 82 | */ |
||||||
| 83 | public function getForm($action = false) |
||||||
| 84 | { |
||||||
| 85 | $grouppermHandler = \xoops_getHandler('groupperm'); |
||||||
| 86 | |||||||
| 87 | if (!$action) { |
||||||
| 88 | $action = $_SERVER['REQUEST_URI']; |
||||||
| 89 | } |
||||||
| 90 | $title = $this->isNew() ? \_AM_WFDOWNLOADS_CCATEGORY_CREATENEW : \_AM_WFDOWNLOADS_CCATEGORY_MODIFY; |
||||||
| 91 | |||||||
| 92 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||||
| 93 | |||||||
| 94 | $form = new \XoopsThemeForm($title, 'form_error', $action, 'post', true); |
||||||
| 95 | $form->setExtra('enctype="multipart/form-data"'); |
||||||
| 96 | // category: title |
||||||
| 97 | $form->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FCATEGORY_TITLE, 'title', 50, 255, $this->getVar('title', 'e')), true); |
||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('title', '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...
|
|||||||
| 98 | // category: pid |
||||||
| 99 | if (Utility::categoriesCount() > 0) { |
||||||
| 100 | $categoryObjs = $this->helper->getHandler('Category')->getObjects(); |
||||||
| 101 | $categoryObjsTree = new ObjectTree($categoryObjs, 'cid', 'pid'); |
||||||
| 102 | |||||||
| 103 | if (Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { |
||||||
| 104 | $catSelect = $categoryObjsTree->makeSelectElement('pid', 'title', '-', $this->getVar('pid'), true, 0, '', \_AM_WFDOWNLOADS_FCATEGORY_SUBCATEGORY); |
||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('pid') 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
Loading history...
|
|||||||
| 105 | $form->addElement($catSelect); |
||||||
| 106 | } else { |
||||||
| 107 | $form->addElement(new \XoopsFormLabel(\_AM_WFDOWNLOADS_FCATEGORY_SUBCATEGORY, $categoryObjsTree->makeSelBox('pid', 'title', '-', $this->getVar('pid', 'e'), true))); |
||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('pid', 'e') can also be of type array and array; however, parameter $selected of XoopsModules\Wfdownloads\ObjectTree::makeSelBox() 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...
|
|||||||
| 108 | } |
||||||
| 109 | } |
||||||
| 110 | // category: weight |
||||||
| 111 | $form->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FCATEGORY_WEIGHT, 'weight', 11, 11, $this->getVar('weight')), false); |
||||||
| 112 | // permission: WFDownCatPerm |
||||||
| 113 | $groups = $grouppermHandler->getGroupIds('WFDownCatPerm', $this->getVar('cid'), $this->helper->getModule()->mid()); |
||||||
|
0 ignored issues
–
show
The method
getGroupIds() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsGroupPermHandler or XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 114 | $groups_down_select = new \XoopsFormSelectGroup(\_AM_WFDOWNLOADS_FCATEGORY_GROUPPROMPT, 'groups', true, $groups, 5, true); |
||||||
| 115 | $groups_down_select->setDescription(\_AM_WFDOWNLOADS_FCATEGORY_GROUPPROMPT_DESC); |
||||||
| 116 | $form->addElement($groups_down_select); |
||||||
| 117 | // permission: WFUpCatPerm |
||||||
| 118 | $up_groups = $grouppermHandler->getGroupIds('WFUpCatPerm', $this->getVar('cid'), $this->helper->getModule()->mid()); |
||||||
| 119 | $groups_up_select = new \XoopsFormSelectGroup(\_AM_WFDOWNLOADS_FCATEGORY_GROUPPROMPT_UP, 'up_groups', true, $up_groups, 5, true); |
||||||
| 120 | $groups_up_select->setDescription(\_AM_WFDOWNLOADS_FCATEGORY_GROUPPROMPT_UP_DESC); |
||||||
| 121 | $form->addElement($groups_up_select); |
||||||
| 122 | // category: imgurl |
||||||
| 123 | $imgurl_path = $this->getVar('imgurl') ? $this->helper->getConfig('catimage') . '/' . $this->getVar('imgurl') : WFDOWNLOADS_IMAGE_URL . '/blank.png'; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 124 | $imgurl_tray = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FCATEGORY_CIMAGE, '<br>'); |
||||||
| 125 | $imgurl_tray->addElement(new \XoopsFormLabel(_AM_WFDOWNLOADS_DOWN_FUPLOADPATH, XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('catimage'))); |
||||||
| 126 | $imgurl_tray->addElement(new \XoopsFormLabel(_AM_WFDOWNLOADS_DOWN_FUPLOADURL, XOOPS_URL . '/' . $this->helper->getConfig('catimage'))); |
||||||
| 127 | $graph_array = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('catimage'), 'images'); |
||||||
| 128 | $imgurl_select = new \XoopsFormSelect('', 'imgurl', $this->getVar('imgurl')); |
||||||
| 129 | $imgurl_select->addOptionArray($graph_array); |
||||||
| 130 | $imgurl_select->setExtra("onchange='showImgSelected(\"image\", \"imgurl\", \"" . $this->helper->getConfig('catimage') . '", "", "' . XOOPS_URL . "\")'"); |
||||||
| 131 | $imgurl_tray->addElement($imgurl_select, false); |
||||||
| 132 | $imgurl_tray->addElement(new \XoopsFormLabel('', "<img src='" . XOOPS_URL . '/' . $imgurl_path . "' name='image' id='image' alt=''>")); |
||||||
| 133 | $imgurl_tray->addElement(new \XoopsFormFile(\_AM_WFDOWNLOADS_BUPLOAD, 'uploadfile', 0), false); |
||||||
| 134 | $form->addElement($imgurl_tray); |
||||||
| 135 | // category: description |
||||||
| 136 | $description_textarea = new \XoopsFormDhtmlTextArea(\_AM_WFDOWNLOADS_FCATEGORY_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60); |
||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('description', 'e') can also be of type array and array; however, parameter $value of XoopsFormDhtmlTextArea::__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...
|
|||||||
| 137 | $description_textarea->setDescription(\_AM_WFDOWNLOADS_FCATEGORY_DESCRIPTION_DESC); |
||||||
| 138 | $form->addElement($description_textarea, true); |
||||||
| 139 | // category: summary |
||||||
| 140 | $summary_textarea = new \XoopsFormTextArea(\_AM_WFDOWNLOADS_FCATEGORY_SUMMARY, 'summary', $this->getVar('summary'), 10, 60); |
||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('summary') 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...
|
|||||||
| 141 | $summary_textarea->setDescription(\_AM_WFDOWNLOADS_FCATEGORY_SUMMARY_DESC); |
||||||
| 142 | $form->addElement($summary_textarea); |
||||||
| 143 | // category: dohtml, dosmiley, doxcode, doimage, dobr |
||||||
| 144 | $options_tray = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_TEXTOPTIONS, ' '); |
||||||
| 145 | $options_tray->setDescription(\_AM_WFDOWNLOADS_TEXTOPTIONS_DESC); |
||||||
| 146 | $html_checkbox = new \XoopsFormCheckBox('', 'dohtml', $this->getVar('dohtml')); |
||||||
| 147 | $html_checkbox->addOption(1, \_AM_WFDOWNLOADS_ALLOWHTML); |
||||||
| 148 | $options_tray->addElement($html_checkbox); |
||||||
| 149 | $smiley_checkbox = new \XoopsFormCheckBox('', 'dosmiley', $this->getVar('dosmiley')); |
||||||
| 150 | $smiley_checkbox->addOption(1, \_AM_WFDOWNLOADS_ALLOWSMILEY); |
||||||
| 151 | $options_tray->addElement($smiley_checkbox); |
||||||
| 152 | $xcodes_checkbox = new \XoopsFormCheckBox('', 'doxcode', $this->getVar('doxcode')); |
||||||
| 153 | $xcodes_checkbox->addOption(1, \_AM_WFDOWNLOADS_ALLOWXCODE); |
||||||
| 154 | $options_tray->addElement($xcodes_checkbox); |
||||||
| 155 | $noimages_checkbox = new \XoopsFormCheckBox('', 'doimage', $this->getVar('doimage')); |
||||||
| 156 | $noimages_checkbox->addOption(1, \_AM_WFDOWNLOADS_ALLOWIMAGES); |
||||||
| 157 | $options_tray->addElement($noimages_checkbox); |
||||||
| 158 | $breaks_checkbox = new \XoopsFormCheckBox('', 'dobr', $this->getVar('dobr')); |
||||||
| 159 | $breaks_checkbox->addOption(1, \_AM_WFDOWNLOADS_ALLOWBREAK); |
||||||
| 160 | $options_tray->addElement($breaks_checkbox); |
||||||
| 161 | $form->addElement($options_tray); |
||||||
| 162 | // Formulize module support (2006/05/04) jpc - start |
||||||
| 163 | // category: formulize_fid |
||||||
| 164 | if (Utility::checkModule('formulize')) { |
||||||
| 165 | if (\is_file(XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php')) { |
||||||
| 166 | require_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php'; |
||||||
| 167 | $fids = allowedForms(); // is a Formulize function |
||||||
|
0 ignored issues
–
show
The function
allowedForms was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 168 | $fids_select = []; |
||||||
| 169 | $fids_select[0] = \_AM_WFDOWNLOADS_FFS_STANDARD_FORM; |
||||||
| 170 | foreach ($fids as $fid) { |
||||||
| 171 | $fids_select[$fid] = \getFormTitle($fid); // is a Formulize function |
||||||
|
0 ignored issues
–
show
The function
getFormTitle was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 172 | } |
||||||
| 173 | |||||||
| 174 | $formulize_forms = new \XoopsFormSelect(\_AM_WFDOWNLOADS_FFS_CUSTOM_FORM, 'formulize_fid', $this->getVar('formulize_fid')); |
||||||
| 175 | $formulize_forms->addOptionArray($fids_select); |
||||||
| 176 | $form->addElement($formulize_forms); |
||||||
| 177 | } |
||||||
| 178 | } |
||||||
| 179 | // Formulize module support (2006/05/04) jpc - end |
||||||
| 180 | // form: buttons |
||||||
| 181 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||
| 182 | $buttonTray->addElement(new \XoopsFormHidden('op', 'category.save')); |
||||||
| 183 | if ($this->isNew()) { |
||||||
| 184 | $button_create = new \XoopsFormButton('', '', _SUBMIT, 'submit'); |
||||||
| 185 | $button_create->setExtra('onclick="this.form.elements.op.value=\'category.save\'"'); |
||||||
| 186 | $buttonTray->addElement($button_create); |
||||||
| 187 | } else { |
||||||
| 188 | $form->addElement(new \XoopsFormHidden('cid', $this->getVar('cid'))); |
||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('cid') 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...
|
|||||||
| 189 | $button_create = new \XoopsFormButton('', '', _SUBMIT, 'submit'); |
||||||
| 190 | $button_create->setExtra('onclick="this.form.elements.op.value=\'category.save\'"'); |
||||||
| 191 | $buttonTray->addElement($button_create); |
||||||
| 192 | $deleteButton = new \XoopsFormButton('', '', _DELETE, 'submit'); |
||||||
| 193 | $deleteButton->setExtra('onclick="this.form.elements.op.value=\'category.delete\'"'); |
||||||
| 194 | $buttonTray->addElement($deleteButton); |
||||||
| 195 | } |
||||||
| 196 | $button_reset = new \XoopsFormButton('', '', _RESET, 'reset'); |
||||||
| 197 | $buttonTray->addElement($button_reset); |
||||||
| 198 | $buttonCancel = new \XoopsFormButton('', '', _CANCEL, 'button'); |
||||||
| 199 | $buttonCancel->setExtra('onclick="history.go(-1)"'); |
||||||
| 200 | $buttonTray->addElement($buttonCancel); |
||||||
| 201 | $form->addElement($buttonTray); |
||||||
| 202 | |||||||
| 203 | return $form; |
||||||
| 204 | } |
||||||
| 205 | } |
||||||
| 206 |