forked from sicalpath/tjupt
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathreports.php
154 lines (146 loc) · 8.26 KB
/
reports.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
require "include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
parked();
global $staffmem_class;
if (get_user_class() < $staffmem_class)
permissiondenied();
$count = get_row_count("reports");
if (!$count) {
stderr($lang_reports['std_oho'], $lang_reports['std_no_report']);
}
stdhead($lang_reports['head_reports']);
$perpage = 10;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, "reports.php?");
begin_main_frame();
print("<h1 align=center>" . $lang_reports['text_reports'] . "</h1>");
print("<table border=1 cellspacing=0 cellpadding=5 align=center>\n");
print("<tr><td class=colhead><nobr>" . $lang_reports['col_added'] . "</nobr></td><td class=colhead>" . $lang_reports['col_reporter'] . "</td><td class=colhead>" . $lang_reports['col_reporting'] . "</td><td class=colhead><nobr>" . $lang_reports['col_type'] . "</nobr></td><td class=colhead>" . $lang_reports['col_reason'] . "</td><td class=colhead><nobr>" . $lang_reports['col_dealt_with'] . "</nobr></td><td class=colhead><nobr>" . $lang_reports['col_action'] . "</nobr></td>");
print("<form method=post action=takeupdate.php>");
$reportres = sql_query("SELECT * FROM reports ORDER BY dealtwith ASC, id DESC $limit");
while ($row = mysql_fetch_array($reportres)) {
if ($row['dealtwith'])
$dealtwith = "<font color=green>" . $lang_reports['text_yes'] . "</font> - " . get_username($row['dealtby']);
else
$dealtwith = "<font color=red>" . $lang_reports['text_no'] . "</font>";
switch ($row['type']) {
case "torrent":
{
$type = $lang_reports['text_torrent'];
$res = sql_query("SELECT id, name FROM torrents WHERE id=" . sqlesc($row['reportid']));
if (mysql_num_rows($res) == 0)
$reporting = $lang_reports['text_torrent_does_not_exist'];
else {
$arr = mysql_fetch_array($res);
$reporting = "<a href=details.php?id=" . $arr['id'] . ">" . htmlspecialchars($arr['name']) . "</a>";
}
break;
}
case "user":
{
$type = $lang_reports['text_user'];
$res = sql_query("SELECT id FROM users WHERE id=" . sqlesc($row['reportid']));
if (mysql_num_rows($res) == 0)
$reporting = $lang_reports['text_user_does_not_exist'];
else {
$arr = mysql_fetch_array($res);
$reporting = get_username($arr['id']);
}
break;
}
case "offer":
{
$type = $lang_reports['text_offer'];
$res = sql_query("SELECT id, name FROM offers WHERE id=" . sqlesc($row['reportid']));
if (mysql_num_rows($res) == 0)
$reporting = $lang_reports['text_offer_does_not_exist'];
else {
$arr = mysql_fetch_array($res);
$reporting = "<a href=\"offers.php?id=" . $arr['id'] . "&off_details=1\">" . htmlspecialchars($arr['name']) . "</a>";
}
break;
}
case "request":
{
$type = $lang_reports['text_request'];
$res = sql_query("SELECT id, name FROM req WHERE id=" . sqlesc($row['reportid']));
if (mysql_num_rows($res) == 0)
$reporting = $lang_reports['text_request_does_not_exist'];
else {
$arr = mysql_fetch_array($res);
$reporting = "<a href=\"viewrequests.php?action=view&id=" . $arr['id'] . "&req_details=1\">" . htmlspecialchars($arr['name']) . "</a>";
}
break;
}
case "post":
{
$type = $lang_reports['text_forum_post'];
$res = sql_query("SELECT topics.id AS topicid, topics.subject AS subject, posts.userid AS postuserid FROM topics LEFT JOIN posts ON posts.topicid = topics.id WHERE posts.id=" . sqlesc($row['reportid']));
if (mysql_num_rows($res) == 0)
$reporting = $lang_reports['text_post_does_not_exist'];
else {
$arr = mysql_fetch_array($res);
$reporting = $lang_reports['text_post_id'] . $row['reportid'] . $lang_reports['text_of_topic'] . "<b><a href=\"forums.php?action=viewtopic&topicid=" . $arr['topicid'] . "&page=p" . htmlspecialchars($row['reportid']) . "#pid" . htmlspecialchars($row['reportid']) . "\">" . htmlspecialchars($arr['subject']) . "</a></b>" . $lang_reports['text_by'] . get_username($arr['postuserid']);
}
break;
}
case "comment":
{
$type = $lang_reports['text_comment'];
// $res = sql_query("SELECT id, user, torrent, offer, request FROM comments WHERE id=".sqlesc($row['reportid']));
$res = sql_query("SELECT id, user, torrent, offer, request FROM comments WHERE id=" . sqlesc($row['reportid']));
if (mysql_num_rows($res) == 0)
$reporting = $lang_reports['text_comment_does_not_exist'];
else {
$arr = mysql_fetch_array($res);
if ($arr['torrent']) {
$name = get_single_value("torrents", "name", "WHERE id=" . sqlesc($arr['torrent']));
$url = "details.php?id=" . $arr['torrent'] . "#cid" . $row['reportid'];
$of = $lang_reports['text_of_torrent'];
} elseif ($arr['offer']) {
$name = get_single_value("offers", "name", "WHERE id=" . sqlesc($arr['offer']));
$url = "offers.php?id=" . $arr['offer'] . "&off_details=1#cid" . $row['reportid'];
$of = $lang_reports['text_of_offer'];
} elseif ($arr['request']) {
$name = get_single_value("req", "name", "WHERE id=" . sqlesc($arr['request']));
$url = "viewrequests.php?action=view&id=" . $arr['request'] . "&req_details=1#cid" . $row['reportid'];
$of = $lang_reports['text_of_request'];
} else //Comment belongs to no one
$of = "unknown";
$reporting = $lang_reports['text_comment_id'] . $row['reportid'] . $of . "<b><a href=\"" . $url . "\">" . htmlspecialchars($name) . "</a></b>" . $lang_reports['text_by'] . get_username($arr['user']);
}
break;
}
case "subtitle":
{
$type = $lang_reports['text_subtitle'];
$res = sql_query("SELECT id, torrent_id, title FROM subs WHERE id=" . sqlesc($row['reportid']));
if (mysql_num_rows($res) == 0)
$reporting = $lang_reports['text_subtitle_does_not_exist'];
else {
$arr = mysql_fetch_array($res);
$reporting = "<a href=\"downloadsubs.php?torrentid=" . $arr['torrent_id'] . "&subid=" . $arr['id'] . "\">" . htmlspecialchars($arr['title']) . "</a>" . $lang_reports['text_for_torrent_id'] . "<a href=\"details.php?id=" . $arr['torrent_id'] . "\">" . $arr['torrent_id'] . "</a>";
}
break;
}
default:
{
break;
}
}
print("<tr><td class=rowfollow><nobr>" . gettime($row['added']) . "</nobr></td><td class=rowfollow>" . get_username($row['addedby']) . "</td><td class=rowfollow>" . $reporting . "</td><td class=rowfollow><nobr>" . $type . "</nobr></td><td class=rowfollow>" . htmlspecialchars($row['reason']) . "</td><td class=rowfollow><nobr>" . $dealtwith . "</nobr></td><td class=rowfollow><input type=\"checkbox\" name=\"delreport[]\" value=\"" . $row['id'] . "\" /></td></tr>\n");
}
?>
<tr>
<td class="colhead" colspan="7" align="right">设为已处理并改变举报者的魔力值<input type="text" name="bonus" value="0"/><input
type="submit" name="setdealt" value="<?php echo $lang_reports['submit_set_dealt'] ?>"/><input
type="submit" name="delete" value="<?php echo $lang_reports['submit_delete'] ?>"/></td>
</tr>
</form>
<?php
print("</table>");
print($pagerbottom);
end_main_frame();
stdfoot();