// run garbage collector to purge old timeout message 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);