X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/d2db68e37307c4918e3c948c0f9ea08f766e764b..f849e0c715b70742a92d1312c2a8eac6cc4336c4:/channels/details.php?ds=sidebyside diff --git a/channels/details.php b/channels/details.php index c4649ef..46d3321 100644 --- a/channels/details.php +++ b/channels/details.php @@ -1,19 +1,23 @@ server()->get()) + IRCList::setmodes($uplink->server->features->chanmodes); $title = "Channel Lookup"; $channel = ""; $channame = ""; $nick = NULL; $channelObj = NULL; + +$can_edit = current_user_can(PERMISSION_EDIT_CHANNEL); do_log($_GET); do_log($_POST); if (isset($_GET['chan'])) { $channel = $_GET['chan']; - $channelObj = $rpc->channel()->get($channel); + $channelObj = $rpc->channel()->get($channel, 4); if (!$channelObj && strlen($channel)) { Message::Fail("Could not find channel: \"$channel\""); @@ -31,7 +35,7 @@ $del_ban = false; $checkboxes = []; $chanban_errors = []; -if (isset($_POST)) +if (!empty($_POST)) { if (isset($_POST['update_topic']) && isset($_POST['set_topic'])) { @@ -50,22 +54,19 @@ if (isset($_POST)) { foreach($_POST['ce_checkboxes'] as $c) $checkboxes[] = $c; - $del_ex = true; - chlkup_autoload_modal("excepts_modal"); + do_delete_chanex($channelObj, $checkboxes); } - else if (isset($_POST['delete_sel_inv'])) + if (isset($_POST['delete_sel_inv'])) { foreach($_POST['ci_checkboxes'] as $c) $checkboxes[] = $c; - $del_inv = true; - chlkup_autoload_modal("invites_modal"); + do_delete_invite($channelObj, $checkboxes); } else if (isset($_POST['delete_sel_ban'])) { foreach($_POST['cb_checkboxes'] as $c) $checkboxes[] = $c; - $del_ban = true; - chlkup_autoload_modal("bans_modal"); + do_delete_chanban($channelObj, $checkboxes); } if (isset($_POST['add_chban']) || isset($_POST['add_chinv']) || isset($_POST['add_chex'])) { @@ -155,90 +156,74 @@ if (isset($_POST)) Message::Success($msgbox_str); } } - /* and finally re-grab the channel because updates lol */ - $channelObj = $rpc->channel()->get($channel); + if (isset($_POST['newmodes']) && isset($_POST['paramed_modes']) && $can_edit) + { + $m = $_POST['newmodes']; + $p = $_POST['paramed_modes']; + + do_log($p,$m); + $addmodestring = "+"; + $addparamstring = ""; + $delmodestring = "-"; + $delparamstring = ""; + foreach ($m as $mode) + { + strcat($addmodestring, $mode); + if (isset($p[$mode]) && strlen($p[$mode])) + strcat($addparamstring, $p[$mode]." "); + } + + $fmodes = $channelObj->modes; + $tok = split($fmodes); + $modes = $tok[0]; + $params = rparv($fmodes); + $paramed_modes = sort_paramed_modes($modes, $params); + for ($i = 0; isset($modes[$i]) && $mode = $modes[$i]; $i++) + { + if (!strstr($addmodestring, $mode)) + { + $req = IRCList::lookup($mode)['requires']; + if ($req == "Server") + continue; + strcat($delmodestring, $mode); + $grp = get_chmode_group($mode); + if ($grp == 2) + strcat($delparamstring, $paramed_modes[$mode]." "); + } + + } + + + if ($rpc->channel()->set_mode($channel, $delmodestring.$addmodestring, $delparamstring." ".$addparamstring)) + Message::Success("Channel settings have been successfully updated"); + else + Message::Fail("Could not change channel settings: $rpc->error"); + } + + /* Re-grab the channel because of updates */ + $channelObj = $rpc->channel()->get($channel, 4); } ?>