コード例 #1
0
ファイル: consumer.php プロジェクト: NewRoute/glfusion
 function find_identity_info($identity_url)
 {
     // Returns (consumer_id, server_id, server_url) or null if no
     // server found. Fetch url and parse openid.server and
     // potentially openid.delegate urls.  consumer_id is the identity
     // url the consumer should use.  It is the url after following
     // any redirects the url passed in might use.  server_id is the
     // url actually sent to the server to verify, and may be the
     // result of finding a delegate link.
     $url = OpenIDConsumerHelper::normalize_url($identity_url);
     $ret = $this->http_client->get($url);
     if (!$ret) {
         return null;
     }
     list($consumer_id, $data) = $ret;
     $server = null;
     $delegate = null;
     $link_attrs = oidParse::parseLinkAttrs($data);
     foreach ($link_attrs as $attrs) {
         $rel = isset($attrs['rel']) ? $attrs['rel'] : null;
         if ($rel == 'openid.server' && !$server) {
             $href = isset($attrs['href']) ? $attrs['href'] : null;
             if ($href) {
                 $server = $href;
             }
         }
         if ($rel == 'openid.delegate' && !$delegate) {
             $href = isset($attrs['href']) ? $attrs['href'] : null;
             if ($href) {
                 $delegate = $href;
             }
         }
     }
     if (!$server) {
         return null;
     }
     if ($delegate) {
         $server_id = $delegate;
     } else {
         $server_id = $consumer_id;
     }
     return array($consumer_id, $server_id, $server);
 }
コード例 #2
0
ファイル: oid_parse.php プロジェクト: hasshy/sahana-tw
 function _parseLinkAttrsWithTidy2($html)
 {
     $tree = tidy_parse_string($html);
     $tags = null;
     return oidParse::_parseLinkAttrsWithTidy2Worker($tree->html(), $tags);
 }