-
Notifications
You must be signed in to change notification settings - Fork 0
/
buddies.php
206 lines (184 loc) · 7.99 KB
/
buddies.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php
/*
##########################################################################
# #
# Version 4 / / / #
# -----------__---/__---__------__----__---/---/- #
# | /| / /___) / ) (_ ` / ) /___) / / #
# _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___ #
# Free Content / Management System #
# / #
# #
# #
# Copyright 2005-2015 by webspell.org #
# #
# visit webSPELL.org, webspell.info to get webSPELL for free #
# - Script runs under the GNU GENERAL PUBLIC LICENSE #
# - It's NOT allowed to remove this copyright-tag #
# -- http://www.fsf.org/licensing/licenses/gpl.html #
# #
# Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at), #
# Far Development by Development Team - webspell.org #
# #
# visit webspell.org #
# #
##########################################################################
*/
$action = (isset($_GET['action'])) ? $_GET['action'] : '';
if (!empty($action)) {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
$action = getAction();
$_language->readModule('buddys');
if (!$userID) {
redirect('index.php?site=buddies', $_language->module[ 'not_logged' ], 3);
} else if (!isset($_GET[ 'id' ]) || !is_numeric($_GET[ 'id' ])) {
redirect('index.php?site=buddies', $_language->module[ 'add_nouserid' ], 3);
}
if ($action == "add") {
if ($_GET[ 'id' ] == $userID) {
redirect('index.php?site=buddies', $_language->module[ 'add_yourself' ], 3);
die();
}
if (mysqli_num_rows(
safe_query(
"SELECT
userID
FROM
" . PREFIX . "user
WHERE
userID='" . (int)$_GET[ 'id' ] . "'"
)
)
) {
safe_query(
"INSERT INTO
" . PREFIX . "buddys (userID, buddy, banned)
values
('$userID', '" . intval($_GET[ 'id' ]) . "', '0') "
);
header("Location: index.php?site=buddies");
} else {
redirect('index.php?site=buddies', $_language->module[ 'add_notexists' ], 3);
}
} else if ($action == "ignore") {
if ($_GET[ 'id' ] == $userID) {
redirect('index.php?site=buddies', $_language->module[ 'add_yourself' ], 3);
die();
}
if (mysqli_num_rows(
safe_query(
"SELECT
userID
FROM
" . PREFIX . "user
WHERE userID='" . (int)$_GET[ 'id' ] . "'"
)
)
) {
safe_query(
"UPDATE
" . PREFIX . "buddys
SET
banned='1'
WHERE
userID='$userID'
AND
buddy='" . (int)$_GET[ 'id' ] . "'"
);
header("Location: index.php?site=buddies");
} else {
redirect('index.php?site=buddies', $_language->module[ 'add_notexists' ], 3);
}
} else if ($action == "readd") {
safe_query(
"UPDATE " . PREFIX . "buddys SET banned='0' WHERE userID='$userID' AND buddy='" . (int)$_GET[ 'id' ] . "'"
);
header("Location: index.php?site=buddies");
} else if ($action == "delete") {
safe_query(
"DELETE FROM " . PREFIX . "buddys WHERE userID='$userID' AND buddy='" . (int)$_GET[ 'id' ] . "'"
);
header("Location: index.php?site=buddies");
}
} else if ($userID) {
$_language->readModule('buddys');
$title_buddys = $GLOBALS["_template"]->replaceTemplate("title_buddys", array());
echo $title_buddys;
$buddys_head = $GLOBALS["_template"]->replaceTemplate("buddys_head", array());
echo $buddys_head;
$ergebnis = safe_query("SELECT * FROM " . PREFIX . "buddys WHERE userID='$userID' AND banned='0'");
$anz = mysqli_num_rows($ergebnis);
if ($anz) {
$n = 1;
while ($ds = mysqli_fetch_array($ergebnis)) {
$flag = '[flag]' . getcountry($ds[ 'buddy' ]) . '[/flag]';
$country = flags($flag);
$nickname = getnickname($ds[ 'buddy' ]);
if (isclanmember($ds[ 'buddy' ])) {
$member = '<span class="bi bi-person-fill" aria-hidden="true" title="Clanmember"></span>';
} else {
$member = '';
}
if (isonline($ds[ 'buddy' ]) == "offline") {
$statuspic = '<span class="label label-danger">' . $_language->module[ 'offline' ] . '</span>';
} else {
$statuspic = '<span class="label label-success">' . $_language->module[ 'online' ] . '</span>';
}
$data_array = array();
$data_array['$country'] = $country;
$data_array['$buddyID'] = $ds['buddy'];
$data_array['$nickname'] = $nickname;
$data_array['$member'] = $member;
$data_array['$userID'] = $userID;
$buddys_content = $GLOBALS["_template"]->replaceTemplate("buddys_content", $data_array);
echo $buddys_content;
$n++;
}
} else {
echo '<tr><td colspan="4">' . $_language->module[ 'buddy_nousers' ] . '</td></tr>';
}
$buddys_foot = $GLOBALS["_template"]->replaceTemplate("buddys_foot", array());
echo $buddys_foot;
$ignore_head = $GLOBALS["_template"]->replaceTemplate("ignore_head", array());
echo $ignore_head;
$ergebnis = safe_query("SELECT * FROM " . PREFIX . "buddys WHERE userID='$userID' AND banned='1'");
$anz = mysqli_num_rows($ergebnis);
if ($anz) {
$n = 1;
while ($ds = mysqli_fetch_array($ergebnis)) {
$flag = '[flag]' . getcountry($ds[ 'buddy' ]) . '[/flag]';
$country = flags($flag);
$nickname = getnickname($ds[ 'buddy' ]);
if (isclanmember($ds[ 'buddy' ])) {
$member = ' <span class="bi bi-person-fill" aria-hidden="true" title="Clanmember"></span>';
} else {
$member = '';
}
if (isonline($ds[ 'buddy' ]) == "offline") {
$statuspic = '<span class="label label-danger">' . $_language->module[ 'offline' ] . '</span>';
} else {
$statuspic = '<span class="label label-success">' . $_language->module[ 'online' ] . '</span>';
}
$data_array = array();
$data_array['$country'] = $country;
$data_array['$nickname'] = $nickname;
$data_array['$member'] = $member;
$data_array['$userID'] = $userID;
$data_array['$buddyID'] = $ds['buddy'];
$ignore_content = $GLOBALS["_template"]->replaceTemplate("ignore_content", $data_array);
echo $ignore_content;
$n++;
}
} else {
echo $_language->module[ 'ignore_nousers' ];
}
$ignore_foot = $GLOBALS["_template"]->replaceTemplate("ignore_foot", array());
echo $ignore_foot;
} else {
$_language->readModule('buddys');
if (!$userID) {
redirect('index.php?site=buddies', $_language->module[ 'not_logged' ], 3);
}
}