From a3103eaa6a24fa0f6edbe5c473f8791ce0779b70 Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Wed, 28 May 2014 10:58:04 +0200 Subject: [PATCH] Properly propagata realname to session vars, fixes #156 --- serendipity_event_openid/ChangeLog | 4 ++++ serendipity_event_openid/common.inc.php | 20 ++++++++++--------- .../serendipity_event_openid.php | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/serendipity_event_openid/ChangeLog b/serendipity_event_openid/ChangeLog index 3a074f3fc..a04a16899 100644 --- a/serendipity_event_openid/ChangeLog +++ b/serendipity_event_openid/ChangeLog @@ -1,3 +1,7 @@ +Version 1.2 + +* Fixed missing "realname" attribute in authentication + Version 1.0 (brockhaus) --------------------------------- * Delegation: Configure what OpenID version the provider is supporting (Version 1 or 2 or both) diff --git a/serendipity_event_openid/common.inc.php b/serendipity_event_openid/common.inc.php index 4e8358c43..31fcea49e 100644 --- a/serendipity_event_openid/common.inc.php +++ b/serendipity_event_openid/common.inc.php @@ -1,4 +1,4 @@ -$realname, 'email'=>$email, 'openID'=>$openid); } $password = md5($openid); - $query = "SELECT DISTINCT a.email, a.authorid, a.userlevel, a.right_publish + $query = "SELECT DISTINCT a.email, a.authorid, a.userlevel, a.right_publish, a.realname FROM {$serendipity['dbPrefix']}authors AS a, {$serendipity['dbPrefix']}openid_authors AS oa WHERE @@ -143,13 +144,14 @@ static function authenticate_openid($getData, $store_path, $returnData = false) if (is_array($row)) { serendipity_setCookie('old_session', session_id()); serendipity_setAuthorToken(); - $_SESSION['serendipityUser'] = $serendipity['serendipityUser'] = $realname; + $_SESSION['serendipityUser'] = $serendipity['serendipityUser'] = $row['realname']; $_SESSION['serendipityPassword'] = $serendipity['serendipityPassword'] = $password; $_SESSION['serendipityEmail'] = $serendipity['serendipityEmail'] = $email; $_SESSION['serendipityAuthorid'] = $serendipity['authorid'] = $row['authorid']; $_SESSION['serendipityUserlevel'] = $serendipity['serendipityUserlevel'] = $row['userlevel']; $_SESSION['serendipityAuthedUser'] = $serendipity['serendipityAuthedUser'] = true; $_SESSION['serendipityRightPublish']= $serendipity['serendipityRightPublish'] = $row['right_publish']; + $_SESSION['serendipityRealname'] = $serendipity['serendipityRealname'] = $row['realname']; $_SESSION['serendipityOpenID'] = true; serendipity_load_configuration($serendipity['authorid']); return true; @@ -161,7 +163,7 @@ static function authenticate_openid($getData, $store_path, $returnData = false) return false; } - static function getOpenID($userID, $checkExist=false) { + function getOpenID($userID, $checkExist=false) { global $serendipity; $q = "SELECT openid_url, authorid FROM {$serendipity['dbPrefix']}openid_authors WHERE authorid = " . (int)$userID; $author = serendipity_db_query($q, true); @@ -175,7 +177,7 @@ static function getOpenID($userID, $checkExist=false) { return ''; } - static function updateOpenID($openid_url, $authorID) { + function updateOpenID($openid_url, $authorID) { global $serendipity; if (!is_array(serendipity_db_query("SELECT username FROM {$serendipity['dbPrefix']}openid_authors LIMIT 1", true, 'both', false, false, false, true))) { @@ -201,7 +203,7 @@ static function updateOpenID($openid_url, $authorID) { return ($retVal===true)?true:false; } - static function load_account_selectbox() { + function load_account_selectbox() { global $serendipity; $query = "SELECT DISTINCT a.realname, a.username, oa.openid_url @@ -229,7 +231,7 @@ static function load_account_selectbox() { return $result; } - static function loginform($url, $hidden = array(), $useAutorSelector = true) { + function loginform($url, $hidden = array(), $useAutorSelector = true) { global $serendipity; $imgopenid = $serendipity['baseURL'] . 'index.php?/plugin/openid.png'; diff --git a/serendipity_event_openid/serendipity_event_openid.php b/serendipity_event_openid/serendipity_event_openid.php index cbc91dbcc..cdcc27d22 100644 --- a/serendipity_event_openid/serendipity_event_openid.php +++ b/serendipity_event_openid/serendipity_event_openid.php @@ -13,7 +13,7 @@ function introspect(&$propbag) $propbag->add('description', PLUGIN_OPENID_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Grischa Brockhaus, Rob Richards'); - $propbag->add('version', '1.1'); + $propbag->add('version', '1.2'); $propbag->add('requirements', array( 'serendipity' => '1.2', 'smarty' => '2.6.7',