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-2013 The XOOPS Project |
||
| 15 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
| 16 | * @version $Id$ |
||
| 17 | * @link http://sourceforge.net/projects/xoops/ |
||
| 18 | * @since 1.0.6 |
||
| 19 | */ |
||
| 20 | |||
| 21 | include_once __DIR__ . '/admin_header.php'; |
||
| 22 | |||
| 23 | $op = xtubeCleanRequestVars($_REQUEST, 'op', ''); |
||
| 24 | $lid = xtubeCleanRequestVars($_REQUEST, 'lid', ''); |
||
| 25 | $lid = intval($lid); |
||
| 26 | |||
| 27 | switch (strtolower($op)) { |
||
| 28 | case 'approve': |
||
|
0 ignored issues
–
show
|
|||
| 29 | |||
| 30 | global $xoopsModule; |
||
| 31 | $sql |
||
| 32 | = 'SELECT cid, title, publisher, notifypub FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' WHERE lid=' . $lid; |
||
| 33 | if (!$result = $xoopsDB->query($sql)) { |
||
| 34 | XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||
| 35 | |||
| 36 | return false; |
||
| 37 | } |
||
| 38 | list($cid, $title, $publisher, $notifypub) = $xoopsDB->fetchRow($result); |
||
| 39 | |||
| 40 | // Update the database |
||
| 41 | $time = time(); |
||
| 42 | // $publisher = $xoopsUser -> getVar( 'uname' ); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
44% 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...
|
|||
| 43 | |||
| 44 | // $xoopsDB->queryF( |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
37% 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...
|
|||
| 45 | // 'UPDATE ' . $xoopsDB->prefix('xoopstube_videos') . ' SET published=' . $time . ', status=1, publisher=' |
||
| 46 | // . $publisher . ' WHERE lid=' . $lid |
||
| 47 | // ); |
||
| 48 | |||
| 49 | $sql = 'UPDATE ' . $xoopsDB->prefix('xoopstube_videos') . ' SET published=' . $time . ", status=1, publisher='" . $publisher . "' WHERE lid=" . $lid; |
||
| 50 | if (!$result = $xoopsDB->queryF($sql)) { |
||
| 51 | XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||
| 52 | |||
| 53 | return false; |
||
| 54 | } |
||
| 55 | |||
| 56 | $tags = array(); |
||
| 57 | $tags['VIDEO_NAME'] = $title; |
||
| 58 | $tags['VIDEO_URL'] |
||
| 59 | = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&lid=' . $lid; |
||
| 60 | |||
| 61 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('xoopstube_cat') . ' WHERE cid=' . $cid; |
||
| 62 | if (!$result = $xoopsDB->query($sql)) { |
||
| 63 | XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||
| 64 | } else { |
||
| 65 | $row = $xoopsDB->fetchArray($result); |
||
| 66 | $tags['CATEGORY_NAME'] = $row['title']; |
||
| 67 | $tags['CATEGORY_URL'] |
||
| 68 | = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid; |
||
| 69 | $notification_handler = & xoops_gethandler('notification'); |
||
| 70 | $notification_handler->triggerEvent('global', 0, 'new_video', $tags); |
||
| 71 | $notification_handler->triggerEvent('category', $cid, 'new_video', $tags); |
||
| 72 | if (intval($notifypub) == 1) { |
||
| 73 | $notification_handler->triggerEvent('video', $lid, 'approve', $tags); |
||
| 74 | } |
||
| 75 | } |
||
| 76 | redirect_header('main.php', 1, _AM_XOOPSTUBE_SUB_NEWFILECREATED); |
||
| 77 | break; |
||
| 78 | |||
| 79 | case 'main': |
||
| 80 | default: |
||
|
0 ignored issues
–
show
The default body in a switch statement must start on the line following the statement.
According to the PSR-2, the body of a default statement must start on the line immediately following the statement. switch ($expr) {
default:
doSomething(); //right
break;
}
switch ($expr) {
default:
doSomething(); //wrong
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 81 | |||
| 82 | global $xoopsModuleConfig; |
||
| 83 | |||
| 84 | $start = xtubeCleanRequestVars($_REQUEST, 'start', 0); |
||
| 85 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' WHERE published = 0 ORDER BY lid DESC'; |
||
| 86 | if (!$result = $xoopsDB->query($sql)) { |
||
| 87 | XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||
| 88 | |||
| 89 | return false; |
||
| 90 | } |
||
| 91 | $new_array = $xoopsDB->query($sql, $xoopsModuleConfig['admin_perpage'], $start); |
||
| 92 | $new_array_count = $xoopsDB->getRowsNum($xoopsDB->query($sql)); |
||
| 93 | |||
| 94 | xoops_cp_header(); |
||
| 95 | $aboutAdmin = new ModuleAdmin(); |
||
| 96 | echo $aboutAdmin->addNavigation('newvideos.php'); |
||
| 97 | |||
| 98 | echo ' <div style="padding:5px; background-color: #EEEEEE; border: 1px solid #D9D9D9;"> |
||
| 99 | <span style="font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_SUB_FILESWAITINGINFO . '<br /><br /></span> |
||
| 100 | <span style="padding: 12px;">' . _AM_XOOPSTUBE_SUB_FILESWAITINGVALIDATION . '<b>' . $new_array_count . '</b><br /><br /><span> |
||
| 101 | <div style="padding: 8px;"><li> ' . $xtubeImageArray['approve'] . ' ' . _AM_XOOPSTUBE_SUB_APPROVEWAITINGFILE . '<br /> |
||
| 102 | <li> ' . $xtubeImageArray['editimg'] . ' ' . _AM_XOOPSTUBE_SUB_EDITWAITINGFILE . '<br /> |
||
| 103 | <li> ' . $xtubeImageArray['deleteimg'] . ' ' . _AM_XOOPSTUBE_SUB_DELETEWAITINGFILE . '</div> |
||
| 104 | </div><br /> |
||
| 105 | '; |
||
| 106 | |||
| 107 | echo '<table width="100%" cellspacing="1" class="outer">'; |
||
| 108 | echo '<tr style="text-align: center;">'; |
||
| 109 | echo '<th><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_ID . '</span></th>'; |
||
| 110 | echo '<th style="text-align: left;"><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_TITLE . '</span></th>'; |
||
| 111 | echo '<th style="text-align: center;"><span style="font-size: small;">' . _AM_XOOPSTUBE_VIDSOURCE2 . '</span></th>'; |
||
| 112 | echo '<th><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_POSTER . '</span></th>'; |
||
| 113 | echo '<th><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_SUBMITTED . '</span></th>'; |
||
| 114 | echo '<th><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_ACTION . '</span></th>'; |
||
| 115 | echo '</tr>'; |
||
| 116 | if ($new_array_count > 0) { |
||
| 117 | while ($new = $xoopsDB->fetchArray($new_array)) { |
||
| 118 | $lid = intval($new['lid']); |
||
| 119 | $rating = number_format($new['rating'], 2); |
||
| 120 | $title = $xtubemyts->htmlSpecialCharsStrip($new['title']); |
||
| 121 | $vidid = urldecode($xtubemyts->htmlSpecialCharsStrip($new['vidid'])); |
||
| 122 | $logourl = $xtubemyts->htmlSpecialCharsStrip($new['screenshot']); |
||
| 123 | $submitter = xtubeGetLinkedUserNameFromId($new['submitter']); |
||
| 124 | $returnsource = xtubeReturnSource($new['vidsource']); |
||
| 125 | $datetime = xtubeGetTimestamp(formatTimestamp($new['date'], $xoopsModuleConfig['dateformatadmin'])); |
||
| 126 | |||
| 127 | $icon = ($new['published']) ? $approved : '<a href="newvideos.php?op=approve&lid=' . $lid . '">' . $xtubeImageArray['approve'] . ' </a>'; |
||
| 128 | $icon .= '<a href="main.php?op=edit&lid=' . $lid . '">' . $xtubeImageArray['editimg'] . ' </a>'; |
||
| 129 | $icon .= '<a href="main.php?op=delete&lid=' . $lid . '">' . $xtubeImageArray['deleteimg'] . '</a>'; |
||
| 130 | |||
| 131 | echo '<tr>'; |
||
| 132 | echo '<td class="head" style="text-align: center;"><span style="font-size: small;">' . $lid . '</span></td>'; |
||
| 133 | echo '<td class="even" nowrap><a href="newvideos.php?op=edit&lid=' . $lid . '"><span style="font-size: small;">' . $title . '</span></a></td>'; |
||
| 134 | echo '<td class="even" style="text-align: center;" nowrap><span style="font-size: small;">' . $returnsource . '</span></td>'; |
||
| 135 | echo '<td class="even" style="text-align: center;" nowrap><span style="font-size: small;">' . $submitter . '</span></td>'; |
||
| 136 | echo '<td class="even" style="text-align: center;"><span style="font-size: small;">' . $datetime . '</span></td>'; |
||
| 137 | echo '<td class="even" style="text-align: center;" nowrap>' . $icon . '</td>'; |
||
| 138 | echo '</tr>'; |
||
| 139 | } |
||
| 140 | } else { |
||
| 141 | echo '<tr><td style="text-align: center;" class="head" colspan="6">' . _AM_XOOPSTUBE_SUB_NOFILESWAITING . '</td></tr>'; |
||
| 142 | } |
||
| 143 | echo '</table>'; |
||
| 144 | |||
| 145 | include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 146 | // $page = ( $new_array_count > $xoopsModuleConfig['admin_perpage'] ) ? _AM_XOOPSTUBE_MINDEX_PAGE : ''; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
47% 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...
|
|||
| 147 | $pagenav = new XoopsPageNav($new_array_count, $xoopsModuleConfig['admin_perpage'], $start, 'start'); |
||
| 148 | echo '<div align="right" style="padding: 8px;">' . $pagenav->renderNav() . '</div>'; |
||
| 149 | include_once __DIR__ . '/admin_footer.php'; |
||
| 150 | break; |
||
| 151 | } |
||
| 152 |
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.