-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathshoutbox.php
148 lines (124 loc) · 4.95 KB
/
shoutbox.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
<?php
/*
// +--------------------------------------------------------------------------+
// | Project: pdonvtracker - NetVision BitTorrent Tracker 2017 |
// +--------------------------------------------------------------------------+
// | This file is part of pdonvtracker. NVTracker is based on BTSource, |
// | originally by RedBeard of TorrentBits, extensively modified by |
// | Gartenzwerg. |
// +--------------------------------------------------------------------------+
// | Obige Zeilen dürfen nicht entfernt werden! Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/
require_once(dirname(__FILE__) . "/include/bittorrent.php");
userlogin();
$shoutbox = new shoutbox($GLOBALS['DB']);
//loggedinorreturn();
if(isset($_REQUEST["ajax"]))
$ajax = (isset($_GET["ajax"]) ? htmlentities($_GET["ajax"]) : htmlentities($_POST["ajax"]));
else
$ajax = 0;
if(isset($_REQUEST["hid"]))
$hid = (isset($_GET["history"]) ? intval($_GET["hid"]) : intval($_POST["hid"]));
else
$hid = 0;
if(isset($_REQUEST["view"]))
$view = (isset($_GET["history"]) ? intval($_GET["view"]) : intval($_POST["view"]));
else
$view = 0;
if(isset($_REQUEST["del"]))
$del = (isset($_GET["history"]) ? intval($_GET["del"]) : intval($_POST["del"]));
else
$del = 0;
if($hid != 0 && $ajax == "yes"){
$shoutbox->make_invisible($hid);
die;
}
if($view != 0 && $ajax == "yes"){
$shoutbox->make_visible($view);
die;
}
if($del != 0 && $ajax == "yes"){
$shoutbox->delete($del);
die;
}
if(isset($_POST["message"])){
//$message = utf2html(trim($_POST["message"]));
$message = trim($_POST["message"]);
$message = str_replace(array("ä","ö","ü","Ä","Ö","Ü","ß"),
array("ä","ö","ü","Ä","Ö","Ü","ß"),
$message);
$message = trim($message);
if($message != ""){
$user = "<font class=\"" . get_class_color($CURUSER["class"]) . "\">" . htmlentities($CURUSER["username"]) . "</font>";
$shoutbox->insert($message, $CURUSER["id"]);
}
}
/*
$append = "(visible = 'yes' AND private_id = 0) OR (visible = 'yes' AND (private_id = " . $CURUSER["id"] . " OR user_id = " . $CURUSER["id"] . "))";
if (!isset($_GET["history"]))
{
$sql = "SELECT * FROM shoutbox WHERE " . $append . " ORDER BY time DESC LIMIT 30";
}
else
{
$sql = "SELECT * FROM shoutbox ORDER BY time DESC LIMIT 100";
}
*/
$result = $shoutbox->get_box(get_user_class());
//$result = mysql_query($sql);
$loading = " <div id=\"loading-layer\" class=\"sb_loading\">\n";
$loading .= " <div style=\"font-weight: bold; color: #000000;\" id=\"loading-layer-text\">Aktualisiere. Bitte warten...</div>\n";
$loading .= " <br />\n";
$loading .= " <img src=\"" . $BASEURL . "/pic/loading.gif\" border=\"0\" />\n";
$loading .= " </div>\n";
$menu = "\n<div id=\"popup\" style=\"display:none;\"></div>\n\n";
if ($result){
if (get_user_class() >= UC_MODERATOR){
print ($loading);
}
print($menu);
$out = "";
$popup_pic = $GLOBALS["PIC_BASE_URL"] . "menu_open.gif";
$history = ( isset($_GET["history"]) ? "1" : "0" );
$hid = ( (get_user_class() >= UC_MODERATOR) ? "1" : "0" );
$usr = ( (get_user_class() >= UC_MODERATOR) ? "1" : "0" );
$del = ( (get_user_class() >= UC_ADMINISTRATOR) ? "1" : "0" );
$pm = "1";
//while($row = mysql_fetch_array($result))
if(is_array($result)){
foreach($result as $row){
$sb_opt = "'" . $row["id"] . // PostID
"','" . $row["userid"] . // UserID des Schreibers
"','" . $hid . // kann Post ausblenden
"','" . $row["visible"] . // Post versteckt oder sichtbar
"','" . $del . // kann Post löschen
"','" . $history . // Ansicht History oder Normal
"','" . $pm . // Kann PM in SB schreiben
"','" . $usr . // Link zum User-Profil
"'";
if ( $history && ($row["visible"] == 0) ){
$start = "<i>";
$ende = "</i>";
}else{
$start = "";
$ende = "";
}
$user = "<span class=\"" . get_class_color($row["class"]) . "\">" . $row["username"] . "</span>";
$line = " <div style=\"width: 99%; vertical-align: text-top; margin: 5px;\">\n" .
" <div style=\"float: left; width: 15px;\"><img class=\"button\" src=\"" . $popup_pic . "\" id=\"menu_" . $row["id"] . "\" onClick=\"popup_sb(" . $sb_opt . ");\" /></div>\n" .
" <div style=\"float: left; width: 85px;\">" . date("H:i:s",strtotime($row['added'])) . "</div>\n" .
" <div style=\"float: left; width: 105px;\">" . $user . "</div>\n" .
" <div><table><tr><td>" . str_replace("<br /><br />", "", format_comment($row["msg"])) . "</td></tr></table></div>\n" .
" </div>\n";
$line = str_replace("<br /></td>", "</td>", $line);
if ($line != ""){
$out .= $line;
}
}
}else{
$out = $result;
}
print($out);
}
?>