Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
36 kaklik 1
<?php
2
 
3
/*************************************************************
4
*  TorrentFlux - PHP Torrent Manager
5
*  www.torrentflux.com
6
**************************************************************/
7
/*
8
    This file is part of TorrentFlux.
9
 
10
    TorrentFlux is free software; you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
12
    the Free Software Foundation; either version 2 of the License, or
13
    (at your option) any later version.
14
 
15
    TorrentFlux is distributed in the hope that it will be useful,
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
19
 
20
    You should have received a copy of the GNU General Public License
21
    along with TorrentFlux; if not, write to the Free Software
22
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
*/
24
 
25
include_once("config.php");
26
include_once("functions.php");
27
 
28
 
29
//****************************************************************************
30
// showIndex -- default view
31
//****************************************************************************
32
function showIndex($min)
33
{
34
    DisplayHead(_UPLOADHISTORY);
35
 
36
    // Display Activity
37
    displayActivity($min);
38
 
39
    DisplayFoot();
40
}
41
 
42
 
43
//****************************************************************************
44
// displayActivity -- displays History
45
//****************************************************************************
46
function displayActivity($min=0)
47
{
48
    global $cfg, $db;
49
 
50
    $offset = 50;
51
    $inx = 0;
52
    $max = $min+$offset;
53
    $output = "";
54
    $morelink = "";
55
 
56
    $sql = "SELECT user_id, file, time FROM tf_log WHERE action=".$db->qstr($cfg["constants"]["url_upload"])." OR action=".$db->qstr($cfg["constants"]["file_upload"])." ORDER BY time desc";
57
 
58
    $result = $db->SelectLimit($sql, $offset, $min);
59
    while(list($user_id, $file, $time) = $result->FetchRow())
60
    {
61
        $user_icon = "images/user_offline.gif";
62
        if (IsOnline($user_id))
63
        {
64
            $user_icon = "images/user.gif";
65
        }
66
 
67
        $output .= "<tr>";
68
        $output .= "<td><a href=\"message.php?to_user=".$user_id."\"><img src=\"".$user_icon."\" width=17 height=14 title=\"".$user_id."\" border=0 align=\"bottom\">".$user_id."</a>&nbsp;&nbsp;</td>";
69
        $output .= "<td><div align=center><div class=\"tiny\" align=\"left\">";
70
        $output .= $file;
71
        $output .= "</div></td>";
72
        $output .= "<td><div class=\"tiny\" align=\"center\">".date(_DATETIMEFORMAT, $time)."</div></td>";
73
        $output .= "</tr>";
74
 
75
        $inx++;
76
    }
77
 
78
    if($inx == 0)
79
    {
80
        $output = "<tr><td colspan=6><center><strong>-- "._NORECORDSFOUND." --</strong></center></td></tr>";
81
    }
82
 
83
    $prev = ($min-$offset);
84
    if ($prev>=0)
85
    {
86
        $prevlink = "<a href=\"history.php?min=".$prev."\">";
87
        $prevlink .= "<font class=\"TinyWhite\">&lt;&lt;".$min." "._SHOWPREVIOUS."]</font></a> &nbsp;";
88
    }
89
    $next=$min+$offset;
90
    if ($inx>=$offset)
91
    {
92
        $morelink = "<a href=\"history.php?min=".$max."\">";
93
        $morelink .= "<font class=\"TinyWhite\">["._SHOWMORE."&gt;&gt;</font></a>";
94
    }
95
 
96
    echo "<table width=\"760\" border=1 bordercolor=\"".$cfg["table_admin_border"]."\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"".$cfg["table_data_bg"]."\">";
97
    echo "<tr><td colspan=6 bgcolor=\"".$cfg["table_header_bg"]."\" background=\"themes/".$cfg["theme"]."/images/bar.gif\">";
98
    echo "<table width=\"100%\" cellpadding=0 cellspacing=0 border=0><tr><td>";
99
    echo "<img src=\"images/properties.png\" width=18 height=13 border=0>&nbsp;&nbsp;<strong><font class=\"title\">"._UPLOADACTIVITY." (".$cfg["days_to_keep"]." "._DAYS.")</font></strong>";
100
 
101
    if(!empty($prevlink) && !empty($morelink))
102
    echo "</td><td align=\"right\">".$prevlink.$morelink."</td></tr></table>";
103
    elseif(!empty($prevlink))
104
        echo "</td><td align=\"right\">".$prevlink."</td></tr></table>";
105
    elseif(!empty($morelink))
106
        echo "</td><td align=\"right\">".$morelink."</td></tr></table>";
107
    else
108
        echo "</td><td align=\"right\"></td></tr></table>";
109
 
110
    echo "</td></tr>";
111
    echo "<tr>";
112
    echo "<td bgcolor=\"".$cfg["table_header_bg"]."\"><div align=center class=\"title\">"._USER."</div></td>";
113
    echo "<td bgcolor=\"".$cfg["table_header_bg"]."\"><div align=center class=\"title\">"._FILE."</div></td>";
114
    echo "<td bgcolor=\"".$cfg["table_header_bg"]."\" width=\"15%\"><div align=center class=\"title\">"._TIMESTAMP."</div></td>";
115
    echo "</tr>";
116
 
117
    echo $output;
118
 
119
    if(!empty($prevlink) || !empty($morelink))
120
    {
121
        echo "<tr><td colspan=6 bgcolor=\"".$cfg["table_header_bg"]."\">";
122
        echo "<table width=\"100%\" cellpadding=0 cellspacing=0 border=0><tr><td align=\"left\">";
123
        echo $prevlink;
124
        echo "</td><td align=\"right\">";
125
        echo $morelink;
126
        echo "</td></tr></table>";
127
        echo "</td></tr>";
128
    }
129
 
130
    echo "</table>";
131
 
132
}
133
 
134
 
135
 
136
 
137
 
138
//****************************************************************************
139
//****************************************************************************
140
//****************************************************************************
141
//****************************************************************************
142
// TRAFFIC CONTROLER
143
if(!isset($op)) $op =  "";
144
 
145
switch ($op) {
146
 
147
    default:
148
    if(!isset($min)) $min = 0;
149
        showIndex($min);
150
    break;
151
 
152
}
153
//****************************************************************************
154
//****************************************************************************
155
//****************************************************************************
156
//****************************************************************************
157
 
158
?>