Completed
Branch master (ddc2b8)
by Michael
02:46
created

submit.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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 (http://xoops.org)
16
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
17
 * @link            http://xoops.org/
18
 * @since           1.0.6
19
 */
20
21
include __DIR__ . '/header.php';
22
include XOOPS_ROOT_PATH . '/header.php';
23
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
24
25
$mytree = new XoopstubeTree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid');
26
27
global $xoopsModule, $xtubemyts;
28
29
$xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" type="text/css" href="' . $moduleDirName . '/assets/css/xtubestyle.css" />');
30
31
$cid = XoopsRequest::getInt('cid', 0); //(int) xtubeCleanRequestVars($_REQUEST, 'cid', 0);
32
$lid = XoopsRequest::getInt('lid', 0); //(int) xtubeCleanRequestVars($_REQUEST, 'lid', 0);
33
34
if (false === XoopstubeUtility::xtubeCheckGroups($cid, 'XTubeSubPerm')) {
35
    redirect_header('index.php', 1, _MD_XOOPSTUBE_NOPERMISSIONTOPOST);
36
}
37
38
if (true === XoopstubeUtility::xtubeCheckGroups($cid, 'XTubeSubPerm')) {
39
    echo '<div class="row">
40
    <div class="col-md-12">';
41
    echo '<ol class="breadcrumb">
42
        <li><a href="index.php">'.$moduleDirName.'</a></li>
43
        <li>'._MD_XOOPSTUBE_SUBMITCATHEAD.'</li>
44
    </ol>
45
    ';
46
    //    if (xtubeCleanRequestVars($_REQUEST, 'submit', 0)) {
47
    if (XoopsRequest::getString('submit', '')) {
48
        if (false === XoopstubeUtility::xtubeCheckGroups($cid, 'XTubeSubPerm')) {
49
            redirect_header('index.php', 1, _MD_XOOPSTUBE_NOPERMISSIONTOPOST);
50
        }
51
52
        $submitter    = (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
53
        $vidsource    = XoopsRequest::getInt('vidsource', 0, 'POST'); // xtubeCleanRequestVars($_REQUEST, 'vidsource', 0);
54
        $offline      = XoopsRequest::getInt('offline', 0, 'POST'); // xtubeCleanRequestVars($_REQUEST, 'offline', 0);
55
        $notifypub    = XoopsRequest::getInt('notifypub', 0, 'POST'); // xtubeCleanRequestVars($_REQUEST, 'notifypub', 0);
56
        $approve      = XoopsRequest::getInt('approve', 0, 'POST'); // xtubeCleanRequestVars($_REQUEST, 'approve', 0);
57
        $vidrating    = XoopsRequest::getInt('vidrating', 0, 'POST'); // xtubeCleanRequestVars($_REQUEST, 'vidrating', 0);
58
        $vidid        = XoopsRequest::getString('vidid', 0, 'POST'); // $xtubemyts->addslashes(ltrim(XoopsRequest::getInt('vidid', 0, 'POST')));
59
        $title        = XoopsRequest::getString('title', '', 'POST'); // $xtubemyts->addslashes(ltrim($_REQUEST['title']));
60
        $descriptionb = XoopsRequest::getString('descriptionb', '', 'POST'); // $xtubemyts->addslashes(ltrim($_REQUEST['descriptionb']));
61
        $publisher    = XoopsRequest::getString('publisher', '', 'POST'); // $xtubemyts->addslashes(trim($_REQUEST['publisher']));
62
        $time         = XoopsRequest::getString('time', '', 'POST'); // $xtubemyts->addslashes(ltrim($_REQUEST['time']));
63
        $keywords     = XoopsRequest::getString('keywords', '', 'POST'); // $xtubemyts->addslashes(trim($_REQUEST['keywords']));
64
        $item_tag     = XoopsRequest::getString('item_tag', '', 'POST'); // $xtubemyts->addslashes(ltrim($_REQUEST['item_tag']));
65
        $picurl       = XoopsRequest::getString('picurl', '', 'POST'); // $xtubemyts->addslashes(ltrim($_REQUEST['picurl']));
66
        $date         = time();
67
        $publishdate  = 0;
68
        $ipaddress    = $_SERVER['REMOTE_ADDR'];
69
70
        if (0 == $lid) {
71
            $status      = 0;
72
            $publishdate = 0;
73
            $message     = _MD_XOOPSTUBE_THANKSFORINFO;
74
            if (true === XoopstubeUtility::xtubeCheckGroups($cid, 'XTubeAutoApp')) {
75
                $publishdate = time();
76
                $status      = 1;
77
                $message     = _MD_XOOPSTUBE_ISAPPROVED;
78
            }
79
            $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . '  (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) ';
80
            $sql .= " VALUES    ('', $cid, '$title', '$vidid', '$submitter', '$publisher', '$status', '$date', 0, 0, 0, 0, '$vidsource', '$publishdate', 0, '$offline', '$descriptionb', '$ipaddress', '$notifypub', '$vidrating', '$time', '$keywords', '$item_tag', '$picurl')";
81 View Code Duplication
            if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
82
                $_error = $GLOBALS['xoopsDB']->error() . ' : ' . $GLOBALS['xoopsDB']->errno();
83
                XoopsErrorHandler_HandleError(E_USER_WARNING, $_error, __FILE__, __LINE__);
84
            }
85
            $newid = $GLOBALS['xoopsDB']->getInsertId();
86
87
            // Add item_tag to Tag-module
88 View Code Duplication
            if ($lid == 0) {
89
                $tagupdate = XoopstubeUtility::xtubeUpdateTag($newid, $item_tag);
0 ignored issues
show
Are you sure the assignment to $tagupdate is correct as \XoopstubeUtility::xtube...eTag($newid, $item_tag) (which targets XoopstubeUtility::xtubeUpdateTag()) 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...
90
            } else {
91
                $tagupdate = XoopstubeUtility::xtubeUpdateTag($lid, $item_tag);
0 ignored issues
show
Are you sure the assignment to $tagupdate is correct as \XoopstubeUtility::xtubeUpdateTag($lid, $item_tag) (which targets XoopstubeUtility::xtubeUpdateTag()) 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...
92
            }
93
94
            // Notify of new link (anywhere) and new link in category
95
            $notificationHandler = xoops_getHandler('notification');
96
97
            $tags               = array();
98
            $tags['VIDEO_NAME'] = $title;
99
            $tags['VIDEO_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&amp;lid=' . $newid;
100
101
            $sql    = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $cid;
102
            $result = $GLOBALS['xoopsDB']->query($sql);
103
            $row    = $GLOBALS['xoopsDB']->fetchArray($result);
104
105
            $tags['CATEGORY_NAME'] = $row['title'];
106
            $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
107
            if (true === XoopstubeUtility::xtubeCheckGroups($cid, 'XTubeAutoApp')) {
108
                $notificationHandler->triggerEvent('global', 0, 'new_video', $tags);
109
                $notificationHandler->triggerEvent('category', $cid, 'new_video', $tags);
110
                redirect_header('index.php', 2, _MD_XOOPSTUBE_ISAPPROVED);
111
            } else {
112
                $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/newvideos.php';
113
                $notificationHandler->triggerEvent('global', 0, 'video_submit', $tags);
114
                $notificationHandler->triggerEvent('category', $cid, 'video_submit', $tags);
115
                if ($notifypub) {
116
                    require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
117
                    $notificationHandler->subscribe('video', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
118
                }
119
                redirect_header('index.php', 2, _MD_XOOPSTUBE_THANKSFORINFO);
120
            }
121
        } else {
122
            if (true === XoopstubeUtility::xtubeCheckGroups($cid, 'XTubeAutoApp') || $approve === 1) {
123
                $updated = time();
124
                $sql     = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos')
125
                           . " 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 ="
126
                           . $lid;
127 View Code Duplication
                if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
128
                    $_error = $GLOBALS['xoopsDB']->error() . ' : ' . $GLOBALS['xoopsDB']->errno();
129
                    XoopsErrorHandler_HandleError(E_USER_WARNING, $_error, __FILE__, __LINE__);
130
                }
131
132
                $notificationHandler   = xoops_getHandler('notification');
133
                $tags                  = array();
134
                $tags['VIDEO_NAME']    = $title;
135
                $tags['VIDEO_URL']     = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&amp;lid=' . $lid;
136
                $sql                   = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $cid;
137
                $result                = $GLOBALS['xoopsDB']->query($sql);
138
                $row                   = $GLOBALS['xoopsDB']->fetchArray($result);
139
                $tags['CATEGORY_NAME'] = $row['title'];
140
                $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
141
142
                $notificationHandler->triggerEvent('global', 0, 'new_video', $tags);
143
                $notificationHandler->triggerEvent('category', $cid, 'new_video', $tags);
144
                $_message = _MD_XOOPSTUBE_ISAPPROVED;
145
            } else {
146
                $submitter_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query('SELECT submitter FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . (int)$lid));
147
                $modifysubmitter = $GLOBALS['xoopsUser']->uid();
148
                $requestid       = $modifysubmitter;
149
                $requestdate     = time();
150
                $updated         = XoopsRequest::getInt('up_dated', time(), 'POST'); //xtubeCleanRequestVars($_REQUEST, 'up_dated', time());
151
                if ($modifysubmitter === $submitter_array['submitter']) {
152
                    $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' (requestid, lid, cid, title, vidid, publisher, vidsource, description, modifysubmitter, requestdate, time, keywords, item_tag, picurl)';
153
                    $sql .= " VALUES ('', $lid, $cid, '$title', '$vidid', '$publisher', '$vidsource', '$descriptionb', '$modifysubmitter', '$requestdate', '$time', '$keywords', '$item_tag', '$picurl')";
154 View Code Duplication
                    if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
155
                        $_error = $GLOBALS['xoopsDB']->error() . ' : ' . $GLOBALS['xoopsDB']->errno();
156
                        XoopsErrorHandler_HandleError(E_USER_WARNING, $_error, __FILE__, __LINE__);
157
                    }
158
                } else {
159
                    redirect_header('index.php', 2, _MD_XOOPSTUBE_MODIFYNOTALLOWED);
160
                }
161
162
                $tags                      = array();
163
                $tags['MODIFYREPORTS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listModReq';
164
                $notificationHandler       = xoops_getHandler('notification');
165
                $notificationHandler->triggerEvent('global', 0, 'video_modify', $tags);
166
167
                $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listNewvideos';
168
                $notificationHandler->triggerEvent('global', 0, 'video_submit', $tags);
169
                $notificationHandler->triggerEvent('category', $cid, 'video_submit', $tags);
170
                if ($notifypub) {
171
                    require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
172
                    $notificationHandler->subscribe('video', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
173
                }
174
                $_message = _MD_XOOPSTUBE_THANKSFORINFO;
175
            }
176
            redirect_header('index.php', 2, $_message);
177
        }
178
    } else {
179
        $approve = XoopsRequest::getInt('approve', 0, 'POST'); // xtubeCleanRequestVars($_REQUEST, 'approve', 0);
180
181
        // Show disclaimer
182
        if ($GLOBALS['xoopsModuleConfig']['showdisclaimer'] && !XoopsRequest::getInt('agree', '', 'GET') && 0 == $approve) {
183
            echo '<br><div style="text-align: center;">' . XoopstubeUtility::xtubeRenderImageHeader() . '</div><br>';
184
            echo '<h4>' . _MD_XOOPSTUBE_DISCLAIMERAGREEMENT . '</h4>';
185
            echo '<div>' . $xtubemyts->displayTarea($GLOBALS['xoopsModuleConfig']['disclaimer'], 1, 1, 1, 1, 1) . '</div>';
186
            echo '<form action="submit.php" method="post">';
187
            echo '<div style="text-align: center;">' . _MD_XOOPSTUBE_DOYOUAGREE . '</b><br><br>';
188
            echo '<input type="button" onclick="location=\'submit.php?agree=1\'" class="formButton" value="' . _MD_XOOPSTUBE_AGREE . '" alt="' . _MD_XOOPSTUBE_AGREE . '" />';
189
            echo '&nbsp;';
190
            echo '<input type="button" onclick="location=\'index.php\'" class="formButton" value="' . _CANCEL . '" alt="' . _CANCEL . '" />';
191
            echo '</div></form>';
192
            include XOOPS_ROOT_PATH . '/footer.php';
193
            exit();
194
        }
195
//        echo '<br><div style="text-align: center;">' . XoopstubeUtility::xtubeRenderImageHeader() . '</div><br>';
0 ignored issues
show
Unused Code Comprehensibility introduced by
42% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
196
        echo '<div>' . _MD_XOOPSTUBE_SUB_SNEWMNAMEDESC . '</div>';
197
        //        echo "<div class='xoopstube_singletitle'>" . _MD_XOOPSTUBE_SUBMITCATHEAD . "</div>\n";
198
199
        $sql         = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . (int)$lid;
200
        $video_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql));
201
202
        $lid          = $video_array['lid'] ?: 0;
203
        $cid          = $video_array['cid'] ?: 0;
204
        $title        = $video_array['title'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['title']) : '';
205
        $vidid        = $video_array['vidid'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['vidid']) : '';
206
        $publisher    = $video_array['publisher'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['publisher']) : '';
207
        $screenshot   = $video_array['screenshot'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['screenshot']) : '';
208
        $descriptionb = $video_array['description'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['description']) : '';
209
        $published    = $video_array['published'] ?: 0;
210
        $expired      = $video_array['expired'] ?: 0;
211
        $updated      = $video_array['updated'] ?: 0;
212
        $offline      = $video_array['offline'] ?: 0;
213
        $vidsource    = $video_array['vidsource'] ?: 0;
214
        $ipaddress    = $video_array['ipaddress'] ?: 0;
215
        $notifypub    = $video_array['notifypub'] ?: 0;
216
        $vidrating    = $video_array['vidrating'] ?: 1;
217
        $time         = $video_array['time'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['time']) : '0:00:00';
218
        $keywords     = $video_array['keywords'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['keywords']) : '';
219
        $item_tag     = $video_array['item_tag'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['item_tag']) : '';
220
        $picurl       = $video_array['picurl'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['picurl']) : 'http://';
221
222
        $sform = new XoopsThemeForm(_MD_XOOPSTUBE_SUBMITCATHEAD, 'storyform', xoops_getenv('PHP_SELF'));
223
        $sform->setExtra('enctype="multipart/form-data"');
224
225
        XoopstubeUtility::xtubeSetNoIndexNoFollow();
226
227
        // Video title form
228
        $sform->addElement(new XoopsFormText(_MD_XOOPSTUBE_FILETITLE, 'title', 70, 255, $title), true);
229
230
        // Video source form
231
        $vidsource_array  = array(
232
            0   => _MD_XOOPSTUBE_YOUTUBE,
233
            1   => _MD_XOOPSTUBE_METACAFE,
234
            2   => _MD_XOOPSTUBE_IFILM,
235
            3   => _MD_XOOPSTUBE_PHOTOBUCKET,
236
            4   => _MD_XOOPSTUBE_VIDDLER,
237
            100 => _MD_XOOPSTUBE_GOOGLEVIDEO,
238
            101 => _MD_XOOPSTUBE_MYSPAVETV,
239
            102 => _MD_XOOPSTUBE_DAILYMOTION,
240
            103 => _MD_XOOPSTUBE_BLIPTV,
241
            104 => _MD_XOOPSTUBE_CLIPFISH,
242
            105 => _MD_XOOPSTUBE_LIVELEAK,
243
            106 => _MD_XOOPSTUBE_MAKTOOB,
244
            107 => _MD_XOOPSTUBE_VEOH,
245
            108 => _MD_XOOPSTUBE_VIMEO,
246
            109 => _MD_XOOPSTUBE_MEGAVIDEO,
247
            200 => _MD_XOOPSTUBE_XOOPSTUBE
248
        );
249
        $vidsource_select = new XoopsFormSelect(_MD_XOOPSTUBE_VIDSOURCE, 'vidsource', $vidsource);
250
        $vidsource_select->addOptionArray($vidsource_array);
251
        $sform->addElement($vidsource_select, false);
252
253
        // Video code form
254
        $videocode = new XoopsFormText(_MD_XOOPSTUBE_DLVIDID, 'vidid', 70, 512, $vidid);
255
        $videocode->setDescription('<br><span style="font-size: small;">' . _MD_XOOPSTUBE_VIDEO_DLVIDIDDSC . '</span>');
256
        $sform->addElement($videocode, true);
257
        $sform->addElement(new XoopsFormLabel('', _MD_XOOPSTUBE_VIDEO_DLVIDID_NOTE));
258
259
        // Picture url form
260
        $picurl = new XoopsFormText(_MD_XOOPSTUBE_VIDEO_PICURL, 'picurl', 70, 255, $picurl);
261
        $picurl->setDescription('<br><span style="font-weight: normal;">' . _MD_XOOPSTUBE_VIDEO_PICURLNOTE . '</span>');
262
        $sform->addElement($picurl, false);
263
264
        // Video publisher form
265
        $sform->addElement(new XoopsFormText(_MD_XOOPSTUBE_VIDEO_PUBLISHER, 'publisher', 70, 255, $publisher), true);
266
267
        // Category tree
268
        $mytree = new XoopstubeTree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid');
269
270
        $submitcats = array();
271
        $sql        = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' ORDER BY title';
272
        $result     = $GLOBALS['xoopsDB']->query($sql);
273
        while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
274
            if (true === XoopstubeUtility::xtubeCheckGroups($myrow['cid'], 'XTubeSubPerm')) {
275
                $submitcats[$myrow['cid']] = $myrow['title'];
276
            }
277
        }
278
279
        // Video time form
280
        $timeform = new XoopsFormText(_MD_XOOPSTUBE_TIME, 'time', 7, 7, $time);
281
        $timeform->setDescription('<span style="font-size: small;">(h:mm:ss)</span>');
282
        $sform->addElement($timeform, false);
283
284
        // Video category form
285
        ob_start();
286
        $mytree->makeMySelBox('title', 'title', $cid, 0);
287
        $sform->addElement(new XoopsFormLabel(_MD_XOOPSTUBE_CATEGORYC, ob_get_contents()));
288
        ob_end_clean();
289
290
        // Video description form
291
        //        $editor = xtube_getWysiwygForm( _MD_XOOPSTUBE_DESCRIPTIONC, 'descriptionb', $descriptionb, 10, 50, '');
292
        //        $sform -> addElement( $editor, true );
293
294
        $optionsTrayNote = new XoopsFormElementTray(_MD_XOOPSTUBE_DESCRIPTIONC, '<br>');
295 View Code Duplication
        if (class_exists('XoopsFormEditor')) {
296
            $options['name']   = 'descriptionb';
297
            $options['value']  = $descriptionb;
298
            $options['rows']   = 5;
299
            $options['cols']   = '100%';
300
            $options['width']  = '100%';
301
            $options['height'] = '200px';
302
            $editor            = new XoopsFormEditor('', $GLOBALS['xoopsModuleConfig']['form_optionsuser'], $options, $nohtml = false, $onfailure = 'textarea');
303
            $optionsTrayNote->addElement($editor);
304
        } else {
305
            $editor = new XoopsFormDhtmlTextArea('', 'descriptionb', $item->getVar('descriptionb', 'e'), '100%', '100%');
306
            $optionsTrayNote->addElement($editor);
307
        }
308
309
        $sform->addElement($optionsTrayNote, false);
310
311
        // Meta keywords form
312
        $keywords = new XoopsFormTextArea(_MD_XOOPSTUBE_KEYWORDS, 'keywords', $keywords, 5, 50, false);
313
        $keywords->setDescription('<br><span style="font-size: smaller;">' . _MD_XOOPSTUBE_KEYWORDS_NOTE . '</span>');
314
        $sform->addElement($keywords);
315
316
        if ($GLOBALS['xoopsModuleConfig']['usercantag'] == 1) {
317
            // Insert tags if Tag-module is installed
318
            if (XoopstubeUtility::xtubeIsModuleTagInstalled()) {
319
                require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php';
320
                $text_tags = new XoopsFormTag('item_tag', 70, 255, $video_array['item_tag'], 0);
321
                $sform->addElement($text_tags);
322
            }
323
        } else {
324
            $sform->addElement(new XoopsFormHidden('item_tag', $video_array['item_tag']));
325
        }
326
327
        $submitter2 = (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
328
        if ($submitter2 > 0) {
329
            $option_tray = new XoopsFormElementTray(_MD_XOOPSTUBE_OPTIONS, '<br>');
330
331
            if (!$approve) {
332
                $notify_checkbox = new XoopsFormCheckBox('', 'notifypub');
333
                $notify_checkbox->addOption(1, _MD_XOOPSTUBE_NOTIFYAPPROVE);
334
                $option_tray->addElement($notify_checkbox);
335
            } else {
336
                $sform->addElement(new XoopsFormHidden('notifypub', 0));
337
            }
338
        }
339
340
        if (true === XoopstubeUtility::xtubeCheckGroups($cid, 'XTubeAppPerm') && $lid > 0) {
341
            $approve_checkbox = new XoopsFormCheckBox('', 'approve', $approve);
342
            $approve_checkbox->addOption(1, _MD_XOOPSTUBE_APPROVE);
343
            $option_tray->addElement($approve_checkbox);
344
        } else {
345
            if (true === XoopstubeUtility::xtubeCheckGroups($cid, 'XTubeAutoApp')) {
346
                $sform->addElement(new XoopsFormHidden('approve', 1));
347
            } else {
348
                $sform->addElement(new XoopsFormHidden('approve', 0));
349
            }
350
        }
351
        $sform->addElement($option_tray);
352
353
        $button_tray = new XoopsFormElementTray('', '');
354
        $button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
355
        $button_tray->addElement(new XoopsFormHidden('lid', $lid));
356
357
        $sform->addElement($button_tray);
358
        $sform->display();
359
360
        echo '</div></div>';
361
362
        include XOOPS_ROOT_PATH . '/footer.php';
363
    }
364
365
} else {
366
    redirect_header('index.php', 2, _MD_XOOPSTUBE_NOPERMISSIONTOPOST);
367
}
368
369