checkUserExists() 공개 정적인 메소드

public static checkUserExists ( $uid )
예제 #1
0
    $res['Content-Type'] = 'application/json; charset=utf-8';
    $res->body(Container_users::getUserMsgs($uid, true));
});
/**
 * Set the close flag (when a user reload or close his window)
 */
$app->put('/users/:uid/closed', function ($uid) use($app, $req, $res) {
    // check user acces
    session_start();
    if (!isset($_SESSION['userdata']) or !isset($_SESSION['userdata']['id'])) {
        $res->status(401);
        // Need to authenticate
        return;
    }
    if ($uid !== $_SESSION['userdata']['id']) {
        $res->status(403);
        // Forbidden
        return;
    }
    if (!Container_users::checkUserExists($uid)) {
        $res->status(404);
        $res['Content-Type'] = 'application/json; charset=utf-8';
        $res->body('{ "error": "user data does not exist" }');
        return;
    }
    // set the close flag
    Container_users::setCloseFlag($uid);
    $res->status(200);
    $res['Content-Type'] = 'application/json; charset=utf-8';
    $res->body('1');
});
예제 #2
0
    }
});
/**
 * Remove :name64 from the :cid channel banished list
 */
$app->delete('/channels/:cid/ban/:name64', function ($cid, $name64) use($app, $req, $res) {
    // check user acces
    session_start();
    if (!isset($_SESSION['userdata']) or !isset($_SESSION['userdata']['id'])) {
        $res->status(401);
        // Need to authenticate
        return;
    }
    $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;