Completed
Push — master ( 8ca430...3024c9 )
by Michael
03:12
created

admin/votedata.php (1 issue)

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-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
$rid = xtubeCleanRequestVars($_REQUEST, 'rid', 0);
25
$lid = xtubeCleanRequestVars($_REQUEST, 'lid', 0);
26
$rid = intval($rid);
27
$lid = intval($lid);
28
29
switch (strtolower($op)) {
30
    case 'delvote':
31
        $sql    = 'DELETE FROM ' . $xoopsDB->prefix('xoopstube_votedata') . ' WHERE ratingid=' . $rid;
32
        $result = $xoopsDB->queryF($sql);
33
        xtubeUpdateRating($lid);
34
        redirect_header('votedata.php', 1, _AM_XOOPSTUBE_VOTEDELETED);
35
        break;
36
37
    case 'main':
38
    default:
39
        $start = xtubeCleanRequestVars($_REQUEST, 'start', 0);
40
        xoops_cp_header();
41
        //xtubeRenderAdminMenu( _AM_XOOPSTUBE_VOTE_RATINGINFOMATION );
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% 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
        $aboutAdmin = new ModuleAdmin();
43
        echo $aboutAdmin->addNavigation('votedata.php');
44
        $_vote_data = xtubeGetVoteDetails($lid);
45
46
        $text_info
47
            = '
48
        <table width="100%">
49
         <tr>
50
          <td width="50%" valign="top">
51
           <div><b>' . _AM_XOOPSTUBE_VOTE_TOTALRATE . ': </b>' . intval($_vote_data['rate']) . '</div>
52
           <div><b>' . _AM_XOOPSTUBE_VOTE_USERAVG . ': </b>' . intval(round($_vote_data['avg_rate'], 2)) . '</div>
53
           <div><b>' . _AM_XOOPSTUBE_VOTE_MAXRATE . ': </b>' . intval($_vote_data['min_rate']) . '</div>
54
           <div><b>' . _AM_XOOPSTUBE_VOTE_MINRATE . ': </b>' . intval($_vote_data['max_rate']) . '</div>
55
          </td>
56
          <td>
57
           <div><b>' . _AM_XOOPSTUBE_VOTE_MOSTVOTEDTITLE . ': </b>' . intval($_vote_data['max_title']) . '</div>
58
           <div><b>' . _AM_XOOPSTUBE_VOTE_LEASTVOTEDTITLE . ': </b>' . intval($_vote_data['min_title']) . '</div>
59
           <div><b>' . _AM_XOOPSTUBE_VOTE_REGISTERED . ': </b>' . (intval(
60
                $_vote_data['rate'] - $_vote_data['null_ratinguser']
61
            )) . '</div>
62
           <div><b>' . _AM_XOOPSTUBE_VOTE_NONREGISTERED . ': </b>' . intval($_vote_data['null_ratinguser']) . '</div>
63
          </td>
64
         </tr>
65
        </table>';
66
67
        echo '
68
         <fieldset style="border: #e8e8e8 1px solid;">
69
         <legend style="display: inline; font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_VOTE_DISPLAYVOTES . '</legend>
70
         <div style="padding: 8px;">' . $text_info . '<br />
71
         <li>' . $xtubeImageArray['deleteimg'] . ' ' . _AM_XOOPSTUBE_VOTE_DELETEDSC . '</li>
72
         </div>
73
         </fieldset>
74
75
        <table width="100%" cellspacing="1" cellpadding="2" class="outer" style="font-size: smaller;">
76
        <tr>
77
        <th style="text-align: center;">' . _AM_XOOPSTUBE_VOTE_ID . '</th>
78
        <th style="text-align: center;">' . _AM_XOOPSTUBE_VOTE_USER . '</th>
79
        <th style="text-align: center;">' . _AM_XOOPSTUBE_VOTE_IP . '</th>
80
        <th style="text-align: left;">&nbsp;' . _AM_XOOPSTUBE_VOTE_FILETITLE . '</th>
81
        <th style="text-align: center;">' . _AM_XOOPSTUBE_VOTE_RATING . '</th>
82
        <th style="text-align: center;">' . _AM_XOOPSTUBE_VOTE_DATE . '</th>
83
        <th style="text-align: center;">' . _AM_XOOPSTUBE_MINDEX_ACTION . '</th></tr>';
84
85
        $sql = 'SELECT * FROM ' . $xoopsDB->prefix('xoopstube_votedata');
86
        if ($lid > 0) {
87
            $sql .= ' WHERE lid=' . $lid;
88
        }
89
        $sql .= ' ORDER BY ratingtimestamp DESC';
90
91
        $results = $xoopsDB->query($sql, $xoopsModuleConfig['admin_perpage'], $start);
92
        $votes   = $xoopsDB->getRowsNum($xoopsDB->query($sql));
93
94
        if ($votes == 0) {
95
            echo '<tr><td style="text-align: center;" colspan="7" class="head">' . _AM_XOOPSTUBE_VOTE_NOVOTES . '</td></tr>';
96
        } else {
97
            while (list($ratingid, $lid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp, $title) = $xoopsDB->fetchRow(
98
                $results
99
            )) {
100
                $formatted_date = xtubeGetTimestamp(
101
                    formatTimestamp($ratingtimestamp, $xoopsModuleConfig['dateformat'])
102
                );
103
                $ratinguname    = XoopsUser::getUnameFromId($ratinguser);
104
                echo '
105
                    <tr>
106
                    <td class="head" style="text-align: center;">' . $ratingid . '</td>
107
                    <td class="even" style="text-align: center;">' . $ratinguname . '</td>
108
                    <td class="even" style="text-align: center;">' . $ratinghostname . '</td>
109
                    <td class="even" style="text-align: left;">&nbsp;' . $title . '</td>
110
                    <td class="even" style="text-align: center;">' . $rating . '</td>
111
                    <td class="even" style="text-align: center;">' . $formatted_date . '</td>
112
                    <td class="even" style="text-align: center;"><a href="votedata.php?op=delvote&amp;lid=' . $lid . '&amp;rid=' . $ratingid . '">' . $xtubeImageArray['deleteimg'] . '</a></td>
113
                    </tr>';
114
            }
115
        }
116
        echo '</table>';
117
        // Include page navigation
118
        include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
119
        $page    = ($votes > $xoopsModuleConfig['admin_perpage']) ? _AM_XOOPSTUBE_MINDEX_PAGE : '';
120
        $pagenav = new XoopsPageNav($page, $xoopsModuleConfig['admin_perpage'], $start, 'start');
121
        echo '<div align="right" style="padding: 8px;">' . $pagenav->renderNav() . '</div>';
122
        break;
123
}
124
include_once __DIR__ . '/admin_footer.php';
125