]> git.mxchange.org Git - friendica.git/commitdiff
OpenID delegation in profile page
authorfabrixxm <fabrix.xm@gmail.com>
Thu, 23 Dec 2010 20:32:13 +0000 (21:32 +0100)
committerfabrixxm <fabrix.xm@gmail.com>
Thu, 23 Dec 2010 20:32:13 +0000 (21:32 +0100)
database.sql
mod/profile.php

index 5b86f60eca772771a99c3656e5ca1dca8a2fce52..bb151da27cc4f46d1edb5faed759470bcc731f23 100644 (file)
@@ -377,6 +377,7 @@ CREATE TABLE IF NOT EXISTS `user` (
   `allow_gid` mediumtext NOT NULL,
   `deny_cid` mediumtext NOT NULL, 
   `deny_gid` mediumtext NOT NULL,
+  `openidserver` text NOT NULL,
   PRIMARY KEY (`uid`), 
   KEY `nickname` (`nickname`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
index b1f0209307d218bd9eb267e3327c109efaee611b..000e955eae443e618c8627d0f9db7baa3e31461c 100644 (file)
@@ -18,6 +18,31 @@ function profile_init(&$a) {
 
        profile_load($a,$which,$profile);
 
+       if (!get_config('system','no_openid') && $a->profile['openid']!=""){
+               if (!isset($a->profile['openidserver'])){
+                       die('friendika user table must be updated. `openidserver` field is missing');
+               }
+               if ($a->profile['openidserver']==''){
+                       require_once('library/openid.php');
+                       $openid = new LightOpenID;
+                       $openid->identity = $a->profile['openid'];
+                       $a->profile['openidserver'] = $openid->discover($openid->identity);
+
+                       q("UPDATE `user` SET `openidserver` = '%s' WHERE `uid` = %d LIMIT 1",
+                               dbesc($a->profile['openidserver']),
+                               intval($a->profile['uid'])
+                       );
+               }
+               
+               
+               $a->page['htmlhead'] .= '<link rel="openid.server" href="'.$a->profile['openidserver'].'" />'. "\r\n";
+               $a->page['htmlhead'] .= '<link rel="openid.delegate" href="'.$a->profile['openid'].'" />'. "\r\n";
+                   
+
+       }
+
+       
+
        $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
        $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
@@ -365,4 +390,4 @@ function profile_content(&$a, $update = 0) {
        $o .= paginate($a);
 
        return $o;
-}
\ No newline at end of file
+}