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-2013 The XOOPS Project |
||
16 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
17 | * @version $Id$ |
||
18 | * @link http://sourceforge.net/projects/xoops/ |
||
19 | * @since 1.0.6 |
||
20 | */ |
||
21 | |||
22 | include __DIR__ . '/header.php'; |
||
23 | include XOOPS_ROOT_PATH . '/header.php'; |
||
24 | include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
25 | |||
26 | $mytree = new XoopstubeTree($xoopsDB->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
27 | |||
28 | global $xoopsModule, $xtubemyts, $xoopsModuleConfig; |
||
0 ignored issues
–
show
|
|||
29 | |||
30 | $xoopsTpl->assign( |
||
31 | 'xoops_module_header', |
||
32 | '<link rel="stylesheet" type="text/css" href="' . xoopstube_url . '/assets/css/xtubestyle.css" />' |
||
33 | ); |
||
34 | |||
35 | $cid = intval(xtubeCleanRequestVars($_REQUEST, 'cid', 0)); |
||
36 | $lid = intval(xtubeCleanRequestVars($_REQUEST, 'lid', 0)); |
||
37 | |||
38 | if (false == xtubeCheckGroups($cid, 'XTubeSubPerm')) { |
||
39 | redirect_header('index.php', 1, _MD_XOOPSTUBE_NOPERMISSIONTOPOST); |
||
40 | exit(); |
||
41 | } |
||
42 | |||
43 | if (true == xtubeCheckGroups($cid, 'XTubeSubPerm')) { |
||
44 | if (xtubeCleanRequestVars($_REQUEST, 'submit', 0)) { |
||
45 | if (false == xtubeCheckGroups($cid, 'XTubeSubPerm')) { |
||
46 | redirect_header('index.php', 1, _MD_XOOPSTUBE_NOPERMISSIONTOPOST); |
||
47 | exit(); |
||
48 | } |
||
49 | |||
50 | $submitter = (is_object($xoopsUser) && !empty($xoopsUser)) ? $xoopsUser->getVar('uid') : 0; |
||
51 | $vidsource = xtubeCleanRequestVars($_REQUEST, 'vidsource', 0); |
||
52 | $offline = xtubeCleanRequestVars($_REQUEST, 'offline', 0); |
||
53 | $notifypub = xtubeCleanRequestVars($_REQUEST, 'notifypub', 0); |
||
54 | $approve = xtubeCleanRequestVars($_REQUEST, 'approve', 0); |
||
55 | $vidrating = xtubeCleanRequestVars($_REQUEST, 'vidrating', 0); |
||
56 | $vidid = $xtubemyts->addslashes(ltrim($_POST['vidid'])); |
||
57 | $title = $xtubemyts->addslashes(ltrim($_REQUEST['title'])); |
||
58 | $descriptionb = $xtubemyts->addslashes(ltrim($_REQUEST['descriptionb'])); |
||
59 | $publisher = $xtubemyts->addslashes(trim($_REQUEST['publisher'])); |
||
60 | $time = $xtubemyts->addslashes(ltrim($_REQUEST['time'])); |
||
61 | $keywords = $xtubemyts->addslashes(trim($_REQUEST['keywords'])); |
||
62 | $item_tag = $xtubemyts->addslashes(ltrim($_REQUEST['item_tag'])); |
||
63 | $picurl = $xtubemyts->addslashes(ltrim($_REQUEST['picurl'])); |
||
64 | $date = time(); |
||
65 | $publishdate = 0; |
||
66 | $ipaddress = $_SERVER['REMOTE_ADDR']; |
||
67 | |||
68 | if ($lid == 0) { |
||
69 | $status = 0; |
||
70 | $publishdate = 0; |
||
71 | $message = _MD_XOOPSTUBE_THANKSFORINFO; |
||
72 | if (true == xtubeCheckGroups($cid, 'XTubeAutoApp')) { |
||
73 | $publishdate = time(); |
||
74 | $status = 1; |
||
75 | $message = _MD_XOOPSTUBE_ISAPPROVED; |
||
76 | } |
||
77 | $sql = 'INSERT INTO ' . $xoopsDB->prefix( |
||
78 | 'xoopstube_videos' |
||
79 | ) |
||
80 | . ' (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) '; |
||
81 | $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')"; |
||
82 | View Code Duplication | if (!$result = $xoopsDB->query($sql)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
83 | $_error = $xoopsDB->error() . ' : ' . $xoopsDB->errno(); |
||
84 | XoopsErrorHandler_HandleError(E_USER_WARNING, $_error, __FILE__, __LINE__); |
||
85 | } |
||
86 | $newid = mysql_insert_id(); |
||
87 | |||
88 | // Add item_tag to Tag-module |
||
89 | View Code Duplication | if ($lid == 0) { |
|
90 | $tagupdate = xtubeUpdateTag($newid, $item_tag); |
||
0 ignored issues
–
show
Are you sure the assignment to
$tagupdate is correct as xtubeUpdateTag($newid, $item_tag) (which targets 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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
91 | } else { |
||
92 | $tagupdate = xtubeUpdateTag($lid, $item_tag); |
||
0 ignored issues
–
show
Are you sure the assignment to
$tagupdate is correct as xtubeUpdateTag($lid, $item_tag) (which targets 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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
93 | } |
||
94 | |||
95 | // Notify of new link (anywhere) and new link in category |
||
96 | $notification_handler = & xoops_gethandler('notification'); |
||
97 | |||
98 | $tags = array(); |
||
99 | $tags['VIDEO_NAME'] = $title; |
||
100 | $tags['VIDEO_URL'] |
||
101 | = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&lid=' . $newid; |
||
102 | |||
103 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('xoopstube_cat') . ' WHERE cid=' . $cid; |
||
104 | $result = $xoopsDB->query($sql); |
||
105 | $row = $xoopsDB->fetchArray($result); |
||
106 | |||
107 | $tags['CATEGORY_NAME'] = $row['title']; |
||
108 | $tags['CATEGORY_URL'] |
||
109 | = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid; |
||
110 | if (true == xtubeCheckGroups($cid, 'XTubeAutoApp')) { |
||
111 | $notification_handler->triggerEvent('global', 0, 'new_video', $tags); |
||
112 | $notification_handler->triggerEvent('category', $cid, 'new_video', $tags); |
||
113 | redirect_header('index.php', 2, _MD_XOOPSTUBE_ISAPPROVED); |
||
114 | } else { |
||
115 | $tags['WAITINGFILES_URL'] |
||
116 | = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/newvideos.php'; |
||
117 | $notification_handler->triggerEvent('global', 0, 'video_submit', $tags); |
||
118 | $notification_handler->triggerEvent('category', $cid, 'video_submit', $tags); |
||
119 | if ($notifypub) { |
||
120 | include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
||
121 | $notification_handler->subscribe( |
||
122 | 'video', |
||
123 | $newid, |
||
124 | 'approve', |
||
125 | XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE |
||
126 | ); |
||
127 | } |
||
128 | redirect_header('index.php', 2, _MD_XOOPSTUBE_THANKSFORINFO); |
||
129 | } |
||
130 | } else { |
||
131 | if (true == xtubeCheckGroups($cid, 'XTubeAutoApp') || $approve == 1) { |
||
132 | $updated = time(); |
||
133 | $sql = "UPDATE " . $xoopsDB->prefix('xoopstube_videos') . " 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 =" |
||
134 | . $lid; |
||
135 | View Code Duplication | if (!$result = $xoopsDB->query($sql)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
136 | $_error = $xoopsDB->error() . " : " . $xoopsDB->errno(); |
||
137 | XoopsErrorHandler_HandleError(E_USER_WARNING, $_error, __FILE__, __LINE__); |
||
138 | } |
||
139 | |||
140 | $notification_handler = & xoops_gethandler('notification'); |
||
141 | $tags = array(); |
||
142 | $tags['VIDEO_NAME'] = $title; |
||
143 | $tags['VIDEO_URL'] |
||
144 | = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&lid=' . $lid; |
||
145 | $sql |
||
146 | = "SELECT title FROM " . $xoopsDB->prefix('xoopstube_cat') . " WHERE cid=" . $cid; |
||
147 | $result = $xoopsDB->query($sql); |
||
148 | $row = $xoopsDB->fetchArray($result); |
||
149 | $tags['CATEGORY_NAME'] = $row['title']; |
||
150 | $tags['CATEGORY_URL'] |
||
151 | = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid; |
||
152 | |||
153 | $notification_handler->triggerEvent('global', 0, 'new_video', $tags); |
||
154 | $notification_handler->triggerEvent('category', $cid, 'new_video', $tags); |
||
155 | $_message = _MD_XOOPSTUBE_ISAPPROVED; |
||
156 | } else { |
||
157 | $submitter_array = $xoopsDB->fetchArray( |
||
158 | $xoopsDB->query( |
||
159 | 'SELECT submitter FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' WHERE lid=' . intval($lid) |
||
160 | ) |
||
161 | ); |
||
162 | $modifysubmitter = $xoopsUser->uid(); |
||
163 | $requestid = $modifysubmitter; |
||
164 | $requestdate = time(); |
||
165 | $updated = xtubeCleanRequestVars($_REQUEST, 'up_dated', time()); |
||
166 | if ($modifysubmitter == $submitter_array['submitter']) { |
||
167 | $sql = 'INSERT INTO ' . $xoopsDB->prefix( |
||
168 | 'xoopstube_mod' |
||
169 | ) . ' (requestid, lid, cid, title, vidid, publisher, vidsource, description, modifysubmitter, requestdate, time, keywords, item_tag, picurl)'; |
||
170 | $sql .= " VALUES ('', $lid, $cid, '$title', '$vidid', '$publisher', '$vidsource', '$descriptionb', '$modifysubmitter', '$requestdate', '$time', '$keywords', '$item_tag', '$picurl')"; |
||
171 | View Code Duplication | if (!$result = $xoopsDB->query($sql)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
172 | $_error = $xoopsDB->error() . " : " . $xoopsDB->errno(); |
||
173 | XoopsErrorHandler_HandleError(E_USER_WARNING, $_error, __FILE__, __LINE__); |
||
174 | } |
||
175 | } else { |
||
176 | redirect_header('index.php', 2, _MD_XOOPSTUBE_MODIFYNOTALLOWED); |
||
177 | } |
||
178 | |||
179 | $tags = array(); |
||
180 | $tags['MODIFYREPORTS_URL'] |
||
181 | = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listModReq'; |
||
182 | $notification_handler = & xoops_gethandler('notification'); |
||
183 | $notification_handler->triggerEvent('global', 0, 'video_modify', $tags); |
||
184 | |||
185 | $tags['WAITINGFILES_URL'] |
||
186 | = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php?op=listNewvideos'; |
||
187 | $notification_handler->triggerEvent('global', 0, 'video_submit', $tags); |
||
188 | $notification_handler->triggerEvent('category', $cid, 'video_submit', $tags); |
||
189 | if ($notifypub) { |
||
190 | include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
||
191 | $notification_handler->subscribe( |
||
192 | 'video', |
||
193 | $newid, |
||
194 | 'approve', |
||
195 | XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE |
||
196 | ); |
||
197 | } |
||
198 | $_message = _MD_XOOPSTUBE_THANKSFORINFO; |
||
199 | } |
||
200 | redirect_header('index.php', 2, $_message); |
||
201 | } |
||
202 | } else { |
||
203 | global $xoopsModuleConfig; |
||
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
![]() |
|||
204 | |||
205 | $approve = xtubeCleanRequestVars($_REQUEST, 'approve', 0); |
||
206 | |||
207 | // Show disclaimer |
||
208 | if ($xoopsModuleConfig['showdisclaimer'] && !isset($_GET['agree']) && $approve == 0) { |
||
209 | echo '<br /><div style="text-align: center;">' . xtubeRenderImageHeader() . '</div><br />'; |
||
210 | echo '<h4>' . _MD_XOOPSTUBE_DISCLAIMERAGREEMENT . '</h4>'; |
||
211 | echo '<div>' . $xtubemyts->displayTarea($xoopsModuleConfig['disclaimer'], 1, 1, 1, 1, 1) . '</div>'; |
||
212 | echo '<form action="submit.php" method="post">'; |
||
213 | echo '<div style="text-align: center;">' . _MD_XOOPSTUBE_DOYOUAGREE . '</b><br /><br />'; |
||
214 | echo '<input type="button" onclick="location=\'submit.php?agree=1\'" class="formButton" value="' . _MD_XOOPSTUBE_AGREE . '" alt="' . _MD_XOOPSTUBE_AGREE . '" />'; |
||
215 | echo ' '; |
||
216 | echo '<input type="button" onclick="location=\'index.php\'" class="formButton" value="' . _CANCEL . '" alt="' . _CANCEL . '" />'; |
||
217 | echo '</div></form>'; |
||
218 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
219 | exit(); |
||
220 | } |
||
221 | echo '<br /><div style="text-align: center;">' . xtubeRenderImageHeader() . '</div><br />'; |
||
222 | echo '<div>' . _MD_XOOPSTUBE_SUB_SNEWMNAMEDESC . '</div>'; |
||
223 | // echo "<div class='xoopstube_singletitle'>" . _MD_XOOPSTUBE_SUBMITCATHEAD . "</div>\n"; |
||
224 | |||
225 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' WHERE lid=' . intval($lid); |
||
226 | $video_array = $xoopsDB->fetchArray($xoopsDB->query($sql)); |
||
227 | |||
228 | $lid = $video_array['lid'] ? $video_array['lid'] : 0; |
||
229 | $cid = $video_array['cid'] ? $video_array['cid'] : 0; |
||
230 | $title = $video_array['title'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['title']) : ''; |
||
231 | $vidid = $video_array['vidid'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['vidid']) : ''; |
||
232 | $publisher = $video_array['publisher'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['publisher']) : ''; |
||
233 | $screenshot = $video_array['screenshot'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['screenshot']) : ''; |
||
234 | $descriptionb = $video_array['description'] ? $xtubemyts->htmlSpecialCharsStrip( |
||
235 | $video_array['description'] |
||
236 | ) : ''; |
||
237 | $published = $video_array['published'] ? $video_array['published'] : 0; |
||
238 | $expired = $video_array['expired'] ? $video_array['expired'] : 0; |
||
239 | $updated = $video_array['updated'] ? $video_array['updated'] : 0; |
||
240 | $offline = $video_array['offline'] ? $video_array['offline'] : 0; |
||
241 | $vidsource = $video_array['vidsource'] ? $video_array['vidsource'] : 0; |
||
242 | $ipaddress = $video_array['ipaddress'] ? $video_array['ipaddress'] : 0; |
||
243 | $notifypub = $video_array['notifypub'] ? $video_array['notifypub'] : 0; |
||
244 | $vidrating = $video_array['vidrating'] ? $video_array['vidrating'] : 1; |
||
245 | $time = $video_array['time'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['time']) : '0:00:00'; |
||
246 | $keywords = $video_array['keywords'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['keywords']) : ''; |
||
247 | $item_tag = $video_array['item_tag'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['item_tag']) : ''; |
||
248 | $picurl = $video_array['picurl'] ? $xtubemyts->htmlSpecialCharsStrip($video_array['picurl']) : 'http://'; |
||
249 | |||
250 | $sform = new XoopsThemeForm(_MD_XOOPSTUBE_SUBMITCATHEAD, 'storyform', xoops_getenv('PHP_SELF')); |
||
251 | $sform->setExtra('enctype="multipart/form-data"'); |
||
252 | |||
253 | xtubeSetNoIndexNoFollow(); |
||
254 | |||
255 | // Video title form |
||
256 | $sform->addElement(new XoopsFormText(_MD_XOOPSTUBE_FILETITLE, 'title', 70, 255, $title), true); |
||
257 | |||
258 | // Video source form |
||
259 | $vidsource_array = array( |
||
260 | 0 => _MD_XOOPSTUBE_YOUTUBE, |
||
261 | 1 => _MD_XOOPSTUBE_METACAFE, |
||
262 | 2 => _MD_XOOPSTUBE_IFILM, |
||
263 | 3 => _MD_XOOPSTUBE_PHOTOBUCKET, |
||
264 | 4 => _MD_XOOPSTUBE_VIDDLER, |
||
265 | 100 => _MD_XOOPSTUBE_GOOGLEVIDEO, |
||
266 | 101 => _MD_XOOPSTUBE_MYSPAVETV, |
||
267 | 102 => _MD_XOOPSTUBE_DAILYMOTION, |
||
268 | 103 => _MD_XOOPSTUBE_BLIPTV, |
||
269 | 104 => _MD_XOOPSTUBE_CLIPFISH, |
||
270 | 105 => _MD_XOOPSTUBE_LIVELEAK, |
||
271 | 106 => _MD_XOOPSTUBE_MAKTOOB, |
||
272 | 107 => _MD_XOOPSTUBE_VEOH, |
||
273 | 108 => _MD_XOOPSTUBE_VIMEO, |
||
274 | 109 => _MD_XOOPSTUBE_MEGAVIDEO, |
||
275 | 200 => _MD_XOOPSTUBE_XOOPSTUBE |
||
276 | ); |
||
277 | $vidsource_select = new XoopsFormSelect(_MD_XOOPSTUBE_VIDSOURCE, 'vidsource', $vidsource); |
||
278 | $vidsource_select->addOptionArray($vidsource_array); |
||
279 | $sform->addElement($vidsource_select, false); |
||
280 | |||
281 | // Video code form |
||
282 | $videocode = new XoopsFormText(_MD_XOOPSTUBE_DLVIDID, 'vidid', 70, 512, $vidid); |
||
283 | $videocode->setDescription('<br /><span style="font-size: small;">' . _MD_XOOPSTUBE_VIDEO_DLVIDIDDSC . '</span>'); |
||
284 | $sform->addElement($videocode, true); |
||
285 | $sform->addElement(new XoopsFormLabel('', _MD_XOOPSTUBE_VIDEO_DLVIDID_NOTE)); |
||
286 | |||
287 | // Picture url form |
||
288 | $picurl = new XoopsFormText(_MD_XOOPSTUBE_VIDEO_PICURL, 'picurl', 70, 255, $picurl); |
||
289 | $picurl->setDescription('<br /><span style="font-weight: normal;">' . _MD_XOOPSTUBE_VIDEO_PICURLNOTE . '</span>'); |
||
290 | $sform->addElement($picurl, false); |
||
291 | |||
292 | // Video publisher form |
||
293 | $sform->addElement(new XoopsFormText(_MD_XOOPSTUBE_VIDEO_PUBLISHER, 'publisher', 70, 255, $publisher), true); |
||
294 | |||
295 | // Category tree |
||
296 | $mytree = new XoopstubeTree($xoopsDB->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
297 | |||
298 | $submitcats = array(); |
||
299 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('xoopstube_cat') . ' ORDER BY title'; |
||
300 | $result = $xoopsDB->query($sql); |
||
301 | while ($myrow = $xoopsDB->fetchArray($result)) { |
||
302 | if (true == xtubeCheckGroups($myrow['cid'], 'XTubeSubPerm')) { |
||
303 | $submitcats[$myrow['cid']] = $myrow['title']; |
||
304 | } |
||
305 | } |
||
306 | |||
307 | // Video time form |
||
308 | $timeform = new XoopsFormText(_MD_XOOPSTUBE_TIME, 'time', 7, 7, $time); |
||
309 | $timeform->setDescription('<span style="font-size: small;">(h:mm:ss)</span>'); |
||
310 | $sform->addElement($timeform, false); |
||
311 | |||
312 | // Video category form |
||
313 | ob_start(); |
||
314 | $mytree->makeMySelBox('title', 'title', $cid, 0); |
||
315 | $sform->addElement(new XoopsFormLabel(_MD_XOOPSTUBE_CATEGORYC, ob_get_contents())); |
||
316 | ob_end_clean(); |
||
317 | |||
318 | // Video description form |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
45% 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. ![]() |
|||
319 | // $editor = xtube_getWysiwygForm( _MD_XOOPSTUBE_DESCRIPTIONC, 'descriptionb', $descriptionb, 10, 50, ''); |
||
320 | // $sform -> addElement( $editor, true ); |
||
321 | |||
322 | $optionsTrayNote = new XoopsFormElementTray(_MD_XOOPSTUBE_DESCRIPTIONC, '<br />'); |
||
323 | View Code Duplication | if (class_exists('XoopsFormEditor')) { |
|
324 | $options['name'] = 'descriptionb'; |
||
325 | $options['value'] = $descriptionb; |
||
326 | $options['rows'] = 5; |
||
327 | $options['cols'] = '100%'; |
||
328 | $options['width'] = '100%'; |
||
329 | $options['height'] = '200px'; |
||
330 | $editor = new XoopsFormEditor('', $xoopsModuleConfig['form_optionsuser'], $options, $nohtml = false, $onfailure = 'textarea'); |
||
331 | $optionsTrayNote->addElement($editor); |
||
332 | } else { |
||
333 | $editor = new XoopsFormDhtmlTextArea( |
||
334 | '', 'descriptionb', $item->getVar( |
||
335 | 'descriptionb', |
||
336 | 'e' |
||
337 | ), '100%', '100%' |
||
338 | ); |
||
339 | $optionsTrayNote->addElement($editor); |
||
340 | } |
||
341 | |||
342 | $sform->addElement($optionsTrayNote, false); |
||
343 | |||
344 | // Meta keywords form |
||
345 | $keywords = new XoopsFormTextArea(_MD_XOOPSTUBE_KEYWORDS, 'keywords', $keywords, 5, 50, false); |
||
346 | $keywords->setDescription('<br /><span style="font-size: smaller;">' . _MD_XOOPSTUBE_KEYWORDS_NOTE . '</span>'); |
||
347 | $sform->addElement($keywords); |
||
348 | |||
349 | View Code Duplication | if ($xoopsModuleConfig['usercantag'] == 1) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
350 | // Insert tags if Tag-module is installed |
||
351 | if (xtubeIsModuleTagInstalled()) { |
||
352 | include_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
||
353 | $text_tags = new XoopsFormTag('item_tag', 70, 255, $video_array['item_tag'], 0); |
||
354 | $sform->addElement($text_tags); |
||
355 | } |
||
356 | } else { |
||
357 | $sform->addElement(new XoopsFormHidden('item_tag', $video_array['item_tag'])); |
||
358 | } |
||
359 | |||
360 | $submitter2 = (is_object($xoopsUser) && !empty($xoopsUser)) ? $xoopsUser->getVar('uid') : 0; |
||
361 | if ($submitter2 > 0) { |
||
362 | $option_tray = new XoopsFormElementTray(_MD_XOOPSTUBE_OPTIONS, '<br />'); |
||
363 | |||
364 | if (!$approve) { |
||
365 | $notify_checkbox = new XoopsFormCheckBox('', 'notifypub'); |
||
366 | $notify_checkbox->addOption(1, _MD_XOOPSTUBE_NOTIFYAPPROVE); |
||
367 | $option_tray->addElement($notify_checkbox); |
||
368 | } else { |
||
369 | $sform->addElement(new XoopsFormHidden('notifypub', 0)); |
||
370 | } |
||
371 | } |
||
372 | |||
373 | if (true == xtubeCheckGroups($cid, 'XTubeAppPerm') && $lid > 0) { |
||
374 | $approve_checkbox = new XoopsFormCheckBox('', 'approve', $approve); |
||
375 | $approve_checkbox->addOption(1, _MD_XOOPSTUBE_APPROVE); |
||
376 | $option_tray->addElement($approve_checkbox); |
||
377 | } else { |
||
378 | if (true == xtubeCheckGroups($cid, 'XTubeAutoApp')) { |
||
379 | $sform->addElement(new XoopsFormHidden('approve', 1)); |
||
380 | } else { |
||
381 | $sform->addElement(new XoopsFormHidden('approve', 0)); |
||
382 | } |
||
383 | } |
||
384 | $sform->addElement($option_tray); |
||
385 | |||
386 | $button_tray = new XoopsFormElementTray('', ''); |
||
387 | $button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
||
388 | $button_tray->addElement(new XoopsFormHidden('lid', $lid)); |
||
389 | |||
390 | $sform->addElement($button_tray); |
||
391 | $sform->display(); |
||
392 | |||
393 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
394 | } |
||
395 | } else { |
||
396 | redirect_header('index.php', 2, _MD_XOOPSTUBE_NOPERMISSIONTOPOST); |
||
397 | exit(); |
||
398 | } |
||
399 |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state