|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Module: WF-Links |
|
4
|
|
|
* Version: v1.0.3 |
|
5
|
|
|
* Release Date: 21 June 2005 |
|
6
|
|
|
* Developer: John N |
|
7
|
|
|
* Team: WF-Projects |
|
8
|
|
|
* Licence: GNU |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
use Xmf\Request; |
|
12
|
|
|
use XoopsModules\Wflinks; |
|
13
|
|
|
|
|
14
|
|
|
require_once __DIR__ . '/admin_header.php'; |
|
15
|
|
|
|
|
16
|
|
|
/** @var Wflinks\Helper $helper */ |
|
17
|
|
|
$helper = Wflinks\Helper::getInstance(); |
|
18
|
|
|
|
|
19
|
|
|
$op = \Xmf\Request::getString('op', ''); |
|
20
|
|
|
$rid = \Xmf\Request::getInt('rid', 0); |
|
21
|
|
|
$lid = \Xmf\Request::getInt('lid', 0); |
|
22
|
|
|
|
|
23
|
|
|
switch (mb_strtolower($op)) { |
|
24
|
|
|
case 'delvote': |
|
25
|
|
|
$sql = 'DELETE FROM ' . $xoopsDB->prefix('wflinks_votedata') . ' WHERE ratingid=' . $rid; |
|
26
|
|
|
$result = $xoopsDB->queryF($sql); |
|
27
|
|
|
Wflinks\Utility::updateRating($lid); |
|
28
|
|
|
redirect_header('votedata.php', 1, _AM_WFL_VOTEDELETED); |
|
29
|
|
|
break; |
|
30
|
|
|
case 'main': |
|
31
|
|
|
default: |
|
32
|
|
|
$start = \Xmf\Request::getInt('start', 0); |
|
33
|
|
|
xoops_cp_header(); |
|
34
|
|
|
|
|
35
|
|
|
$_vote_data = Wflinks\Utility::getVoteDetails($lid); |
|
36
|
|
|
|
|
37
|
|
|
$text_info = " |
|
38
|
|
|
<table width='100%'> |
|
39
|
|
|
<tr> |
|
40
|
|
|
<td width='50%' valign='top'> |
|
41
|
|
|
<div><b>" . _AM_WFL_VOTE_TOTALRATE . ': </b>' . Request::getInt('rate', 0, 'vote_data') . '</div> |
|
42
|
|
|
<div><b>' . _AM_WFL_VOTE_USERAVG . ': </b>' . (int)round($_vote_data['avg_rate'], 2) . '</div> |
|
43
|
|
|
<div><b>' . _AM_WFL_VOTE_MAXRATE . ': </b>' . Request::getInt('min_rate', 0, 'vote_data') . '</div> |
|
44
|
|
|
<div><b>' . _AM_WFL_VOTE_MINRATE . ': </b>' . Request::getInt('max_rate', 0, 'vote_data') . '</div> |
|
45
|
|
|
</td> |
|
46
|
|
|
<td> |
|
47
|
|
|
<div><b>' . _AM_WFL_VOTE_MOSTVOTEDTITLE . ': </b>' . Request::getInt('max_title', 0, 'vote_data') . '</div> |
|
48
|
|
|
<div><b>' . _AM_WFL_VOTE_LEASTVOTEDTITLE . ': </b>' . Request::getInt('min_title', 0, 'vote_data') . '</div> |
|
49
|
|
|
<div><b>' . _AM_WFL_VOTE_REGISTERED . ': </b>' . $_vote_data['rate'] - $_vote_data['null_ratinguser'] . '</div> |
|
50
|
|
|
<div><b>' . _AM_WFL_VOTE_NONREGISTERED . ': </b>' . Request::getInt('null_ratinguser', 0, 'vote_data') . '</div> |
|
51
|
|
|
</td> |
|
52
|
|
|
</tr> |
|
53
|
|
|
</table>'; |
|
54
|
|
|
|
|
55
|
|
|
echo " |
|
56
|
|
|
<fieldset><legend style='font-weight: bold; color: #0A3760;'>" . _AM_WFL_VOTE_DISPLAYVOTES . "</legend>\n |
|
57
|
|
|
<div style='padding: 8px;'>$text_info</div>\n |
|
58
|
|
|
<div style='padding: 8px;'><li>" . $imageArray['deleteimg'] . ' ' . _AM_WFL_VOTE_DELETEDSC . "</li></div>\n |
|
59
|
|
|
</fieldset>\n |
|
60
|
|
|
<br>\n |
|
61
|
|
|
|
|
62
|
|
|
<table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n |
|
63
|
|
|
<tr>\n |
|
64
|
|
|
<th class='txtcenter;'>" . _AM_WFL_VOTE_ID . "</th>\n |
|
65
|
|
|
<th class='txtcenter;'>" . _AM_WFL_VOTE_USER . "</th>\n |
|
66
|
|
|
<th class='txtcenter;'>" . _AM_WFL_VOTE_IP . "</th>\n |
|
67
|
|
|
<th class='txtcenter;'>" . _AM_WFL_VOTE_FILETITLE . "</th>\n |
|
68
|
|
|
<th class='txtcenter;'>" . _AM_WFL_VOTE_RATING . "</th>\n |
|
69
|
|
|
<th class='txtcenter;'>" . _AM_WFL_VOTE_DATE . "</th>\n |
|
70
|
|
|
<th class='txtcenter;'>" . _AM_WFL_MINDEX_ACTION . "</th></tr>\n"; |
|
71
|
|
|
|
|
72
|
|
|
$sql = 'SELECT * FROM ' . $xoopsDB->prefix('wflinks_votedata'); |
|
73
|
|
|
if ($lid > 0) { |
|
74
|
|
|
$sql .= ' WHERE lid=' . $lid; |
|
75
|
|
|
} |
|
76
|
|
|
$sql .= ' ORDER BY ratingtimestamp DESC'; |
|
77
|
|
|
|
|
78
|
|
|
$results = $xoopsDB->query($sql, $helper->getConfig('admin_perpage'), $start); |
|
79
|
|
|
$votes = $xoopsDB->getRowsNum($xoopsDB->query($sql)); |
|
80
|
|
|
|
|
81
|
|
|
if (0 == $votes) { |
|
82
|
|
|
echo "<tr><td class='txtcenter;' colspan='7' class='head'>" . _AM_WFL_VOTE_NOVOTES . '</td></tr>'; |
|
83
|
|
|
} else { |
|
84
|
|
|
while (list($ratingid, $lid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp, $title) = $xoopsDB->fetchRow($results)) { |
|
85
|
|
|
$formatted_date = formatTimestamp($ratingtimestamp, $helper->getConfig('dateformatadmin')); |
|
86
|
|
|
$ratinguname = \XoopsUser:: getUnameFromId($ratinguser); |
|
87
|
|
|
echo " |
|
88
|
|
|
<tr class='txtcenter;'>\n |
|
89
|
|
|
<td class='head'>$ratingid</td>\n |
|
90
|
|
|
<td class='even'>$ratinguname</td>\n |
|
91
|
|
|
<td class='even'>$ratinghostname</td>\n |
|
92
|
|
|
<td class='even'>$title</td>\n |
|
93
|
|
|
<td class='even'>$rating</td>\n |
|
94
|
|
|
<td class='even'>$formatted_date</td>\n |
|
95
|
|
|
<td class='even'><a href='votedata.php?op=delvote&lid=" . $lid . '&rid=' . $ratingid . "'>" . $imageArray['deleteimg'] . "</a></td>\n |
|
96
|
|
|
</tr>\n"; |
|
97
|
|
|
} |
|
98
|
|
|
} |
|
99
|
|
|
echo '</table>'; |
|
100
|
|
|
// Include page navigation |
|
101
|
|
|
require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
102
|
|
|
$page = ($votes > $helper->getConfig('admin_perpage')) ? _AM_WFL_MINDEX_PAGE : ''; |
|
103
|
|
|
$pagenav = new \XoopsPageNav($page, $helper->getConfig('admin_perpage'), $start, 'start'); |
|
|
|
|
|
|
104
|
|
|
echo '<div align="right" style="padding: 8px;">' . $pagenav->renderNav() . '</div>'; |
|
105
|
|
|
break; |
|
106
|
|
|
} |
|
107
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
|
108
|
|
|
|