Example #1
0
/**
 * DEPRECATED: Old named wrapper for get_char_id
 *
 * @return int
 */
function get_user_id($p_name = false)
{
    if (defined('DEBUG') && DEBUG && $p_name === false) {
        nw_error('Improper call to get_user_id() with no argument.  For clarity reasons, this is now deprecated, use self_char_id() instead.');
    }
    return get_char_id($p_name);
}
Example #2
0
/**
 * Returns the state of the player from the database,
 * uses a user_id if one is present, otherwise
 * defaults to the currently logged in player, but can act on any player
 * if another username is passed in.
 * @param $user user_id or username
**/
function char_info($p_id)
{
    if (!$p_id) {
        if (defined('DEBUG') && DEBUG) {
            nw_error('DEPRECATED: call to char_info with a null argument.  For clarity reasons, this is now deprecated, use the player object instead. Backtrace: ' . print_r(debug_backtrace(), true));
        }
        return self_info();
    }
    $id = whichever($p_id, SESSION::get('player_id'));
    // *** Default to current player. ***
    if (!is_numeric($id)) {
        // If there's no id, don't try to get any data.
        return null;
    }
    $player = new Player($id);
    // Constructor uses DAO to get player object.
    $player_data = array();
    if ($player instanceof Player && $player->id()) {
        // Turn the player data vo into a simple array.
        $player_data = (array) $player->vo;
        $player_data['clan_id'] = $player->getClan() ? $player->getClan()->getID() : null;
        $player_data = add_data_to_player_row($player_data);
    }
    return $player_data;
}
Example #3
0
function get_char_id($p_name = false)
{
    if ($p_name === false) {
        if (defined('DEBUG') && DEBUG) {
            nw_error('Improper call to get_char_id with a null argument.  For clarity reasons, this is now deprecated, use self_char_id() instead.');
        }
        return self_char_id();
        // TODO: Remove this use case, it's troublesome.
    } else {
        if ($p_name) {
            $sql = "SELECT player_id FROM players WHERE lower(uname) = :find";
            return query_item($sql, array(':find' => strtolower($p_name)));
        } else {
            return null;
            // a blank name came in, or a name
        }
    }
}