2 require_once "../common.php";
3 require_once "../connection.php";
4 require_once "../header.php";
6 if ($uplink = $rpc->server()->get())
7 IRCList
::setmodes($uplink->server
->features
->chanmodes
);
8 $title = "Channel Lookup";
14 $can_edit = current_user_can(PERMISSION_EDIT_CHANNEL
);
17 if (isset($_GET['chan']))
19 $channel = $_GET['chan'];
20 $channelObj = $rpc->channel()->get($channel, 4);
21 if (!$channelObj && strlen($channel))
23 Message
::Fail("Could not find channel: \"$channel\"");
24 } elseif (strlen($channel)) {
26 $channame = $channelObj->name
;
27 $title .= " for \"" . $channame . "\"";
40 if (isset($_POST['update_topic']) && isset($_POST['set_topic']))
42 if (isset($channelObj))
44 if (!isset($channelObj->topic
) || strcmp($channelObj->topic
,$_POST['set_topic'])) // if the set topic is different
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'];
52 $checkboxes = (isset($_POST['ban_checkboxes'])) ? $_POST['ban_checkboxes'] : [];
53 if (isset($_POST['delete_sel_ex']))
55 foreach($_POST['ce_checkboxes'] as $c)
57 do_delete_chanex($channelObj, $checkboxes);
59 if (isset($_POST['delete_sel_inv']))
61 foreach($_POST['ci_checkboxes'] as $c)
63 do_delete_invite($channelObj, $checkboxes);
65 else if (isset($_POST['delete_sel_ban']))
67 foreach($_POST['cb_checkboxes'] as $c)
69 do_delete_chanban($channelObj, $checkboxes);
71 if (isset($_POST['add_chban']) || isset($_POST['add_chinv']) || isset($_POST['add_chex']))
74 if (isset($_POST['add_chban']))
75 $mode = $_POST['add_chban'];
77 $mode = (isset($_POST['add_chinv'])) ? $_POST['add_chinv'] : $_POST['add_chex'];
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;
82 $type_string = (strlen($_POST['bantype_sel_type'])) ? $_POST['bantype_sel_type'] : false;
84 $expiry = (strlen($_POST['bantype_sel_ex'])) ? $_POST['bantype_sel_ex'] : false;
88 $chanban_errors[] = "You did not specify a nick/mask";
92 if (strstr($action_string,"Quiet"))
94 elseif (strstr($action_string,"Nick-change"))
95 $action = "~nickchange:";
96 elseif (strstr($action_string,"Join"))
101 if (strstr($type_string,"Account"))
103 elseif (strstr($type_string,"Channel"))
105 elseif (strstr($type_string,"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"))
118 $future = strtotime($expiry);
119 $now = strtotime(date("Y-m-d h:i:s"));
120 $ts = ($future - $now) / 60;
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";
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");
131 foreach($chanban_errors as $err)
134 if ((isset($_POST['kickban']) || isset($_POST['muteban'])) && current_user_can(PERMISSION_EDIT_CHANNEL_USER))
136 $mute = (isset($_POST['muteban'])) ? true : false;
137 $mutestr = ($mute) ? "~quiet
:" : "";
138 $user = (!$mute) ? $_POST['kickban'] : $_POST['muteban'];
140 $kbuser = $rpc->user()->get($user);
143 Message::Fail("Could not kickban user
: User does not exist
");
146 $rpc->channel()->set_mode($channelObj->name, "+b
", "~time
:".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME.":".$mutestr."*!*@".$kbuser->user->cloakedhost);
148 $rpc->channel()->kick($channelObj->name, $kbuser->name, DEFAULT_CHAN_DETAIL_QUICK_BAN_REASON);
150 $msgbox_str = ($mute)
152 "User \"
$kbuser->name\" has been muted
for ".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME." minutes
."
154 "User \"
$kbuser->name\" has been banned
for ".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME." minutes
."
156 Message::Success($msgbox_str);
160 if (isset($_POST['newmodes']) && isset($_POST['paramed_modes']) && $can_edit)
162 $m = $_POST['newmodes'];
163 $p = $_POST['paramed_modes'];
166 $addmodestring = "+
";
167 $addparamstring = "";
168 $delmodestring = "-";
169 $delparamstring = "";
170 foreach ($m as $mode)
172 strcat($addmodestring, $mode);
173 if (isset($p[$mode]) && strlen($p[$mode]))
174 strcat($addparamstring, $p[$mode]." ");
177 $fmodes = $channelObj->modes;
178 $tok = split($fmodes);
180 $params = rparv($fmodes);
181 $paramed_modes = sort_paramed_modes($modes, $params);
182 for ($i = 0; isset($modes[$i]) && $mode = $modes[$i]; $i++)
184 if (!strstr($addmodestring, $mode))
186 $req = IRCList::lookup($mode)['requires'];
187 if ($req == "Server
")
189 strcat($delmodestring, $mode);
190 $grp = get_chmode_group($mode);
192 strcat($delparamstring, $paramed_modes[$mode]." ");
198 if ($rpc->channel()->set_mode($channel, $delmodestring.$addmodestring, $delparamstring." ".$addparamstring))
199 Message::Success("Channel settings have been successfully updated
");
201 Message::Fail("Could not change channel settings
: $rpc->error
");
204 /* Re-grab the channel because of updates */
205 $channelObj = $rpc->channel()->get($channel, 4);
209 <title><?php echo $title; ?></title>
210 <h6><?php echo $title; ?></h6>
214 <form method="get
" action="details
.php
">
215 <div class="text
-left input
-group
" style="width
: 35%
;">
216 <input class="form
-control
" id="chan
" name="chan
" type="text
" value="<?php
echo $channame; ?>">
217 <div class="input
-group
-append
">
218 <button type="submit
" class="btn btn
-primary
">Go</button>
222 <?php if (!$channelObj)
225 <!-- Modal for Add Ban -->
226 <div class="modal fade
" id="ban
" tabindex="-1" role="dialog
" aria-labelledby="confirmModalCenterTitle
" aria-hidden="true">
227 <div class="modal
-dialog modal
-lg modal
-dialog
-centered
" role="document
">
228 <div class="modal
-content
">
229 <div class="modal
-header
">
230 <h5 class="modal
-title
" id="myModalLabel
">Add New Channel Ban</h5>
231 <div type="button
" class="close
" data-dismiss="modal
" aria-label="Close
">
232 <span aria-hidden="true">×</span>
235 <div class="modal
-body
">
237 <div class="input
-group mb
-3">
238 <label for="ban_nick
">Mask
239 <a href="https
://www.unrealircd.org/docs/Extended_bans" target="__blank"><i class="fa fa-info-circle" aria-hidden="true"
240 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"
242 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
243 placeholder
="nick!user@host or something else"
247 <div
class="input-group mb-3">
248 <label
for="bantype_action">Ban Action
249 <select
class="form-control" name
="bantype_sel_action" id
="bantype_sel">
251 <option
>Quiet (Mute
)</option
>
252 <option
>Nick
-change
</option
>
253 <option
>Join
</option
>
257 <div
class="input-group mb-3">
258 <label
for="bantype_sel_type">Ban Type
259 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
261 <option
>Match Account
</option
>
262 <option
>Match Channel
</option
>
263 <option
>Match Country
</option
>
264 <option
>Match OperClass
</option
>
265 <option
>Match RealName
/ GECOS
</option
>
266 <option
>Match Security Group
</option
>
267 <option
>Match Certificate Fingerprint
</option
>
271 <div
class="input-group mb-3">
272 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
273 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
277 <div
class="modal-footer">
278 <input type
="hidden" id
="server" name
="add_chban" value
="b"></input
>
279 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
280 <button type
="submit" action
="post" class="btn btn-danger">Add Channel Ban
</button
>
288 <!-- Modal
for Add Invite
-->
289 <div
class="modal fade" id
="invite" tabindex
="-1" role
="dialog" aria
-labelledby
="add_invite_modal" aria
-hidden
="true">
290 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
291 <div
class="modal-content">
292 <div
class="modal-header">
293 <h5
class="modal-title" id
="add_invite_modal">Add
New Channel Invite
</h5
>
294 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
295 <span aria
-hidden
="true">×
;</span
>
298 <div
class="modal-body">
300 <div
class="input-group mb-3">
301 <label
for="ban_nick">Mask
302 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
303 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"
305 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
306 placeholder
="nick!user@host or something else"
310 <div
class="input-group mb-3">
311 <label
for="bantype_sel_type">Invite Type
312 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
314 <option
>Match Account
</option
>
315 <option
>Match Channel
</option
>
316 <option
>Match Country
</option
>
317 <option
>Match OperClass
</option
>
318 <option
>Match RealName
/ GECOS
</option
>
319 <option
>Match Security Group
</option
>
320 <option
>Match Certificate Fingerprint
</option
>
324 <div
class="input-group mb-3">
325 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
326 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
330 <div
class="modal-footer">
331 <input type
="hidden" name
="add_chinv" value
="I"></input
>
332 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
333 <button type
="submit" action
="post" class="btn btn-danger">Add Invite
</button
>
340 <!-- Modal
for Add Ban Exceptions
-->
341 <div
class="modal fade" id
="except" tabindex
="-1" role
="dialog" aria
-labelledby
="except" aria
-hidden
="true">
342 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
343 <div
class="modal-content">
344 <div
class="modal-header">
345 <h5
class="modal-title" >Add
New Channel Ban Exception
</h5
>
346 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
347 <span aria
-hidden
="true">×
;</span
>
350 <div
class="modal-body">
352 <div
class="input-group mb-3">
353 <label
for="ban_nick">Mask
354 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
355 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"
357 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
358 placeholder
="nick!user@host or something else"
362 <div
class="input-group mb-3">
363 <label
for="bantype_sel_type">Ban Type
364 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
366 <option
>Match Account
</option
>
367 <option
>Match Channel
</option
>
368 <option
>Match Country
</option
>
369 <option
>Match OperClass
</option
>
370 <option
>Match RealName
/ GECOS
</option
>
371 <option
>Match Security Group
</option
>
372 <option
>Match Certificate Fingerprint
</option
>
376 <div
class="input-group mb-3">
377 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
378 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
382 <div
class="modal-footer">
383 <input type
="hidden" id
="server" name
="add_chex" value
="e"></input
>
384 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
385 <button type
="submit" action
="post" class="btn btn-danger">Add Exception
</button
>
392 <!-- Modal
for Edit Channel Modes
-->
393 <div
class="modal fade" id
="editchmodes" tabindex
="-1" role
="dialog" aria
-labelledby
="editchmodes" aria
-hidden
="true">
394 <div
class="modal-dialog modal-dialog-centered" role
="document">
395 <div
class="modal-content">
396 <div
class="modal-header">
397 <h5
class="modal-title" id
="editchmodes">Edit Channel Modes
</h5
>
398 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
399 <span aria
-hidden
="true">×
;</span
>
402 <div
class="modal-body">
405 <?php
generate_edit_chmodes($channelObj); ?>
408 <div
class="modal-footer">
409 <input type
="hidden" id
="server" name
="add_chex" value
="e"></input
>
410 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
411 <button type
="submit" action
="post" class="btn btn-danger">Update
</button
>
421 <form method
="post" action
="details.php?chan=<?php echo urlencode($channelObj->name); ?>">
422 <div
class="input-group">
423 <input maxlength
="360" type
="text" class="input-group form-control" name
="set_topic" value
="<?php echo (isset($channelObj->topic)) ? htmlspecialchars($channelObj->topic) : ""; ?>">
424 <div
class="input-group-append"><button type
="submit" name
="update_topic" value
="true" class="btn btn-info">Update Topic
</button
></div
></div
>
428 Message
::Success("The topic for $channelObj->name has been updated to be: \"".htmlspecialchars($channelObj->topic
)."\"");
432 <!-- Modal
for User Action
-->
433 <div
class="modal fade" id
="useraction" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
434 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
435 <div
class="modal-content">
436 <div
class="modal-header">
437 <h5
class="modal-title" id
="myModalLabel">Add
New Channel Ban
</h5
>
438 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
439 <span aria
-hidden
="true">×
;</span
>
442 <div
class="modal-body">
444 <div
class="input-group mb-3">
445 <label
for="ban_nick">Mask
446 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
447 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"
449 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
450 placeholder
="nick!user@host or something else"
454 <div
class="input-group mb-3">
455 <label
for="bantype_action">Ban Action
456 <select
class="form-control" name
="bantype_sel_action" id
="bantype_sel">
458 <option
>Quiet (Mute
)</option
>
459 <option
>Nick
-change
</option
>
460 <option
>Join
</option
>
464 <div
class="input-group mb-3">
465 <label
for="bantype_sel_type">Ban Type
466 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
468 <option
>Match Account
</option
>
469 <option
>Match Channel
</option
>
470 <option
>Match Country
</option
>
471 <option
>Match OperClass
</option
>
472 <option
>Match RealName
/ GECOS
</option
>
473 <option
>Match Security Group
</option
>
474 <option
>Match Certificate Fingerprint
</option
>
478 <div
class="input-group mb-3">
479 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
480 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
484 <div
class="modal-footer">
485 <input type
="hidden" id
="server" name
="add_chban" value
="b"></input
>
486 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
487 <button type
="submit" action
="post" class="btn btn-danger">Add Channel Ban
</button
>
494 <div
class="container-xxl">
496 <div
class="col-sm-4">
498 <div
class="card-body">
499 <h6
class="card-title">User
List</h6
>
500 <p
class="card-text"><?php
generate_chan_occupants_table($channelObj); ?></p
>
504 <div
class="col-sm-8">
506 <div
class="card-body">
507 <h6
class="card-title">Channel Settings
</h6
>
508 <ul
class="nav nav-tabs" role
="tablist">
509 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanmodes" aria
-controls
="chanmodes" role
="tab" data
-toggle
="tab">Settings
/ Modes
</a
></li
>
510 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanbans" aria
-controls
="chanbans" role
="tab" data
-toggle
="tab">Bans
</a
></li
>
511 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chaninv" aria
-controls
="chaninv" role
="tab" data
-toggle
="tab">Invites
</a
></li
>
512 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanex" aria
-controls
="chanex" role
="tab" data
-toggle
="tab">Excepts
</a
></li
>
515 <div
class="tab-content">
517 <div
class="tab-pane fade in" id
="chanmodes">
518 <button id
="editlol" class="btn btn-sm btn-primary" <?php
echo ($can_edit) ? "" : "disabled"; ?>>Change Settings
</button
>
519 <p
class="card-text"><?php
generate_html_chansettings($channelObj); ?></p
>
520 </div
><form id
="editchanmodes" method
="post" name
="editchanmodes">
521 <div
class="tab-pane" style
="display: none" id
="chanmodes_edit">
523 <div
class="btn btn-sm btn-secondary" id
="editchmodesbk">Go back
</div
>
524 <button type
="submit" class="btn btn-sm btn-primary">Save Changes
</button
>
525 <p
class="card-text"><?php
generate_edit_chmodes($channelObj); ?></p
>
529 <div
class="tab-pane fade in" id
="chanbans">
530 <p
class="card-text"><?php
generate_chanbans_table($channelObj); ?></p
>
532 <div
class="tab-pane fade in" id
="chaninv">
533 <p
class="card-text"><?php
generate_chaninvites_table($channelObj); ?></p
>
535 <div
class="tab-pane fade in" id
="chanex">
536 <p
class="card-text"><?php
generate_chanexcepts_table($channelObj); ?></p
>
538 <div
class="tab-pane fade in" id
="chanmodes_edit">
539 <p
class="card-text"><?php
/* insert hacks here */ ?></p
>
548 const toggleBtn
= document
.getElementById('editlol');
549 const staticInfo
= document
.getElementById('chanmodes');
550 const options
= document
.getElementById('chanmodes_edit');
551 const backBtn
= document
.getElementById('editchmodesbk');
553 backBtn
.addEventListener('click', function() {
554 staticInfo
.style
.display
= '';
555 options
.style
.display
= 'none';
557 toggleBtn
.addEventListener('click', function() {
558 staticInfo
.style
.display
= 'none';
559 options
.style
.display
= '';
562 // show dat first tab
563 $
('.nav-tabs a[href="#chanmodes"]').tab('show')
566 require_once("../footer.php");