-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlog.php
More file actions
154 lines (135 loc) · 6.64 KB
/
log.php
File metadata and controls
154 lines (135 loc) · 6.64 KB
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
154
<?php
/*
// +--------------------------------------------------------------------------+
// | Project: NVTracker - NetVision BitTorrent Tracker |
// +--------------------------------------------------------------------------+
// | This file is part of NVTracker. NVTracker is based on BTSource, |
// | originally by RedBeard of TorrentBits, extensively modified by |
// | Gartenzwerg. |
// | |
// | NVTracker is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | NVTracker is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with NVTracker; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +--------------------------------------------------------------------------+
// | Obige Zeilen dürfen nicht entfernt werden! Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/
require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();
function puke($text = "w00t")
{
stderr("w00t", $text);
}
if (get_user_class() < UC_GUTEAM)
puke();
function get_typ_name($typ)
{
switch ($typ) {
case "torrentupload": return "Torrent hochgeladen";
case "torrentedit": return "Torrent bearbeitet";
case "torrentdelete": return "Torrent gelöscht";
case "torrentgranted":return "Torrent freigeschaltet";
case "promotion": return "Beförderung";
case "demotion": return "Degradierung";
case "addwarn": return "Verwarnung erteilt";
case "remwarn": return "Verwarnung entfernt";
case "accenabled": return "Account aktiviert";
case "accdisabled": return "Account deaktiviert";
case "accdeleted": return "Account gelöscht";
case "waitgrant": return "Wartezzeitaufh. zugestimmt";
case "waitreject": return "Wartezeitaufh. abgelehnt";
case "passkeyreset": return "PassKey neu gesetzt";
}
}
$timerange = array(3600 => "1 Stunde",
3 * 3600 => "3 Stunden",
6 * 3600 => "6 Stunden",
9 * 3600 => "9 Stunden",
12 * 3600 => "12 Stunden",
18 * 3600 => "18 Stunden",
24 * 3600 => "1 Tag",
2 * 24 * 3600 => "2 Tage",
3 * 24 * 3600 => "3 Tage",
4 * 24 * 3600 => "4 Tage",
5 * 24 * 3600 => "5 Tage",
6 * 24 * 3600 => "6 Tage",
7 * 24 * 3600 => "1 Woche",
14 * 24 * 3600 => "2 Wochen"
);
$types = array('torrentupload', 'torrentedit', 'torrentdelete', 'torrentgranted', 'promotion', 'demotion', 'addwarn', 'remwarn', 'accenabled', 'accdisabled', 'accdeleted', 'waitgrant', 'waitreject', 'passkeyreset');
// delete items older than two weeks
$secs = 14 * 24 * 3600;
stdhead("Site log");
mysql_query("DELETE FROM sitelog WHERE " . time() . " - UNIX_TIMESTAMP(added) > $secs") or sqlerr(__FILE__, __LINE__);
$where = "WHERE ";
$typelist = Array();
if (isset($_GET["types"])) {
foreach ($_GET["types"] as $type) {
$typelist[] = sqlesc($type);
}
$where .= "typ IN (" . implode(",", $typelist) . ") AND ";
}
if (isset($_GET["timerange"]))
$where .= time() . "-UNIX_TIMESTAMP(added)<" . intval($_GET["timerange"]);
else {
$where .= time() . " - UNIX_TIMESTAMP(added) < 432000";
$_GET["timerange"] = 432000;
}
begin_frame("Site Log");
print("<form action=\"log.php\" method=\"get\"><a name=\"log\"></a><center>");
begin_table();
print("<tr>\n");
$I = 0;
foreach ($types as $type) {
if ($I == 4) {
$I = 0;
print("</tr><tr>\n");
}
print("<td class=\"tablea\"><input type=\"checkbox\" name=\"types[]\" value=\"$type\"");
if (in_array(sqlesc($type), $typelist))
print(" checked=checked");
print("> <a href=\"log.php?timerange=" . intval($_GET["timerange"]) . "&types[]=$type&filter=1#log\">" . get_typ_name($type) . "</a></td>\n");
$I++;
}
if ($I < 4)
echo "<td colspan=\"" . (4 - $I) . "\" class=\"tablea\"> </td>\n";
print("</tr><tr><td class=\"tablea\" align=\"center\"><a href=\"log.php?timerange=" . intval($_GET["timerange"]) . "&filter=1#log\">Alle anzeigen</a></td><td class=\"tablea\" colspan=\"2\" align=\"center\">Zeitraum: <select name=\"timerange\" size=\"1\">\n");
foreach ($timerange as $range => $desc) {
print "<option value=\"$range\"";
if (intval($_GET["timerange"]) == $range)
echo " selected=\"selected\"";
print ">$desc</option>\n";
}
print("</select></td><td class=\"tablea\" align=\"center\"><input type=\"submit\" name=\"filter\" value=\"Filtern\"></td></tr></table></form><br>");
if (isset($_GET["filter"])) {
$res = mysql_query("SELECT typ, added, txt FROM sitelog $where ORDER BY added DESC") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print("<b>Es liegen keine Ereignisse mit den gewünschten Typen vor.</b>\n");
else {
print("<b>Es wurden " . mysql_num_rows($res) . " Ereignisse mit den gewünschten Typen gefunden.</b>\n");
begin_table(true);
print("<tr><td class=tablecat align=left>Datum</td><td class=tablecat align=left>Zeit</td><td class=tablecat align=left>Typ</td><td class=tablecat align=left>Ereignis</td></tr>\n");
while ($arr = mysql_fetch_assoc($res)) {
$typ = get_typ_name($arr["typ"]);
$date = substr($arr['added'], 0, strpos($arr['added'], " "));
$time = substr($arr['added'], strpos($arr['added'], " ") + 1);
print("<tr><td class=tableb>$date</td><td class=tablea>$time</td><td class=tableb align=left nowrap=nowrap>$typ</td><td class=tablea align=left>$arr[txt]</td></tr>\n");
}
print("</table>");
}
print("<p>Alle Zeitangaben sind lokal.</p>\n");
}
end_frame();
stdfoot();
?>