]>
Commit | Line | Data |
---|---|---|
e98b5a51 BM |
1 | <?php |
2 | require_once "common.php"; | |
3 | ||
4 | require_once "header.php"; | |
5 | ||
6 | if (!empty($_POST)) | |
7 | { | |
8 | do_log($_POST); | |
fe2a6f27 | 9 | $bantype = $_POST['bantype']; |
e98b5a51 BM |
10 | if (isset($_POST['userch'])) |
11 | { | |
12 | foreach ($_POST["userch"] as $user) | |
13 | { | |
14 | $user = base64_decode($user); | |
15 | $bantype = (isset($_POST['bantype'])) ? $_POST['bantype'] : NULL; | |
16 | if (!$bantype) /* shouldn't happen? */ | |
17 | { | |
18 | Message::Fail("An error occured"); | |
19 | return; | |
20 | } | |
21 | $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL; | |
22 | $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL; | |
23 | $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL; | |
24 | ||
25 | $duration = ""; | |
26 | if (!$banlen_d && !$banlen_h && !$banlen_w) | |
27 | $duration .= "0"; | |
28 | ||
29 | else | |
30 | { | |
31 | if ($banlen_w) | |
32 | $duration .= $banlen_w; | |
33 | if ($banlen_d) | |
34 | $duration .= $banlen_d; | |
35 | if ($banlen_h) | |
36 | $duration .= $banlen_h; | |
37 | } | |
38 | ||
fe633176 BM |
39 | $user = $rpc->user()->get($user); |
40 | if (!user) | |
e98b5a51 BM |
41 | { |
42 | Message::Fail("Could not find that user. Maybe they disconnected after you clicked this?"); | |
43 | return; | |
44 | } | |
45 | ||
46 | $msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for ".rpc_convert_duration_string($duration); | |
47 | $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason"; | |
48 | if ($rpc->serverban()->add($user, $bantype, $duration, $reason)) | |
fe633176 | 49 | Message::Success($user->name . " (*@".$user->hostname.") has been $bantype" . "d $msg_msg: $reason"); |
e98b5a51 BM |
50 | } |
51 | } | |
52 | } | |
53 | ||
54 | /* Get the user list */ | |
55 | $users = $rpc->user()->getAll(); | |
56 | ?> | |
57 | ||
1e6ffd06 | 58 | <div id="Users"> |
e98b5a51 BM |
59 | <table class='users_filter'> |
60 | <th class="thuf">Filter by: </th> | |
61 | <th> | |
fe2a6f27 | 62 | <form action="users.php" method="post"> |
e98b5a51 BM |
63 | Nick: <input name="uf_nick" id="uf_nick" type="text"> |
64 | <input class="cute_button2" type="submit" value="Search"> | |
65 | </form> | |
66 | </th> | |
67 | <th> | |
68 | <form action="" method="post"> | |
69 | Hostname: <input name="uf_host" id="uf_host" type="text"> | |
70 | <input class="cute_button2" type="submit" value="Search"> | |
71 | </form> | |
72 | </th> | |
73 | <th> | |
74 | <form action="" method="post"> | |
75 | IP: <input name="uf_ip" id="uf_ip" type="text"> | |
76 | <input class="cute_button2" type="submit" value="Search"> | |
77 | </form> | |
78 | </th> | |
79 | <th class="thuffer"> | |
80 | <form action="" method="post"> | |
81 | Account: <input name="uf_account" id="uf_account" type="text"> | |
82 | <input class="cute_button2" type="submit" value="Search"> | |
83 | </form> | |
84 | </th> | |
85 | </form> | |
86 | </table> | |
87 | <?php | |
88 | if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick'])) | |
89 | Message::Info("Listing users which match nick: \"" . $_POST['uf_nick'] . "\""); | |
90 | ||
91 | if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip'])) | |
92 | Message::Info("Listing users which match IP: \"" . $_POST['uf_ip'] . "\""); | |
93 | ||
94 | if (isset($_POST['uf_host']) && strlen($_POST['uf_host'])) | |
95 | Message::Info("Listing users which match hostmask: \"" . $_POST['uf_host'] . "\""); | |
96 | ||
97 | if (isset($_POST['uf_account']) && strlen($_POST['uf_account'])) | |
98 | Message::Info("Listing users which match account: \"" . $_POST['uf_account'] . "\""); | |
99 | ||
100 | ?> | |
101 | <table class='users_overview'> | |
102 | <th><input type="checkbox" label='selectall' onClick="toggle_user(this)" />Select all</th> | |
103 | <th>Nick</th> | |
104 | <th>UID</th> | |
105 | <th>Host / IP</th> | |
106 | <th>Account</th> | |
1a1ee050 | 107 | <th>Usermodes <a href="https://www.unrealircd.org/docs/User_modes" target="_blank">ℹ️</a></th> |
e98b5a51 BM |
108 | <th>Oper</th> |
109 | <th>Secure</th> | |
110 | <th>Connected to</th> | |
111 | <th>Reputation <a href="https://www.unrealircd.org/docs/Reputation_score" target="_blank">ℹ️</a></th> | |
112 | ||
7b1ba98c | 113 | <form action="users.php" method="post"> |
e98b5a51 BM |
114 | <?php |
115 | foreach($users as $user) | |
116 | { | |
117 | ||
118 | /* Some basic filtering for NICK */ | |
119 | if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick']) && | |
120 | strpos(strtolower($user->name), strtolower($_POST['uf_nick'])) !== 0 && | |
121 | strpos(strtolower($user->name), strtolower($_POST['uf_nick'])) == false) | |
122 | continue; | |
123 | ||
124 | /* Some basic filtering for HOST */ | |
125 | if (isset($_POST['uf_host']) && strlen($_POST['uf_host']) && | |
126 | strpos(strtolower($user->hostname), strtolower($_POST['uf_host'])) !== 0 && | |
127 | strpos(strtolower($user->hostname), strtolower($_POST['uf_host'])) == false) | |
128 | continue; | |
129 | ||
130 | /* Some basic filtering for IP */ | |
131 | if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip']) && | |
132 | strpos(strtolower($user->ip), strtolower($_POST['uf_ip'])) !== 0 && | |
133 | strpos(strtolower($user->ip), strtolower($_POST['uf_ip'])) == false) | |
134 | continue; | |
135 | ||
136 | /* Some basic filtering for ACCOUNT */ | |
137 | if (isset($_POST['uf_account']) && strlen($_POST['uf_account']) && | |
138 | strpos(strtolower($user->user->account), strtolower($_POST['uf_account'])) !== 0 && | |
139 | strpos(strtolower($user->user->account), strtolower($_POST['uf_account'])) == false) | |
140 | continue; | |
141 | ||
142 | echo "<tr>"; | |
143 | echo "<td><input type=\"checkbox\" value='" . base64_encode($user->id)."' name=\"userch[]\"></td>"; | |
144 | $isBot = (strpos($user->user->modes, "B") !== false) ? ' <span class="label">Bot</span>' : ""; | |
145 | echo "<td>".$user->name.$isBot.'</td>'; | |
146 | echo "<td>".$user->id."</td>"; | |
147 | echo "<td>".$user->hostname." (".$user->ip.")</td>"; | |
148 | $account = (isset($user->user->account)) ? $user->user->account : '<span class="label bluelabel ">None</span>'; | |
149 | echo "<td>".$account."</td>"; | |
150 | $modes = (isset($user->user->modes)) ? "+" . $user->user->modes : "<none>"; | |
151 | echo "<td>".$modes."</td>"; | |
152 | $oper = (isset($user->user->operlogin)) ? $user->user->operlogin." <span class=\"label bluelabel\">".$user->user->operclass."</span>" : ""; | |
153 | if (!strlen($oper)) | |
154 | $oper = (strpos($user->user->modes, "S") !== false) ? '<span class="label secure-connection">Service</span>' : ""; | |
155 | echo "<td>".$oper."</td>"; | |
156 | $secure = (isset($user->tls)) ? "<span class=\"label secure-connection\">Secure</span>" : "<span class=\"label redlabel\">Insecure</span>"; | |
157 | echo "<td>".$secure."</td>"; | |
158 | echo "<td>".$user->user->servername."</td>"; | |
159 | echo "<td>".$user->user->reputation."</td>"; | |
160 | } | |
161 | ?></table> | |
162 | <label for="bantype">Apply action: </label><br> | |
163 | <select name="bantype" id="bantype"> | |
164 | <option value=""></option> | |
165 | <optgroup label="Bans"> | |
166 | <option value="gline">GLine</option> | |
167 | <option value="gzline">GZLine</option> | |
168 | </optgroup> | |
169 | </select> | |
170 | <br> | |
171 | <label for="banlen_w">Duration: </label><br> | |
172 | <select name="banlen_w" id="banlen_w"> | |
173 | <?php | |
174 | for ($i = 0; $i <= 56; $i++) | |
175 | { | |
176 | if (!$i) | |
177 | echo "<option value=\"0w\"></option>"; | |
178 | else | |
179 | { | |
180 | $w = ($i == 1) ? "week" : "weeks"; | |
181 | echo "<option value=\"$i" . "w\">$i $w" . "</option>"; | |
182 | } | |
183 | } | |
184 | ?> | |
185 | </select> | |
186 | <select name="banlen_d" id="banlen_d"> | |
187 | <?php | |
188 | for ($i = 0; $i <= 31; $i++) | |
189 | { | |
190 | if (!$i) | |
191 | echo "<option value=\"0d\"></option>"; | |
192 | else | |
193 | { | |
194 | $d = ($i == 1) ? "day" : "days"; | |
195 | echo "<option value=\"$i" . "d\">$i $d" . "</option>"; | |
196 | } | |
197 | } | |
198 | ?> | |
199 | </select> | |
200 | <select name="banlen_h" id="banlen_h"> | |
201 | <?php | |
202 | for ($i = 0; $i <= 24; $i++) | |
203 | { | |
204 | if (!$i) | |
205 | echo "<option value=\"0d\"></option>"; | |
206 | else | |
207 | { | |
208 | $h = ($i == 1) ? "hour" : "hours"; | |
209 | echo "<option value=\"$i" . "h\">$i $h" . "</option>"; | |
210 | } | |
211 | } | |
212 | ?> | |
213 | </select> | |
214 | <br><label for="ban_reason">Reason:<br></label> | |
215 | <textarea name="ban_reason" id="ban_reason">No reason</textarea><br> | |
216 | <input class="cute_button" type="submit" value="Apply"> | |
217 | </form> | |
218 | ||
1e6ffd06 BM |
219 | </div |
220 | </div> | |
e98b5a51 BM |
221 | |
222 | <?php require_once 'footer.php'; ?> |