|
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 (https://xoops.org) |
|
15
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
|
16
|
|
|
* @link https://xoops.org/ |
|
17
|
|
|
* @since 1.0.6 |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
use Xmf\Module\Admin; |
|
21
|
|
|
use Xmf\Request; |
|
22
|
|
|
use XoopsModules\Xoopstube; |
|
23
|
|
|
|
|
24
|
|
|
require_once __DIR__ . '/admin_header.php'; |
|
25
|
|
|
|
|
26
|
|
|
$op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); //cleanRequestVars($_REQUEST, 'op', ''); |
|
27
|
|
|
$lid = Request::getInt('rid', Request::getInt('rid', 0, 'POST'), 'GET'); //cleanRequestVars($_REQUEST, 'rid', 0); |
|
28
|
|
|
$lid = Request::getInt('lid', Request::getInt('lid', 0, 'POST'), 'GET'); //cleanRequestVars($_REQUEST, 'lid', 0); |
|
29
|
|
|
|
|
30
|
|
|
switch (mb_strtolower($op)) { |
|
31
|
|
|
case 'delvote': |
|
32
|
|
|
$sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_votedata') . ' WHERE ratingid=' . $rid; |
|
33
|
|
|
$result = $GLOBALS['xoopsDB']->queryF($sql); |
|
34
|
|
|
Xoopstube\Utility::updateRating($lid); |
|
35
|
|
|
redirect_header('votedata.php', 1, _AM_XOOPSTUBE_VOTEDELETED); |
|
36
|
|
|
break; |
|
37
|
|
|
case 'main': |
|
38
|
|
|
default: |
|
39
|
|
|
$start = Request::getInt('start', 0); //cleanRequestVars($_REQUEST, 'start', 0); |
|
40
|
|
|
xoops_cp_header(); |
|
41
|
|
|
//renderAdminMenu( _AM_XOOPSTUBE_VOTE_RATINGINFOMATION ); |
|
42
|
|
|
$adminObject = Admin::getInstance(); |
|
43
|
|
|
$adminObject->displayNavigation(basename(__FILE__)); |
|
44
|
|
|
$_vote_data = Xoopstube\Utility::getVoteDetails($lid); |
|
45
|
|
|
|
|
46
|
|
|
$text_info = ' |
|
47
|
|
|
<table width="100%"> |
|
48
|
|
|
<tr> |
|
49
|
|
|
<td width="50%" valign="top"> |
|
50
|
|
|
<div><b>' . _AM_XOOPSTUBE_VOTE_TOTALRATE . ': </b>' . Request::getInt('rate', 0, 'vote_data') . '</div> |
|
51
|
|
|
<div><b>' . _AM_XOOPSTUBE_VOTE_USERAVG . ': </b>' . (int)round($_vote_data['avg_rate'], 2) . '</div> |
|
52
|
|
|
<div><b>' . _AM_XOOPSTUBE_VOTE_MAXRATE . ': </b>' . Request::getInt('min_rate', 0, 'vote_data') . '</div> |
|
53
|
|
|
<div><b>' . _AM_XOOPSTUBE_VOTE_MINRATE . ': </b>' . Request::getInt('max_rate', 0, 'vote_data') . '</div> |
|
54
|
|
|
</td> |
|
55
|
|
|
<td> |
|
56
|
|
|
<div><b>' . _AM_XOOPSTUBE_VOTE_MOSTVOTEDTITLE . ': </b>' . Request::getInt('max_title', 0, 'vote_data') . '</div> |
|
57
|
|
|
<div><b>' . _AM_XOOPSTUBE_VOTE_LEASTVOTEDTITLE . ': </b>' . Request::getInt('min_title', 0, 'vote_data') . '</div> |
|
58
|
|
|
<div><b>' . _AM_XOOPSTUBE_VOTE_REGISTERED . ': </b>' . (Request::getInt('rate', 0, 'vote_data') - $_vote_data['null_ratinguser']) . '</div> |
|
59
|
|
|
<div><b>' . _AM_XOOPSTUBE_VOTE_NONREGISTERED . ': </b>' . Request::getInt('null_ratinguser', 0, 'vote_data') . '</div> |
|
60
|
|
|
</td> |
|
61
|
|
|
</tr> |
|
62
|
|
|
</table>'; |
|
63
|
|
|
|
|
64
|
|
|
echo ' |
|
65
|
|
|
<fieldset style="border: #e8e8e8 1px solid;"> |
|
66
|
|
|
<legend style="display: inline; font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_VOTE_DISPLAYVOTES . '</legend> |
|
67
|
|
|
<div style="padding: 8px;">' . $text_info . '<br> |
|
68
|
|
|
<li>' . $xtubeImageArray['deleteimg'] . ' ' . _AM_XOOPSTUBE_VOTE_DELETEDSC . '</li> |
|
69
|
|
|
</div> |
|
70
|
|
|
</fieldset> |
|
71
|
|
|
|
|
72
|
|
|
<table width="100%" cellspacing="1" cellpadding="2" class="outer" style="font-size: smaller;"> |
|
73
|
|
|
<tr> |
|
74
|
|
|
<th style="text-align: center;">' . _AM_XOOPSTUBE_VOTE_ID . '</th> |
|
75
|
|
|
<th style="text-align: center;">' . _AM_XOOPSTUBE_VOTE_USER . '</th> |
|
76
|
|
|
<th style="text-align: center;">' . _AM_XOOPSTUBE_VOTE_IP . '</th> |
|
77
|
|
|
<th style="text-align: left;"> ' . _AM_XOOPSTUBE_VOTE_FILETITLE . '</th> |
|
78
|
|
|
<th style="text-align: center;">' . _AM_XOOPSTUBE_VOTE_RATING . '</th> |
|
79
|
|
|
<th style="text-align: center;">' . _AM_XOOPSTUBE_VOTE_DATE . '</th> |
|
80
|
|
|
<th style="text-align: center;">' . _AM_XOOPSTUBE_MINDEX_ACTION . '</th></tr>'; |
|
81
|
|
|
|
|
82
|
|
|
$sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_votedata'); |
|
83
|
|
|
if ($lid > 0) { |
|
84
|
|
|
$sql .= ' WHERE lid=' . $lid; |
|
85
|
|
|
} |
|
86
|
|
|
$sql .= ' ORDER BY ratingtimestamp DESC'; |
|
87
|
|
|
|
|
88
|
|
|
$results = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['admin_perpage'], $start); |
|
89
|
|
|
$votes = $GLOBALS['xoopsDB']->getRowsNum($GLOBALS['xoopsDB']->query($sql)); |
|
90
|
|
|
|
|
91
|
|
|
if (0 == $votes) { |
|
92
|
|
|
echo '<tr><td style="text-align: center;" colspan="7" class="head">' . _AM_XOOPSTUBE_VOTE_NOVOTES . '</td></tr>'; |
|
93
|
|
|
} else { |
|
94
|
|
|
while (list($ratingid, $lid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp, $title) = $GLOBALS['xoopsDB']->fetchRow($results)) { |
|
95
|
|
|
$formatted_date = Xoopstube\Utility::getTimestamp(formatTimestamp($ratingtimestamp, $GLOBALS['xoopsModuleConfig']['dateformat'])); |
|
96
|
|
|
$ratinguname = XoopsUser::getUnameFromId($ratinguser); |
|
97
|
|
|
echo ' |
|
98
|
|
|
<tr> |
|
99
|
|
|
<td class="head" style="text-align: center;">' . $ratingid . '</td> |
|
100
|
|
|
<td class="even" style="text-align: center;">' . $ratinguname . '</td> |
|
101
|
|
|
<td class="even" style="text-align: center;">' . $ratinghostname . '</td> |
|
102
|
|
|
<td class="even" style="text-align: left;"> ' . $title . '</td> |
|
103
|
|
|
<td class="even" style="text-align: center;">' . $rating . '</td> |
|
104
|
|
|
<td class="even" style="text-align: center;">' . $formatted_date . '</td> |
|
105
|
|
|
<td class="even" style="text-align: center;"><a href="votedata.php?op=delvote&lid=' . $lid . '&rid=' . $ratingid . '">' . $xtubeImageArray['deleteimg'] . '</a></td> |
|
106
|
|
|
</tr>'; |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
echo '</table>'; |
|
110
|
|
|
// Include page navigation |
|
111
|
|
|
require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
112
|
|
|
$page = ($votes > $GLOBALS['xoopsModuleConfig']['admin_perpage']) ? _AM_XOOPSTUBE_MINDEX_PAGE : ''; |
|
113
|
|
|
$pagenav = new XoopsPageNav($page, $GLOBALS['xoopsModuleConfig']['admin_perpage'], $start, 'start'); |
|
|
|
|
|
|
114
|
|
|
echo '<div align="right" style="padding: 8px;">' . $pagenav->renderNav() . '</div>'; |
|
115
|
|
|
break; |
|
116
|
|
|
} |
|
117
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
|
118
|
|
|
|