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 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
| 16 | * @link http://xoops.org/ |
||
| 17 | * @since 1.0.6 |
||
| 18 | */ |
||
| 19 | |||
| 20 | include_once __DIR__ . '/admin_header.php'; |
||
| 21 | |||
| 22 | global $xoopstubetree; |
||
|
0 ignored issues
–
show
|
|||
| 23 | |||
| 24 | $op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); //xtubeCleanRequestVars($_REQUEST, 'op', ''); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
73% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 25 | $requestid = XoopsRequest::getInt('requestid', XoopsRequest::getInt('requestid', 0, 'POST'), 'GET'); //xtubeCleanRequestVars($_REQUEST, 'requestid', 0); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
73% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 26 | |||
| 27 | switch (strtolower($op)) { |
||
| 28 | case 'listmodreqshow': |
||
| 29 | |||
| 30 | xoops_cp_header(); |
||
| 31 | // xtubeRenderAdminMenu(_AM_XOOPSTUBE_MOD_MODREQUESTS); |
||
| 32 | |||
| 33 | $sql = 'SELECT modifysubmitter, requestid, lid, cid, title, vidid, submitter, publisher, vidsource, description, time, keywords, item_tag, picurl FROM ' |
||
| 34 | . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' WHERE requestid=' . $requestid; |
||
| 35 | $mod_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
| 36 | unset($sql); |
||
| 37 | |||
| 38 | $sql = 'SELECT submitter, lid, cid, title, vidid, submitter, publisher, vidsource, description, time, keywords, item_tag, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') |
||
| 39 | . ' WHERE lid=' . $mod_array['lid']; |
||
| 40 | $orig_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
| 41 | unset($sql); |
||
| 42 | |||
| 43 | $orig_user = new XoopsUser($orig_array['submitter']); |
||
| 44 | $submittername = XoopstubeUtilities::xtubeGetLinkedUserNameFromId($orig_array['submitter']); |
||
| 45 | $submitteremail = $orig_user::getUnameFromId('email'); |
||
| 46 | |||
| 47 | echo '<div><b>' . _AM_XOOPSTUBE_MOD_MODPOSTER . '</b> ' . $submittername . '</div>'; |
||
| 48 | $not_allowed = array('lid', 'submitter', 'requestid', 'modifysubmitter'); |
||
| 49 | $sform = new XoopsThemeForm(_AM_XOOPSTUBE_MOD_ORIGINAL, 'storyform', 'index.php'); |
||
| 50 | View Code Duplication | foreach ($orig_array as $key => $content) { |
|
| 51 | if (in_array($key, $not_allowed)) { |
||
| 52 | continue; |
||
| 53 | } |
||
| 54 | $lang_def = constant('_AM_XOOPSTUBE_MOD_' . strtoupper($key)); |
||
| 55 | |||
| 56 | if ($key == 'cid') { |
||
| 57 | $sql = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $content; |
||
| 58 | $row = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
| 59 | $content = $row['title']; |
||
| 60 | } |
||
| 61 | |||
| 62 | if ($key == 'vidsource') { |
||
| 63 | include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/video.php'; |
||
| 64 | $content = xtubeReturnSource($content); |
||
| 65 | } |
||
| 66 | $sform->addElement(new XoopsFormLabel($lang_def, $content)); |
||
| 67 | } |
||
| 68 | $sform->display(); |
||
| 69 | |||
| 70 | $orig_user = new XoopsUser($mod_array['modifysubmitter']); |
||
| 71 | $submittername = XoopstubeUtilities::xtubeGetLinkedUserNameFromId($mod_array['modifysubmitter']); |
||
| 72 | $submitteremail = $orig_user::getUnameFromId('email'); |
||
| 73 | |||
| 74 | echo '<div><b>' . _AM_XOOPSTUBE_MOD_MODIFYSUBMITTER . '</b> ' . $submittername . '</div>'; |
||
| 75 | $sform = new XoopsThemeForm(_AM_XOOPSTUBE_MOD_PROPOSED, 'storyform', 'modifications.php'); |
||
| 76 | View Code Duplication | foreach ($mod_array as $key => $content) { |
|
| 77 | if (in_array($key, $not_allowed)) { |
||
| 78 | continue; |
||
| 79 | } |
||
| 80 | $lang_def = constant('_AM_XOOPSTUBE_MOD_' . strtoupper($key)); |
||
| 81 | |||
| 82 | if ($key == 'cid') { |
||
| 83 | $sql = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $content; |
||
| 84 | $row = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
| 85 | $content = $row['title']; |
||
| 86 | } |
||
| 87 | |||
| 88 | if ($key == 'vidsource') { |
||
| 89 | include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/video.php'; |
||
| 90 | $content = xtubeReturnSource($content); |
||
| 91 | } |
||
| 92 | $sform->addElement(new XoopsFormLabel($lang_def, $content)); |
||
| 93 | } |
||
| 94 | $button_tray = new XoopsFormElementTray('', ''); |
||
| 95 | $button_tray->addElement(new XoopsFormHidden('requestid', $requestid)); |
||
| 96 | $button_tray->addElement(new XoopsFormHidden('lid', $mod_array['requestid'])); |
||
| 97 | $hidden = new XoopsFormHidden('op', 'changemodreq'); |
||
| 98 | $button_tray->addElement($hidden); |
||
| 99 | if ($mod_array) { |
||
| 100 | $butt_dup = new XoopsFormButton('', '', _AM_XOOPSTUBE_BAPPROVE, 'submit'); |
||
| 101 | $butt_dup->setExtra('onclick="this.form.elements.op.value=\'changemodreq\'"'); |
||
| 102 | $button_tray->addElement($butt_dup); |
||
| 103 | } |
||
| 104 | $butt_dupct2 = new XoopsFormButton('', '', _AM_XOOPSTUBE_BIGNORE, 'submit'); |
||
| 105 | $butt_dupct2->setExtra('onclick="this.form.elements.op.value=\'ignoremodreq\'"'); |
||
| 106 | $button_tray->addElement($butt_dupct2); |
||
| 107 | $sform->addElement($button_tray); |
||
| 108 | $sform->display(); |
||
| 109 | xoops_cp_footer(); |
||
| 110 | break; |
||
| 111 | |||
| 112 | case 'changemodreq': |
||
| 113 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' WHERE requestid=' . $requestid; |
||
| 114 | $video_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
| 115 | |||
| 116 | $lid = $video_array['lid']; |
||
| 117 | $cid = $video_array['cid']; |
||
| 118 | $title = $video_array['title']; |
||
| 119 | $publisher = $GLOBALS['xoopsUser']->uname(); |
||
| 120 | $screenshot = $video_array['screenshot']; |
||
| 121 | $vidsource = $video_array['vidsource']; |
||
| 122 | $descriptionb = $video_array['description']; |
||
| 123 | $submitter = $video_array['modifysubmitter']; |
||
| 124 | $keywords = $video_array['keywords']; |
||
| 125 | $vidid = $video_array['vidid']; |
||
| 126 | $item_tag = $video_array['item_tag']; |
||
| 127 | $picurl = $video_array['picurl']; |
||
| 128 | $title = $video_array['title']; |
||
| 129 | $time = $video_array['time']; |
||
| 130 | $updated = time(); |
||
| 131 | |||
| 132 | $GLOBALS['xoopsDB']->query('UPDATE ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') |
||
| 133 | . " SET cid = $cid, title='$title', vidid='$vidid', screenshot='', publisher='$publisher', vidsource='$vidsource', description='$descriptionb', time='$time', keywords='$keywords', item_tag='$item_tag', picurl='$picurl', updated='$updated' WHERE lid = " |
||
| 134 | . $lid); |
||
| 135 | $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' WHERE requestid=' . $requestid; |
||
| 136 | $result = $GLOBALS['xoopsDB']->query($sql); |
||
| 137 | redirect_header('index.php', 1, _AM_XOOPSTUBE_MOD_REQUPDATED); |
||
| 138 | break; |
||
| 139 | |||
| 140 | case 'ignoremodreq': |
||
| 141 | $sql = sprintf('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' WHERE requestid=' . $requestid); |
||
| 142 | $GLOBALS['xoopsDB']->query($sql); |
||
| 143 | redirect_header('index.php', 1, _AM_XOOPSTUBE_MOD_REQDELETED); |
||
| 144 | break; |
||
| 145 | |||
| 146 | case 'main': |
||
| 147 | default: |
||
| 148 | |||
| 149 | $start = XoopsRequest::getInt('start', 0, 'GET'); |
||
| 150 | $xoopstubetree = new XoopstubeTree($GLOBALS['xoopsDB']->prefix('xoopstube_mod'), 'requestid', 0); |
||
| 151 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod') . ' ORDER BY requestdate DESC'; |
||
| 152 | $result = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['admin_perpage'], $start); |
||
| 153 | $totalmodrequests = $GLOBALS['xoopsDB']->getRowsNum($GLOBALS['xoopsDB']->query($sql)); |
||
| 154 | |||
| 155 | xoops_cp_header(); |
||
| 156 | $aboutAdmin = new ModuleAdmin(); |
||
| 157 | echo $aboutAdmin->addNavigation(basename(__FILE__)); |
||
| 158 | |||
| 159 | echo '<fieldset style="border: #E8E8E8 1px solid;"> |
||
| 160 | <legend style="display: inline; font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_MOD_MODREQUESTSINFO . '</legend>'; |
||
| 161 | echo '<div style="padding: 8px;">' . _AM_XOOPSTUBE_MOD_TOTMODREQUESTS . '<b>' . $totalmodrequests . '</b></div>'; |
||
| 162 | echo '</fieldset>'; |
||
| 163 | |||
| 164 | echo '<table width="100%" cellspacing="1" class="outer" style="font-size: smaller;>'; |
||
| 165 | echo '<tr style="text-align: center;">'; |
||
| 166 | echo '<th>' . _AM_XOOPSTUBE_MOD_MODID . '</th>'; |
||
| 167 | echo '<th style="text-align: left;">' . _AM_XOOPSTUBE_MOD_MODTITLE . '</th>'; |
||
| 168 | echo '<th>' . _AM_XOOPSTUBE_MOD_MODIFYSUBMIT . '</th>'; |
||
| 169 | echo '<th>' . _AM_XOOPSTUBE_MOD_DATE . '</th>'; |
||
| 170 | echo '<th>' . _AM_XOOPSTUBE_MINDEX_ACTION . '</th>'; |
||
| 171 | echo '</tr>'; |
||
| 172 | if ($totalmodrequests > 0) { |
||
| 173 | while (false !== ($video_arr = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
| 174 | $path = $xoopstubetree->getNicePathFromId($video_arr['requestid'], 'title', 'modifications.php?op=listmodreqshow&requestid'); |
||
| 175 | $path = str_replace('/', '', $path); |
||
| 176 | $path = str_replace(':', '', trim($path)); |
||
| 177 | $title = trim($path); |
||
| 178 | $submitter = XoopstubeUtilities::xtubeGetLinkedUserNameFromId($video_arr['modifysubmitter']); |
||
| 179 | $requestdate = XoopstubeUtilities::xtubeGetTimestamp(formatTimestamp($video_arr['requestdate'], $GLOBALS['xoopsModuleConfig']['dateformatadmin'])); |
||
| 180 | |||
| 181 | echo '<tr style="text-align: center;">'; |
||
| 182 | echo '<td class="head">' . $video_arr['requestid'] . '</td>'; |
||
| 183 | echo '<td class="even" style="text-align: left;">' . $title . '</td>'; |
||
| 184 | echo '<td class="even">' . $submitter . '</td>'; |
||
| 185 | echo '<td class="even">' . $requestdate . '</td>'; |
||
| 186 | echo '<td class="even"><a href="modifications.php?op=listmodreqshow&requestid=' . $video_arr['requestid'] . '">' . $xtubeImageArray['view'] . '</a></td>'; |
||
| 187 | echo '</tr>'; |
||
| 188 | } |
||
| 189 | } else { |
||
| 190 | echo '<tr style="text-align: center;"><td class="head" colspan="7">' . _AM_XOOPSTUBE_MOD_NOMODREQUEST . '</td></tr>'; |
||
| 191 | } |
||
| 192 | echo '</table>'; |
||
| 193 | |||
| 194 | include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 195 | // $page = ( $totalmodrequests > $GLOBALS['xoopsModuleConfig']['admin_perpage'] ) ? _AM_xtube_MINDEX_PAGE : ''; |
||
| 196 | $pagenav = new XoopsPageNav($totalmodrequests, $GLOBALS['xoopsModuleConfig']['admin_perpage'], $start, 'start'); |
||
| 197 | echo "<div style='text-align: right; padding: 8px;'>" . $pagenav->renderNav() . '</div>'; |
||
| 198 | include_once __DIR__ . '/admin_footer.php'; |
||
| 199 | } |
||
| 200 |
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state