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 Download |
||||||||
| 29 | */ |
||||||||
| 30 | class Download extends \XoopsObject |
||||||||
| 31 | { |
||||||||
| 32 | /** |
||||||||
| 33 | * @access public |
||||||||
| 34 | */ |
||||||||
| 35 | public $helper; |
||||||||
| 36 | /** |
||||||||
| 37 | * @var Category |
||||||||
| 38 | * @access public |
||||||||
| 39 | */ |
||||||||
| 40 | public $category; |
||||||||
| 41 | public $db; |
||||||||
| 42 | |||||||||
| 43 | /** |
||||||||
| 44 | * @param int|null $id |
||||||||
| 45 | */ |
||||||||
| 46 | public function __construct($id = null) |
||||||||
| 47 | { |
||||||||
| 48 | /** @var \XoopsModules\Wfdownloads\Helper $this ->helper */ |
||||||||
| 49 | $this->helper = Helper::getInstance(); |
||||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||||
| 50 | $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); |
||||||||
|
0 ignored issues
–
show
|
|||||||||
| 51 | $this->initVar('lid', \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...
|
|||||||||
| 52 | $this->initVar('cid', \XOBJ_DTYPE_INT, 0); |
||||||||
| 53 | $this->initVar('title', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 54 | $this->initVar('url', \XOBJ_DTYPE_URL, 'http://'); |
||||||||
| 55 | $this->initVar('filename', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 56 | $this->initVar('filetype', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 57 | $this->initVar('homepage', \XOBJ_DTYPE_URL, 'http://'); |
||||||||
| 58 | $this->initVar('version', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 59 | $this->initVar('size', \XOBJ_DTYPE_INT, 0); |
||||||||
| 60 | $this->initVar('platform', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 61 | $this->initVar('screenshot', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 62 | $this->initVar('screenshot2', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 63 | $this->initVar('screenshot3', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 64 | $this->initVar('screenshot4', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 65 | $this->initVar('submitter', \XOBJ_DTYPE_INT); |
||||||||
| 66 | $this->initVar('publisher', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 67 | $this->initVar('status', \XOBJ_DTYPE_INT, \_WFDOWNLOADS_STATUS_WAITING); |
||||||||
| 68 | $this->initVar('date', \XOBJ_DTYPE_INT); |
||||||||
| 69 | $this->initVar('hits', \XOBJ_DTYPE_INT, 0); |
||||||||
| 70 | $this->initVar('rating', \XOBJ_DTYPE_OTHER, 0.0); |
||||||||
| 71 | $this->initVar('votes', \XOBJ_DTYPE_INT, 0); |
||||||||
| 72 | $this->initVar('comments', \XOBJ_DTYPE_INT, 0); |
||||||||
| 73 | $this->initVar('license', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 74 | $this->initVar('mirror', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 75 | $this->initVar('price', \XOBJ_DTYPE_TXTBOX, 0); |
||||||||
| 76 | $this->initVar('paypalemail', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 77 | $this->initVar('features', \XOBJ_DTYPE_TXTAREA, ''); |
||||||||
| 78 | $this->initVar('requirements', \XOBJ_DTYPE_TXTAREA, ''); |
||||||||
| 79 | $this->initVar('homepagetitle', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 80 | $this->initVar('forumid', \XOBJ_DTYPE_INT, 0); |
||||||||
| 81 | $this->initVar('limitations', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 82 | $this->initVar('versiontypes', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 83 | $this->initVar('dhistory', \XOBJ_DTYPE_TXTAREA, ''); |
||||||||
| 84 | $this->initVar('published', \XOBJ_DTYPE_INT, 0); // published time or 0 |
||||||||
| 85 | $this->initVar('expired', \XOBJ_DTYPE_INT, 0); |
||||||||
| 86 | $this->initVar('updated', \XOBJ_DTYPE_INT, 0); // uploaded time or 0 |
||||||||
| 87 | $this->initVar('offline', \XOBJ_DTYPE_INT, false); // boolean |
||||||||
| 88 | $this->initVar('summary', \XOBJ_DTYPE_TXTAREA, ''); |
||||||||
| 89 | $this->initVar('description', \XOBJ_DTYPE_TXTAREA, ''); |
||||||||
| 90 | $this->initVar('ipaddress', \XOBJ_DTYPE_TXTBOX, ''); |
||||||||
| 91 | $this->initVar('notifypub', \XOBJ_DTYPE_INT, 0); |
||||||||
| 92 | // Formulize module support (2006/05/04) jpc |
||||||||
| 93 | $this->initVar('formulize_idreq', \XOBJ_DTYPE_INT, 0); |
||||||||
| 94 | // added 3.23 |
||||||||
| 95 | $this->initVar('screenshots', \XOBJ_DTYPE_ARRAY, []); // IN PROGRESS |
||||||||
| 96 | $this->initVar('dohtml', \XOBJ_DTYPE_INT, false); // boolean |
||||||||
| 97 | $this->initVar('dosmiley', \XOBJ_DTYPE_INT, true); // boolean |
||||||||
| 98 | $this->initVar('doxcode', \XOBJ_DTYPE_INT, true); // boolean |
||||||||
| 99 | $this->initVar('doimage', \XOBJ_DTYPE_INT, true); // boolean |
||||||||
| 100 | $this->initVar('dobr', \XOBJ_DTYPE_INT, true); // boolean |
||||||||
| 101 | |||||||||
| 102 | if (null !== $id) { |
||||||||
| 103 | $item = $this->helper->getHandler('Item')->get($id); |
||||||||
| 104 | foreach ($item->vars as $k => $v) { |
||||||||
| 105 | $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...
|
|||||||||
| 106 | } |
||||||||
| 107 | } |
||||||||
| 108 | } |
||||||||
| 109 | |||||||||
| 110 | /** |
||||||||
| 111 | * @param string $method |
||||||||
| 112 | * @param array $args |
||||||||
| 113 | * |
||||||||
| 114 | * @return mixed |
||||||||
| 115 | */ |
||||||||
| 116 | public function __call($method, $args) |
||||||||
| 117 | { |
||||||||
| 118 | $arg = $args[0] ?? null; |
||||||||
| 119 | |||||||||
| 120 | return $this->getVar($method, $arg); |
||||||||
| 121 | } |
||||||||
| 122 | |||||||||
| 123 | /** |
||||||||
| 124 | * @return null|\XoopsModules\Wfdownloads\Category |
||||||||
| 125 | */ |
||||||||
| 126 | public function category() |
||||||||
| 127 | { |
||||||||
| 128 | if (!isset($this->_category)) { |
||||||||
| 129 | $this->_category = $this->helper->getHandler('Category')->get($this->getVar('cid')); |
||||||||
|
0 ignored issues
–
show
|
|||||||||
| 130 | } |
||||||||
| 131 | |||||||||
| 132 | return $this->_category; |
||||||||
| 133 | } |
||||||||
| 134 | |||||||||
| 135 | /** |
||||||||
| 136 | * @return mixed |
||||||||
| 137 | */ |
||||||||
| 138 | public function getDownloadInfo() |
||||||||
| 139 | { |
||||||||
| 140 | \xoops_load('XoopsUserUtility'); |
||||||||
| 141 | |||||||||
| 142 | $download['id'] = $this->getVar('lid'); |
||||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||||
| 143 | $download['cid'] = $this->getVar('cid'); |
||||||||
| 144 | |||||||||
| 145 | $use_mirrors = $this->helper->getConfig('enable_mirrors'); |
||||||||
| 146 | $add_mirror = false; |
||||||||
| 147 | if (!\is_object($GLOBALS['xoopsUser']) |
||||||||
| 148 | && (\_WFDOWNLOADS_ANONPOST_MIRROR == $this->helper->getConfig('anonpost') |
||||||||
| 149 | || \_WFDOWNLOADS_ANONPOST_BOTH == $this->helper->getConfig('anonpost')) |
||||||||
| 150 | && (\_WFDOWNLOADS_SUBMISSIONS_MIRROR == $this->helper->getConfig('submissions') |
||||||||
| 151 | || \_WFDOWNLOADS_SUBMISSIONS_BOTH == $this->helper->getConfig('submissions')) |
||||||||
| 152 | && true === $use_mirrors) { |
||||||||
| 153 | $add_mirror = true; |
||||||||
| 154 | } elseif (\is_object($GLOBALS['xoopsUser']) |
||||||||
| 155 | && (\_WFDOWNLOADS_SUBMISSIONS_MIRROR == $this->helper->getConfig('submissions') |
||||||||
| 156 | || \_WFDOWNLOADS_SUBMISSIONS_BOTH == $this->helper->getConfig('submissions') |
||||||||
| 157 | || Utility::userIsAdmin()) |
||||||||
| 158 | && true === $use_mirrors) { |
||||||||
| 159 | $add_mirror = true; |
||||||||
| 160 | } |
||||||||
| 161 | $download['add_mirror'] = $add_mirror; |
||||||||
| 162 | $download['use_mirrors'] = $use_mirrors; |
||||||||
| 163 | |||||||||
| 164 | $download['use_reviews'] = $this->helper->getConfig('enable_reviews'); |
||||||||
| 165 | $download['use_ratings'] = $this->helper->getConfig('enable_ratings'); |
||||||||
| 166 | $download['use_brokenreports'] = $this->helper->getConfig('enable_brokenreports'); |
||||||||
| 167 | $download['rateimg'] = 'rate' . \round(\number_format($this->getVar('rating'), 0) / 2) . '.gif'; // this definition is not removed for backward compatibility issues |
||||||||
| 168 | $download['average_rating'] = $this->getVar('rating'); // new |
||||||||
| 169 | $download['votes'] = (1 == $this->getVar('votes')) ? \_MD_WFDOWNLOADS_ONEVOTE : \sprintf(\_MD_WFDOWNLOADS_NUMVOTES, $this->getVar('votes')); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('votes') can also be of type array and array; however, parameter $args of sprintf() 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...
|
|||||||||
| 170 | $download['hits'] = $this->getVar('hits'); |
||||||||
| 171 | |||||||||
| 172 | $download['path'] = $this->helper->getHandler('Category')->getNicePath($download['cid']); |
||||||||
| 173 | |||||||||
| 174 | $download['imageheader'] = Utility::headerImage(); |
||||||||
| 175 | |||||||||
| 176 | $download['title'] = \trim($this->getVar('title')); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('title') can also be of type array and array; however, parameter $str of trim() 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...
|
|||||||||
| 177 | $download['url'] = $this->getVar('url'); |
||||||||
| 178 | $download['filename'] = $this->getVar('filename'); |
||||||||
| 179 | $download['filetype'] = $this->getVar('filetype'); |
||||||||
| 180 | /* |
||||||||
| 181 | if ($this->getVar('screenshot')) { // IN PROGRESS |
||||||||
| 182 | $download['screenshot_full'] = $this->getVar('screenshot'); // IN PROGRESS |
||||||||
| 183 | $download['screenshot_full1'] = $this->getVar('screenshot'); // IN PROGRESS |
||||||||
| 184 | if ($this->getVar('screenshot') // IN PROGRESS |
||||||||
| 185 | && file_exists(XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot'))) |
||||||||
| 186 | ) { |
||||||||
| 187 | if ($this->helper->getConfig('usethumbs') === true) { |
||||||||
| 188 | $download['screenshot_thumb'] = Utility::createThumb( |
||||||||
| 189 | $download['screenshot_full'], $this->helper->getConfig('screenshots'), 'thumbs', |
||||||||
| 190 | $this->helper->getConfig('shotwidth'), $this->helper->getConfig('shotheight'), |
||||||||
| 191 | $this->helper->getConfig('imagequality'), $this->helper->getConfig('updatethumbs'), $this->helper->getConfig('keepaspect') |
||||||||
| 192 | ); |
||||||||
| 193 | } else { |
||||||||
| 194 | $download['screenshot_thumb'] = XOOPS_URL . '/' . $this->helper->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot')); |
||||||||
| 195 | } |
||||||||
| 196 | $download['screenshot_thumb1'] = $download['screenshot_thumb']; // IN PROGRESS |
||||||||
| 197 | } |
||||||||
| 198 | } |
||||||||
| 199 | if ($this->getVar('screenshot2') && $this->helper->getConfig('max_screenshot') >= 2) { // IN PROGRESS |
||||||||
| 200 | $download['screenshot_full2'] = $this->getVar('screenshot2'); |
||||||||
| 201 | if ($this->getVar('screenshot2') |
||||||||
| 202 | && file_exists(XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot2'))) |
||||||||
| 203 | ) { |
||||||||
| 204 | if ($this->helper->getConfig('usethumbs') === true) { |
||||||||
| 205 | $download['screenshot_thumb2'] = Utility::createThumb( |
||||||||
| 206 | $download['screenshot_full2'], $this->helper->getConfig('screenshots'), 'thumbs', |
||||||||
| 207 | $this->helper->getConfig('shotwidth'), $this->helper->getConfig('shotheight'), |
||||||||
| 208 | $this->helper->getConfig('imagequality'), $this->helper->getConfig('updatethumbs'), $this->helper->getConfig('keepaspect') |
||||||||
| 209 | ); |
||||||||
| 210 | } else { |
||||||||
| 211 | $download['screenshot_thumb2'] = XOOPS_URL . '/' . $this->helper->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot2')); |
||||||||
| 212 | } |
||||||||
| 213 | } |
||||||||
| 214 | } |
||||||||
| 215 | if ($this->getVar('screenshot3') && $this->helper->getConfig('max_screenshot') >= 3) { // IN PROGRESS |
||||||||
| 216 | $download['screenshot_full3'] = $this->getVar('screenshot3'); |
||||||||
| 217 | if ($this->getVar('screenshot3') |
||||||||
| 218 | && file_exists(XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot3'))) |
||||||||
| 219 | ) { |
||||||||
| 220 | if ($this->helper->getConfig('usethumbs') === true) { |
||||||||
| 221 | $download['screenshot_thumb3'] = Utility::createThumb( |
||||||||
| 222 | $download['screenshot_full3'], $this->helper->getConfig('screenshots'), 'thumbs', |
||||||||
| 223 | $this->helper->getConfig('shotwidth'), $this->helper->getConfig('shotheight'), |
||||||||
| 224 | $this->helper->getConfig('imagequality'), $this->helper->getConfig('updatethumbs'), $this->helper->getConfig('keepaspect') |
||||||||
| 225 | ); |
||||||||
| 226 | } else { |
||||||||
| 227 | $download['screenshot_thumb3'] = XOOPS_URL . '/' . $this->helper->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot3')); |
||||||||
| 228 | } |
||||||||
| 229 | } |
||||||||
| 230 | } |
||||||||
| 231 | if ($this->getVar('screenshot4') && $this->helper->getConfig('max_screenshot') >= 4) { // IN PROGRESS |
||||||||
| 232 | $download['screenshot_full4'] = $this->getVar('screenshot4'); |
||||||||
| 233 | if ($this->getVar('screenshot4') |
||||||||
| 234 | && file_exists(XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot4'))) |
||||||||
| 235 | ) { |
||||||||
| 236 | if ($this->helper->getConfig('usethumbs') === true) { |
||||||||
| 237 | $download['screenshot_thumb4'] = Utility::createThumb( |
||||||||
| 238 | $download['screenshot_full4'], $this->helper->getConfig('screenshots'), 'thumbs', |
||||||||
| 239 | $this->helper->getConfig('shotwidth'), $this->helper->getConfig('shotheight'), |
||||||||
| 240 | $this->helper->getConfig('imagequality'), $this->helper->getConfig('updatethumbs'), $this->helper->getConfig('keepaspect') |
||||||||
| 241 | ); |
||||||||
| 242 | } else { |
||||||||
| 243 | $download['screenshot_thumb4'] = XOOPS_URL . '/' . $this->helper->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot4')); |
||||||||
| 244 | } |
||||||||
| 245 | } |
||||||||
| 246 | } |
||||||||
| 247 | */ |
||||||||
| 248 | // IN PROGRESS |
||||||||
| 249 | $screenshots = $this->getVar('screenshots'); |
||||||||
| 250 | $download['screenshots'] = []; |
||||||||
| 251 | foreach ($screenshots as $key => $screenshot) { |
||||||||
| 252 | if (\file_exists(XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('screenshots') . '/' . \xoops_trim($screenshot))) { |
||||||||
| 253 | if ('' != $screenshot && 1 === $this->helper->getConfig('usethumbs')) { |
||||||||
| 254 | $screenshot_thumb = Utility::createThumb( |
||||||||
| 255 | $screenshot, |
||||||||
| 256 | $this->helper->getConfig('screenshots'), |
||||||||
| 257 | 'thumbs', |
||||||||
| 258 | $this->helper->getConfig('shotwidth'), |
||||||||
| 259 | $this->helper->getConfig('shotheight'), |
||||||||
| 260 | $this->helper->getConfig('imagequality'), |
||||||||
| 261 | $this->helper->getConfig('updatethumbs'), |
||||||||
| 262 | $this->helper->getConfig('keepaspect') |
||||||||
| 263 | ); |
||||||||
| 264 | } else { |
||||||||
| 265 | $screenshot_thumb = XOOPS_URL . '/' . $this->helper->getConfig('screenshots') . '/' . \xoops_trim($screenshot); |
||||||||
| 266 | } |
||||||||
| 267 | $download['screenshots'][$key]['filename'] = $screenshot; |
||||||||
| 268 | $download['screenshots'][$key]['thumb_url'] = $screenshot_thumb; |
||||||||
| 269 | unset($screenshot_thumb); |
||||||||
| 270 | } |
||||||||
| 271 | } |
||||||||
| 272 | |||||||||
| 273 | $download['homepage'] = (!$this->getVar('homepage') || 'http://' === $this->getVar('homepage')) ? '' : $GLOBALS['myts']->htmlSpecialChars(\trim($this->getVar('homepage'))); |
||||||||
| 274 | |||||||||
| 275 | $homepagetitle = $this->getVar('homepagetitle'); |
||||||||
| 276 | if ($download['homepage'] && !empty($download['homepage'])) { |
||||||||
| 277 | $download['homepagetitle'] = ('' !== $homepagetitle) ? \trim($download['homepage']) : \trim($homepagetitle); |
||||||||
| 278 | $download['homepage'] = "<a href='" . $download['homepage'] . "' target='_blank'>" . $homepagetitle . '</a>'; |
||||||||
| 279 | } else { |
||||||||
| 280 | $download['homepage'] = ''; |
||||||||
| 281 | } |
||||||||
| 282 | |||||||||
| 283 | if (true !== $use_mirrors) { |
||||||||
| 284 | $download['mirror'] = ('http://' === $this->getVar('mirror')) ? '' : \trim($this->getVar('mirror')); |
||||||||
| 285 | if ($download['mirror'] && !empty($download['mirror'])) { |
||||||||
| 286 | $download['mirror'] = "<a href='" . $download['mirror'] . "' target='_blank'>" . \_MD_WFDOWNLOADS_MIRRORSITE . '</a>'; |
||||||||
| 287 | } else { |
||||||||
| 288 | $download['mirror'] = ''; |
||||||||
| 289 | } |
||||||||
| 290 | } |
||||||||
| 291 | |||||||||
| 292 | $download['comments'] = $this->getVar('comments'); |
||||||||
| 293 | |||||||||
| 294 | $download['version'] = $this->getVar('version') ?: 0; |
||||||||
| 295 | |||||||||
| 296 | $download['downtime'] = \str_replace('|', '<br>', Utility::getDownloadTime($this->getVar('size'), 1, 1, 1, 1, 0)); |
||||||||
| 297 | |||||||||
| 298 | $download['size'] = Utility::bytesToSize1024($this->getVar('size')); |
||||||||
| 299 | |||||||||
| 300 | $time = (0 != $this->getVar('updated')) ? $this->getVar('updated') : $this->getVar('published'); |
||||||||
| 301 | $download['updated'] = \formatTimestamp($time, $this->helper->getConfig('dateformat')); |
||||||||
| 302 | $download['lang_subdate'] = (0 != $this->getVar('updated')) ? \_MD_WFDOWNLOADS_UPDATEDON : \_MD_WFDOWNLOADS_SUBMITDATE; |
||||||||
| 303 | |||||||||
| 304 | $summary = $this->getVar('summary'); |
||||||||
| 305 | if ((\_WFDOWNLOADS_AUTOSUMMARY_YES == $this->helper->getConfig('autosummary')) || (\_WFDOWNLOADS_AUTOSUMMARY_IFBLANK == $this->helper->getConfig('autosummary') && empty($summary))) { |
||||||||
| 306 | // generate auto summary from description field |
||||||||
| 307 | $download['summary'] = $this->getVar('description'); |
||||||||
| 308 | // patch for multilanguage summary if xlanguage module is installed |
||||||||
| 309 | if (Utility::checkModule('xlanguage')) { |
||||||||
| 310 | global $xlanguage; |
||||||||
| 311 | require_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php'; |
||||||||
| 312 | require_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/functions.php'; |
||||||||
| 313 | $download['summary'] = xlanguage_ml($download['summary']); |
||||||||
|
0 ignored issues
–
show
The function
xlanguage_ml 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...
|
|||||||||
| 314 | } |
||||||||
| 315 | // html or plain text auto summary |
||||||||
| 316 | if ($this->helper->getConfig('autosumplaintext')) { |
||||||||
| 317 | $download['summary'] = \strip_tags($download['summary'], '<br><br>'); |
||||||||
| 318 | } |
||||||||
| 319 | // truncate auto summary |
||||||||
| 320 | $autosumLength = (int)$this->helper->getConfig('autosumlength'); |
||||||||
| 321 | if (mb_strlen($download['summary']) > $autosumLength) { |
||||||||
| 322 | $download['summary'] = Utility::truncateHtml($download['summary'], $autosumLength, '...', false, true); |
||||||||
| 323 | } |
||||||||
| 324 | } else { |
||||||||
| 325 | $download['summary'] = $summary; |
||||||||
| 326 | } |
||||||||
| 327 | |||||||||
| 328 | $download['description'] = $this->getVar('description'); //no html |
||||||||
| 329 | // |
||||||||
| 330 | $download['price'] = (0 != $this->getVar('price')) ? $this->getVar('price') : \_MD_WFDOWNLOADS_PRICEFREE; |
||||||||
| 331 | |||||||||
| 332 | $limitationsArray = $this->helper->getConfig('limitations'); |
||||||||
| 333 | $download['limitations'] = ('' === $this->getVar('limitations')) ? \_MD_WFDOWNLOADS_NOTSPECIFIED : $GLOBALS['myts']->htmlSpecialChars(\trim($limitationsArray[$this->getVar('limitations')])); |
||||||||
| 334 | // |
||||||||
| 335 | // $versiontypesArray = $this->helper->getConfig('versiontypes'); |
||||||||
| 336 | // $download['versiontypes'] = ('' === $this->getVar('versiontypes')) ? _MD_WFDOWNLOADS_NOTSPECIFIED : $GLOBALS['myts']->htmlSpecialChars(trim($versiontypesArray[$this->getVar('versiontypes')])); |
||||||||
| 337 | $temp = $this->getVar('versiontypes') ?? ''; |
||||||||
| 338 | $download['versiontypes'] = (!$temp) ? \_MD_WFDOWNLOADS_NOTSPECIFIED : $temp; |
||||||||
| 339 | |||||||||
| 340 | $licenseArray = $this->helper->getConfig('license'); |
||||||||
| 341 | $download['license'] = ('' === $this->getVar('license')) ? \_MD_WFDOWNLOADS_NOTSPECIFIED : $GLOBALS['myts']->htmlSpecialChars(\trim($licenseArray[$this->getVar('license')])); |
||||||||
| 342 | |||||||||
| 343 | $download['submitter'] = \XoopsUserUtility::getUnameFromId($this->getVar('submitter')); |
||||||||
| 344 | |||||||||
| 345 | $publisher = $this->getVar('publisher'); |
||||||||
| 346 | $download['publisher'] = !empty($publisher) ? $publisher : ''; |
||||||||
| 347 | |||||||||
| 348 | $platformArray = $this->helper->getConfig('platform'); |
||||||||
| 349 | $download['platform'] = $GLOBALS['myts']->htmlSpecialChars($platformArray[$this->getVar('platform')]); |
||||||||
| 350 | |||||||||
| 351 | $history = $this->getVar('dhistory', 'n'); |
||||||||
| 352 | $download['history'] = $GLOBALS['myts']->displayTarea($history, true); |
||||||||
| 353 | |||||||||
| 354 | $download['features'] = []; |
||||||||
| 355 | if ($this->getVar('features')) { |
||||||||
| 356 | $features = \explode('|', \trim($this->getVar('features'))); |
||||||||
| 357 | foreach ($features as $feature) { |
||||||||
| 358 | $download['features'][] = $feature; |
||||||||
| 359 | } |
||||||||
| 360 | } |
||||||||
| 361 | |||||||||
| 362 | $download['requirements'] = []; |
||||||||
| 363 | if ($this->getVar('requirements')) { |
||||||||
| 364 | $requirements = \explode('|', \trim($this->getVar('requirements'))); |
||||||||
| 365 | foreach ($requirements as $requirement) { |
||||||||
| 366 | $download['requirements'][] = $requirement; |
||||||||
| 367 | } |
||||||||
| 368 | } |
||||||||
| 369 | |||||||||
| 370 | $download['mail_subject'] = \rawurlencode(\sprintf(\_MD_WFDOWNLOADS_INTFILEFOUND, $GLOBALS['xoopsConfig']['sitename'])); |
||||||||
| 371 | |||||||||
| 372 | $download['mail_body'] = \rawurlencode(\sprintf(\_MD_WFDOWNLOADS_INTFILEFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . WFDOWNLOADS_URL . '/singlefile.php?cid=' . $download['cid'] . '&lid=' . $download['id']); |
||||||||
|
0 ignored issues
–
show
|
|||||||||
| 373 | |||||||||
| 374 | $download['isadmin'] = Utility::userIsAdmin() ? true : false; |
||||||||
| 375 | |||||||||
| 376 | $download['adminlink'] = ''; |
||||||||
| 377 | if (true === $download['isadmin']) { |
||||||||
| 378 | $download['adminlink'] = '[<a href="' . WFDOWNLOADS_URL . '/admin/downloads.php?op=download.edit&lid=' . $download['id'] . '">' . \_MD_WFDOWNLOADS_EDIT . '</a> | '; |
||||||||
| 379 | $download['adminlink'] .= '<a href="' . WFDOWNLOADS_URL . '/admin/downloads.php?op=download.delete&lid=' . $download['id'] . '">' . \_MD_WFDOWNLOADS_DELETE . '</a>]'; |
||||||||
| 380 | } |
||||||||
| 381 | |||||||||
| 382 | $download['is_updated'] = ($this->getVar('updated') > 0) ? \_MD_WFDOWNLOADS_UPDATEDON : \_MD_WFDOWNLOADS_SUBMITDATE; |
||||||||
| 383 | |||||||||
| 384 | if (\is_object($GLOBALS['xoopsUser']) && true !== $download['isadmin']) { |
||||||||
| 385 | $download['useradminlink'] = (int)$GLOBALS['xoopsUser']->getvar('uid') == $this->getVar('submitter'); // this definition is not removed for backward compatibility issues |
||||||||
| 386 | $download['issubmitter'] = (int)$GLOBALS['xoopsUser']->getvar('uid') == $this->getVar('submitter'); |
||||||||
| 387 | } |
||||||||
| 388 | |||||||||
| 389 | $sql2 = 'SELECT rated'; |
||||||||
| 390 | $sql2 .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_reviews'); |
||||||||
| 391 | $sql2 .= " WHERE lid = '" . (int)$download['id'] . "' AND submit = '1'"; |
||||||||
| 392 | $results = $GLOBALS['xoopsDB']->query($sql2); |
||||||||
| 393 | $numrows = $GLOBALS['xoopsDB']->getRowsNum($results); |
||||||||
| 394 | $download['reviews_num'] = $numrows ?: 0; |
||||||||
| 395 | |||||||||
| 396 | $totalReviewsRating = 0; |
||||||||
| 397 | while (false !== ($review_text = $GLOBALS['xoopsDB']->fetchArray($results))) { |
||||||||
| 398 | $totalReviewsRating += $review_text['rated']; |
||||||||
| 399 | } |
||||||||
| 400 | $averageReviewsRating = ($download['reviews_num'] > 0) ? $totalReviewsRating / $download['reviews_num'] : 0; |
||||||||
| 401 | $download['review_average_rating'] = $averageReviewsRating; // new |
||||||||
| 402 | // |
||||||||
| 403 | $download['review_rateimg'] = 'rate' . \round(\number_format($averageReviewsRating, 0) / 2) . '.gif'; // this definition is not removed for backward compatibility issues |
||||||||
| 404 | // |
||||||||
| 405 | $download['icons'] = Utility::displayIcons($this->getVar('published'), $this->getVar('status'), $this->getVar('hits')); |
||||||||
| 406 | |||||||||
| 407 | $sql3 = 'SELECT downurl'; |
||||||||
| 408 | $sql3 .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_mirrors'); |
||||||||
| 409 | $sql3 .= " WHERE lid = '" . (int)$download['id'] . "' AND submit = '1'"; |
||||||||
| 410 | $results3 = $GLOBALS['xoopsDB']->query($sql3); |
||||||||
| 411 | $numrows2 = $GLOBALS['xoopsDB']->getRowsNum($results3); |
||||||||
| 412 | $download['mirrors_num'] = $numrows2 ?: 0; |
||||||||
| 413 | // file url |
||||||||
| 414 | $fullFilename = \trim($download['filename']); |
||||||||
| 415 | if (('' === !$download['url'] && 'http://' === !$download['url']) || '' == $fullFilename) { |
||||||||
|
0 ignored issues
–
show
|
|||||||||
| 416 | $download['file_url'] = $GLOBALS['myts']->htmlSpecialChars(\preg_replace('/javascript:/si', 'javascript:', $download['url']), \ENT_QUOTES); |
||||||||
| 417 | } else { |
||||||||
| 418 | $download['file_url'] = XOOPS_URL . \str_replace(XOOPS_ROOT_PATH, '', $this->helper->getConfig('uploaddir')) . '/' . \stripslashes(\trim($fullFilename)); |
||||||||
| 419 | } |
||||||||
| 420 | // has_custom_fields |
||||||||
| 421 | $download['has_custom_fields'] = (Utility::checkModule('formulize') && $this->getVar('formulize_idreq')); |
||||||||
| 422 | |||||||||
| 423 | return $download; |
||||||||
| 424 | } |
||||||||
| 425 | |||||||||
| 426 | /** |
||||||||
| 427 | * @param array $customArray |
||||||||
| 428 | * |
||||||||
| 429 | * @return \XoopsThemeForm |
||||||||
| 430 | */ |
||||||||
| 431 | public function getForm($customArray = []) // $custom array added April 22, 2006 by jwe) |
||||||||
| 432 | { |
||||||||
| 433 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||||||
| 434 | require_once XOOPS_ROOT_PATH . '/class/tree.php'; |
||||||||
| 435 | |||||||||
| 436 | $groups = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : [0 => XOOPS_GROUP_ANONYMOUS]; |
||||||||
| 437 | |||||||||
| 438 | $use_mirrors = $this->helper->getConfig('enable_mirrors'); |
||||||||
| 439 | |||||||||
| 440 | $sform = new \XoopsThemeForm(\_MD_WFDOWNLOADS_SUBMITCATHEAD, 'storyform', $_SERVER['REQUEST_URI']); |
||||||||
| 441 | $sform->setExtra('enctype="multipart/form-data"'); |
||||||||
| 442 | // download: title |
||||||||
| 443 | $sform->addElement(new \XoopsFormText(\_MD_WFDOWNLOADS_FILETITLE, '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...
|
|||||||||
| 444 | // download: url |
||||||||
| 445 | $sform->addElement(new \XoopsFormText(\_MD_WFDOWNLOADS_DLURL, 'url', 50, 255, $this->getVar('url', 'e')), false); |
||||||||
| 446 | if (!$this->isNew()) { |
||||||||
| 447 | // download: filename |
||||||||
| 448 | $sform->addElement(new \XoopsFormHidden('filename', $this->getVar('filename', 'e'))); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('filename', 'e') 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...
|
|||||||||
| 449 | // download: filetype |
||||||||
| 450 | $sform->addElement(new \XoopsFormHidden('filetype', $this->getVar('filetype', 'e'))); |
||||||||
| 451 | } |
||||||||
| 452 | // download: userfile |
||||||||
| 453 | if (($this->helper->getConfig('useruploads') |
||||||||
| 454 | && \array_intersect($this->helper->getConfig('useruploadsgroup'), $groups)) |
||||||||
|
0 ignored issues
–
show
It seems like
$this->helper->getConfig('useruploadsgroup') can also be of type null; however, parameter $array1 of array_intersect() does only seem to accept array, 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...
|
|||||||||
| 455 | || Utility::userIsAdmin()) { |
||||||||
| 456 | $userfile_file = new \XoopsFormFile(\_MD_WFDOWNLOADS_UPLOAD_FILEC, 'userfile', 0); |
||||||||
| 457 | // get max file size (setup and php.ini) |
||||||||
| 458 | $phpiniMaxFileSize = \min((int)\ini_get('upload_max_filesize'), (int)\ini_get('post_max_size'), (int)\ini_get('memory_limit')) * 1024 * 1024; // bytes |
||||||||
| 459 | $maxFileSize = Utility::bytesToSize1024(\min($this->helper->getConfig('maxfilesize'), $phpiniMaxFileSize)); |
||||||||
| 460 | // get allowed mimetypes |
||||||||
| 461 | if (Utility::userIsAdmin()) { |
||||||||
| 462 | $criteria = new \Criteria('mime_admin', true); |
||||||||
|
0 ignored issues
–
show
true of type true is incompatible with the type string expected by parameter $value of Criteria::__construct().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 463 | } else { |
||||||||
| 464 | $criteria = new \Criteria('mime_user', true); |
||||||||
| 465 | } |
||||||||
| 466 | $mimetypes = $this->helper->getHandler('Mimetype')->getList($criteria); |
||||||||
| 467 | $allowedExtensions = \implode(' | ', $mimetypes); |
||||||||
| 468 | $userfile_file->setDescription(\sprintf(\_MD_WFDOWNLOADS_UPLOAD_FILEC_DESC, $maxFileSize, $this->helper->getConfig('maximgwidth'), $this->helper->getConfig('maximgheight'), $allowedExtensions, mb_substr($allowedExtensions, 0, 40) . '...')); |
||||||||
| 469 | $sform->addElement($userfile_file, false); |
||||||||
| 470 | } |
||||||||
| 471 | // download: mirror |
||||||||
| 472 | if (true !== $use_mirrors) { |
||||||||
| 473 | $sform->addElement(new \XoopsFormText(\_MD_WFDOWNLOADS_MIRROR, 'mirror', 50, 255, $this->getVar('mirror', 'e')), false); |
||||||||
| 474 | } |
||||||||
| 475 | // download: cid |
||||||||
| 476 | // Formulize module support (2006/05/04) jpc - start |
||||||||
| 477 | if (Utility::checkModule('formulize')) { |
||||||||
| 478 | $sform->addElement(new \XoopsFormHidden('cid', $this->getVar('cid', 'e'))); |
||||||||
| 479 | } else { |
||||||||
| 480 | $categoryObjs = $this->helper->getHandler('Category')->getUserUpCategories(); |
||||||||
| 481 | $categoryObjsTree = new ObjectTree($categoryObjs, 'cid', 'pid'); |
||||||||
| 482 | |||||||||
| 483 | if (Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { |
||||||||
| 484 | $catSelect = $categoryObjsTree->makeSelectElement('cid', 'title', '--', $this->getVar('cid'), true, 0, '', \_MD_WFDOWNLOADS_CATEGORYC); |
||||||||
|
0 ignored issues
–
show
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
Loading history...
|
|||||||||
| 485 | $sform->addElement($catSelect); |
||||||||
| 486 | } else { |
||||||||
| 487 | $sform->addElement(new \XoopsFormLabel(\_MD_WFDOWNLOADS_CATEGORYC, $categoryObjsTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e')))); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('cid', '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...
|
|||||||||
| 488 | } |
||||||||
| 489 | } |
||||||||
| 490 | |||||||||
| 491 | if (0 == \count($customArray)) { |
||||||||
| 492 | // download: homepagetitle |
||||||||
| 493 | $sform->addElement(new \XoopsFormText(\_MD_WFDOWNLOADS_HOMEPAGETITLEC, 'homepagetitle', 50, 255, $this->getVar('homepagetitle', 'e')), false); |
||||||||
| 494 | // download: homepage |
||||||||
| 495 | $sform->addElement(new \XoopsFormText(\_MD_WFDOWNLOADS_HOMEPAGEC, 'homepage', 50, 255, $this->getVar('homepage', 'e')), false); |
||||||||
| 496 | // download: version |
||||||||
| 497 | $sform->addElement(new \XoopsFormText(\_MD_WFDOWNLOADS_VERSIONC, 'version', 10, 20, $this->getVar('version', 'e')), false); |
||||||||
| 498 | // download: publisher |
||||||||
| 499 | $sform->addElement(new \XoopsFormText(\_MD_WFDOWNLOADS_PUBLISHERC, 'publisher', 50, 255, $this->getVar('publisher', 'e')), false); |
||||||||
| 500 | // download: size |
||||||||
| 501 | $sform->addElement(new \XoopsFormText(\_MD_WFDOWNLOADS_FILESIZEC, 'size', 10, 20, $this->getVar('size', 'e')), false); |
||||||||
| 502 | // download: platform |
||||||||
| 503 | $platform_array = $this->helper->getConfig('platform'); |
||||||||
| 504 | $platform_select = new \XoopsFormSelect(\_MD_WFDOWNLOADS_PLATFORMC, 'platform', $this->getVar('platform', 'e')); |
||||||||
| 505 | $platform_select->addOptionArray($platform_array); |
||||||||
| 506 | $sform->addElement($platform_select); |
||||||||
| 507 | // download: license |
||||||||
| 508 | $license_array = $this->helper->getConfig('license'); |
||||||||
| 509 | $license_select = new \XoopsFormSelect(\_MD_WFDOWNLOADS_LICENCEC, 'license', $this->getVar('license', 'e')); |
||||||||
| 510 | $license_select->addOptionArray($license_array); |
||||||||
| 511 | $sform->addElement($license_select); |
||||||||
| 512 | // download: limitations |
||||||||
| 513 | $limitations_array = $this->helper->getConfig('limitations'); |
||||||||
| 514 | $limitations_select = new \XoopsFormSelect(\_MD_WFDOWNLOADS_LIMITATIONS, 'limitations', $this->getVar('limitations', 'e')); |
||||||||
| 515 | $limitations_select->addOptionArray($limitations_array); |
||||||||
| 516 | $sform->addElement($limitations_select); |
||||||||
| 517 | // download: versiontype |
||||||||
| 518 | $versiontypes_array = $this->helper->getConfig('versiontypes'); |
||||||||
| 519 | $versiontypes_select = new \XoopsFormSelect(\_MD_WFDOWNLOADS_VERSIONTYPES, 'versiontypes', $this->getVar('versiontypes', 'e')); |
||||||||
| 520 | $versiontypes_select->addOptionArray($versiontypes_array); |
||||||||
| 521 | $sform->addElement($versiontypes_select); |
||||||||
| 522 | // download: price |
||||||||
| 523 | $sform->addElement(new \XoopsFormText(\_MD_WFDOWNLOADS_PRICEC, 'price', 10, 20, $this->getVar('price', 'e')), false); |
||||||||
| 524 | // download: summary |
||||||||
| 525 | switch ($this->helper->getConfig('autosummary')) { |
||||||||
| 526 | case \_WFDOWNLOADS_AUTOSUMMARY_YES: |
||||||||
| 527 | $summary_dhtmltextarea = new \XoopsFormDhtmlTextArea(\_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary'); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('summary', '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...
|
|||||||||
| 528 | $summary_dhtmltextarea->setDescription(\_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_YES); |
||||||||
| 529 | $summary_dhtmltextarea->setExtra('disabled', 'disabled'); |
||||||||
|
0 ignored issues
–
show
'disabled' of type string is incompatible with the type boolean expected by parameter $replace of XoopsFormElement::setExtra().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 530 | $sform->addElement($summary_dhtmltextarea, false); |
||||||||
| 531 | break; |
||||||||
| 532 | case \_WFDOWNLOADS_AUTOSUMMARY_IFBLANK: |
||||||||
| 533 | $summary_dhtmltextarea = new \XoopsFormDhtmlTextArea(\_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary'); |
||||||||
| 534 | $summary_dhtmltextarea->setDescription(\_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_IFBLANK); |
||||||||
| 535 | $sform->addElement($summary_dhtmltextarea, false); |
||||||||
| 536 | break; |
||||||||
| 537 | default: |
||||||||
| 538 | case \_WFDOWNLOADS_AUTOSUMMARY_NO: |
||||||||
| 539 | $summary_dhtmltextarea = new \XoopsFormDhtmlTextArea(\_MD_WFDOWNLOADS_SUMMARY, 'summary', $this->getVar('summary', 'e'), 10, 60, 'smartHiddenSummary'); |
||||||||
| 540 | $summary_dhtmltextarea->setDescription(\_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_NO); |
||||||||
| 541 | $sform->addElement($summary_dhtmltextarea, false); |
||||||||
| 542 | break; |
||||||||
| 543 | } |
||||||||
| 544 | // download: description |
||||||||
| 545 | $description_dhtmltextarea = new \XoopsFormDhtmlTextArea(\_MD_WFDOWNLOADS_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, 'smartHiddenDescription'); |
||||||||
| 546 | $description_dhtmltextarea->setDescription(\_MD_WFDOWNLOADS_DESCRIPTION_DESC); |
||||||||
| 547 | $sform->addElement($description_dhtmltextarea, true); |
||||||||
| 548 | // download: dohtml, dosmiley, doxcode, doimage, dobr |
||||||||
| 549 | $options_tray = new \XoopsFormElementTray(\_MD_WFDOWNLOADS_TEXTOPTIONS, '<br>'); |
||||||||
| 550 | $options_tray->setDescription(\_MD_WFDOWNLOADS_TEXTOPTIONS_DESC); |
||||||||
| 551 | $html_checkbox = new \XoopsFormCheckBox('', 'dohtml', $this->getVar('dohtml')); |
||||||||
| 552 | $html_checkbox->addOption(1, \_MD_WFDOWNLOADS_ALLOWHTML); |
||||||||
| 553 | $options_tray->addElement($html_checkbox); |
||||||||
| 554 | $smiley_checkbox = new \XoopsFormCheckBox('', 'dosmiley', $this->getVar('dosmiley')); |
||||||||
| 555 | $smiley_checkbox->addOption(1, \_MD_WFDOWNLOADS_ALLOWSMILEY); |
||||||||
| 556 | $options_tray->addElement($smiley_checkbox); |
||||||||
| 557 | $xcodes_checkbox = new \XoopsFormCheckBox('', 'doxcode', $this->getVar('doxcode')); |
||||||||
| 558 | $xcodes_checkbox->addOption(1, \_MD_WFDOWNLOADS_ALLOWXCODE); |
||||||||
| 559 | $options_tray->addElement($xcodes_checkbox); |
||||||||
| 560 | $noimages_checkbox = new \XoopsFormCheckBox('', 'doimage', $this->getVar('doimage')); |
||||||||
| 561 | $noimages_checkbox->addOption(1, \_MD_WFDOWNLOADS_ALLOWIMAGES); |
||||||||
| 562 | $options_tray->addElement($noimages_checkbox); |
||||||||
| 563 | $breaks_checkbox = new \XoopsFormCheckBox('', 'dobr', $this->getVar('dobr')); |
||||||||
| 564 | $breaks_checkbox->addOption(1, \_MD_WFDOWNLOADS_ALLOWBREAK); |
||||||||
| 565 | $options_tray->addElement($breaks_checkbox); |
||||||||
| 566 | $sform->addElement($options_tray); |
||||||||
| 567 | // download: features |
||||||||
| 568 | $features_textarea = new \XoopsFormTextArea(\_MD_WFDOWNLOADS_KEYFEATURESC, 'features', $this->getVar('features', 'e'), 7, 60); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('features', '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...
|
|||||||||
| 569 | $features_textarea->setDescription(\_MD_WFDOWNLOADS_KEYFEATURESC_DESC); |
||||||||
| 570 | $sform->addElement($features_textarea, false); |
||||||||
| 571 | // download: requirements |
||||||||
| 572 | $requirements_textarea = new \XoopsFormTextArea(\_MD_WFDOWNLOADS_REQUIREMENTSC, 'requirements', $this->getVar('requirements', 'e'), 7, 60); |
||||||||
| 573 | $requirements_textarea->setDescription(\_MD_WFDOWNLOADS_REQUIREMENTSC_DESC); |
||||||||
| 574 | $sform->addElement($requirements_textarea, false); |
||||||||
| 575 | } else { |
||||||||
| 576 | // if we are using a custom form, then add in the form's elements here |
||||||||
| 577 | $sform->addElement(new \XoopsFormDhtmlTextArea(\_MD_WFDOWNLOADS_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60, 'smartHiddenDescription'), true); |
||||||||
| 578 | $sform->addElement(new \XoopsFormHidden('size', $this->getVar('size', 'e'))); |
||||||||
| 579 | if (Utility::checkModule('formulize')) { |
||||||||
| 580 | require_once XOOPS_ROOT_PATH . '/modules/formulize/include/formdisplay.php'; |
||||||||
| 581 | require_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php'; |
||||||||
| 582 | $sform = compileElements(// is a Formulize function |
||||||||
|
0 ignored issues
–
show
The function
compileElements 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...
|
|||||||||
| 583 | $customArray['fid'], |
||||||||
| 584 | $sform, |
||||||||
| 585 | $customArray['formulize_mgr'], |
||||||||
| 586 | $customArray['prevEntry'], |
||||||||
| 587 | $customArray['entry'], |
||||||||
| 588 | $customArray['go_back'], |
||||||||
| 589 | $customArray['parentLinks'], |
||||||||
| 590 | $customArray['owner_groups'], |
||||||||
| 591 | $customArray['groups'], |
||||||||
| 592 | null, |
||||||||
| 593 | null, |
||||||||
| 594 | null, |
||||||||
| 595 | null, |
||||||||
| 596 | null, |
||||||||
| 597 | null, |
||||||||
| 598 | null, |
||||||||
| 599 | null, |
||||||||
| 600 | null, |
||||||||
| 601 | null |
||||||||
| 602 | ); |
||||||||
| 603 | } |
||||||||
| 604 | // IN PROGRESS... formulize module not installed!!! |
||||||||
| 605 | } |
||||||||
| 606 | // Formulize module support (2006/05/04) jpc - end |
||||||||
| 607 | // download: dhistory |
||||||||
| 608 | $sform->addElement(new \XoopsFormTextArea(\_MD_WFDOWNLOADS_HISTORYC, 'dhistory', $this->getVar('dhistory', 'e'), 7, 60), false); |
||||||||
| 609 | if (!$this->isNew() && '' !== $this->getVar('dhistory', 'n')) { |
||||||||
| 610 | $dhistoryaddedd_textarea = new \XoopsFormTextArea(\_MD_WFDOWNLOADS_HISTORYD, 'dhistoryaddedd', '', 7, 60); |
||||||||
| 611 | $dhistoryaddedd_textarea->setDescription(\_MD_WFDOWNLOADS_HISTORYD_DESC); |
||||||||
| 612 | $sform->addElement($dhistoryaddedd_textarea, false); |
||||||||
| 613 | } |
||||||||
| 614 | // download: screenshot, screenshot2, screenshot3, screenshot4 |
||||||||
| 615 | if (($this->helper->getConfig('useruploads') |
||||||||
| 616 | && \array_intersect($this->helper->getConfig('useruploadsgroup'), $groups)) |
||||||||
| 617 | || Utility::userIsAdmin()) { |
||||||||
| 618 | $sform->addElement(new \XoopsFormFile(\_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot', 0), false); // IN PROGRESS |
||||||||
| 619 | if ($this->helper->getConfig('max_screenshot') >= 2) { |
||||||||
| 620 | $sform->addElement(new \XoopsFormFile(\_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot2', 0), false); // IN PROGRESS |
||||||||
| 621 | } |
||||||||
| 622 | if ($this->helper->getConfig('max_screenshot') >= 3) { |
||||||||
| 623 | $sform->addElement(new \XoopsFormFile(\_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot3', 0), false); // IN PROGRESS |
||||||||
| 624 | } |
||||||||
| 625 | if ($this->helper->getConfig('max_screenshot') >= 4) { |
||||||||
| 626 | $sform->addElement(new \XoopsFormFile(\_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot4', 0), false); // IN PROGRESS |
||||||||
| 627 | } |
||||||||
| 628 | } |
||||||||
| 629 | |||||||||
| 630 | // download: notifypub |
||||||||
| 631 | $option_tray = new \XoopsFormElementTray(\_MD_WFDOWNLOADS_OPTIONS, '<br>'); |
||||||||
| 632 | $notify_checkbox = new \XoopsFormCheckBox('', 'notifypub'); |
||||||||
| 633 | $notify_checkbox->addOption(1, \_MD_WFDOWNLOADS_NOTIFYAPPROVE); |
||||||||
| 634 | $option_tray->addElement($notify_checkbox); |
||||||||
| 635 | $sform->addElement($option_tray); |
||||||||
| 636 | // form: button tray |
||||||||
| 637 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||||
| 638 | if ($this->isNew()) { |
||||||||
| 639 | $buttonTray->addElement(new \XoopsFormHidden('op', 'download.save')); |
||||||||
| 640 | $button_submit = new \XoopsFormButton('', '', _SUBMIT, 'submit'); |
||||||||
| 641 | //$button_submit->setExtra('onclick="this.form.elements.op.value=\'download.save\'"'); |
||||||||
| 642 | $buttonTray->addElement($button_submit); |
||||||||
| 643 | } else { |
||||||||
| 644 | $buttonTray->addElement(new \XoopsFormHidden('lid', (int)$this->getVar('lid'))); |
||||||||
| 645 | $buttonTray->addElement(new \XoopsFormHidden('op', 'download.save')); |
||||||||
| 646 | $button_submit = new \XoopsFormButton('', '', _SUBMIT, 'submit'); |
||||||||
| 647 | //$button_submit->setExtra('onclick="this.form.elements.op.value=\'download.save\'"'); |
||||||||
| 648 | $buttonTray->addElement($button_submit); |
||||||||
| 649 | } |
||||||||
| 650 | $button_reset = new \XoopsFormButton('', '', _RESET, 'reset'); |
||||||||
| 651 | $buttonTray->addElement($button_reset); |
||||||||
| 652 | $buttonCancel = new \XoopsFormButton('', '', _CANCEL, 'button'); |
||||||||
| 653 | $buttonCancel->setExtra('onclick="history.go(-1)"'); |
||||||||
| 654 | $buttonTray->addElement($buttonCancel); |
||||||||
| 655 | $sform->addElement($buttonTray); |
||||||||
| 656 | |||||||||
| 657 | return $sform; |
||||||||
| 658 | } |
||||||||
| 659 | |||||||||
| 660 | /** |
||||||||
| 661 | * @param $title |
||||||||
| 662 | * @param array $customArray |
||||||||
| 663 | * |
||||||||
| 664 | * @return \XoopsThemeForm |
||||||||
| 665 | */ |
||||||||
| 666 | public function getAdminForm($title, $customArray = []) // $custom array added April 22, 2006 by jwe |
||||||||
| 667 | { |
||||||||
| 668 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||||||
| 669 | |||||||||
| 670 | $use_mirrors = $this->helper->getConfig('enable_mirrors'); |
||||||||
| 671 | |||||||||
| 672 | $sform = new \XoopsThemeForm($title, 'storyform', $_SERVER['REQUEST_URI']); |
||||||||
| 673 | $sform->setExtra('enctype="multipart/form-data"'); |
||||||||
| 674 | // download: lid |
||||||||
| 675 | if (!$this->isNew()) { |
||||||||
| 676 | $sform->addElement(new \XoopsFormLabel(\_AM_WFDOWNLOADS_FILE_ID, (int)$this->getVar('lid'))); |
||||||||
| 677 | } |
||||||||
| 678 | // download: ipaddress |
||||||||
| 679 | if ('' != $this->getVar('ipaddress')) { |
||||||||
| 680 | $sform->addElement(new \XoopsFormLabel(\_AM_WFDOWNLOADS_FILE_IP, $this->getVar('ipaddress'))); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('ipaddress') 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
Loading history...
|
|||||||||
| 681 | } |
||||||||
| 682 | // download: title |
||||||||
| 683 | $titles_tray = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_TITLE, '<br>'); |
||||||||
| 684 | $titles = new \XoopsFormText('', 'title', 50, 255, $this->getVar('title', 'e')); |
||||||||
|
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...
|
|||||||||
| 685 | $titles_tray->addElement($titles); |
||||||||
| 686 | $titles_checkbox = new \XoopsFormCheckBox('', 'title_checkbox', 0); |
||||||||
| 687 | $titles_checkbox->addOption(1, \_AM_WFDOWNLOADS_FILE_USE_UPLOAD_TITLE); |
||||||||
| 688 | $titles_tray->addElement($titles_checkbox); |
||||||||
| 689 | $sform->addElement($titles_tray); |
||||||||
| 690 | // download: submitter |
||||||||
| 691 | if (!$this->isNew()) { |
||||||||
| 692 | //$sform -> addElement(new \XoopsFormText(_AM_WFDOWNLOADS_FILE_SUBMITTERID, 'submitter', 10, 10, $this->getVar('submitter', 'e')), true); |
||||||||
| 693 | $submitter_select = new \XoopsFormSelectUser(\_AM_WFDOWNLOADS_FILE_SUBMITTER, 'submitter', false, $this->getVar('submitter', 'e'), 1, false); |
||||||||
| 694 | $submitter_select->setDescription(\_AM_WFDOWNLOADS_FILE_SUBMITTER_DESC); |
||||||||
| 695 | $sform->addElement($submitter_select); |
||||||||
| 696 | } else { |
||||||||
| 697 | $sform->addElement(new \XoopsFormHidden('submitter', $GLOBALS['xoopsUser']->getVar('uid', 'e'))); |
||||||||
| 698 | } |
||||||||
| 699 | // download: url |
||||||||
| 700 | $sform->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FILE_DLURL, 'url', 50, 255, $this->getVar('url', 'e')), false); |
||||||||
| 701 | // download: filename |
||||||||
| 702 | $sform->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FILE_FILENAME, 'filename', 50, 255, $this->getVar('filename', 'e')), false); |
||||||||
| 703 | // download: filetype |
||||||||
| 704 | $sform->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FILE_FILETYPE, 'filetype', 50, 100, $this->getVar('filetype', 'e')), false); |
||||||||
| 705 | // download: mirror |
||||||||
| 706 | if (true !== $use_mirrors) { |
||||||||
| 707 | $sform->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FILE_MIRRORURL, 'mirror', 50, 255, $this->getVar('mirror', 'e')), false); |
||||||||
| 708 | } |
||||||||
| 709 | // download: userfile |
||||||||
| 710 | $userfile_file = new \XoopsFormFile(\_MD_WFDOWNLOADS_UPLOAD_FILEC, 'userfile', 0); |
||||||||
| 711 | // get max file size (setup and php.ini) |
||||||||
| 712 | $phpiniMaxFileSize = \min((int)\ini_get('upload_max_filesize'), (int)\ini_get('post_max_size'), (int)\ini_get('memory_limit')) * 1024 * 1024; // bytes |
||||||||
| 713 | $maxFileSize = Utility::bytesToSize1024(\min($this->helper->getConfig('maxfilesize'), $phpiniMaxFileSize)); |
||||||||
| 714 | // get allowed mimetypes |
||||||||
| 715 | $criteria = new \Criteria('mime_admin', true); |
||||||||
|
0 ignored issues
–
show
true of type true is incompatible with the type string expected by parameter $value of Criteria::__construct().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||||
| 716 | $mimetypes = $this->helper->getHandler('Mimetype')->getList($criteria); |
||||||||
| 717 | $allowedExtensions = \implode(' | ', $mimetypes); |
||||||||
| 718 | $userfile_file->setDescription(\sprintf(\_MD_WFDOWNLOADS_UPLOAD_FILEC_DESC, $maxFileSize, $this->helper->getConfig('maximgwidth'), $this->helper->getConfig('maximgheight'), $allowedExtensions, mb_substr($allowedExtensions, 0, 40) . '...')); |
||||||||
| 719 | $sform->addElement($userfile_file, false); |
||||||||
| 720 | // download: cid |
||||||||
| 721 | $categoryObjs = $this->helper->getHandler('Category')->getObjects(); |
||||||||
| 722 | $categoryObjsTree = new ObjectTree($categoryObjs, 'cid', 'pid'); |
||||||||
| 723 | |||||||||
| 724 | if (Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { |
||||||||
| 725 | $catSelect = $categoryObjsTree->makeSelectElement('cid', 'title', '--', $this->getVar('cid'), true, 0, '', \_AM_WFDOWNLOADS_FILE_CATEGORY); |
||||||||
|
0 ignored issues
–
show
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
Loading history...
|
|||||||||
| 726 | $sform->addElement($catSelect); |
||||||||
| 727 | } else { |
||||||||
| 728 | $sform->addElement(new \XoopsFormLabel(\_AM_WFDOWNLOADS_FILE_CATEGORY, $categoryObjsTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e')))); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('cid', '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...
|
|||||||||
| 729 | } |
||||||||
| 730 | |||||||||
| 731 | // Formulize module support (2006/03/06, 2006/03/08) jpc - start |
||||||||
| 732 | if (0 == \count($customArray)) { |
||||||||
| 733 | // download: homepagetitle |
||||||||
| 734 | $sform->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FILE_HOMEPAGETITLE, 'homepagetitle', 50, 255, $this->getVar('homepagetitle', 'e')), false); |
||||||||
| 735 | // download: homepage |
||||||||
| 736 | $sform->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FILE_HOMEPAGE, 'homepage', 50, 255, $this->getVar('homepage', 'e')), false); |
||||||||
| 737 | // download: version |
||||||||
| 738 | $sform->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FILE_VERSION, 'version', 10, 20, $this->getVar('version', 'e')), false); |
||||||||
| 739 | // download: publisher |
||||||||
| 740 | $sform->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FILE_PUBLISHER, 'publisher', 50, 255, $this->getVar('publisher', 'e')), false); |
||||||||
| 741 | // download: size |
||||||||
| 742 | $sform->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FILE_SIZE, 'size', 10, 20, $this->getVar('size', 'e')), false); |
||||||||
| 743 | // download: platform |
||||||||
| 744 | $platform_array = $this->helper->getConfig('platform'); |
||||||||
| 745 | $platform_select = new \XoopsFormSelect('', 'platform', $this->getVar('platform', 'e'), '', '', 0); |
||||||||
|
0 ignored issues
–
show
'' of type string is incompatible with the type boolean expected by parameter $multiple of XoopsFormSelect::__construct().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
'' of type string is incompatible with the type integer expected by parameter $size of XoopsFormSelect::__construct().
(
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
XoopsFormSelect::__construct() has too many arguments starting with 0.
(
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...
|
|||||||||
| 746 | $platform_select->addOptionArray($platform_array); |
||||||||
| 747 | $platform_tray = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_PLATFORM, ' '); |
||||||||
| 748 | $platform_tray->addElement($platform_select); |
||||||||
| 749 | $sform->addElement($platform_tray); |
||||||||
| 750 | // download: license |
||||||||
| 751 | $license_array = $this->helper->getConfig('license'); |
||||||||
| 752 | $license_select = new \XoopsFormSelect('', 'license', $this->getVar('license', 'e'), '', '', 0); |
||||||||
| 753 | $license_select->addOptionArray($license_array); |
||||||||
| 754 | $license_tray = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_LICENCE, ' '); |
||||||||
| 755 | $license_tray->addElement($license_select); |
||||||||
| 756 | $sform->addElement($license_tray); |
||||||||
| 757 | // download: limitations |
||||||||
| 758 | $limitations_array = $this->helper->getConfig('limitations'); |
||||||||
| 759 | $limitations_select = new \XoopsFormSelect('', 'limitations', $this->getVar('limitations', 'e'), '', '', 0); |
||||||||
| 760 | $limitations_select->addOptionArray($limitations_array); |
||||||||
| 761 | $limitations_tray = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_LIMITATIONS, ' '); |
||||||||
| 762 | $limitations_tray->addElement($limitations_select); |
||||||||
| 763 | $sform->addElement($limitations_tray); |
||||||||
| 764 | // download: versiontypes |
||||||||
| 765 | $versiontypes_array = $this->helper->getConfig('versiontypes'); |
||||||||
| 766 | $versiontypes_select = new \XoopsFormSelect('', 'versiontypes', $this->getVar('versiontypes', 'e'), '', '', 0); |
||||||||
| 767 | $versiontypes_select->addOptionArray($versiontypes_array); |
||||||||
| 768 | $versiontypes_tray = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_VERSIONTYPES, ' '); |
||||||||
| 769 | $versiontypes_tray->addElement($versiontypes_select); |
||||||||
| 770 | $sform->addElement($versiontypes_tray); |
||||||||
| 771 | // download: versiontypes |
||||||||
| 772 | $sform->addElement(new \XoopsFormText(\_AM_WFDOWNLOADS_FILE_PRICE, 'price', 10, 20, $this->getVar('price', 'e')), false); |
||||||||
| 773 | // download: summary |
||||||||
| 774 | $mode = 'html'; |
||||||||
| 775 | $summary_tray = new \XoopsFormElementTray(\_MD_WFDOWNLOADS_SUMMARY, '<br>'); |
||||||||
| 776 | $options['name'] = 'summary'; |
||||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||||
| 777 | $options['value'] = $this->getVar('summary', 'e'); |
||||||||
| 778 | $options['rows'] = 10; |
||||||||
| 779 | $options['cols'] = '100%'; |
||||||||
| 780 | $options['width'] = '100%'; |
||||||||
| 781 | $options['height'] = '200px'; |
||||||||
| 782 | $options['mode'] = $mode; // for editors that support mode option |
||||||||
| 783 | $summary_editor = new \XoopsFormEditor('', $this->helper->getConfig('editor_options'), $options, $nohtml = false, $onfailure = 'textarea'); |
||||||||
| 784 | $summary_tray->addElement($summary_editor); |
||||||||
| 785 | switch ($this->helper->getConfig('autosummary')) { |
||||||||
| 786 | case \_WFDOWNLOADS_AUTOSUMMARY_YES: |
||||||||
| 787 | $summary_tray->setDescription(\_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_YES); |
||||||||
| 788 | break; |
||||||||
| 789 | case \_WFDOWNLOADS_AUTOSUMMARY_IFBLANK: |
||||||||
| 790 | $summary_tray->setDescription(\_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_IFBLANK); |
||||||||
| 791 | break; |
||||||||
| 792 | default: |
||||||||
| 793 | case \_WFDOWNLOADS_AUTOSUMMARY_NO: |
||||||||
| 794 | $summary_tray->setDescription(\_MD_WFDOWNLOADS_SUMMARY_DESC_AUTOSUMMARY_NO); |
||||||||
| 795 | break; |
||||||||
| 796 | } |
||||||||
| 797 | $sform->addElement($summary_tray); |
||||||||
| 798 | // download: decription |
||||||||
| 799 | $description_tray = new \XoopsFormElementTray(\_MD_WFDOWNLOADS_DESCRIPTION, '<br>'); |
||||||||
| 800 | $options['name'] = 'description'; |
||||||||
| 801 | $options['value'] = $this->getVar('description', 'e'); |
||||||||
| 802 | $options['rows'] = 15; |
||||||||
| 803 | $options['cols'] = '100%'; |
||||||||
| 804 | $options['width'] = '100%'; |
||||||||
| 805 | $options['height'] = '200px'; |
||||||||
| 806 | $description_editor = new \XoopsFormEditor('', $this->helper->getConfig('editor_options'), $options, $nohtml = false, $onfailure = 'textarea'); |
||||||||
| 807 | $description_tray->addElement($description_editor, true); |
||||||||
| 808 | $description_tray->setDescription(\_MD_WFDOWNLOADS_DESCRIPTION_DESC); |
||||||||
| 809 | $sform->addElement($description_tray); |
||||||||
| 810 | // download: dohtml, dosmiley, doxcode, doimage, dobr |
||||||||
| 811 | $options_tray = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_TEXTOPTIONS, ' '); |
||||||||
| 812 | $options_tray->setDescription(\_AM_WFDOWNLOADS_TEXTOPTIONS_DESC); |
||||||||
| 813 | $html_checkbox = new \XoopsFormCheckBox('', 'dohtml', $this->getVar('dohtml')); |
||||||||
| 814 | $html_checkbox->addOption(1, \_AM_WFDOWNLOADS_ALLOWHTML); |
||||||||
| 815 | $options_tray->addElement($html_checkbox); |
||||||||
| 816 | $smiley_checkbox = new \XoopsFormCheckBox('', 'dosmiley', $this->getVar('dosmiley')); |
||||||||
| 817 | $smiley_checkbox->addOption(1, \_AM_WFDOWNLOADS_ALLOWSMILEY); |
||||||||
| 818 | $options_tray->addElement($smiley_checkbox); |
||||||||
| 819 | $xcodes_checkbox = new \XoopsFormCheckBox('', 'doxcode', $this->getVar('doxcode')); |
||||||||
| 820 | $xcodes_checkbox->addOption(1, \_AM_WFDOWNLOADS_ALLOWXCODE); |
||||||||
| 821 | $options_tray->addElement($xcodes_checkbox); |
||||||||
| 822 | $noimages_checkbox = new \XoopsFormCheckBox('', 'doimage', $this->getVar('doimage')); |
||||||||
| 823 | $noimages_checkbox->addOption(1, \_AM_WFDOWNLOADS_ALLOWIMAGES); |
||||||||
| 824 | $options_tray->addElement($noimages_checkbox); |
||||||||
| 825 | $breaks_checkbox = new \XoopsFormCheckBox('', 'dobr', $this->getVar('dobr')); |
||||||||
| 826 | $breaks_checkbox->addOption(1, \_AM_WFDOWNLOADS_ALLOWBREAK); |
||||||||
| 827 | $options_tray->addElement($breaks_checkbox); |
||||||||
| 828 | $sform->addElement($options_tray); |
||||||||
| 829 | // download: features |
||||||||
| 830 | $sform->addElement(new \XoopsFormTextArea(\_AM_WFDOWNLOADS_FILE_KEYFEATURES, 'features', $this->getVar('features', 'e'), 7, 60), false); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('features', '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...
|
|||||||||
| 831 | // download: requirements |
||||||||
| 832 | $sform->addElement(new \XoopsFormTextArea(\_AM_WFDOWNLOADS_FILE_REQUIREMENTS, 'requirements', $this->getVar('requirements', 'e'), 7, 60), false); |
||||||||
| 833 | } else { |
||||||||
| 834 | // if we are using a custom form, then add in the form's elements here |
||||||||
| 835 | // download: description |
||||||||
| 836 | $description_tray = new \XoopsFormElementTray(\_MD_WFDOWNLOADS_DESCRIPTION, '<br>'); |
||||||||
| 837 | $options['name'] = 'description'; |
||||||||
| 838 | $options['value'] = $this->getVar('description', 'e'); |
||||||||
| 839 | $options['rows'] = 15; |
||||||||
| 840 | $options['cols'] = '100%'; |
||||||||
| 841 | $options['width'] = '100%'; |
||||||||
| 842 | $options['height'] = '200px'; |
||||||||
| 843 | $description_editor = new \XoopsFormEditor('', $this->helper->getConfig('editor_options'), $options, $nohtml = false, $onfailure = 'textarea'); |
||||||||
| 844 | $description_tray->addElement($description_editor, true); |
||||||||
| 845 | $description_tray->setDescription(\_MD_WFDOWNLOADS_DESCRIPTION_DESC); |
||||||||
| 846 | $sform->addElement($description_tray); |
||||||||
| 847 | // download: size |
||||||||
| 848 | $sform->addElement(new \XoopsFormHidden('size', $this->getVar('size', 'e'))); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('size', 'e') 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...
|
|||||||||
| 849 | |||||||||
| 850 | if (Utility::checkModule('formulize')) { |
||||||||
| 851 | require_once XOOPS_ROOT_PATH . '/modules/formulize/include/formdisplay.php'; |
||||||||
| 852 | require_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php'; |
||||||||
| 853 | $sform = compileElements(// is a Formulize function |
||||||||
|
0 ignored issues
–
show
The function
compileElements 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...
|
|||||||||
| 854 | $customArray['fid'], |
||||||||
| 855 | $sform, |
||||||||
| 856 | $customArray['formulize_mgr'], |
||||||||
| 857 | $customArray['prevEntry'], |
||||||||
| 858 | $customArray['entry'], |
||||||||
| 859 | $customArray['go_back'], |
||||||||
| 860 | $customArray['parentLinks'], |
||||||||
| 861 | $customArray['owner_groups'], |
||||||||
| 862 | $customArray['groups'], |
||||||||
| 863 | null, |
||||||||
| 864 | null, |
||||||||
| 865 | null, |
||||||||
| 866 | null, |
||||||||
| 867 | null, |
||||||||
| 868 | null, |
||||||||
| 869 | null, |
||||||||
| 870 | null, |
||||||||
| 871 | null, |
||||||||
| 872 | null |
||||||||
| 873 | ); |
||||||||
| 874 | } |
||||||||
| 875 | // IN PROGRESS... Formulize module not installed!!! |
||||||||
| 876 | } |
||||||||
| 877 | // Formulize module support (2006/03/06, 2006/03/08) jpc - end |
||||||||
| 878 | // download: dhistory |
||||||||
| 879 | $sform->addElement(new \XoopsFormTextArea(\_AM_WFDOWNLOADS_FILE_HISTORY, 'dhistory', $this->getVar('dhistory', 'e'), 7, 60), false); |
||||||||
| 880 | if (!$this->isNew() && '' != $this->getVar('dhistory')) { |
||||||||
| 881 | $sform->addElement(new \XoopsFormTextArea(\_AM_WFDOWNLOADS_FILE_HISTORYD, 'dhistoryaddedd', '', 7, 60), false); |
||||||||
| 882 | } |
||||||||
| 883 | |||||||||
| 884 | // download: screenshot |
||||||||
| 885 | $graph_array1 = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('screenshots'), 'images'); |
||||||||
| 886 | $indeximage_select1 = new \XoopsFormSelect('', 'screenshot', $this->getVar('screenshot', 'e')); |
||||||||
| 887 | $indeximage_select1->addOptionArray($graph_array1); |
||||||||
| 888 | $indeximage_select1->setExtra("onchange='showImgSelected(\"image1\", \"screenshot\", \"" . $this->helper->getConfig('screenshots') . '", "", "' . XOOPS_URL . "\")'"); |
||||||||
| 889 | $indeximage_tray1 = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_SHOTIMAGE, ' '); |
||||||||
| 890 | $indeximage_tray1->addElement($indeximage_select1); |
||||||||
| 891 | if ('' != $this->getVar('screenshot')) { // IN PROGRESS |
||||||||
| 892 | $indeximage_tray1->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . '/' . $this->helper->getConfig('screenshots') . '/' . $this->getVar('screenshot', 'e') . "' id='image1' alt='' title='screenshot 1'>")); |
||||||||
| 893 | } else { |
||||||||
| 894 | $indeximage_tray1->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . "/uploads/blank.png' id='image1' alt='' title=''>")); |
||||||||
| 895 | } |
||||||||
| 896 | $sform->addElement($indeximage_tray1); |
||||||||
| 897 | |||||||||
| 898 | // download: screenshot2 |
||||||||
| 899 | $graph_array2 = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('screenshots'), 'images'); |
||||||||
| 900 | $indeximage_select2 = new \XoopsFormSelect('', 'screenshot2', $this->getVar('screenshot2', 'e')); |
||||||||
| 901 | $indeximage_select2->addOptionArray($graph_array2); |
||||||||
| 902 | $indeximage_select2->setExtra("onchange='showImgSelected(\"image2\", \"screenshot2\", \"" . $this->helper->getConfig('screenshots') . '", "", "' . XOOPS_URL . "\")'"); |
||||||||
| 903 | $indeximage_tray2 = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_SHOTIMAGE, ' '); |
||||||||
| 904 | $indeximage_tray2->addElement($indeximage_select2); |
||||||||
| 905 | if ('' != $this->getVar('screenshot2')) { |
||||||||
| 906 | $indeximage_tray2->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . '/' . $this->helper->getConfig('screenshots') . '/' . $this->getVar('screenshot2', 'e') . "' id='image2' alt='' title='screenshot 2'>")); |
||||||||
| 907 | } else { |
||||||||
| 908 | $indeximage_tray2->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . "/uploads/blank.png' id='image2' alt='' title=''>")); |
||||||||
| 909 | } |
||||||||
| 910 | $sform->addElement($indeximage_tray2); |
||||||||
| 911 | |||||||||
| 912 | // download: screenshot3 |
||||||||
| 913 | $graph_array3 = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('screenshots'), 'images'); |
||||||||
| 914 | $indeximage_select3 = new \XoopsFormSelect('', 'screenshot3', $this->getVar('screenshot3', 'e', true)); |
||||||||
|
0 ignored issues
–
show
The call to
XoopsObject::getVar() has too many arguments starting with true.
(
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...
|
|||||||||
| 915 | $indeximage_select3->addOptionArray($graph_array3); |
||||||||
| 916 | $indeximage_select3->setExtra("onchange='showImgSelected(\"image3\", \"screenshot3\", \"" . $this->helper->getConfig('screenshots') . '", "", "' . XOOPS_URL . "\")'"); |
||||||||
| 917 | $indeximage_tray3 = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_SHOTIMAGE, ' '); |
||||||||
| 918 | $indeximage_tray3->addElement($indeximage_select3); |
||||||||
| 919 | if ('' != $this->getVar('screenshot3')) { |
||||||||
| 920 | $indeximage_tray3->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . '/' . $this->helper->getConfig('screenshots') . '/' . $this->getVar('screenshot3', 'e') . "' id='image3' alt='' title='screenshot 3'>")); |
||||||||
| 921 | } else { |
||||||||
| 922 | $indeximage_tray3->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . "/uploads/blank.png' id='image3' alt='' title=''>")); |
||||||||
| 923 | } |
||||||||
| 924 | $sform->addElement($indeximage_tray3); |
||||||||
| 925 | |||||||||
| 926 | // download: screenshot4 |
||||||||
| 927 | $graph_array4 = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->helper->getConfig('screenshots'), 'images'); |
||||||||
| 928 | $indeximage_select4 = new \XoopsFormSelect('', 'screenshot4', $this->getVar('screenshot4', 'e')); |
||||||||
| 929 | $indeximage_select4->addOptionArray($graph_array4); |
||||||||
| 930 | $indeximage_select4->setExtra("onchange='showImgSelected(\"image4\", \"screenshot4\", \"" . $this->helper->getConfig('screenshots') . '", "", "' . XOOPS_URL . "\")'"); |
||||||||
| 931 | $indeximage_tray4 = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_SHOTIMAGE, ' '); |
||||||||
| 932 | $indeximage_tray4->addElement($indeximage_select4); |
||||||||
| 933 | if ('' != $this->getVar('screenshot4')) { |
||||||||
| 934 | $indeximage_tray4->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . '/' . $this->helper->getConfig('screenshots') . '/' . $this->getVar('screenshot4', 'e') . "' id='image4' alt='' title='screenshot 4'>")); |
||||||||
| 935 | } else { |
||||||||
| 936 | $indeximage_tray4->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . "/uploads/blank.png' id='image4' alt='' title=''>")); |
||||||||
| 937 | } |
||||||||
| 938 | $sform->addElement($indeximage_tray4); |
||||||||
| 939 | |||||||||
| 940 | $sform->insertBreak(\sprintf(\_AM_WFDOWNLOADS_FILE_MUSTBEVALID, '<b>' . $this->helper->getConfig('screenshots') . '</b>'), 'even'); |
||||||||
| 941 | |||||||||
| 942 | // download: published |
||||||||
| 943 | $publishtext = ($this->isNew() || 0 == $this->getVar('published')) ? \_AM_WFDOWNLOADS_FILE_SETPUBLISHDATE : \_AM_WFDOWNLOADS_FILE_SETNEWPUBLISHDATE; |
||||||||
| 944 | if ($this->getVar('published') > \time()) { |
||||||||
| 945 | $publishtext = \_AM_WFDOWNLOADS_FILE_SETPUBDATESETS; |
||||||||
| 946 | } |
||||||||
| 947 | $ispublished = $this->getVar('published') > \time(); |
||||||||
| 948 | $publishdates = ($this->getVar('published') > \time()) ? \_AM_WFDOWNLOADS_FILE_PUBLISHDATESET . \formatTimestamp($this->getVar('published', 'e'), 'Y-m-d H:s') : \_AM_WFDOWNLOADS_FILE_SETDATETIMEPUBLISH; |
||||||||
| 949 | $publishdate_checkbox = new \XoopsFormCheckBox('', 'publishdateactivate', $ispublished); |
||||||||
| 950 | $publishdate_checkbox->addOption(1, $publishdates . '<br>'); |
||||||||
| 951 | if (!$this->isNew()) { |
||||||||
| 952 | $sform->addElement(new \XoopsFormHidden('was_published', $this->getVar('published', 'e'))); |
||||||||
| 953 | $sform->addElement(new \XoopsFormHidden('was_expired', $this->getVar('expired', 'e'))); |
||||||||
| 954 | } |
||||||||
| 955 | $publishdate_tray = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_PUBLISHDATE, ''); |
||||||||
| 956 | $publishdate_tray->addElement($publishdate_checkbox); |
||||||||
| 957 | $publishdate_tray->addElement(new \XoopsFormDateTime($publishtext, 'published', 15, $this->getVar('published', 'e'))); |
||||||||
| 958 | $publishdate_tray->addElement(new \XoopsFormRadioYN(\_AM_WFDOWNLOADS_FILE_CLEARPUBLISHDATE, 'clearpublish', 0)); |
||||||||
| 959 | $sform->addElement($publishdate_tray); |
||||||||
| 960 | // download: expired |
||||||||
| 961 | $isexpired = $this->getVar('expired', 'e') > \time(); |
||||||||
| 962 | $expiredates = ($this->getVar('expired', 'e') > \time()) ? \_AM_WFDOWNLOADS_FILE_EXPIREDATESET . \formatTimestamp($this->getVar('expired'), 'Y-m-d H:s') : \_AM_WFDOWNLOADS_FILE_SETDATETIMEEXPIRE; |
||||||||
| 963 | $warning = ($this->getVar('published') > $this->getVar('expired') |
||||||||
| 964 | && $this->getVar('expired') > \time()) ? \_AM_WFDOWNLOADS_FILE_EXPIREWARNING : ''; |
||||||||
| 965 | $expiredate_checkbox = new \XoopsFormCheckBox('', 'expiredateactivate', $isexpired); |
||||||||
| 966 | $expiredate_checkbox->addOption(1, $expiredates . '<br>'); |
||||||||
| 967 | $expiredate_tray = new \XoopsFormElementTray(\_AM_WFDOWNLOADS_FILE_EXPIREDATE . $warning, ''); |
||||||||
| 968 | $expiredate_tray->addElement($expiredate_checkbox); |
||||||||
| 969 | $expiredate_tray->addElement(new \XoopsFormDateTime(\_AM_WFDOWNLOADS_FILE_SETEXPIREDATE, 'expired', 15, $this->getVar('expired'))); |
||||||||
| 970 | $expiredate_tray->addElement(new \XoopsFormRadioYN(\_AM_WFDOWNLOADS_FILE_CLEAREXPIREDATE, 'clearexpire', 0)); |
||||||||
| 971 | $sform->addElement($expiredate_tray); |
||||||||
| 972 | // download: offline |
||||||||
| 973 | $filestatus_radio = new \XoopsFormRadioYN(\_AM_WFDOWNLOADS_FILE_FILESSTATUS, 'offline', $this->getVar('offline', 'e')); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('offline', '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...
|
|||||||||
| 974 | $sform->addElement($filestatus_radio); |
||||||||
| 975 | // download: up_dated |
||||||||
| 976 | $file_updated_radio = new \XoopsFormRadioYN(\_AM_WFDOWNLOADS_FILE_SETASUPDATED, 'up_dated', true === $this->getVar('updated', 'e')); |
||||||||
| 977 | $sform->addElement($file_updated_radio); |
||||||||
| 978 | // download: approved |
||||||||
| 979 | if (!$this->isNew() && 0 == $this->getVar('published')) { |
||||||||
| 980 | $approved = 0 != $this->getVar('published'); |
||||||||
|
0 ignored issues
–
show
|
|||||||||
| 981 | $approve_checkbox = new \XoopsFormCheckBox(\_AM_WFDOWNLOADS_FILE_EDITAPPROVE, 'approved', true); |
||||||||
| 982 | $approve_checkbox->addOption(1, ' '); |
||||||||
| 983 | $sform->addElement($approve_checkbox); |
||||||||
| 984 | } |
||||||||
| 985 | // form: button tray |
||||||||
| 986 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||||
| 987 | $buttonTray->addElement(new \XoopsFormHidden('op', 'download.save')); |
||||||||
| 988 | if ($this->isNew()) { |
||||||||
| 989 | $buttonTray->addElement(new \XoopsFormHidden('status', \_WFDOWNLOADS_STATUS_APPROVED)); |
||||||||
| 990 | $buttonTray->addElement(new \XoopsFormHidden('notifypub', $this->getVar('notifypub', 'e'))); |
||||||||
| 991 | |||||||||
| 992 | $buttonTray->addElement(new \XoopsFormButton('', '', _SUBMIT, 'submit')); |
||||||||
| 993 | } else { |
||||||||
| 994 | $buttonTray->addElement(new \XoopsFormHidden('status', \_WFDOWNLOADS_STATUS_UPDATED)); |
||||||||
| 995 | $buttonTray->addElement(new \XoopsFormHidden('lid', (int)$this->getVar('lid'))); |
||||||||
| 996 | $button_submit = new \XoopsFormButton('', '', _SUBMIT, 'submit'); |
||||||||
| 997 | $button_submit->setExtra('onclick="this.form.elements.op.value=\'download.save\'"'); |
||||||||
| 998 | $buttonTray->addElement($button_submit); |
||||||||
| 999 | $deleteButton = new \XoopsFormButton('', '', _DELETE, 'submit'); |
||||||||
| 1000 | $deleteButton->setExtra('onclick="this.form.elements.op.value=\'download.delete\'"'); |
||||||||
| 1001 | $buttonTray->addElement($deleteButton); |
||||||||
| 1002 | } |
||||||||
| 1003 | $button_reset = new \XoopsFormButton('', '', _RESET, 'reset'); |
||||||||
| 1004 | $buttonTray->addElement($button_reset); |
||||||||
| 1005 | $buttonCancel = new \XoopsFormButton('', '', _CANCEL, 'button'); |
||||||||
| 1006 | $buttonCancel->setExtra('onclick="history.go(-1)"'); |
||||||||
| 1007 | $buttonTray->addElement($buttonCancel); |
||||||||
| 1008 | |||||||||
| 1009 | $sform->addElement($buttonTray); |
||||||||
| 1010 | |||||||||
| 1011 | return $sform; |
||||||||
| 1012 | } |
||||||||
| 1013 | |||||||||
| 1014 | // Formulize module support (2006/03/06, 2006/03/08) jpc - start |
||||||||
| 1015 | |||||||||
| 1016 | /** |
||||||||
| 1017 | * @param $title |
||||||||
| 1018 | * |
||||||||
| 1019 | * @return \XoopsThemeForm |
||||||||
| 1020 | */ |
||||||||
| 1021 | public function getCategoryForm($title) |
||||||||
| 1022 | { |
||||||||
| 1023 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||||||
| 1024 | require_once XOOPS_ROOT_PATH . '/class/tree.php'; |
||||||||
| 1025 | $sform = new \XoopsThemeForm($title, 'storyform', $_SERVER['REQUEST_URI']); |
||||||||
| 1026 | $sform->setExtra('enctype="multipart/form-data"'); |
||||||||
| 1027 | // download: cid |
||||||||
| 1028 | $categoryObjs = $this->helper->getHandler('Category')->getUserUpCategories(); |
||||||||
| 1029 | $categoryObjsTree = new ObjectTree($categoryObjs, 'cid', 'pid'); |
||||||||
| 1030 | |||||||||
| 1031 | if (Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { |
||||||||
| 1032 | $catSelect = $categoryObjsTree->makeSelectElement('cid', 'title', '-', $this->getVar('cid'), true, 0, '', \_MD_WFDOWNLOADS_CATEGORYC); |
||||||||
|
0 ignored issues
–
show
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
Loading history...
|
|||||||||
| 1033 | $sform->addElement($catSelect); |
||||||||
| 1034 | } else { |
||||||||
| 1035 | $sform->addElement(new \XoopsFormLabel(\_MD_WFDOWNLOADS_CATEGORYC, $categoryObjsTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e')))); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('cid', '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...
|
|||||||||
| 1036 | } |
||||||||
| 1037 | |||||||||
| 1038 | // form: button tray |
||||||||
| 1039 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||||
| 1040 | $buttonTray->addElement(new \XoopsFormButton('', 'submit_category', _SUBMIT, 'submit')); |
||||||||
| 1041 | if (!$this->isNew()) { |
||||||||
| 1042 | $buttonTray->addElement(new \XoopsFormHidden('lid', $this->getVar('lid', 'e'))); |
||||||||
|
0 ignored issues
–
show
It seems like
$this->getVar('lid', 'e') 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...
|
|||||||||
| 1043 | } |
||||||||
| 1044 | $sform->addElement($buttonTray); |
||||||||
| 1045 | |||||||||
| 1046 | return $sform; |
||||||||
| 1047 | } |
||||||||
| 1048 | |||||||||
| 1049 | // Formulize module support (2006/03/06, 2006/03/08) jpc - end |
||||||||
| 1050 | |||||||||
| 1051 | /** |
||||||||
| 1052 | * Returns an array representation of the object |
||||||||
| 1053 | * |
||||||||
| 1054 | * @return array |
||||||||
| 1055 | */ |
||||||||
| 1056 | public function toArray() |
||||||||
| 1057 | { |
||||||||
| 1058 | $ret = []; |
||||||||
| 1059 | $vars = &$this->getVars(); |
||||||||
| 1060 | foreach (\array_keys($vars) as $i) { |
||||||||
| 1061 | $ret[$i] = $this->getVar($i); |
||||||||
| 1062 | } |
||||||||
| 1063 | |||||||||
| 1064 | return $ret; |
||||||||
| 1065 | } |
||||||||
| 1066 | } |
||||||||
| 1067 |