예제 #1
0
/**
 * Validate webservices token, with or without username
 *
 * @param $h Webservices
 *        token
 * @param $u Username        
 * @return boolean FALSE if invalid, string username if valid
 */
function webservices_validate($h, $u)
{
    global $core_config;
    $ret = false;
    if ($c_uid = auth_validate_token($h)) {
        $c_u = user_uid2username($c_uid);
        if ($core_config['webservices_username']) {
            if ($c_u && $u && $c_u == $u) {
                $ret = $c_u;
            }
        } else {
            $ret = $c_u;
        }
    }
    return $ret;
}
예제 #2
0
/**
 * Validate webservices token, with or without username
 *
 * @param $h Webservices
 *        token
 * @param $u Username        
 * @return boolean FALSE if invalid, string username if valid
 */
function webservices_validate($h, $u)
{
    global $core_config;
    $ret = false;
    if (preg_match('/^(.+)@(.+)\\.(.+)$/', $u)) {
        $u = user_email2username($u);
    }
    if ($c_uid = auth_validate_token($h)) {
        $c_u = user_uid2username($c_uid);
        if ($core_config['webservices_username']) {
            if ($c_u && $u && $c_u == $u) {
                $ret = $c_u;
            }
        } else {
            $ret = $c_u;
        }
    }
    return $ret;
}