-
Notifications
You must be signed in to change notification settings - Fork 29
/
mysimpaty.php
147 lines (134 loc) · 7.12 KB
/
mysimpaty.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
<?
/*
// +--------------------------------------------------------------------------+
// | Project: TBDevYSE - TBDev Yuna Scatari Edition |
// +--------------------------------------------------------------------------+
// | This file is part of TBDevYSE. TBDevYSE is based on TBDev, |
// | originally by RedBeard of TorrentBits, extensively modified by |
// | Gartenzwerg. |
// | |
// | TBDevYSE 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. |
// | |
// | TBDevYSE 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 TBDevYSE; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +--------------------------------------------------------------------------+
// | Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/
require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();
if (!isset($_GET["id"]))
$userid = $CURUSER["id"];
elseif (get_user_class() < UC_MODERATOR && $_GET["id"] != $CURUSER["id"])
stderr($tracker_lang['error'], $tracker_lang['access_denied']);
elseif (get_user_class() >= UC_MODERATOR || $_GET["id"] == $CURUSER["id"])
$userid = (int) $_GET["id"];
if (!is_valid_id($userid))
stderr($tracker_lang['error'], $tracker_lang['invalid_id']);
stdhead("Ìîè ðåñïåêòû");
$count_res = sql_query("SELECT COUNT(*) FROM simpaty WHERE touserid = $userid");
$count_row = mysql_fetch_array($count_res);
$count = $count_row[0];
if (!$count) {
stdmsg("Èçâèíèòå", "Ó ýòîãî ïîëüçîâàòåëÿ íåò ðåñïåêòîâ.");
stdfoot();
die();
} else {
?>
<table class="embedded" cellspacing="0" cellpadding="5" width="100%">
<tr><td class="colhead" align="center" colspan="12">Ñïèñîê ðåñïåêòîâ</td></tr>
<?
unset ($admin);
if (get_user_class()>=UC_ADMINISTRATOR) {
$admin = true;
}
list($pagertop, $pagerbottom, $limit) = pager(30, $count, "mysimpaty.php?", array(lastpagedefault => 0));
print("<tr><td class=\"index\" colspan=\"12\">");
print($pagertop);
print("</td></tr>");
?>
<tr>
<td width=10 class=colhead>#</td>
<td width=20 class=colhead>Òèï</td>
<td class=colhead>Îò êîãî</td>
<td class=colhead>Çà ÷òî</td>
<td class=colhead>Ïðè÷èíà</td>
<td class=colhead align=center width="10%">Äàòà</td>
<?
if ($admin)
print("<td class=colhead width=5></td>");
?>
</tr>
<?
$res = sql_query("SELECT * FROM simpaty WHERE touserid = $userid ORDER BY respect_time DESC $limit");
while ($arr = mysql_fetch_assoc($res)) {
$respect_id = $arr["id"];
$touserid = $arr["touserid"];
$respect_type = ($arr["bad"]==1?"bad":"good");
$i++;
if (substr($arr["type"],0,7) == 'torrent') {
$from_what = '<a href="details.php?id=' . substr($arr["type"],7,strlen($arr["type"])) . '&hit=1">' . "Òîððåíò" . '</a>';
}
elseif (substr($arr["type"],0,7) == 'comment') {
preg_match("/comment[a-z]{0,3}([0-9]*)_id([0-9]*)/", $arr["type"], $matches);
$comment_id = $matches[1];
$id = $matches[2];
if (substr($arr["type"],0,10)=="commentreq") $filename = "requests.php";
elseif (substr($arr["type"],0,10)=="commentoff") $filename = "offers.php";
else $filename = "details.php";
$from_what = '<a href="' . $filename . '?id=' . $id . '&page=' . $page . '&viewcomm=' . $comment_id . '#comm' . $comment_id . '">' . "Êîììåíòàðèé" . '</a>';
}
elseif (substr($arr["type"],0,7) == 'request')
$from_what = '<a href="requests.php?id=' . substr($arr["type"],7,strlen($arr["type"])) . '">' . "Çàïðîñ" . '</a>';
elseif (substr($arr["type"],0,5) == 'offer')
$from_what = '<a href="offers.php?id=' . substr($arr["type"],5,strlen($arr["type"])) . '">' . "Ïðåäëîæåíèå" . '</a>';
/*$tracker_template->assign_block_vars('simpaty_section.switch_count.simpaty_row', array(
'TOUSERID' => $touserid,
'RESPECT_ID' => $respect_id,
'RESPECT_TYPE' => $respect_type,
'NUMBER' => $i + (30 * (int)$_GET["page"]),
'TYPE' => $arr["good"]==1?'<img src="pic/thum_good.gif" alt="' . "Ðåñïåêò" . '" title="' . "Ðåñïåêò" . '">':'<img src="pic/thum_bad.gif" alt="' . "Àíòèðåñïåêò" . '" title="' . "Àíòèðåñïåêò" . '">',
'FROM_USERID' => $arr["fromuserid"],
'FROM_USERNAME' => $arr["fromusername"],
'FROM_WHAT' => $from_what,
'DESCRIPTION' => $arr["description"],
'DATE' => str_replace("\" \"", "<br />", display_date_time(strtotime($arr["respect_time"]), $CURUSER["tzoffset"])))
);*/
$number = $i + (30 * (int)$_GET["page"]);
$type = $arr["good"]==1?'<img src="pic/thum_good.gif" alt="' . "Ðåñïåêò" . '" title="' . "Ðåñïåêò" . '">':'<img src="pic/thum_bad.gif" alt="' . "Àíòèðåñïåêò" . '" title="' . "Àíòèðåñïåêò" . '">';
$fromuserid = $arr["fromuserid"];
$fromusername = $arr["fromusername"];
$description = $arr["description"];
$respect_time = $arr["respect_time"];
?>
<tr>
<td><?=$number;?></td>
<td><?=$type;?></td>
<td><a href="userdetails.php?id=<?=$fromuserid;?>"><?=$fromusername;?></a></td>
<td><?=$from_what;?></td>
<td><?=$description;?></td>
<td align="center"><?=$respect_time;?></td>
<?
if ($admin)
print('<td><a href="simpaty.php?action=delete&respect_id='.$respect_id.'&touserid='.$touserid.'&respect_type='.$respect_type.'&returnto='.urlencode($_SERVER["REQUEST_URI"]).'"><img src="pic/warned2.gif" border="0" /></a></td>');
?>
</tr>
<?
}
}
print("<tr><td class=\"index\" colspan=\"12\">");
print($pagerbottom);
print("</td></tr>");
print("</table>");
stdfoot();
?>