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