} $online_uid = $_SESSION['userdata']['id']; // check this user is online if (!Container_users::checkUserExists($online_uid)) { $res->status(400); // User is not connected return; } // check this user has joined the channel if (!Container_channels::checkChannelUser($cid, $online_uid)) { $res->status(403); // You have to join channel return; } // check this user is an operator on this channel if (!Container_channels_op::isOp($cid, $online_uid)) { $res->status(403); // You have to be an operator to unban a user return; } // removes name64 from the ban list $banlist = Container_channels_ban::getBanList($cid); $ok = Container_channels_ban::rmBan($cid, $name64); if ($ok) { // check if the user is in the ban list $name = base64_decode($name64); if (!isset($banlist[$name])) { $res->status(404); return; } // notification to other connected user of this removed ban
if (!Container_users::checkUserExists($online_uid)) { $res->status(400); // User is not connected return; } // check this user is an operator on this channel if (!Container_channels_op::isOp($cid, $online_uid)) { $res->status(403); // You have to be an operator to give op to other user return; } // check the destination user is an operator on this channel if (!Container_channels_op::isOp($cid, $uid)) { $res->status(400); $res['Content-Type'] = 'application/json; charset=utf-8'; $res->body(GetPfcError(40002)); // This user is not an operator on the channel return; } // removes $uid user as a $cid channel operator $ok = Container_channels_op::rmOp($cid, $uid); if ($ok) { $res->status(200); // notification to other connected user of this removed operator Container_messages::postMsgToChannel($cid, $online_uid, $uid, 'deop'); } else { $res->status(500); } $res['Content-Type'] = 'application/json; charset=utf-8'; $res->body(json_encode($ok)); });