+ 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);