示例#1
0
    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));
});