} // 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 $unban_body = $banlist[$name]; $unban_body = array_merge($unban_body, array('name' => $name)); Container_messages::postMsgToChannel($cid, $online_uid, $unban_body, 'unban'); $res->status(200); } else { $res->status(500); }
Container_users::runGC(); // check this user is online if (!Container_users::checkUserExists($uid)) { $res->status(400); // User is not connected $res['Content-Type'] = 'application/json; charset=utf-8'; $res->body('{ "error": "User is not connected" }'); return; } // check the user name is not banished or not on this channel // do not allow the join if he is banned and he is not already online $isban = false; $name = Container_users::getUserData($uid, 'name'); $isjoin = Container_channels::checkChannelUser($cid, $uid); if (!$isjoin and Container_channels_ban::isBan($cid, $name)) { $baninfo = Container_channels_ban::getBanInfo($cid, $name); $isban = true; } // check if the user is banned from this channel (from the hook) if (!$isban and !$isjoin and isset($GLOBALS['pfc_hooks']['pfc.isban'])) { foreach ($GLOBALS['pfc_hooks']['pfc.isban'] as $hook) { $login = Container_users::getUserData($uid)->name; $channel = $cid; // todo: replace this by the channel fullname $baninfo = $hook($login, $channel, $uid, $cid); $isban = $baninfo !== false; } } if ($isban) { $res->status(403); $res['Content-Type'] = 'application/json; charset=utf-8';