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 | * Module: XoopsTube |
||||||
4 | * |
||||||
5 | * You may not change or alter any portion of this comment or credits |
||||||
6 | * of supporting developers from this source code or any supporting source code |
||||||
7 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||||
8 | * |
||||||
9 | * PHP version 5 |
||||||
10 | * |
||||||
11 | * @category Module |
||||||
12 | * @package Xoopstube |
||||||
13 | * @author XOOPS Development Team |
||||||
14 | * @copyright 2001-2016 XOOPS Project (https://xoops.org) |
||||||
15 | * @link https://xoops.org/ |
||||||
16 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||||||
17 | * @since 1.0.6 |
||||||
18 | */ |
||||||
19 | |||||||
20 | use Xmf\Module\Admin; |
||||||
21 | use Xmf\Request; |
||||||
22 | use XoopsModules\Tag\FormTag; |
||||||
23 | use XoopsModules\Xoopstube\{ |
||||||
24 | Tree, |
||||||
25 | Utility |
||||||
26 | }; |
||||||
27 | /** @var Tree $mytree */ |
||||||
28 | /** @var Utility $utility */ |
||||||
29 | /** @var \XoopsLogger $logger */ |
||||||
30 | |||||||
31 | require_once __DIR__ . '/admin_header.php'; |
||||||
32 | global $xoopsModule; |
||||||
33 | |||||||
34 | $mytree = new Tree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||||||
35 | |||||||
36 | $op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); |
||||||
37 | $lid = Request::getInt('lid', Request::getInt('lid', 0, 'POST'), 'GET'); |
||||||
38 | |||||||
39 | /** |
||||||
40 | * @param int $lid |
||||||
41 | * @return bool|null |
||||||
42 | */ |
||||||
43 | function edit($lid = 0) |
||||||
44 | { |
||||||
45 | global $myts, $mytree, $xtubeImageArray; |
||||||
46 | |||||||
47 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid; |
||||||
48 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||||||
49 | $logger = XoopsLogger::getInstance(); |
||||||
50 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
51 | |||||||
52 | return false; |
||||||
53 | } |
||||||
54 | $video_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||||||
55 | $directory = $GLOBALS['xoopsModuleConfig']['videoimgdir']; |
||||||
56 | $lid = $video_array['lid'] ?? 0; |
||||||
57 | $cid = $video_array['cid'] ?? 0; |
||||||
58 | $title = isset($video_array['title']) ? htmlspecialchars($video_array['title'], ENT_QUOTES | ENT_HTML5) : ''; |
||||||
59 | $vidid = isset($video_array['vidid']) ? htmlspecialchars($video_array['vidid'], ENT_QUOTES | ENT_HTML5) : ''; |
||||||
60 | $picurl = isset($video_array['picurl']) ? htmlspecialchars($video_array['picurl'], ENT_QUOTES | ENT_HTML5) : 'https://'; |
||||||
61 | $publisher = isset($video_array['publisher']) ? htmlspecialchars($video_array['publisher'], ENT_QUOTES | ENT_HTML5) : ''; |
||||||
62 | $screenshot = isset($video_array['screenshot']) ? htmlspecialchars($video_array['screenshot'], ENT_QUOTES | ENT_HTML5) : ''; |
||||||
63 | $descriptionb = isset($video_array['description']) ? htmlspecialchars($video_array['description'], ENT_QUOTES | ENT_HTML5) : ''; |
||||||
64 | $published = $video_array['published'] ?? time(); |
||||||
65 | $expired = $video_array['expired'] ?? 0; |
||||||
66 | $updated = $video_array['updated'] ?? 0; |
||||||
67 | $offline = $video_array['offline'] ?? 0; |
||||||
68 | $vidsource = $video_array['vidsource'] ?? 0; |
||||||
69 | $ipaddress = $video_array['ipaddress'] ?? 0; |
||||||
70 | $notifypub = $video_array['notifypub'] ?? 0; |
||||||
71 | $time = isset($video_array['time']) ? htmlspecialchars($video_array['time'], ENT_QUOTES | ENT_HTML5) : '0:00:00'; |
||||||
72 | $keywords = isset($video_array['keywords']) ? htmlspecialchars($video_array['keywords'], ENT_QUOTES | ENT_HTML5) : ''; |
||||||
73 | $item_tag = isset($video_array['item_tag']) ? htmlspecialchars($video_array['item_tag'], ENT_QUOTES | ENT_HTML5) : ''; |
||||||
74 | |||||||
75 | require_once __DIR__ . '/admin_header.php'; |
||||||
76 | xoops_cp_header(); |
||||||
77 | //renderAdminMenu( _AM_XOOPSTUBE_MVIDEOS ); |
||||||
78 | |||||||
79 | if ($lid) { |
||||||
80 | $_vote_data = Utility::getVoteDetails($lid); |
||||||
81 | $text_info = ' |
||||||
82 | <table width="100%" style="font-size: 90%;"> |
||||||
83 | <tr> |
||||||
84 | <td style="width: 25%; border-right: #E8E8E8 1px solid; vertical-align: top; padding-left: 10px;"> |
||||||
85 | <div><b>' . _AM_XOOPSTUBE_VIDEO_ID . ' </b>' . $lid . '</div> |
||||||
86 | <div><b>' . _AM_XOOPSTUBE_MINDEX_SUBMITTED . ': </b>' . Utility::getTimestamp(formatTimestamp($video_array['date'], $GLOBALS['xoopsModuleConfig']['dateformat'])) . '</div> |
||||||
87 | <div><b>' . _AM_XOOPSTUBE_MOD_MODIFYSUBMITTER . ' </b>' . Utility::getLinkedUserNameFromId($video_array['submitter']) . '</div><div><b>' . _AM_XOOPSTUBE_VIDEO_IP . ' </b>' . $ipaddress . '</div> |
||||||
88 | <div><b>' . _AM_XOOPSTUBE_VIDEO_VIEWS . ' </b>' . $video_array['hits'] . '</div> |
||||||
89 | </td> |
||||||
90 | <td style="width: 25%; border-right: #E8E8E8 1px solid; vertical-align: top; padding-left: 10px;"> |
||||||
91 | <div><b>' . _AM_XOOPSTUBE_VOTE_TOTALRATE . ': </b>' . Request::getInt('rate', 0, 'vote_data') . '</div> |
||||||
92 | <div><b>' . _AM_XOOPSTUBE_VOTE_USERAVG . ': </b>' . (int)round($_vote_data['avg_rate'], 2) . '</div> |
||||||
93 | <div><b>' . _AM_XOOPSTUBE_VOTE_MAXRATE . ': </b>' . Request::getInt('min_rate', 0, 'vote_data') . '</div> |
||||||
94 | <div><b>' . _AM_XOOPSTUBE_VOTE_MINRATE . ': </b>' . Request::getInt('max_rate', 0, 'vote_data') . '</div> |
||||||
95 | </td> |
||||||
96 | <td style="width: 25%; border-right: #E8E8E8 1px solid; vertical-align: top; padding-left: 10px;"> |
||||||
97 | <div><b>' . _AM_XOOPSTUBE_VOTE_MOSTVOTEDTITLE . ': </b>' . Request::getInt('max_title', 0, 'vote_data') . '</div> |
||||||
98 | <div><b>' . _AM_XOOPSTUBE_VOTE_LEASTVOTEDTITLE . ': </b>' . Request::getInt('min_title', 0, 'vote_data') . '</div> |
||||||
99 | <div><b>' . _AM_XOOPSTUBE_VOTE_REGISTERED . ': </b>' . (Request::getInt('rate', 0, 'vote_data') - $_vote_data['null_ratinguser']) . '</div> |
||||||
100 | <div><b>' . _AM_XOOPSTUBE_VOTE_NONREGISTERED . ': </b>' . Request::getInt('null_ratinguser', 0, 'vote_data') . '</div> |
||||||
101 | </td> |
||||||
102 | <td style="width: 25%; vertical-align: top; padding-left: 10px;"> |
||||||
103 | <div>' . xtubeGetVideoThumb($video_array['vidid'], $video_array['title'], $video_array['vidsource'], $video_array['picurl'], $video_array['screenshot']) . '</div> |
||||||
104 | </td> |
||||||
105 | </tr> |
||||||
106 | </table>'; |
||||||
107 | echo ' |
||||||
108 | <fieldset style="border: #E8E8E8 1px solid;"><legend style="display: inline; font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_INFORMATION . '</legend> |
||||||
109 | <div style="padding: 8px;">' . $text_info . '</div> |
||||||
110 | <!-- <div style="padding: 8px;"><li>' . $xtubeImageArray['deleteimg'] . ' ' . _AM_XOOPSTUBE_VOTE_DELETEDSC . '</li></div>\n --> |
||||||
111 | </fieldset> |
||||||
112 | <br>'; |
||||||
113 | } |
||||||
114 | unset($_vote_data); |
||||||
115 | |||||||
116 | $caption = $lid ? _AM_XOOPSTUBE_VIDEO_MODIFYFILE : _AM_XOOPSTUBE_VIDEO_CREATENEWFILE; |
||||||
117 | |||||||
118 | $sform = new \XoopsThemeForm($caption, 'storyform', xoops_getenv('SCRIPT_NAME'), 'post', true); |
||||||
119 | $sform->setExtra('enctype="multipart / form - data"'); |
||||||
120 | |||||||
121 | // Video title |
||||||
122 | $sform->addElement(new \XoopsFormText(_AM_XOOPSTUBE_VIDEO_TITLE, 'title', 70, 255, $title), true); |
||||||
123 | |||||||
124 | // Video source |
||||||
125 | $vidsource_array = [ |
||||||
126 | 0 => _AM_XOOPSTUBE_YOUTUBE, |
||||||
127 | 1 => _AM_XOOPSTUBE_METACAFE, |
||||||
128 | 2 => _AM_XOOPSTUBE_IFILM, |
||||||
129 | 3 => _AM_XOOPSTUBE_PHOTOBUCKET, |
||||||
130 | 4 => _AM_XOOPSTUBE_VIDDLER, |
||||||
131 | 100 => _AM_XOOPSTUBE_GOOGLEVIDEO, |
||||||
132 | 101 => _AM_XOOPSTUBE_MYSPAVETV, |
||||||
133 | 102 => _AM_XOOPSTUBE_DAILYMOTION, |
||||||
134 | 103 => _AM_XOOPSTUBE_BLIPTV, |
||||||
135 | 104 => _AM_XOOPSTUBE_CLIPFISH, |
||||||
136 | 105 => _AM_XOOPSTUBE_LIVELEAK, |
||||||
137 | 106 => _AM_XOOPSTUBE_MAKTOOB, |
||||||
138 | 107 => _AM_XOOPSTUBE_VEOH, |
||||||
139 | 108 => _AM_XOOPSTUBE_VIMEO, |
||||||
140 | 109 => _MD_XOOPSTUBE_MEGAVIDEO, |
||||||
141 | 200 => _MD_XOOPSTUBE_XOOPSTUBE, |
||||||
142 | ]; // #200 is reserved for XoopsTube's internal FLV player |
||||||
143 | $vidsource_select = new \XoopsFormSelect(_AM_XOOPSTUBE_VIDSOURCE, 'vidsource', $vidsource); |
||||||
144 | $vidsource_select->addOptionArray($vidsource_array); |
||||||
145 | $sform->addElement($vidsource_select); |
||||||
146 | |||||||
147 | // Video code |
||||||
148 | $videocode = new \XoopsFormText(_AM_XOOPSTUBE_VIDEO_DLVIDID, 'vidid', 70, 512, $vidid); |
||||||
149 | $videocode->setDescription('<br><span style="font-size: small;">' . _AM_XOOPSTUBE_VIDEO_DLVIDIDDSC . '</span>'); |
||||||
150 | $sform->addElement($videocode, true); |
||||||
151 | $note = _AM_XOOPSTUBE_VIDEO_DLVIDID_NOTE; |
||||||
152 | $sform->addElement(new \XoopsFormLabel('', $note)); |
||||||
153 | |||||||
154 | // Picture url |
||||||
155 | $picurl = new \XoopsFormText(_AM_XOOPSTUBE_VIDEO_PICURL, 'picurl', 70, 255, $picurl); |
||||||
156 | $picurl->setDescription('<br><span style="font-weight: normal;font-size: smaller;">' . _AM_XOOPSTUBE_VIDEO_PICURLNOTE . '</span>'); |
||||||
157 | $sform->addElement($picurl, false); |
||||||
158 | |||||||
159 | // Video publisher |
||||||
160 | $sform->addElement(new \XoopsFormText(_AM_XOOPSTUBE_VIDEO_PUBLISHER, 'publisher', 70, 255, $publisher), true); |
||||||
161 | |||||||
162 | // Time form |
||||||
163 | $timeform = new \XoopsFormText(_AM_XOOPSTUBE_TIME, 'time', 7, 7, $time); |
||||||
164 | $timeform->setDescription('<span style="font-size: small;">(h:mm:ss)</span>'); |
||||||
165 | $sform->addElement($timeform, false); |
||||||
166 | |||||||
167 | // Category menu |
||||||
168 | ob_start(); |
||||||
169 | $mytree->makeMySelBox('title', 'title', $cid, 0); |
||||||
170 | $sform->addElement(new \XoopsFormLabel(_AM_XOOPSTUBE_VIDEO_CATEGORY, ob_get_clean())); |
||||||
171 | |||||||
172 | // Description form |
||||||
173 | // $editor = xtube_getWysiwygForm( _AM_XOOPSTUBE_VIDEO_DESCRIPTION, 'descriptionb', $descriptionb ); |
||||||
174 | // $sform -> addElement( $editor, false ); |
||||||
175 | |||||||
176 | $optionsTrayNote = new \XoopsFormElementTray(_AM_XOOPSTUBE_VIDEO_DESCRIPTION, '<br>'); |
||||||
177 | if (class_exists('XoopsFormEditor')) { |
||||||
178 | $options['name'] = 'descriptionb'; |
||||||
179 | $options['value'] = $descriptionb; |
||||||
180 | $options['rows'] = 5; |
||||||
181 | $options['cols'] = '100%'; |
||||||
182 | $options['width'] = '100%'; |
||||||
183 | $options['height'] = '200px'; |
||||||
184 | $descriptionb = new \XoopsFormEditor('', $GLOBALS['xoopsModuleConfig']['form_options'], $options, $nohtml = false, $onfailure = 'textarea'); |
||||||
185 | $optionsTrayNote->addElement($descriptionb); |
||||||
186 | } else { |
||||||
187 | $descriptionb = new \XoopsFormDhtmlTextArea('', 'descriptionb', $item->getVar('descriptionb', 'e'), '100%', '100%'); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() '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
![]() |
|||||||
188 | $optionsTrayNote->addElement($descriptionb); |
||||||
189 | } |
||||||
190 | |||||||
191 | $sform->addElement($optionsTrayNote, false); |
||||||
192 | |||||||
193 | // Meta keywords form |
||||||
194 | $keywords = new \XoopsFormTextArea(_AM_XOOPSTUBE_KEYWORDS, 'keywords', $keywords, 7, 60, false); |
||||||
195 | $keywords->setDescription("<br><br><br><br><span style='font-size: smaller;'>" . _AM_XOOPSTUBE_KEYWORDS_NOTE . '</span>'); |
||||||
196 | $sform->addElement($keywords); |
||||||
197 | |||||||
198 | // Insert tags if Tag-module is installed |
||||||
199 | if (isset($video_array['item_tag'])) { |
||||||
200 | if (Utility::isModuleTagInstalled()) { |
||||||
201 | require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php'; |
||||||
202 | $text_tags = new FormTag('item_tag', 70, 255, $video_array['item_tag'], 0); |
||||||
203 | $sform->addElement($text_tags); |
||||||
204 | } else { |
||||||
205 | $sform->addElement(new \XoopsFormHidden('item_tag', $video_array['item_tag'])); |
||||||
206 | } |
||||||
207 | } |
||||||
208 | |||||||
209 | // Video Publish Date |
||||||
210 | $sform->addElement(new \XoopsFormDateTime(_AM_XOOPSTUBE_VIDEO_SETPUBLISHDATE, 'published', $size = 15, $published)); |
||||||
211 | |||||||
212 | if ($lid) { |
||||||
213 | $sform->addElement(new \XoopsFormHidden('was_published', $published)); |
||||||
214 | $sform->addElement(new \XoopsFormHidden('was_expired', $expired)); |
||||||
215 | } |
||||||
216 | |||||||
217 | // Video Expire Date |
||||||
218 | $isexpired = ($expired > time()) ? 1 : 0; |
||||||
219 | $expiredates = ($expired > time()) ? _AM_XOOPSTUBE_VIDEO_EXPIREDATESET . Utility::getTimestamp(formatTimestamp($expired, $GLOBALS['xoopsModuleConfig']['dateformat'])) : _AM_XOOPSTUBE_VIDEO_SETDATETIMEEXPIRE; |
||||||
220 | $warning = ($published > $expired && $expired > time()) ? _AM_XOOPSTUBE_VIDEO_EXPIREWARNING : ''; |
||||||
221 | $expiredate_checkbox = new \XoopsFormCheckBox('', 'expiredateactivate', $isexpired); |
||||||
222 | $expiredate_checkbox->addOption(1, $expiredates . ' <br> <br> '); |
||||||
223 | |||||||
224 | $expiredate_tray = new \XoopsFormElementTray(_AM_XOOPSTUBE_VIDEO_EXPIREDATE . $warning, ''); |
||||||
225 | $expiredate_tray->addElement($expiredate_checkbox); |
||||||
226 | $expiredate_tray->addElement(new \XoopsFormDateTime(_AM_XOOPSTUBE_VIDEO_SETEXPIREDATE . ' <br> ', 'expired', 15, $expired)); |
||||||
227 | $expiredate_tray->addElement(new \XoopsFormRadioYN(_AM_XOOPSTUBE_VIDEO_CLEAREXPIREDATE, 'clearexpire', 0, ' ' . _YES . '', ' ' . _NO . '')); |
||||||
228 | $sform->addElement($expiredate_tray); |
||||||
229 | |||||||
230 | // Set video offline yes/no |
||||||
231 | $videostatus_radio = new \XoopsFormRadioYN(_AM_XOOPSTUBE_VIDEO_FILESSTATUS, 'offline', $offline, ' ' . _YES . '', ' ' . _NO . ''); |
||||||
232 | $sform->addElement($videostatus_radio); |
||||||
233 | |||||||
234 | // Set video status as updated yes/no |
||||||
235 | $up_dated = (0 == $updated) ? 0 : 1; |
||||||
236 | $video_updated_radio = new \XoopsFormRadioYN(_AM_XOOPSTUBE_VIDEO_SETASUPDATED, 'up_dated', $up_dated, ' ' . _YES . '', ' ' . _NO . ''); |
||||||
237 | $sform->addElement($video_updated_radio); |
||||||
238 | |||||||
239 | $result = $GLOBALS['xoopsDB']->query('SELECT COUNT( * ) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_broken') . ' WHERE lid = ' . $lid); |
||||||
240 | [$broken_count] = $GLOBALS['xoopsDB']->fetchRow($result); |
||||||
241 | if ($broken_count > 0) { |
||||||
242 | $video_updated_radio = new \XoopsFormRadioYN(_AM_XOOPSTUBE_VIDEO_DELEDITMESS, 'delbroken', 1, ' ' . _YES . '', ' ' . _NO . ''); |
||||||
243 | $sform->addElement($editmess_radio); |
||||||
244 | } |
||||||
245 | |||||||
246 | if ($lid && 0 == $published) { |
||||||
247 | $approved = (0 == $published) ? 0 : 1; |
||||||
248 | $approve_checkbox = new \XoopsFormCheckBox(_AM_XOOPSTUBE_VIDEO_EDITAPPROVE, 'approved', 1); |
||||||
249 | $approve_checkbox->addOption(1, ' '); |
||||||
250 | $sform->addElement($approve_checkbox); |
||||||
251 | } |
||||||
252 | |||||||
253 | if (!$lid) { |
||||||
254 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||
255 | $buttonTray->addElement(new \XoopsFormHidden('status', 1)); |
||||||
256 | $buttonTray->addElement(new \XoopsFormHidden('notifypub', $notifypub)); |
||||||
257 | $buttonTray->addElement(new \XoopsFormHidden('op', 'save')); |
||||||
258 | $buttonTray->addElement(new \XoopsFormButton('', '', _AM_XOOPSTUBE_BSAVE, 'submit')); |
||||||
259 | $sform->addElement($buttonTray); |
||||||
260 | } else { |
||||||
261 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||
262 | $buttonTray->addElement(new \XoopsFormHidden('lid', $lid)); |
||||||
263 | $buttonTray->addElement(new \XoopsFormHidden('status', 2)); |
||||||
264 | $hidden = new \XoopsFormHidden('op', 'save'); |
||||||
265 | $buttonTray->addElement($hidden); |
||||||
266 | |||||||
267 | $butt_dup = new \XoopsFormButton('', '', _AM_XOOPSTUBE_BMODIFY, 'submit'); |
||||||
268 | $butt_dup->setExtra('onclick="this . form . elements . op . value = \'save\'"'); |
||||||
269 | $buttonTray->addElement($butt_dup); |
||||||
270 | $butt_dupct = new \XoopsFormButton('', '', _AM_XOOPSTUBE_BDELETE, 'submit'); |
||||||
271 | $butt_dupct->setExtra('onclick="this.form.elements.op.value=\'delete\'"'); |
||||||
272 | $buttonTray->addElement($butt_dupct); |
||||||
273 | $butt_dupct2 = new \XoopsFormButton('', '', _AM_XOOPSTUBE_BCANCEL, 'submit'); |
||||||
274 | $butt_dupct2->setExtra('onclick="this.form.elements.op.value=\'videosConfigMenu\'"'); |
||||||
275 | $buttonTray->addElement($butt_dupct2); |
||||||
276 | $sform->addElement($buttonTray); |
||||||
277 | } |
||||||
278 | $sform->display(); |
||||||
279 | unset($hidden); |
||||||
280 | require_once __DIR__ . '/admin_footer.php'; |
||||||
281 | |||||||
282 | return null; |
||||||
283 | } |
||||||
284 | |||||||
285 | switch (mb_strtolower($op)) { |
||||||
286 | case 'edit': |
||||||
287 | edit($lid); |
||||||
288 | break; |
||||||
289 | case 'save': |
||||||
290 | |||||||
291 | $groups = Request::getArray('groups', [], 'POST'); //isset($_POST['groups']) ? $_POST['groups'] : array(); |
||||||
292 | $lid = Request::getInt('lid', 0, 'POST'); // (!empty($_POST['lid'])) ? $_POST['lid'] : 0; |
||||||
293 | $cid = Request::getInt('cid', 0, 'POST'); // (!empty($_POST['cid'])) ? $_POST['cid'] : 0; |
||||||
294 | $vidrating = Request::getInt('vidrating', 6, 'POST'); // (!empty($_POST['vidrating'])) ? $_POST['vidrating'] : 6; |
||||||
295 | $status = Request::getInt('status', 2, 'POST'); // (!empty($_POST['status'])) ? $_POST['status'] : 2; |
||||||
296 | |||||||
297 | // Get data from form |
||||||
298 | $vidid = $myts->addSlashes(Request::getString('vidid', '', 'POST')); |
||||||
299 | $picurl = ('https://' !== Request::getString('picurl', '', 'POST')) ? $myts->addSlashes(Request::getString('picurl', '', 'POST')) : ''; |
||||||
300 | $title = $myts->addSlashes(Request::getString('title', '', 'POST')); |
||||||
301 | $descriptionb = $myts->addSlashes(Request::getString('descriptionb', '', 'POST')); |
||||||
302 | $time = $myts->addSlashes(Request::getString('time', '', 'POST')); |
||||||
303 | $keywords = $myts->addSlashes(Request::getString('keywords', '', 'POST')); |
||||||
304 | $item_tag = $myts->addSlashes(Request::getString('item_tag', '', 'POST')); |
||||||
305 | $submitter = $GLOBALS['xoopsUser']->uid(); |
||||||
306 | $publisher = $myts->addSlashes(Request::getString('publisher', '', 'POST')); |
||||||
307 | $vidsource = Request::getInt('vidsource', 0, 'POST'); //(!empty($_POST['vidsource'])) ? $_POST['vidsource'] : 0; |
||||||
308 | $updated = Request::getInt('was_published', time(), 'POST'); |
||||||
309 | |||||||
310 | //PHP 5.3 |
||||||
311 | // $temp = Request::getArray('published', [], 'POST'); |
||||||
312 | // $published = strtotime($temp['date']) + $temp['time']; |
||||||
313 | |||||||
314 | // PHP 5.4 |
||||||
315 | $published = strtotime(Request::getArray('published', [], 'POST')['date']) + Request::getArray('published', [], 'POST')['time']; |
||||||
316 | |||||||
317 | if (0 == Request::getInt('up_dated', '', 'POST')) { |
||||||
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
![]() |
|||||||
318 | $updated = 0; |
||||||
319 | $status = 1; |
||||||
320 | } |
||||||
321 | |||||||
322 | $offline = Request::hasVar('offline', 'POST') ? 1 : 0; // $_POST['offline'] == 1) ? 1 : 0; |
||||||
323 | $approved = (1 == Request::getInt('approved', 0, 'POST')) ? 1 : 0; //isset($_POST['approved']) && $_POST['approved'] == 1) ? 1 : 0; |
||||||
324 | $notifypub = (1 == Request::getInt('notifypub', 0, 'POST')); //(isset($_POST['notifypub']) && $_POST['notifypub'] == 1); |
||||||
325 | |||||||
326 | if (!$lid) { |
||||||
327 | $date = time(); |
||||||
328 | $publishdate = time(); |
||||||
329 | $expiredate = '0'; |
||||||
330 | } else { |
||||||
331 | $publishdate = Request::getBool('was_published', false, 'POST'); //$_POST['was_published']; |
||||||
332 | $expiredate = Request::getBool('was_expired', false, 'POST'); //$_POST['was_expired']; |
||||||
333 | } |
||||||
334 | if (1 == $approved && empty($publishdate)) { |
||||||
335 | $publishdate = time(); |
||||||
336 | } |
||||||
337 | // if (Request::hasVar('expiredateactivate', 'POST')) { |
||||||
338 | $expiredate = strtotime(Request::getArray('expired', [], 'POST')['date']) + Request::getArray('expired', [], 'POST')['time']; |
||||||
339 | // } |
||||||
340 | |||||||
341 | if (1 === Request::getInt('clearexpire', 0, 'POST')) { |
||||||
342 | $expiredate = '0'; |
||||||
343 | } |
||||||
344 | |||||||
345 | // Update or insert linkload data into database |
||||||
346 | if (!$lid) { |
||||||
347 | $date = time(); |
||||||
348 | $publishdate = time(); |
||||||
349 | $ipaddress = $_SERVER['REMOTE_ADDR']; |
||||||
350 | $sql = 'INSERT INTO ' |
||||||
351 | . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') |
||||||
352 | . ' (lid, cid, title, vidid, screenshot, submitter, publisher, status, date, hits, rating, votes, comments, vidsource, published, expired, updated, offline, description, ipaddress, notifypub, vidrating, time, keywords, item_tag, picurl )'; |
||||||
353 | $sql .= " VALUES (NULL, $cid, '$title', '$vidid', '', '$submitter', '$publisher', '$status', '$date', 0, 0, 0, 0, '$vidsource', '$published', '$expiredate', '$updated', '$offline', '$descriptionb', '$ipaddress', '0', '$vidrating', '$time', '$keywords', '$item_tag', '$picurl')"; |
||||||
354 | // $newid = $GLOBALS['xoopsDB'] -> getInsertId(); |
||||||
355 | } else { |
||||||
356 | $sql = 'UPDATE ' |
||||||
357 | . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') |
||||||
358 | . " SET cid = $cid, title='$title', vidid='$vidid', screenshot='', publisher='$publisher', status='$status', vidsource='$vidsource', published='$published', expired='$expiredate', updated='$updated', offline='$offline', description='$descriptionb', vidrating='$vidrating', time='$time', keywords='$keywords', item_tag='$item_tag', picurl='$picurl' WHERE lid=" |
||||||
359 | . $lid; |
||||||
360 | } |
||||||
361 | |||||||
362 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
||||||
363 | $logger = XoopsLogger::getInstance(); |
||||||
364 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
365 | |||||||
366 | return false; |
||||||
367 | } |
||||||
368 | |||||||
369 | $newid = $GLOBALS['xoopsDB']->getInsertId(); |
||||||
370 | |||||||
371 | // Add item_tag to Tag-module |
||||||
372 | if (!$lid) { |
||||||
373 | $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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||||||
374 | } else { |
||||||
375 | $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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||||||
376 | } |
||||||
377 | |||||||
378 | // Send notifications |
||||||
379 | if (!$lid) { |
||||||
380 | $tags = []; |
||||||
381 | $tags['VIDEO_NAME'] = $title; |
||||||
382 | $tags['VIDEO_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&lid=' . $newid; |
||||||
383 | $sql = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $cid; |
||||||
384 | $result = $GLOBALS['xoopsDB']->query($sql); |
||||||
385 | $row = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||||||
386 | $tags['CATEGORY_NAME'] = $row['title']; |
||||||
387 | $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid; |
||||||
388 | /** @var XoopsNotificationHandler $notificationHandler */ |
||||||
389 | $notificationHandler = xoops_getHandler('notification'); |
||||||
390 | $notificationHandler->triggerEvent('global', 0, 'new_video', $tags); |
||||||
391 | $notificationHandler->triggerEvent('category', $cid, 'new_video', $tags); |
||||||
392 | } |
||||||
393 | if ($lid && $approved && $notifypub) { |
||||||
394 | $tags = []; |
||||||
395 | $tags['VIDEO_NAME'] = $title; |
||||||
396 | $tags['VIDEO_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&lid=' . $lid; |
||||||
397 | $sql = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $cid; |
||||||
398 | $result = $GLOBALS['xoopsDB']->query($sql); |
||||||
399 | $row = $GLOBALS['xoopsDB']->fetchArray($result); |
||||||
400 | $tags['CATEGORY_NAME'] = $row['title']; |
||||||
401 | $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid; |
||||||
402 | $notificationHandler = xoops_getHandler('notification'); |
||||||
403 | $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
![]() |
|||||||
404 | $notificationHandler->triggerEvent('category', $cid, 'new_video', $tags); |
||||||
405 | $notificationHandler->triggerEvent('video', $lid, 'approve', $tags); |
||||||
406 | } |
||||||
407 | $message = (!$lid) ? _AM_XOOPSTUBE_VIDEO_NEWFILEUPLOAD : _AM_XOOPSTUBE_VIDEO_FILEMODIFIEDUPDATE; |
||||||
408 | $message = ($lid && !Request::getBool('was_published', false, 'POST') && $approved) ? _AM_XOOPSTUBE_VIDEO_FILEAPPROVED : $message; |
||||||
409 | |||||||
410 | if (Request::hasVar('delbroken')) { //cleanRequestVars($_REQUEST, 'delbroken', 0)) { |
||||||
411 | $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_broken') . ' WHERE lid=' . $lid; |
||||||
412 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
||||||
413 | $logger = XoopsLogger::getInstance(); |
||||||
414 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
415 | |||||||
416 | return false; |
||||||
417 | } |
||||||
418 | } |
||||||
419 | |||||||
420 | redirect_header('main.php', 1, $message); |
||||||
421 | |||||||
422 | break; |
||||||
423 | case 'delete': |
||||||
424 | if (Request::hasVar('confirm')) { // (cleanRequestVars($_REQUEST, 'confirm', 0)) { |
||||||
425 | $title = Request::getString('title', 0); //cleanRequestVars($_REQUEST, 'title', 0); |
||||||
426 | |||||||
427 | // delete video |
||||||
428 | $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid; |
||||||
429 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||||||
430 | $logger = XoopsLogger::getInstance(); |
||||||
431 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
432 | |||||||
433 | return false; |
||||||
434 | } |
||||||
435 | |||||||
436 | // delete altcat |
||||||
437 | $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_altcat') . ' WHERE lid=' . $lid; |
||||||
438 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||||||
439 | $logger = XoopsLogger::getInstance(); |
||||||
440 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
441 | |||||||
442 | return false; |
||||||
443 | } |
||||||
444 | |||||||
445 | // delete vote data |
||||||
446 | $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_votedata') . ' WHERE lid=' . $lid; |
||||||
447 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||||||
448 | $logger = XoopsLogger::getInstance(); |
||||||
449 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
450 | |||||||
451 | return false; |
||||||
452 | } |
||||||
453 | |||||||
454 | // delete comments |
||||||
455 | xoops_comment_delete($xoopsModule->getVar('mid'), $lid); |
||||||
456 | redirect_header('main.php', 1, sprintf(_AM_XOOPSTUBE_VIDEO_FILEWASDELETED, $title)); |
||||||
457 | } else { |
||||||
458 | $sql = 'SELECT lid, title, item_tag, vidid FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid; |
||||||
459 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||||||
460 | $logger = XoopsLogger::getInstance(); |
||||||
461 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
462 | |||||||
463 | return false; |
||||||
464 | } |
||||||
465 | |||||||
466 | [$lid, $title, $item_tag, $vidid] = $GLOBALS['xoopsDB']->fetchrow($result); |
||||||
467 | |||||||
468 | xoops_cp_header(); |
||||||
469 | //renderAdminMenu( _AM_XOOPSTUBE_BINDEX ); |
||||||
470 | |||||||
471 | xoops_confirm( |
||||||
472 | [ |
||||||
473 | 'op' => 'delete', |
||||||
474 | 'lid' => $lid, |
||||||
475 | 'confirm' => 1, |
||||||
476 | 'title' => $title, |
||||||
477 | ], |
||||||
478 | 'main.php', |
||||||
479 | _AM_XOOPSTUBE_VIDEO_REALLYDELETEDTHIS . '<br><br>' . $title, |
||||||
480 | _DELETE |
||||||
481 | ); |
||||||
482 | |||||||
483 | // Remove item_tag from Tag-module |
||||||
484 | $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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||||||
485 | |||||||
486 | require_once __DIR__ . '/admin_footer.php'; |
||||||
487 | } |
||||||
488 | break; |
||||||
489 | case 'toggle': |
||||||
490 | if (Request::hasVar('lid', 'GET') > 0) { |
||||||
491 | $a = (null === Request::getInt('offline', null, 'GET')); |
||||||
492 | $b = null === Request::getInt('offzzline', null, 'GET'); |
||||||
493 | $c = null === Request::getInt('offline', '', 'GET'); |
||||||
494 | $d = null === Request::getInt('offzzline', '', 'GET'); |
||||||
495 | // $e = empty(Request::getInt('offline', 0, 'GET')); |
||||||
496 | $yy = Request::getInt('offzzline', null, 'GET'); |
||||||
497 | $f0 = isset($yy); |
||||||
498 | $g0 = empty($yy); |
||||||
499 | $h0 = null === $yy; |
||||||
500 | $yy1 = Request::getString('offzzline'); |
||||||
501 | $f1 = isset($yy1); |
||||||
502 | $g1 = empty($yy1); |
||||||
503 | $h1 = null === $yy1; |
||||||
504 | |||||||
505 | $yy2 = Request::getVar('offzzline', null, 'GET'); |
||||||
506 | $f2 = isset($yy2); |
||||||
507 | $g2 = empty($yy2); |
||||||
508 | $h2 = null === $yy2; |
||||||
509 | |||||||
510 | $xx = Request::getInt('offline', '', 'GET'); |
||||||
511 | $f = isset($xx); |
||||||
512 | $g = empty($xx); |
||||||
513 | $h = null === $xx; |
||||||
514 | // $e = empty(Request::getInt('offline', '', 'GET')); |
||||||
515 | $offline = Request::getInt('offline', 0, 'GET'); |
||||||
516 | // if (0 != $offline) { |
||||||
517 | xtubeToggleOffline($lid, $offline); |
||||||
518 | // } |
||||||
519 | } |
||||||
520 | break; |
||||||
521 | case 'delvote': |
||||||
522 | $rid = Request::getInt('rid', 0); //cleanRequestVars($_REQUEST, 'rid', 0); |
||||||
523 | $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_votedata') . ' WHERE ratingid=' . $rid; |
||||||
524 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
||||||
525 | /** @var \XoopsLogger $logger */ |
||||||
526 | $logger = XoopsLogger::getInstance(); |
||||||
527 | $logger->handleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||||||
528 | |||||||
529 | return false; |
||||||
530 | } |
||||||
531 | Utility::updateRating($rid); |
||||||
532 | redirect_header('main.php', 1, _AM_XOOPSTUBE_VOTE_VOTEDELETED); |
||||||
533 | break; |
||||||
534 | case 'main': |
||||||
535 | default: |
||||||
536 | $start = Request::getInt('start', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start', 0); |
||||||
537 | $start1 = Request::getInt('start1', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start1', 0); |
||||||
538 | $start2 = Request::getInt('start2', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start2', 0); |
||||||
539 | $start3 = Request::getInt('start3', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start3', 0); |
||||||
540 | $start4 = Request::getInt('start4', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start4', 0); |
||||||
541 | $start5 = Request::getInt('start5', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start5', 0); |
||||||
542 | $totalcats = Utility::getTotalCategoryCount(); |
||||||
543 | |||||||
544 | $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_broken')); |
||||||
545 | [$totalbrokenvideos] = $GLOBALS['xoopsDB']->fetchRow($result); |
||||||
546 | $result2 = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod')); |
||||||
547 | [$totalmodrequests] = $GLOBALS['xoopsDB']->fetchRow($result2); |
||||||
548 | $result3 = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published = 0'); |
||||||
549 | [$totalnewvideos] = $GLOBALS['xoopsDB']->fetchRow($result3); |
||||||
550 | $result4 = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0'); |
||||||
551 | [$totalvideos] = $GLOBALS['xoopsDB']->fetchRow($result4); |
||||||
552 | |||||||
553 | xoops_cp_header(); |
||||||
554 | |||||||
555 | $adminObject = Admin::getInstance(); |
||||||
556 | $adminObject->displayNavigation(basename(__FILE__)); |
||||||
557 | $adminObject->addItemButton(_MI_XOOPSTUBE_ADD_VIDEO, 'main.php?op=edit', 'add', ''); |
||||||
558 | $adminObject->addItemButton(_MI_XOOPSTUBE_ADD_CATEGORY, 'category.php', 'add', ''); |
||||||
559 | $adminObject->displayButton('left', ''); |
||||||
560 | |||||||
561 | //renderAdminMenu( _AM_XOOPSTUBE_BINDEX ); |
||||||
562 | // echo ' |
||||||
563 | // <fieldset style="border: #E8E8E8 1px solid;"> |
||||||
564 | // <legend style="display: inline; font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_MINDEX_VIDEOSUMMARY . '</legend> |
||||||
565 | // <div style="padding: 8px;"> |
||||||
566 | // <span style="font-size: small;"> |
||||||
567 | // <a href="category.php">' . _AM_XOOPSTUBE_SCATEGORY . '</a><b>' . $totalcats . '</b> | |
||||||
568 | // <a href="main.php">' . _AM_XOOPSTUBE_SFILES . '</a><b>' . $totalvideos . '</b> | |
||||||
569 | // <a href="newvideos.php">' . _AM_XOOPSTUBE_SNEWFILESVAL . '</a><b>' . $totalnewvideos . '</b> | |
||||||
570 | // <a href="modifications.php">' . _AM_XOOPSTUBE_SMODREQUEST . '</a><b>' . $totalmodrequests . '</b> | |
||||||
571 | // <a href="brokenvideo.php">' . _AM_XOOPSTUBE_SBROKENSUBMIT . '</a><b>' . $totalbrokenvideos . '</b> |
||||||
572 | // </span> |
||||||
573 | // </div> |
||||||
574 | // </fieldset>'; |
||||||
575 | |||||||
576 | if ($totalcats > 0) { |
||||||
577 | $sform = new \XoopsThemeForm(_AM_XOOPSTUBE_CCATEGORY_MODIFY, 'category', 'category.php'); |
||||||
578 | ob_start(); |
||||||
579 | $mytree->makeMySelBox('title', 'title'); |
||||||
580 | $sform->addElement(new \XoopsFormLabel(_AM_XOOPSTUBE_CCATEGORY_MODIFY_TITLE, ob_get_clean())); |
||||||
581 | $dup_tray = new \XoopsFormElementTray('', ''); |
||||||
582 | $dup_tray->addElement(new \XoopsFormHidden('op', 'modCat')); |
||||||
583 | $butt_dup = new \XoopsFormButton('', '', _AM_XOOPSTUBE_BMODIFY, 'submit'); |
||||||
584 | $butt_dup->setExtra('onclick="this.form.elements.op.value=\'modCat\'"'); |
||||||
585 | $dup_tray->addElement($butt_dup); |
||||||
586 | $butt_dupct = new \XoopsFormButton('', '', _AM_XOOPSTUBE_BDELETE, 'submit'); |
||||||
587 | $butt_dupct->setExtra('onclick="this.form.elements.op.value=\'del\'"'); |
||||||
588 | $dup_tray->addElement($butt_dupct); |
||||||
589 | $sform->addElement($dup_tray); |
||||||
590 | $sform->display(); |
||||||
591 | |||||||
592 | //TODO add table with categories |
||||||
593 | |||||||
594 | // $sql='SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' ORDER BY cid DESC'; |
||||||
595 | // $publishedArray = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['admin_perpage'], $start); |
||||||
596 | // $publishedArrayCount = $GLOBALS['xoopsDB']->getRowsNum($GLOBALS['xoopsDB']->query($sql)); |
||||||
597 | // renderCategoryListHeader(_AM_XOOPSTUBE_MINDEX_PUBLISHEDVIDEO); |
||||||
598 | // setPageNavigationCategoryList($publishedArrayCount, $start, 'art', '', 'left'); |
||||||
599 | // if ($publishedArrayCount > 0) { |
||||||
600 | // while (false !== ($published = $GLOBALS['xoopsDB']->fetchArray($publishedArray))) { |
||||||
601 | // renderCategoryListBody($published); |
||||||
602 | // } |
||||||
603 | // echo '</table>'; |
||||||
604 | // } else { |
||||||
605 | // renderCategoryListFooter(); |
||||||
606 | // } |
||||||
607 | // setPageNavigationCategoryList($publishedArrayCount, $start, 'art', '', 'right'); |
||||||
608 | } |
||||||
609 | |||||||
610 | if ($totalvideos > 0) { |
||||||
611 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0 ORDER BY lid DESC'; |
||||||
612 | $publishedArray = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['admin_perpage'], $start); |
||||||
613 | $publishedArrayCount = $GLOBALS['xoopsDB']->getRowsNum($GLOBALS['xoopsDB']->query($sql)); |
||||||
614 | Utility::renderVideoListHeader(_AM_XOOPSTUBE_MINDEX_PUBLISHEDVIDEO); |
||||||
615 | Utility::setPageNavigationVideoList($publishedArrayCount, $start, 'art', '', 'left'); |
||||||
616 | if ($publishedArrayCount > 0) { |
||||||
617 | while (false !== ($published = $GLOBALS['xoopsDB']->fetchArray($publishedArray))) { |
||||||
618 | Utility::renderVideoListBody($published); |
||||||
619 | } |
||||||
620 | echo '</table>'; |
||||||
621 | } else { |
||||||
622 | Utility::renderVideoListFooter(); |
||||||
623 | } |
||||||
624 | Utility::setPageNavigationVideoList($publishedArrayCount, $start, 'art', '', 'right'); |
||||||
625 | } |
||||||
626 | require_once __DIR__ . '/admin_footer.php'; |
||||||
627 | break; |
||||||
628 | } |
||||||
629 | /** |
||||||
630 | * @param $lid |
||||||
631 | * @param $offline |
||||||
632 | * |
||||||
633 | * @return bool|null |
||||||
634 | */ |
||||||
635 | function xtubeToggleOffline($lid, $offline) |
||||||
636 | { |
||||||
637 | $message = ''; |
||||||
638 | $offline = (1 == $offline) ? 0 : 1; |
||||||
639 | |||||||
640 | $message = _AM_XOOPSTUBE_TOGGLE_ONLINE_SUCCESS; |
||||||
641 | if (1 == $offline) { |
||||||
642 | $message = _AM_XOOPSTUBE_TOGGLE_OFFLINE_SUCCESS; |
||||||
643 | } |
||||||
644 | |||||||
645 | // $thisHandler = xoops_getModuleHandler('xoopstube_videos', 'xoopstube'); |
||||||
646 | // $obj = $thisHandler->get($lid); |
||||||
647 | // $obj->setVar('offline', $offline); |
||||||
648 | // if ($thisHandler->insert($obj, true)) { |
||||||
649 | // redirect_header('main.php', 1, _AM_XOOPSTUBE_TOGGLE_SUCCESS); |
||||||
650 | // } else { |
||||||
651 | // redirect_header('main.php', 1, _AM_XOOPSTUBE_TOGGLE_FAILED); |
||||||
652 | // } |
||||||
653 | |||||||
654 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . " SET offline='" . $offline . "' WHERE lid=" . $lid; |
||||||
655 | |||||||
656 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
||||||
657 | redirect_header('main.php', 1, _AM_XOOPSTUBE_TOGGLE_FAILED); |
||||||
658 | |||||||
659 | return false; |
||||||
660 | } |
||||||
661 | redirect_header('main.php', 1, $message); |
||||||
662 | |||||||
663 | return null; |
||||||
664 | } |
||||||
665 |