]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | require_once "../inc/common.php"; | |
3 | require_once "../inc/connection.php"; | |
4 | require_once "../inc/header.php"; | |
5 | ||
6 | if ($uplink = $rpc->server()->get()) | |
7 | IRCList::setmodes($uplink->server->features->chanmodes); | |
8 | $title = "Channel Lookup"; | |
9 | $channel = ""; | |
10 | $channame = ""; | |
11 | $nick = NULL; | |
12 | $channelObj = NULL; | |
13 | ||
14 | $can_edit = current_user_can(PERMISSION_EDIT_CHANNEL); | |
15 | do_log($_GET); | |
16 | do_log($_POST); | |
17 | if (isset($_GET['chan'])) | |
18 | { | |
19 | $channel = $_GET['chan']; | |
20 | $channelObj = $rpc->channel()->get($channel, 4); | |
21 | if (!$channelObj && strlen($channel)) | |
22 | { | |
23 | Message::Fail("Could not find channel: \"$channel\""); | |
24 | } elseif (strlen($channel)) { | |
25 | ||
26 | $channame = $channelObj->name; | |
27 | $title .= " for \"" . $channame . "\""; | |
28 | do_log($channelObj); | |
29 | } | |
30 | } | |
31 | $topicset = false; | |
32 | $del_ex = false; | |
33 | $del_inv = false; | |
34 | $del_ban = false; | |
35 | $checkboxes = []; | |
36 | ||
37 | $chanban_errors = []; | |
38 | if (!empty($_POST)) | |
39 | { | |
40 | if (isset($_POST['update_topic']) && isset($_POST['set_topic'])) | |
41 | { | |
42 | if (isset($channelObj)) | |
43 | { | |
44 | if (!isset($channelObj->topic) || strcmp($channelObj->topic,$_POST['set_topic'])) // if the set topic is different | |
45 | { | |
46 | $user = (function_exists('unreal_get_current_user') && $u = unreal_get_current_user()) ? $u->username : NULL; | |
47 | $topicset = $rpc->channel()->set_topic($channelObj->name, $_POST['set_topic'], $user); | |
48 | $channelObj->topic = $_POST['set_topic']; | |
49 | } | |
50 | } | |
51 | } | |
52 | $checkboxes = (isset($_POST['ban_checkboxes'])) ? $_POST['ban_checkboxes'] : []; | |
53 | if (isset($_POST['delete_sel_ex'])) | |
54 | { | |
55 | foreach($_POST['ce_checkboxes'] as $c) | |
56 | $checkboxes[] = $c; | |
57 | do_delete_chanex($channelObj, $checkboxes); | |
58 | } | |
59 | if (isset($_POST['delete_sel_inv'])) | |
60 | { | |
61 | foreach($_POST['ci_checkboxes'] as $c) | |
62 | $checkboxes[] = $c; | |
63 | do_delete_invite($channelObj, $checkboxes); | |
64 | } | |
65 | else if (isset($_POST['delete_sel_ban'])) | |
66 | { | |
67 | foreach($_POST['cb_checkboxes'] as $c) | |
68 | $checkboxes[] = $c; | |
69 | do_delete_chanban($channelObj, $checkboxes); | |
70 | } | |
71 | if (isset($_POST['add_chban']) || isset($_POST['add_chinv']) || isset($_POST['add_chex'])) | |
72 | { | |
73 | ||
74 | if (isset($_POST['add_chban'])) | |
75 | $mode = $_POST['add_chban']; | |
76 | else | |
77 | $mode = (isset($_POST['add_chinv'])) ? $_POST['add_chinv'] : $_POST['add_chex']; | |
78 | ||
79 | $nick = (strlen($_POST['ban_nick'])) ? $_POST['ban_nick'] : false; | |
80 | $action_string = (isset($_POST['bantype_sel_action']) && strlen($_POST['bantype_sel_action'])) ? $_POST['bantype_sel_action'] : false; | |
81 | $action = ""; | |
82 | $type_string = (strlen($_POST['bantype_sel_type'])) ? $_POST['bantype_sel_type'] : false; | |
83 | $type = ""; | |
84 | $expiry = (strlen($_POST['bantype_sel_ex'])) ? $_POST['bantype_sel_ex'] : false; | |
85 | $time = ""; | |
86 | ||
87 | if (!$nick) | |
88 | $chanban_errors[] = "You did not specify a nick/mask"; | |
89 | ||
90 | if ($action_string) | |
91 | { | |
92 | if (strstr($action_string,"Quiet")) | |
93 | $action = "~quiet:"; | |
94 | elseif (strstr($action_string,"Nick-change")) | |
95 | $action = "~nickchange:"; | |
96 | elseif (strstr($action_string,"Join")) | |
97 | $action = "~join:"; | |
98 | } | |
99 | if ($type_string) | |
100 | { | |
101 | if (strstr($type_string,"Account")) | |
102 | $type = "~account:"; | |
103 | elseif (strstr($type_string,"Channel")) | |
104 | $type = "~channel:"; | |
105 | elseif (strstr($type_string,"Country")) | |
106 | $type = "~country:"; | |
107 | elseif (strstr($type_string,"OperClass")) | |
108 | $type = "~operclass:"; | |
109 | elseif (strstr($type_string,"GECOS")) | |
110 | $type = "~realname:"; | |
111 | elseif (strstr($type_string,"Security")) | |
112 | $type = "~security-group:"; | |
113 | elseif (strstr($type_string,"Certificate")) | |
114 | $type = "~certfp:"; | |
115 | } | |
116 | if ($expiry) | |
117 | { | |
118 | $future = strtotime($expiry); | |
119 | $now = strtotime(date("Y-m-d h:i:s")); | |
120 | $ts = ($future - $now) / 60; | |
121 | $ts = (int)$ts; | |
122 | $time = "~time:$ts:"; | |
123 | if ($ts > 9999 || $ts < 1) | |
124 | $chanban_errors[] = "Cannot set expiry more than ".(9999 / 60)." hours (".(9999 / 1440)." days) in the future, or in the past"; | |
125 | } | |
126 | if (empty($chanban_errors)) | |
127 | if ($rpc->channel()->set_mode($channel, "$mode", "$time$action$type$nick")) | |
128 | Message::Success("The mode was set successfully: $mode $time$action$type$nick"); | |
129 | ||
130 | else | |
131 | foreach($chanban_errors as $err) | |
132 | Message::Fail($err); | |
133 | } | |
134 | if ((isset($_POST['kickban']) || isset($_POST['muteban'])) && current_user_can(PERMISSION_EDIT_CHANNEL_USER)) | |
135 | { | |
136 | $mute = (isset($_POST['muteban'])) ? true : false; | |
137 | $mutestr = ($mute) ? "~quiet:" : ""; | |
138 | $user = (!$mute) ? $_POST['kickban'] : $_POST['muteban']; | |
139 | ||
140 | $kbuser = $rpc->user()->get($user); | |
141 | ||
142 | if (!$kbuser) | |
143 | Message::Fail("Could not kickban user: User does not exist"); | |
144 | else | |
145 | { | |
146 | $rpc->channel()->set_mode($channelObj->name, "+b", "~time:".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME.":".$mutestr."*!*@".$kbuser->user->cloakedhost); | |
147 | if (!$mute) | |
148 | $rpc->channel()->kick($channelObj->name, $kbuser->name, DEFAULT_CHAN_DETAIL_QUICK_BAN_REASON); | |
149 | ||
150 | $msgbox_str = ($mute) | |
151 | ? | |
152 | "User \"$kbuser->name\" has been muted for ".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME." minutes." | |
153 | : | |
154 | "User \"$kbuser->name\" has been banned for ".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME." minutes." | |
155 | ; | |
156 | Message::Success($msgbox_str); | |
157 | } | |
158 | } | |
159 | ||
160 | if (isset($_POST['newmodes']) && isset($_POST['paramed_modes']) && $can_edit) | |
161 | { | |
162 | $m = $_POST['newmodes']; | |
163 | $p = $_POST['paramed_modes']; | |
164 | ||
165 | do_log($p,$m); | |
166 | $addmodestring = "+"; | |
167 | $addparamstring = ""; | |
168 | $delmodestring = "-"; | |
169 | $delparamstring = ""; | |
170 | foreach ($m as $mode) | |
171 | { | |
172 | strcat($addmodestring, $mode); | |
173 | if (isset($p[$mode]) && strlen($p[$mode])) | |
174 | strcat($addparamstring, $p[$mode]." "); | |
175 | } | |
176 | ||
177 | $fmodes = $channelObj->modes; | |
178 | $tok = split($fmodes); | |
179 | $modes = $tok[0]; | |
180 | $params = rparv($fmodes); | |
181 | $paramed_modes = sort_paramed_modes($modes, $params); | |
182 | for ($i = 0; isset($modes[$i]) && $mode = $modes[$i]; $i++) | |
183 | { | |
184 | if (!strstr($addmodestring, $mode)) | |
185 | { | |
186 | $req = IRCList::lookup($mode)['requires']; | |
187 | if ($req == "Server") | |
188 | continue; | |
189 | strcat($delmodestring, $mode); | |
190 | $grp = get_chmode_group($mode); | |
191 | if ($grp == 2) | |
192 | strcat($delparamstring, $paramed_modes[$mode]." "); | |
193 | } | |
194 | ||
195 | } | |
196 | ||
197 | ||
198 | if ($rpc->channel()->set_mode($channel, $delmodestring.$addmodestring, $delparamstring." ".$addparamstring)) | |
199 | Message::Success("Channel settings have been successfully updated"); | |
200 | else | |
201 | Message::Fail("Could not change channel settings: $rpc->error"); | |
202 | } | |
203 | ||
204 | /* Re-grab the channel because of updates */ | |
205 | $channelObj = $rpc->channel()->get($channel, 4); | |
206 | } | |
207 | ||
208 | ?> | |
209 | <title><?php echo $title; ?></title> | |
210 | <h6><?php echo $title; ?></h6> | |
211 | ||
212 | ||
213 | <form method="get" action="details.php"> | |
214 | <div class="text-left input-group" style="width: 35%;"> | |
215 | <input class="form-control" id="chan" name="chan" type="text" value="<?php echo $channame; ?>"> | |
216 | <div class="input-group-append"> | |
217 | <button type="submit" class="btn btn-primary">Go</button> | |
218 | </div> | |
219 | </div> | |
220 | </form> | |
221 | <?php if (!$channelObj) | |
222 | { | |
223 | require_once("../inc/footer.php"); | |
224 | return; | |
225 | } | |
226 | ?> | |
227 | ||
228 | <!-- Modal for Add Ban --> | |
229 | <div class="modal fade" id="ban" tabindex="-1" role="dialog" aria-labelledby="confirmModalCenterTitle" aria-hidden="true"> | |
230 | <div class="modal-dialog modal-lg modal-dialog-centered" role="document"> | |
231 | <div class="modal-content"> | |
232 | <div class="modal-header"> | |
233 | <h5 class="modal-title" id="myModalLabel">Add New Channel Ban</h5> | |
234 | <div type="button" class="close" data-dismiss="modal" aria-label="Close"> | |
235 | <span aria-hidden="true">×</span> | |
236 | </div> | |
237 | </div> | |
238 | <div class="modal-body"> | |
239 | <form method="post"> | |
240 | <div class="input-group mb-3"> | |
241 | <label for="ban_nick">Mask | |
242 | <a href="https://www.unrealircd.org/docs/Extended_bans" target="__blank"><i class="fa fa-info-circle" aria-hidden="true" | |
243 | title="The mask or other value. For example if you are matching a country in 'Ban Type' then you would put the country code as this value. Click to view more information on Extended Bans" | |
244 | ></i></a> | |
245 | <input style="width: 170%;" name="ban_nick" id="ban_nick" class="form-control curvy" type="text" | |
246 | placeholder="nick!user@host or something else" | |
247 | ></label> | |
248 | ||
249 | </div> | |
250 | <div class="input-group mb-3"> | |
251 | <label for="bantype_action">Ban Action | |
252 | <select class="form-control" name="bantype_sel_action" id="bantype_sel"> | |
253 | <option></option> | |
254 | <option>Quiet (Mute)</option> | |
255 | <option>Nick-change</option> | |
256 | <option>Join</option> | |
257 | </select> | |
258 | </label> | |
259 | </div> | |
260 | <div class="input-group mb-3"> | |
261 | <label for="bantype_sel_type">Ban Type <small>Leave this blank for a "normal" ban</small> | |
262 | <select class="form-control" name="bantype_sel_type" id="bantype_sel_type"> | |
263 | <option></option> | |
264 | <option>Match Account</option> | |
265 | <option>Match Channel</option> | |
266 | <option>Match Country</option> | |
267 | <option>Match OperClass</option> | |
268 | <option>Match RealName / GECOS</option> | |
269 | <option>Match Security Group</option> | |
270 | <option>Match Certificate Fingerprint</option> | |
271 | </select> | |
272 | </label> | |
273 | </div> | |
274 | <div class="input-group mb-3"> | |
275 | <label for="bantype_sel_ex">Expiry Date-Time <br><small>Leave blank to mean "Permanent"</small> | |
276 | <input type="datetime-local" name="bantype_sel_ex" id="bantype_sel_ex" class="form-control"> | |
277 | </label> | |
278 | </div> | |
279 | </div> | |
280 | <div class="modal-footer"> | |
281 | <input type="hidden" id="server" name="add_chban" value="b"></input> | |
282 | <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> | |
283 | <button type="submit" action="post" class="btn btn-danger">Add Channel Ban</button> | |
284 | </form> | |
285 | </div> | |
286 | </div> | |
287 | </div> | |
288 | </div> | |
289 | ||
290 | ||
291 | <!-- Modal for Add Invite --> | |
292 | <div class="modal fade" id="invite" tabindex="-1" role="dialog" aria-labelledby="add_invite_modal" aria-hidden="true"> | |
293 | <div class="modal-dialog modal-lg modal-dialog-centered" role="document"> | |
294 | <div class="modal-content"> | |
295 | <div class="modal-header"> | |
296 | <h5 class="modal-title" id="add_invite_modal">Add New Channel Invite</h5> | |
297 | <div type="button" class="close" data-dismiss="modal" aria-label="Close"> | |
298 | <span aria-hidden="true">×</span> | |
299 | </div> | |
300 | </div> | |
301 | <div class="modal-body"> | |
302 | <form method="post"> | |
303 | <div class="input-group mb-3"> | |
304 | <label for="ban_nick">Mask | |
305 | <a href="https://www.unrealircd.org/docs/Extended_bans" target="__blank"><i class="fa fa-info-circle" aria-hidden="true" | |
306 | title="The mask or other value. For example if you are matching a country in 'Invite Type' then you would put the country code as this value. Click to view more information on Extended Bans" | |
307 | ></i></a> | |
308 | <input style="width: 170%;" name="ban_nick" id="ban_nick" class="form-control curvy" type="text" | |
309 | placeholder="nick!user@host or something else" | |
310 | ></label> | |
311 | ||
312 | </div> | |
313 | <div class="input-group mb-3"> | |
314 | <label for="bantype_sel_type">Invite Type | |
315 | <select class="form-control" name="bantype_sel_type" id="bantype_sel_type"> | |
316 | <option></option> | |
317 | <option>Match Account</option> | |
318 | <option>Match Channel</option> | |
319 | <option>Match Country</option> | |
320 | <option>Match OperClass</option> | |
321 | <option>Match RealName / GECOS</option> | |
322 | <option>Match Security Group</option> | |
323 | <option>Match Certificate Fingerprint</option> | |
324 | </select> | |
325 | </label> | |
326 | </div> | |
327 | <div class="input-group mb-3"> | |
328 | <label for="bantype_sel_ex">Expiry Date-Time <br><small>Leave blank to mean "Permanent"</small> | |
329 | <input type="datetime-local" name="bantype_sel_ex" id="bantype_sel_ex" class="form-control"> | |
330 | </label> | |
331 | </div> | |
332 | </div> | |
333 | <div class="modal-footer"> | |
334 | <input type="hidden" name="add_chinv" value="I"></input> | |
335 | <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> | |
336 | <button type="submit" action="post" class="btn btn-danger">Add Invite</button> | |
337 | </form> | |
338 | </div> | |
339 | </div> | |
340 | </div> | |
341 | </div> | |
342 | ||
343 | <!-- Modal for Add Ban Exceptions --> | |
344 | <div class="modal fade" id="except" tabindex="-1" role="dialog" aria-labelledby="except" aria-hidden="true"> | |
345 | <div class="modal-dialog modal-lg modal-dialog-centered" role="document"> | |
346 | <div class="modal-content"> | |
347 | <div class="modal-header"> | |
348 | <h5 class="modal-title" >Add New Channel Ban Exception</h5> | |
349 | <div type="button" class="close" data-dismiss="modal" aria-label="Close"> | |
350 | <span aria-hidden="true">×</span> | |
351 | </div> | |
352 | </div> | |
353 | <div class="modal-body"> | |
354 | <form method="post"> | |
355 | <div class="input-group mb-3"> | |
356 | <label for="ban_nick">Mask | |
357 | <a href="https://www.unrealircd.org/docs/Extended_bans" target="__blank"><i class="fa fa-info-circle" aria-hidden="true" | |
358 | title="The mask or other value. For example if you are matching a country in 'Ban Type' then you would put the country code as this value. Click to view more information on Extended Bans" | |
359 | ></i></a> | |
360 | <input style="width: 170%;" name="ban_nick" id="ban_nick" class="form-control curvy" type="text" | |
361 | placeholder="nick!user@host or something else" | |
362 | ></label> | |
363 | ||
364 | </div> | |
365 | <div class="input-group mb-3"> | |
366 | <label for="bantype_sel_type">Ban Type | |
367 | <select class="form-control" name="bantype_sel_type" id="bantype_sel_type"> | |
368 | <option></option> | |
369 | <option>Match Account</option> | |
370 | <option>Match Channel</option> | |
371 | <option>Match Country</option> | |
372 | <option>Match OperClass</option> | |
373 | <option>Match RealName / GECOS</option> | |
374 | <option>Match Security Group</option> | |
375 | <option>Match Certificate Fingerprint</option> | |
376 | </select> | |
377 | </label> | |
378 | </div> | |
379 | <div class="input-group mb-3"> | |
380 | <label for="bantype_sel_ex">Expiry Date-Time <br><small>Leave blank to mean "Permanent"</small> | |
381 | <input type="datetime-local" name="bantype_sel_ex" id="bantype_sel_ex" class="form-control"> | |
382 | </label> | |
383 | </div> | |
384 | </div> | |
385 | <div class="modal-footer"> | |
386 | <input type="hidden" id="server" name="add_chex" value="e"></input> | |
387 | <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> | |
388 | <button type="submit" action="post" class="btn btn-danger">Add Exception</button> | |
389 | </form> | |
390 | </div> | |
391 | </div> | |
392 | </div> | |
393 | </div> | |
394 | ||
395 | <!-- Modal for Edit Channel Modes --> | |
396 | <div class="modal fade" id="editchmodes" tabindex="-1" role="dialog" aria-labelledby="editchmodes" aria-hidden="true"> | |
397 | <div class="modal-dialog modal-dialog-centered" role="document"> | |
398 | <div class="modal-content"> | |
399 | <div class="modal-header"> | |
400 | <h5 class="modal-title" id="editchmodes">Edit Channel Modes</h5> | |
401 | <div type="button" class="close" data-dismiss="modal" aria-label="Close"> | |
402 | <span aria-hidden="true">×</span> | |
403 | </div> | |
404 | </div> | |
405 | <div class="modal-body"> | |
406 | <form method="post"> | |
407 | <?php generate_edit_chmodes($channelObj); ?> | |
408 | <input type="hidden" id="server" name="add_chex" value="e"></input> | |
409 | <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> | |
410 | <button type="submit" action="post" class="btn btn-danger">Update</button> | |
411 | </form> | |
412 | </div> | |
413 | </div> | |
414 | </div> | |
415 | </div> | |
416 | ||
417 | <br> | |
418 | <h6> | |
419 | Topic:<br></h6> | |
420 | <form method="post" action="details.php?chan=<?php echo urlencode($channelObj->name); ?>"> | |
421 | <div class="input-group"> | |
422 | <input maxlength="360" type="text" class="input-group form-control" name="set_topic" value="<?php echo (isset($channelObj->topic)) ? htmlspecialchars($channelObj->topic) : ""; ?>"> | |
423 | <div class="input-group-append"><button type="submit" name="update_topic" value="true" class="btn btn-info">Update Topic</button></div></div> | |
424 | </form> | |
425 | <?php | |
426 | if ($topicset) | |
427 | Message::Success("The topic for $channelObj->name has been updated to be: \"".htmlspecialchars($channelObj->topic)."\""); | |
428 | ?> | |
429 | <br> | |
430 | ||
431 | <!-- Modal for User Action --> | |
432 | <div class="modal fade" id="useraction" tabindex="-1" role="dialog" aria-labelledby="confirmModalCenterTitle" aria-hidden="true"> | |
433 | <div class="modal-dialog modal-lg modal-dialog-centered" role="document"> | |
434 | <div class="modal-content"> | |
435 | <div class="modal-header"> | |
436 | <h5 class="modal-title" id="myModalLabel">Add New Channel Ban</h5> | |
437 | <div type="button" class="close" data-dismiss="modal" aria-label="Close"> | |
438 | <span aria-hidden="true">×</span> | |
439 | </div> | |
440 | </div> | |
441 | <div class="modal-body"> | |
442 | <form method="post"> | |
443 | <div class="input-group mb-3"> | |
444 | <label for="ban_nick">Mask | |
445 | <a href="https://www.unrealircd.org/docs/Extended_bans" target="__blank"><i class="fa fa-info-circle" aria-hidden="true" | |
446 | title="The mask or other value. For example if you are matching a country in 'Ban Type' then you would put the country code as this value. Click to view more information on Extended Bans" | |
447 | ></i></a> | |
448 | <input style="width: 170%;" name="ban_nick" id="ban_nick" class="form-control curvy" type="text" | |
449 | placeholder="nick!user@host or something else" | |
450 | ></label> | |
451 | ||
452 | </div> | |
453 | <div class="input-group mb-3"> | |
454 | <label for="bantype_action">Ban Action | |
455 | <select class="form-control" name="bantype_sel_action" id="bantype_sel"> | |
456 | <option></option> | |
457 | <option>Quiet (Mute)</option> | |
458 | <option>Nick-change</option> | |
459 | <option>Join</option> | |
460 | </select> | |
461 | </label> | |
462 | </div> | |
463 | <div class="input-group mb-3"> | |
464 | <label for="bantype_sel_type">Ban Type | |
465 | <select class="form-control" name="bantype_sel_type" id="bantype_sel_type"> | |
466 | <option></option> | |
467 | <option>Match Account</option> | |
468 | <option>Match Channel</option> | |
469 | <option>Match Country</option> | |
470 | <option>Match OperClass</option> | |
471 | <option>Match RealName / GECOS</option> | |
472 | <option>Match Security Group</option> | |
473 | <option>Match Certificate Fingerprint</option> | |
474 | </select> | |
475 | </label> | |
476 | </div> | |
477 | <div class="input-group mb-3"> | |
478 | <label for="bantype_sel_ex">Expiry Date-Time <br><small>Leave blank to mean "Permanent"</small> | |
479 | <input type="datetime-local" name="bantype_sel_ex" id="bantype_sel_ex" class="form-control"> | |
480 | </label> | |
481 | </div> | |
482 | </div> | |
483 | <div class="modal-footer"> | |
484 | <input type="hidden" id="server" name="add_chban" value="b"></input> | |
485 | <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> | |
486 | <button type="submit" action="post" class="btn btn-danger">Add Channel Ban</button> | |
487 | </form> | |
488 | </div> | |
489 | </div> | |
490 | </div> | |
491 | </div> | |
492 | ||
493 | <div class="container-xxl"> | |
494 | <div class="row"> | |
495 | <div class="col-sm-4"> | |
496 | <div class="card"> | |
497 | <div class="card-body"> | |
498 | <h6 class="card-title">User List</h6> | |
499 | <p class="card-text"><?php generate_chan_occupants_table($channelObj); ?></p> | |
500 | </div> | |
501 | </div> | |
502 | </div> | |
503 | <div class="col-sm-8"> | |
504 | <div class="card"> | |
505 | <div class="card-body"> | |
506 | <h6 class="card-title">Channel Settings</h6> | |
507 | <ul class="nav nav-tabs" role="tablist"> | |
508 | <li class="nav-item" role="presentation"><a class="nav-link" href="#chanmodes" aria-controls="chanmodes" role="tab" data-toggle="tab">Settings / Modes</a></li> | |
509 | <li class="nav-item" role="presentation"><a class="nav-link" href="#chanbans" aria-controls="chanbans" role="tab" data-toggle="tab">Bans</a></li> | |
510 | <li class="nav-item" role="presentation"><a class="nav-link" href="#chaninv" aria-controls="chaninv" role="tab" data-toggle="tab">Invites</a></li> | |
511 | <li class="nav-item" role="presentation"><a class="nav-link" href="#chanex" aria-controls="chanex" role="tab" data-toggle="tab">Excepts</a></li> | |
512 | </ul> | |
513 | ||
514 | <div class="tab-content"> | |
515 | <br> | |
516 | <div class="tab-pane fade in" id="chanmodes"> | |
517 | <button id="editlol" class="btn btn-sm btn-primary" <?php echo ($can_edit) ? "" : "disabled"; ?>>Change Settings</button> | |
518 | <p class="card-text"><?php generate_html_chansettings($channelObj); ?></p> | |
519 | </div><form id="editchanmodes" method="post" name="editchanmodes"> | |
520 | <div class="tab-pane" style="display: none" id="chanmodes_edit"> | |
521 | ||
522 | <div class="btn btn-sm btn-secondary" id="editchmodesbk">Go back</div> | |
523 | <button type="submit" class="btn btn-sm btn-primary">Save Changes</button> | |
524 | <p class="card-text"><?php generate_edit_chmodes($channelObj); ?></p> | |
525 | </form> | |
526 | </div> | |
527 | ||
528 | <div class="tab-pane fade in" id="chanbans"> | |
529 | <p class="card-text"><?php generate_chanbans_table($channelObj); ?></p> | |
530 | </div> | |
531 | <div class="tab-pane fade in" id="chaninv"> | |
532 | <p class="card-text"><?php generate_chaninvites_table($channelObj); ?></p> | |
533 | </div> | |
534 | <div class="tab-pane fade in" id="chanex"> | |
535 | <p class="card-text"><?php generate_chanexcepts_table($channelObj); ?></p> | |
536 | </div> | |
537 | <div class="tab-pane fade in" id="chanmodes_edit"> | |
538 | <p class="card-text"><?php /* insert hacks here */ ?></p> | |
539 | </div> | |
540 | ||
541 | </div> | |
542 | </div> | |
543 | </div> | |
544 | </div> | |
545 | </div> | |
546 | <script> | |
547 | const toggleBtn = document.getElementById('editlol'); | |
548 | const staticInfo = document.getElementById('chanmodes'); | |
549 | const options = document.getElementById('chanmodes_edit'); | |
550 | const backBtn = document.getElementById('editchmodesbk'); | |
551 | ||
552 | backBtn.addEventListener('click', function() { | |
553 | staticInfo.style.display = ''; | |
554 | options.style.display = 'none'; | |
555 | }); | |
556 | toggleBtn.addEventListener('click', function() { | |
557 | staticInfo.style.display = 'none'; | |
558 | options.style.display = ''; | |
559 | }); | |
560 | ||
561 | // show dat first tab | |
562 | $('.nav-tabs a[href="#chanmodes"]').tab('show') | |
563 | </script> | |
564 | <?php | |
565 | require_once("../inc/footer.php"); | |
566 |