Example #1
0
/**
 * Ensure that the user's profile URL matches one of their OpenIDs
 */
function openid_ensure_url_match($user, $url = null)
{
    $identities = get_user_openids($user->ID);
    if (empty($identities)) {
        return true;
    }
    set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
    require_once 'Auth/OpenID.php';
    if ($url == null) {
        $url = $user->user_url;
    }
    $url = Auth_OpenID::normalizeUrl($url);
    foreach ($identities as $id) {
        if ($id == $url) {
            return true;
        }
    }
    return false;
}
Example #2
0
/**
 * Check if the user has any OpenIDs.
 *
 * @param mixed $user the username or ID.  If not provided, the current user will be used.
 * @return bool true if the user has any OpenIDs
 * @since 1.0
 */
function is_user_openid($user = null) {
	$urls = get_user_openids($user);
	return ( !empty($urls) );
}
/**
 * Ensure that the user's profile URL matches one of their OpenIDs
 */
function openid_ensure_url_match($user, $url = null)
{
    $identities = get_user_openids($user->ID);
    if (empty($identities)) {
        return true;
    }
    require_once 'Auth/OpenID.php';
    if ($url == null) {
        $url = $user->user_url;
    }
    $url = Auth_OpenID::normalizeUrl($url);
    foreach ($identities as $id) {
        $id = Auth_OpenID::normalizeUrl($id);
        if ($id == $url) {
            return true;
        }
    }
    return false;
}