예제 #1
0
function get_agent($agenturi)
{
    if ($agenturi) {
        $agent = NULL;
        $store = create_store($agenturi);
        if ($agentrsakey = get_foaf_rsakey($store, $agenturi)) {
            $agent = safe_array_merge($agent, array('RSAKey' => $agentrsakey));
        }
        if ($nyms = get_all_nyms($store, $agenturi)) {
            $agent = safe_array_merge($agent, $nyms);
        } else {
            // Where the san points to a rdf file (not the webid) try to find the primary topic of the rdf file
            if ($primaryuri = get_primary_profile($store)) {
                if (($nyms = get_all_nyms($store, $primaryuri)) || ($nyms = get_all_nyms_sec($store, $primaryuri))) {
                    $agent = safe_array_merge($agent, $nyms);
                    $agenturi = $primaryuri;
                } else {
                    //					print "primaryTopic $primaryuri is not helping<br><br>";
                }
            } else {
                if ($holdaccount = get_online_account($store, $agenturi)) {
                    if ($nyms = get_agent($holdaccount)) {
                        return $nyms;
                    } else {
                        //							print "holdAccount is not helping<br><br>";
                    }
                } else {
                    //							print "holdAccount is missing<br><br>";
                }
            }
        }
        if ($friends = get_all_friends($store, $agenturi)) {
            $agent = safe_array_merge($agent, array('knows' => $friends));
        }
        if ($agent) {
            $agent = safe_array_merge(array("webid" => $agenturi), $agent);
            $agent = array('agent' => $agent);
        }
        return $agent;
    }
}
예제 #2
0
    return false;
}
if ($_SERVER['HTTPS']) {
    $host = "https://openid4.me/";
} else {
    $host = "http://openid4.me/";
}
$foaf = urldecode(substr($_SERVER['REQUEST_URI'], strlen('/')));
if (strncmp('http://', $foaf, strlen('http://')) != 0) {
    $foaf = str_replace('https://', '', $foaf);
    $foaf = 'http://' . $foaf;
}
$valid = is_valid_url($foaf);
if ($valid) {
    $store = create_store($foaf);
    $keys = get_foaf_rsakey($store, $foaf);
    $agent = get_agent($foaf);
    $len = strlen(strstr($foaf, '#'));
    $foaf_file = $rest = substr($foaf, 0, -$len);
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" 
  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"
      xmlns:cert="http://www.w3.org/ns/auth/cert#"
      xmlns:foaf="http://xmlns.com/foaf/0.1/"
      xmlns:rsa="http://www.w3.org/ns/auth/rsa#"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="openid.server" href="<?php