Issues (267)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

submit.php (8 issues)

1
<?php
2
3
/**
4
 * Module: XoopsTube
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
 * PHP version 5
11
 *
12
 * @category        Module
13
 * @package         Xoopstube
14
 * @author          XOOPS Development Team
15
 * @copyright       2001-2016 XOOPS Project (https://xoops.org)
16
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
17
 * @link            https://xoops.org/
18
 * @since           1.0.6
19
 */
20
21
use Xmf\Request;
22
use XoopsModules\Tag\FormTag;
23
use XoopsModules\Xoopstube\{
24
    Utility,
25
    Tree
26
};
27
28
/** @var \XoopsNotificationHandler $notificationHandler */
29
30
require_once __DIR__ . '/header.php';
31
require_once XOOPS_ROOT_PATH . '/header.php';
32
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
33
34
$mytree = new Tree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid');
35
36
global $xoopsModule, $myts;
37
38
$xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" type="text/css" href="' . $moduleDirName . '/assets/css/xtubestyle.css">');
39
40
$cid = Request::getInt('cid', 0); //(int) cleanRequestVars($_REQUEST, 'cid', 0);
41
$lid = Request::getInt('lid', 0); //(int) cleanRequestVars($_REQUEST, 'lid', 0);
42
43
if (false === Utility::checkGroups($cid, 'XTubeSubPerm')) {
44
    redirect_header('index.php', 1, _MD_XOOPSTUBE_NOPERMISSIONTOPOST);
45
}
46
47
if (true === Utility::checkGroups($cid, 'XTubeSubPerm')) {
48
    echo '<div class="row">
49
    <div class="col-md-12">';
50
    echo '<ol class="breadcrumb">
51
        <li><a href="index.php">' . $moduleDirName . '</a></li>
52
        <li>' . _MD_XOOPSTUBE_SUBMITCATHEAD . '</li>
53
    </ol>
54
    ';
55
    //    if (cleanRequestVars($_REQUEST, 'submit', 0)) {
56
    if (Request::hasVar('submit')) {
57
        if (false === Utility::checkGroups($cid, 'XTubeSubPerm')) {
58
            redirect_header('index.php', 1, _MD_XOOPSTUBE_NOPERMISSIONTOPOST);
59
        }
60
61
        $submitter    = (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
62
        $vidsource    = Request::getInt('vidsource', 0, 'POST'); // cleanRequestVars($_REQUEST, 'vidsource', 0);
63
        $offline      = Request::getInt('offline', 0, 'POST'); // cleanRequestVars($_REQUEST, 'offline', 0);
64
        $notifypub    = Request::getInt('notifypub', 0, 'POST'); // cleanRequestVars($_REQUEST, 'notifypub', 0);
65
        $approve      = Request::getInt('approve', 0, 'POST'); // cleanRequestVars($_REQUEST, 'approve', 0);
66
        $vidrating    = Request::getInt('vidrating', 0, 'POST'); // cleanRequestVars($_REQUEST, 'vidrating', 0);
67
        $vidid        = Request::getString('vidid', 0, 'POST'); // $myts->addslashes(ltrim(Request::getInt('vidid', 0, 'POST')));
68
        $title        = Request::getString('title', '', 'POST'); // $myts->addslashes(ltrim($_REQUEST['title']));
69
        $descriptionb = Request::getString('descriptionb', '', 'POST'); // $myts->addslashes(ltrim($_REQUEST['descriptionb']));
70
        $publisher    = Request::getString('publisher', '', 'POST'); // $myts->addslashes(trim($_REQUEST['publisher']));
71
        $time         = Request::getString('time', '', 'POST'); // $myts->addslashes(ltrim($_REQUEST['time']));
72
        $keywords     = Request::getString('keywords', '', 'POST'); // $myts->addslashes(trim($_REQUEST['keywords']));
73
        $item_tag     = Request::getString('item_tag', '', 'POST'); // $myts->addslashes(ltrim($_REQUEST['item_tag']));
74
        $picurl       = Request::getString('picurl', '', 'POST'); // $myts->addslashes(ltrim($_REQUEST['picurl']));
75
        $date         = time();
76
        $publishdate  = 0;
77
        $ipaddress    = $_SERVER['REMOTE_ADDR'];
78
79
        if (0 == $lid) {
80
            $status      = 0;
81
            $publishdate = 0;
82
            $message     = _MD_XOOPSTUBE_THANKSFORINFO;
83
            if (true === Utility::checkGroups($cid, 'XTubeAutoApp')) {
84
                $publishdate = time();
85
                $status      = 1;
86
                $message     = _MD_XOOPSTUBE_ISAPPROVED;
87
            }
88
            $sql = 'INSERT INTO '
89
                   . $GLOBALS['xoopsDB']->prefix('xoopstube_videos')
90
                   . '  (lid, cid, title, vidid, submitter, publisher, status, date, hits, rating, votes, comments, vidsource, published, expired, offline, description, ipaddress, notifypub, vidrating, time, keywords, item_tag, picurl) ';
91
            $sql .= " VALUES    (0, $cid, '$title', '$vidid', '$submitter', '$publisher', '$status', '$date', 0, 0, 0, 0, '$vidsource', '$publishdate', 0, '$offline', '$descriptionb', '$ipaddress', '$notifypub', '$vidrating', '$time', '$keywords', '$item_tag', '$picurl')";
92
            if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
93
                $_error = $GLOBALS['xoopsDB']->error() . ' : ' . $GLOBALS['xoopsDB']->errno();
94
                /** @var \XoopsLogger $logger */
95
                $logger = \XoopsLogger::getInstance();
96
                $logger->handleError(E_USER_WARNING, $_error, __FILE__, __LINE__);
97
            }
98
            $newid = $GLOBALS['xoopsDB']->getInsertId();
99
100
            // Add item_tag to Tag-module
101
            if (0 == $lid) {
102
                $tagupdate = Utility::updateTag($newid, $item_tag);
0 ignored issues
show
Are you sure the assignment to $tagupdate is correct as XoopsModules\Xoopstube\U...eTag($newid, $item_tag) targeting XoopsModules\Xoopstube\Utility::updateTag() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
103
            } else {
104
                $tagupdate = Utility::updateTag($lid, $item_tag);
0 ignored issues
show
Are you sure the assignment to $tagupdate is correct as XoopsModules\Xoopstube\U...ateTag($lid, $item_tag) targeting XoopsModules\Xoopstube\Utility::updateTag() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
105
            }
106
107
            // Notify of new link (anywhere) and new link in category
108
            $notificationHandler = xoops_getHandler('notification');
109
110
            $tags               = [];
111
            $tags['VIDEO_NAME'] = $title;
112
            $tags['VIDEO_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&amp;lid=' . $newid;
113
114
            $sql    = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $cid;
115
            $result = $GLOBALS['xoopsDB']->query($sql);
116
            $row    = $GLOBALS['xoopsDB']->fetchArray($result);
117
118
            $tags['CATEGORY_NAME'] = $row['title'];
119
            $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
120
            if (true === Utility::checkGroups($cid, 'XTubeAutoApp')) {
121
                $notificationHandler->triggerEvent('global', 0, 'new_video', $tags);
0 ignored issues
show
The method triggerEvent() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsNotificationHandler or XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

121
                $notificationHandler->/** @scrutinizer ignore-call */ 
122
                                      triggerEvent('global', 0, 'new_video', $tags);
Loading history...
122
                $notificationHandler->triggerEvent('category', $cid, 'new_video', $tags);
123
                redirect_header('index.php', 2, _MD_XOOPSTUBE_ISAPPROVED);
124
            } else {
125
                $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/newvideos.php';
126
                $notificationHandler->triggerEvent('global', 0, 'video_submit', $tags);
127
                $notificationHandler->triggerEvent('category', $cid, 'video_submit', $tags);
128
                if ($notifypub) {
129
                    require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
130
                    $notificationHandler->subscribe('video', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
0 ignored issues
show
The method subscribe() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsNotificationHandler or XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

130
                    $notificationHandler->/** @scrutinizer ignore-call */ 
131
                                          subscribe('video', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
Loading history...
131
                }
132
                redirect_header('index.php', 2, _MD_XOOPSTUBE_THANKSFORINFO);
133
            }
134
        } else {
135
            if (true === Utility::checkGroups($cid, 'XTubeAutoApp') || 1 === $approve) {
136
                $updated = time();
137
                $sql     = 'UPDATE '
138
                           . $GLOBALS['xoopsDB']->prefix('xoopstube_videos')
139
                           . " SET cid=$cid, title='$title', vidid='$vidid', publisher='$publisher', updated='$updated', offline='$offline', description='$descriptionb', ipaddress='$ipaddress', notifypub='$notifypub', vidrating='$vidrating', time='$time', keywords='$keywords', item_tag='$item_tag', picurl='$picurl' WHERE lid ="
140
                           . $lid;
141
                if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
142
                    $_error = $GLOBALS['xoopsDB']->error() . ' : ' . $GLOBALS['xoopsDB']->errno();
143
                    $logger->handleError(E_USER_WARNING, $_error, __FILE__, __LINE__);
144
                }
145
146
                $notificationHandler   = xoops_getHandler('notification');
147
                $tags                  = [];
148
                $tags['VIDEO_NAME']    = $title;
149
                $tags['VIDEO_URL']     = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&amp;lid=' . $lid;
150
                $sql                   = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $cid;
151
                $result                = $GLOBALS['xoopsDB']->query($sql);
152
                $row                   = $GLOBALS['xoopsDB']->fetchArray($result);
153
                $tags['CATEGORY_NAME'] = $row['title'];
154
                $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
155
156
                $notificationHandler->triggerEvent('global', 0, 'new_video', $tags);
157
                $notificationHandler->triggerEvent('category', $cid, 'new_video', $tags);
158
                $_message = _MD_XOOPSTUBE_ISAPPROVED;
159
            } else {
160
                $submitter_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query('SELECT submitter FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid));
161
                $modifysubmitter = $GLOBALS['xoopsUser']->uid();
162
                $requestid       = $modifysubmitter;
163
                $requestdate     = time();
164
                $updated         = Request::getInt('up_dated', time(), 'POST'); //cleanRequestVars($_REQUEST, 'up_dated', time());
165
                if ($modifysubmitter === $submitter_array['submitter']) {
166
                    $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' (requestid, lid, cid, title, vidid, publisher, vidsource, description, modifysubmitter, requestdate, time, keywords, item_tag, picurl)';
167
                    $sql .= " VALUES ('', $lid, $cid, '$title', '$vidid', '$publisher', '$vidsource', '$descriptionb', '$modifysubmitter', '$requestdate', '$time', '$keywords', '$item_tag', '$picurl')";
168
                    if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
169
                        $_error = $GLOBALS['xoopsDB']->error() . ' : ' . $GLOBALS['xoopsDB']->errno();
170
                        $logger->handleError(E_USER_WARNING, $_error, __FILE__, __LINE__);
171
                    }
172
                } else {
173
                    redirect_header('index.php', 2, _MD_XOOPSTUBE_MODIFYNOTALLOWED);
174
                }
175
176
                $tags                      = [];
177
                $tags['MODIFYREPORTS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listModReq';
178
                $notificationHandler       = xoops_getHandler('notification');
179
                $notificationHandler->triggerEvent('global', 0, 'video_modify', $tags);
180
181
                $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listNewvideos';
182
                $notificationHandler->triggerEvent('global', 0, 'video_submit', $tags);
183
                $notificationHandler->triggerEvent('category', $cid, 'video_submit', $tags);
184
                if ($notifypub) {
185
                    require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
186
                    $notificationHandler->subscribe('video', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
187
                }
188
                $_message = _MD_XOOPSTUBE_THANKSFORINFO;
189
            }
190
            redirect_header('index.php', 2, $_message);
191
        }
192
    } else {
193
        $approve = Request::getInt('approve', 0, 'POST'); // cleanRequestVars($_REQUEST, 'approve', 0);
194
195
        // Show disclaimer
196
        if ($GLOBALS['xoopsModuleConfig']['showdisclaimer'] && !Request::getInt('agree', '', 'GET') && 0 == $approve) {
0 ignored issues
show
'' of type string is incompatible with the type integer expected by parameter $default of Xmf\Request::getInt(). ( Ignorable by Annotation )

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

196
        if ($GLOBALS['xoopsModuleConfig']['showdisclaimer'] && !Request::getInt('agree', /** @scrutinizer ignore-type */ '', 'GET') && 0 == $approve) {
Loading history...
197
            echo '<br><div style="text-align: center;">' . Utility::renderImageHeader() . '</div><br>';
198
            echo '<h4>' . _MD_XOOPSTUBE_DISCLAIMERAGREEMENT . '</h4>';
199
            echo '<div>' . $myts->displayTarea($GLOBALS['xoopsModuleConfig']['disclaimer'], 1, 1, 1, 1, 1) . '</div>';
200
            echo '<form action="submit.php" method="post">';
201
            echo '<div style="text-align: center;">' . _MD_XOOPSTUBE_DOYOUAGREE . '</b><br><br>';
202
            echo '<input type="button" onclick="location=\'submit.php?agree=1\'" class="formButton" value="' . _MD_XOOPSTUBE_AGREE . '" alt="' . _MD_XOOPSTUBE_AGREE . '">';
203
            echo '&nbsp;';
204
            echo '<input type="button" onclick="location=\'index.php\'" class="formButton" value="' . _CANCEL . '" alt="' . _CANCEL . '">';
205
            echo '</div></form>';
206
            require_once XOOPS_ROOT_PATH . '/footer.php';
207
            exit();
208
        }
209
        //        echo '<br><div style="text-align: center;">' . Utility::renderImageHeader() . '</div><br>';
210
        echo '<div>' . _MD_XOOPSTUBE_SUB_SNEWMNAMEDESC . '</div>';
211
        //        echo "<div class='xoopstube_singletitle'>" . _MD_XOOPSTUBE_SUBMITCATHEAD . "</div>\n";
212
213
        $sql         = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid;
214
        $video_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql));
215
216
        $lid          = $video_array['lid'] ?? 0;
217
        $cid          = $video_array['cid'] ?? 0;
218
        $title        = isset($video_array['title']) ? htmlspecialchars($video_array['title'], ENT_QUOTES | ENT_HTML5) : '';
219
        $vidid        = isset($video_array['vidid']) ? htmlspecialchars($video_array['vidid'], ENT_QUOTES | ENT_HTML5) : '';
220
        $picurl       = isset($video_array['picurl']) ? htmlspecialchars($video_array['picurl'], ENT_QUOTES | ENT_HTML5) : 'http://';
221
        $publisher    = isset($video_array['publisher']) ? htmlspecialchars($video_array['publisher'], ENT_QUOTES | ENT_HTML5) : '';
222
        $screenshot   = isset($video_array['screenshot']) ? htmlspecialchars($video_array['screenshot'], ENT_QUOTES | ENT_HTML5) : '';
223
        $descriptionb = isset($video_array['description']) ? htmlspecialchars($video_array['description'], ENT_QUOTES | ENT_HTML5) : '';
224
        $published    = $video_array['published'] ?? time();
225
        $expired      = $video_array['expired'] ?? 0;
226
        $updated      = $video_array['updated'] ?? 0;
227
        $offline      = $video_array['offline'] ?? 0;
228
        $vidsource    = $video_array['vidsource'] ?? 0;
229
        $ipaddress    = $video_array['ipaddress'] ?? 0;
230
        $notifypub    = $video_array['notifypub'] ?? 0;
231
        $vidrating    = $video_array['vidrating'] ?? 1;
232
        $time         = isset($video_array['time']) ? htmlspecialchars($video_array['time'], ENT_QUOTES | ENT_HTML5) : '0:00:00';
233
        $keywords     = isset($video_array['keywords']) ? htmlspecialchars($video_array['keywords'], ENT_QUOTES | ENT_HTML5) : '';
234
        $item_tag     = isset($video_array['item_tag']) ? htmlspecialchars($video_array['item_tag'], ENT_QUOTES | ENT_HTML5) : '';
235
236
        $sform = new \XoopsThemeForm(_MD_XOOPSTUBE_SUBMITCATHEAD, 'storyform', xoops_getenv('SCRIPT_NAME'), 'post', true);
237
        $sform->setExtra('enctype="multipart/form-data"');
238
239
        Utility::setNoIndexNoFollow();
240
241
        // Video title form
242
        $sform->addElement(new \XoopsFormText(_MD_XOOPSTUBE_FILETITLE, 'title', 70, 255, $title), true);
243
244
        // Video source form
245
        $vidsource_array  = [
246
            0   => _MD_XOOPSTUBE_YOUTUBE,
247
            1   => _MD_XOOPSTUBE_METACAFE,
248
            2   => _MD_XOOPSTUBE_IFILM,
249
            3   => _MD_XOOPSTUBE_PHOTOBUCKET,
250
            4   => _MD_XOOPSTUBE_VIDDLER,
251
            100 => _MD_XOOPSTUBE_GOOGLEVIDEO,
252
            101 => _MD_XOOPSTUBE_MYSPAVETV,
253
            102 => _MD_XOOPSTUBE_DAILYMOTION,
254
            103 => _MD_XOOPSTUBE_BLIPTV,
255
            104 => _MD_XOOPSTUBE_CLIPFISH,
256
            105 => _MD_XOOPSTUBE_LIVELEAK,
257
            106 => _MD_XOOPSTUBE_MAKTOOB,
258
            107 => _MD_XOOPSTUBE_VEOH,
259
            108 => _MD_XOOPSTUBE_VIMEO,
260
            109 => _MD_XOOPSTUBE_MEGAVIDEO,
261
            200 => _MD_XOOPSTUBE_XOOPSTUBE,
262
        ];
263
        $vidsource_select = new \XoopsFormSelect(_MD_XOOPSTUBE_VIDSOURCE, 'vidsource', $vidsource);
264
        $vidsource_select->addOptionArray($vidsource_array);
265
        $sform->addElement($vidsource_select, false);
266
267
        // Video code form
268
        $videocode = new \XoopsFormText(_MD_XOOPSTUBE_DLVIDID, 'vidid', 70, 512, $vidid);
269
        $videocode->setDescription('<br><span style="font-size: small;">' . _MD_XOOPSTUBE_VIDEO_DLVIDIDDSC . '</span>');
270
        $sform->addElement($videocode, true);
271
        $sform->addElement(new \XoopsFormLabel('', _MD_XOOPSTUBE_VIDEO_DLVIDID_NOTE));
272
273
        // Picture url form
274
        $picurl = new \XoopsFormText(_MD_XOOPSTUBE_VIDEO_PICURL, 'picurl', 70, 255, $picurl);
275
        $picurl->setDescription('<br><span style="font-weight: normal;">' . _MD_XOOPSTUBE_VIDEO_PICURLNOTE . '</span>');
276
        $sform->addElement($picurl, false);
277
278
        // Video publisher form
279
        $sform->addElement(new \XoopsFormText(_MD_XOOPSTUBE_VIDEO_PUBLISHER, 'publisher', 70, 255, $publisher), true);
280
281
        // Category tree
282
        $mytree = new Tree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid');
283
284
        $submitcats = [];
285
        $sql        = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' ORDER BY title';
286
        $result     = $GLOBALS['xoopsDB']->query($sql);
287
        while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
288
            if (true === Utility::checkGroups($myrow['cid'], 'XTubeSubPerm')) {
289
                $submitcats[$myrow['cid']] = $myrow['title'];
290
            }
291
        }
292
293
        // Video time form
294
        $timeform = new \XoopsFormText(_MD_XOOPSTUBE_TIME, 'time', 7, 7, $time);
295
        $timeform->setDescription('<span style="font-size: small;">(h:mm:ss)</span>');
296
        $sform->addElement($timeform, false);
297
298
        // Video category form
299
        ob_start();
300
        $mytree->makeMySelBox('title', 'title', $cid, 0);
301
        $sform->addElement(new \XoopsFormLabel(_MD_XOOPSTUBE_CATEGORYC, ob_get_clean()));
302
303
        // Video description form
304
        //        $editor = xtube_getWysiwygForm( _MD_XOOPSTUBE_DESCRIPTIONC, 'descriptionb', $descriptionb, 10, 50, '');
305
        //        $sform -> addElement( $editor, true );
306
307
        $optionsTrayNote = new \XoopsFormElementTray(_MD_XOOPSTUBE_DESCRIPTIONC, '<br>');
308
        if (class_exists('XoopsFormEditor')) {
309
            $options['name']   = 'descriptionb';
310
            $options['value']  = $descriptionb;
311
            $options['rows']   = 5;
312
            $options['cols']   = '100%';
313
            $options['width']  = '100%';
314
            $options['height'] = '200px';
315
            $editor            = new \XoopsFormEditor('', $GLOBALS['xoopsModuleConfig']['form_optionsuser'], $options, $nohtml = false, $onfailure = 'textarea');
316
            $optionsTrayNote->addElement($editor);
317
        } else {
318
            $editor = new \XoopsFormDhtmlTextArea('', 'descriptionb', $item->getVar('descriptionb', 'e'), '100%', '100%');
0 ignored issues
show
'100%' of type string is incompatible with the type integer expected by parameter $rows of XoopsFormDhtmlTextArea::__construct(). ( Ignorable by Annotation )

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

318
            $editor = new \XoopsFormDhtmlTextArea('', 'descriptionb', $item->getVar('descriptionb', 'e'), /** @scrutinizer ignore-type */ '100%', '100%');
Loading history...
'100%' of type string is incompatible with the type integer expected by parameter $cols of XoopsFormDhtmlTextArea::__construct(). ( Ignorable by Annotation )

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

318
            $editor = new \XoopsFormDhtmlTextArea('', 'descriptionb', $item->getVar('descriptionb', 'e'), '100%', /** @scrutinizer ignore-type */ '100%');
Loading history...
319
            $optionsTrayNote->addElement($editor);
320
        }
321
322
        $sform->addElement($optionsTrayNote, false);
323
324
        // Meta keywords form
325
        $keywords = new \XoopsFormTextArea(_MD_XOOPSTUBE_KEYWORDS, 'keywords', $keywords, 5, 50, false);
0 ignored issues
show
The call to XoopsFormTextArea::__construct() has too many arguments starting with false. ( Ignorable by Annotation )

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

325
        $keywords = /** @scrutinizer ignore-call */ new \XoopsFormTextArea(_MD_XOOPSTUBE_KEYWORDS, 'keywords', $keywords, 5, 50, false);

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...
326
        $keywords->setDescription('<br><span style="font-size: smaller;">' . _MD_XOOPSTUBE_KEYWORDS_NOTE . '</span>');
327
        $sform->addElement($keywords);
328
329
        if (isset($video_array['item_tag'])) {
330
            if (1 == $GLOBALS['xoopsModuleConfig']['usercantag']) {
331
                // Insert tags if Tag-module is installed
332
                if (Utility::isModuleTagInstalled()) {
333
                    require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php';
334
                    $text_tags = new FormTag('item_tag', 70, 255, $video_array['item_tag'], 0);
335
                    $sform->addElement($text_tags);
336
                }
337
            } else {
338
                $sform->addElement(new \XoopsFormHidden('item_tag', $video_array['item_tag']));
339
            }
340
        }
341
342
        $submitter2 = (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
343
        if ($submitter2 > 0) {
344
            $option_tray = new \XoopsFormElementTray(_MD_XOOPSTUBE_OPTIONS, '<br>');
345
346
            if (!$approve) {
347
                $notify_checkbox = new \XoopsFormCheckBox('', 'notifypub');
348
                $notify_checkbox->addOption(1, _MD_XOOPSTUBE_NOTIFYAPPROVE);
349
                $option_tray->addElement($notify_checkbox);
350
            } else {
351
                $sform->addElement(new \XoopsFormHidden('notifypub', 0));
352
            }
353
        }
354
355
        if (true === Utility::checkGroups($cid, 'XTubeAppPerm') && $lid > 0) {
356
            $approve_checkbox = new \XoopsFormCheckBox('', 'approve', $approve);
357
            $approve_checkbox->addOption(1, _MD_XOOPSTUBE_APPROVE);
358
            $option_tray->addElement($approve_checkbox);
359
        } elseif (true === Utility::checkGroups($cid, 'XTubeAutoApp')) {
360
            $sform->addElement(new \XoopsFormHidden('approve', 1));
361
        } else {
362
            $sform->addElement(new \XoopsFormHidden('approve', 0));
363
        }
364
        $sform->addElement($option_tray);
365
366
        $buttonTray = new \XoopsFormElementTray('', '');
367
        $buttonTray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
368
        $buttonTray->addElement(new \XoopsFormHidden('lid', $lid));
369
370
        $sform->addElement($buttonTray);
371
        $sform->display();
372
373
        echo '</div></div>';
374
375
        require_once XOOPS_ROOT_PATH . '/footer.php';
376
    }
377
} else {
378
    redirect_header('index.php', 2, _MD_XOOPSTUBE_NOPERMISSIONTOPOST);
379
}
380