]> git.mxchange.org Git - friendica.git/commitdiff
OpenID delegation degrade gracefully if database table is not updated.
authorfabrixxm <fabrix.xm@gmail.com>
Thu, 23 Dec 2010 20:52:51 +0000 (21:52 +0100)
committerfabrixxm <fabrix.xm@gmail.com>
Thu, 23 Dec 2010 20:52:51 +0000 (21:52 +0100)
mod/profile.php
mod/settings.php

index 000e955eae443e618c8627d0f9db7baa3e31461c..a5f440f434356bf0940f2e494d0947c65e558443 100644 (file)
@@ -20,24 +20,24 @@ function profile_init(&$a) {
 
        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'])
-                       );
-               }
+                       logger('friendika user table must be updated. `openidserver` field is missing');
+               } else {
+                       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'] .= '<link rel="openid.server" href="'.$a->profile['openidserver'].'" />'. "\r\n";
+                       $a->page['htmlhead'] .= '<link rel="openid.delegate" href="'.$a->profile['openid'].'" />'. "\r\n";
+               }                   
 
        }
 
index 4743ecd6611aef05eff2bf1b8b9e477cc91239e0..af826c53b70c51cd269a9d497c0bd16525b9a404 100644 (file)
@@ -109,7 +109,12 @@ function settings_post(&$a) {
        $str_group_deny    = perms2str($_POST['group_deny']);
        $str_contact_deny  = perms2str($_POST['contact_deny']);
 
-       $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s',  `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d  WHERE `uid` = %d LIMIT 1",
+       $openidserver="";
+       if ($openid != $a->user['openid'] && isset($a->user['openidserver'])){
+               $openidserver = ", `openidserver` = ''";
+       }
+
+       $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s',  `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d".$openidserver."  WHERE `uid` = %d LIMIT 1",
                        dbesc($username),
                        dbesc($email),
                        dbesc($openid),