Completed
Push — master ( 3024c9...954431 )
by Michael
04:21
created

admin/newvideos.php (5 issues)

Upgrade to new PHP Analysis Engine

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
$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...
23
$lid = XoopsRequest::getInt('lid', XoopsRequest::getInt('lid', 0, 'POST'), 'GET'); //xtubeCleanRequestVars($_REQUEST, 'lid', 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...
24
25
switch (strtolower($op)) {
26
    case 'approve':
27
28
        global $xoopsModule;
29
        $sql = 'SELECT cid, title, publisher, notifypub FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid;
30
        if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
31
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
32
33
            return false;
34
        }
35
        list($cid, $title, $publisher, $notifypub) = $GLOBALS['xoopsDB']->fetchRow($result);
36
37
        // Update the database
38
        $time = time();
39
        //        $publisher = $GLOBALS['xoopsUser'] -> getVar( 'uname' );
40
41
        //        $GLOBALS['xoopsDB']->queryF(
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% 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...
42
        //            'UPDATE ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' SET published=' . $time . ', status=1, publisher='
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...
43
        //            . $publisher . ' WHERE lid=' . $lid
44
        //        );
45
46
        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' SET published=' . $time . ", status=1, publisher='" . $publisher . "' WHERE lid=" . $lid;
47
        if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
48
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
49
50
            return false;
51
        }
52
53
        $tags               = array();
54
        $tags['VIDEO_NAME'] = $title;
55
        $tags['VIDEO_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&amp;lid=' . $lid;
56
57
        $sql = 'SELECT title FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $cid;
58
        if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
59
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
60
        } else {
61
            $row                   = $GLOBALS['xoopsDB']->fetchArray($result);
62
            $tags['CATEGORY_NAME'] = $row['title'];
63
            $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
64
            $notificationHandler   = xoops_getHandler('notification');
65
            $notificationHandler->triggerEvent('global', 0, 'new_video', $tags);
66
            $notificationHandler->triggerEvent('category', $cid, 'new_video', $tags);
67
            if ((int)$notifypub == 1) {
68
                $notificationHandler->triggerEvent('video', $lid, 'approve', $tags);
69
            }
70
        }
71
        redirect_header('main.php', 1, _AM_XOOPSTUBE_SUB_NEWFILECREATED);
72
        break;
73
74
    case 'main':
75
    default:
76
77
        $start = XoopsRequest::getInt('start', 0); //xtubeCleanRequestVars($_REQUEST, 'start', 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...
78
        $sql   = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published = 0 ORDER BY lid DESC';
79
        if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
80
            XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__);
81
82
            return false;
83
        }
84
        $new_array       = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['admin_perpage'], $start);
85
        $new_array_count = $GLOBALS['xoopsDB']->getRowsNum($GLOBALS['xoopsDB']->query($sql));
86
87
        xoops_cp_header();
88
        $aboutAdmin = new ModuleAdmin();
89
        echo $aboutAdmin->addNavigation(basename(__FILE__));
90
91
        echo '  <div style="padding:5px; background-color: #EEEEEE; border: 1px solid #D9D9D9;">
92
                <span style="font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_SUB_FILESWAITINGINFO . '<br><br></span>
93
                <span style="padding: 12px;">' . _AM_XOOPSTUBE_SUB_FILESWAITINGVALIDATION . '<b>' . $new_array_count . '</b><br><br><span>
94
                <div style="padding: 8px;"><li>&nbsp;&nbsp;' . $xtubeImageArray['approve'] . ' ' . _AM_XOOPSTUBE_SUB_APPROVEWAITINGFILE . '<br>
95
                <li>&nbsp;&nbsp;' . $xtubeImageArray['editimg'] . ' ' . _AM_XOOPSTUBE_SUB_EDITWAITINGFILE . '<br>
96
                <li>&nbsp;&nbsp;' . $xtubeImageArray['deleteimg'] . ' ' . _AM_XOOPSTUBE_SUB_DELETEWAITINGFILE . '</div>
97
                </div><br>
98
             ';
99
100
        echo '<table width="100%" cellspacing="1" class="outer">';
101
        echo '<tr style="text-align: center;">';
102
        echo '<th><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_ID . '</span></th>';
103
        echo '<th style="text-align: left;"><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_TITLE . '</span></th>';
104
        echo '<th style="text-align: center;"><span style="font-size: small;">' . _AM_XOOPSTUBE_VIDSOURCE2 . '</span></th>';
105
        echo '<th><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_POSTER . '</span></th>';
106
        echo '<th><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_SUBMITTED . '</span></th>';
107
        echo '<th><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_ACTION . '</span></th>';
108
        echo '</tr>';
109
        if ($new_array_count > 0) {
110
            while (false !== ($new = $GLOBALS['xoopsDB']->fetchArray($new_array))) {
111
                $lid          = (int)$new['lid'];
112
                $rating       = number_format($new['rating'], 2);
113
                $title        = $xtubemyts->htmlSpecialCharsStrip($new['title']);
114
                $vidid        = urldecode($xtubemyts->htmlSpecialCharsStrip($new['vidid']));
115
                $logourl      = $xtubemyts->htmlSpecialCharsStrip($new['screenshot']);
116
                $submitter    = XoopstubeUtilities::xtubeGetLinkedUserNameFromId($new['submitter']);
117
                $returnsource = xtubeReturnSource($new['vidsource']);
118
                $datetime     = XoopstubeUtilities::xtubeGetTimestamp(formatTimestamp($new['date'], $GLOBALS['xoopsModuleConfig']['dateformatadmin']));
119
120
                $icon = $new['published'] ? $approved : '<a href="newvideos.php?op=approve&amp;lid=' . $lid . '">' . $xtubeImageArray['approve'] . ' </a>';
121
                $icon .= '<a href="main.php?op=edit&amp;lid=' . $lid . '">' . $xtubeImageArray['editimg'] . ' </a>';
122
                $icon .= '<a href="main.php?op=delete&amp;lid=' . $lid . '">' . $xtubeImageArray['deleteimg'] . '</a>';
123
124
                echo '<tr>';
125
                echo '<td class="head" style="text-align: center;"><span style="font-size: small;">' . $lid . '</span></td>';
126
                echo '<td class="even" nowrap><a href="newvideos.php?op=edit&amp;lid=' . $lid . '"><span style="font-size: small;">' . $title . '</span></a></td>';
127
                echo '<td class="even" style="text-align: center;" nowrap><span style="font-size: small;">' . $returnsource . '</span></td>';
128
                echo '<td class="even" style="text-align: center;" nowrap><span style="font-size: small;">' . $submitter . '</span></td>';
129
                echo '<td class="even" style="text-align: center;"><span style="font-size: small;">' . $datetime . '</span></td>';
130
                echo '<td class="even" style="text-align: center;" nowrap>' . $icon . '</td>';
131
                echo '</tr>';
132
            }
133
        } else {
134
            echo '<tr><td style="text-align: center;" class="head" colspan="6">' . _AM_XOOPSTUBE_SUB_NOFILESWAITING . '</td></tr>';
135
        }
136
        echo '</table>';
137
138
        include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
139
        //        $page = ( $new_array_count > $GLOBALS['xoopsModuleConfig']['admin_perpage'] ) ? _AM_XOOPSTUBE_MINDEX_PAGE : '';
140
        $pagenav = new XoopsPageNav($new_array_count, $GLOBALS['xoopsModuleConfig']['admin_perpage'], $start, 'start');
141
        echo '<div align="right" style="padding: 8px;">' . $pagenav->renderNav() . '</div>';
142
        include_once __DIR__ . '/admin_footer.php';
143
        break;
144
}
145