plugin_openid:

* If no user has configured his OpenID yet, there will be no OpenID
login but a info about that.
* No need to enter your OpenID URL anymore, just choose the user and log
in (can be switched back to old style)
This commit is contained in:
Grischa Brockhaus 2012-03-27 01:09:25 +02:00
parent 9a40598d78
commit 99929a2eff
6 changed files with 104 additions and 16 deletions

View file

@ -1,3 +1,8 @@
Version 0.9 (brockhaus)
---------------------------------
* If no user has configured his OpenID yet, there will be no OpenID login but a info about that.
* No need to enter your OpenID URL anymore, just choose the user and log in (can be switched back to old style)
Version 0.8 (brockhaus)
---------------------------------
* Added AOL shortcut

View file

@ -24,6 +24,13 @@
'<p>Das Aufsetzen der Delegation ist völlig optional und wird nicht für ein Login in Dein Blog mittels OpenID benötigt.</p>'
);
@define('PLUGIN_OPENID_LOGIN_USERS', 'Login mit Benutzer Auswahl');
@define('PLUGIN_OPENID_LOGIN_USERS_DESC',
'Nachdem Autoren dieses Blogs ihre OpenID URL konfiguriert haben, können sie im Login ihren Namen auswählen und einfach einloggen.
Dies ist eine sehr bequeme Art des Logins, aber sie zeigt anderen die Autorennamen dieses Blogs.
Das sollte normaler Weise kein Problem sein, da diese ja auch in der Artikel Ansicht angezeigt werden.
Wenn Du das aber nicht magst, kannst Du diese Auswahl ausschalten. Dann wird beim Login eine normale Eingabe für die OpenID URL ausgegeben.');
@define('PLUGIN_OPENID_SERVER', 'OpenID Server');
@define('PLUGIN_OPENID_SERVER_DESC', 'OpenID Server, der Deine OpenID hostet (benötigt einen Eintrag in "OpenID Delegation")');
@ -45,3 +52,7 @@
@define('PLUGIN_OPENID_SET_YAHOO_OID', 'Deinen Yahoo Account als OpenID setzen');
@define('PLUGIN_OPENID_LOGIN_WITH_AOL', 'Mit Deinem Aol Account einloggen');
@define('PLUGIN_OPENID_SET_AOL_OID', 'Deinen Aol Account als OpenID setzen');
@define('PLUGIN_OPENID_LOGIN_NOOPENID', 'Im Moment gibt es keinen Benutzer mit konfigurierter OpenID URL.<br/>
Wenn Du Dich mit Deiner OpenID anmelden möchtest, dann konfiguriere sie bitte zuerst in den "Eigenen Einstellungen"..<br/>Danke.');

View file

@ -201,18 +201,53 @@ class serendipity_common_openid {
return ($retVal===true)?true:false;
}
function loginform($url, $hidden = array(), $instructions = '') {
function load_account_selectbox() {
global $serendipity;
$query = "SELECT DISTINCT a.realname, a.username, oa.openid_url
FROM
{$serendipity['dbPrefix']}authors AS a, {$serendipity['dbPrefix']}openid_authors AS oa
WHERE
oa.authorid = a.authorid";
$rows = serendipity_db_query($query);
// Singnal no existing OpenID URL.
if (!is_array($rows) || count($rows)==0) return false;
$result = '<select name="serendipity[openid_url]">';
foreach ($rows as $row) {
$result .= '<option value="' . $row['openid_url'] . '">';
if (!empty($row['realname'])) {
$result .= $row['realname'];
}
else {
$result .= $row['username'];
}
$result .= '</option>';
}
$result .= '</select> ';
return $result;
}
function loginform($url, $hidden = array(), $useAutorSelector = true) {
global $serendipity;
$imgopenid = $serendipity['baseURL'] . 'index.php?/plugin/openid.png';
// Check, if we have any user with OpenID configured
$select = serendipity_common_openid::load_account_selectbox();
if ($select===false) { // No we don't. Say so
$result = '<div class="no_openid_user">';
$result .= '<img src="' . $imgopenid . '" alt="OpenID">';
$result .= '<p>' . PLUGIN_OPENID_LOGIN_NOOPENID . '</p></div>';
return $result;
}
$imggoogle = $serendipity['baseURL'] . 'index.php?/plugin/oid_google.png';
$imgyahoo = $serendipity['baseURL'] . 'index.php?/plugin/oid_yahoo.png';
$imgaol = $serendipity['baseURL'] . 'index.php?/plugin/oid_aol.png';
$form = '';
if (! empty($instructions)) {
$form = $instructions . '<br /><br />';
}
// We need two forms in order to allow ENTER in the input line
$form .= '<form name="openid" id="openid" method="post" action="' . $url . '">';
@ -220,18 +255,26 @@ class serendipity_common_openid {
foreach($hidden AS $key => $val) {
$form .= '<input type="hidden" name="serendipity[' . $key . ']" value="' . htmlspecialchars($val) . '" />';
}
$form .= '<img src="' . $imgopenid . '" alt="OpenID"> <input type="text" size="40" name="serendipity[openid_url]" value="" placeholder="' . PLUGIN_OPENID_LOGIN_INPUT . '"/>'."\n".
'<input type="submit" name="openIDLogin" value="Login" />';
$form .= '</form>';
$form .= '<img src="' . $imgopenid . '" alt="OpenID"> ';
$form .= '<form name="openid" id="openid" method="post" action="' . $url . '">';
$form .='<input type="hidden" name="serendipity[openidflag]" value="1" />';
foreach($hidden AS $key => $val) {
$form .= '<input type="hidden" name="serendipity[' . $key . ']" value="' . htmlspecialchars($val) . '" />';
if ($useAutorSelector) {
$form .= $select;
$form .= '<input type="submit" name="openIDLogin" value="Login with OpenID" />';
}
if (!$useAutorSelector) {
$form .= '<input type="text" size="40" name="serendipity[openid_url]" value="" placeholder="' . PLUGIN_OPENID_LOGIN_INPUT . '"/>';
$form .= '<input type="submit" name="openIDLogin" value="Login" />';
$form .= '</form>';
$form .= '<form name="openid" id="openid" method="post" action="' . $url . '">';
$form .='<input type="hidden" name="serendipity[openidflag]" value="1" />';
foreach($hidden AS $key => $val) {
$form .= '<input type="hidden" name="serendipity[' . $key . ']" value="' . htmlspecialchars($val) . '" />';
}
$form .= '<input name="openIDLoginGoogle" type="image" src="' . $imggoogle . '" alt="' . PLUGIN_OPENID_LOGIN_WITH_GOOGLE . '" title="' . PLUGIN_OPENID_LOGIN_WITH_GOOGLE .'"/> ';
$form .= '<input name="openIDLoginYahoo" type="image" src="' . $imgyahoo . '" alt="' . PLUGIN_OPENID_LOGIN_WITH_YAHOO . '" title="' . PLUGIN_OPENID_LOGIN_WITH_YAHOO .'"/> ';
$form .= '<input name="openIDLoginAol" type="image" src="' . $imgaol . '" alt="' . PLUGIN_OPENID_LOGIN_WITH_AOL . '" title="' . PLUGIN_OPENID_LOGIN_WITH_AOL .'"/> ';
}
$form .= '<input name="openIDLoginGoogle" type="image" src="' . $imggoogle . '" alt="' . PLUGIN_OPENID_LOGIN_WITH_GOOGLE . '" title="' . PLUGIN_OPENID_LOGIN_WITH_GOOGLE .'"/> ';
$form .= '<input name="openIDLoginYahoo" type="image" src="' . $imgyahoo . '" alt="' . PLUGIN_OPENID_LOGIN_WITH_YAHOO . '" title="' . PLUGIN_OPENID_LOGIN_WITH_YAHOO .'"/> ';
$form .= '<input name="openIDLoginAol" type="image" src="' . $imgaol . '" alt="' . PLUGIN_OPENID_LOGIN_WITH_AOL . '" title="' . PLUGIN_OPENID_LOGIN_WITH_AOL .'"/> ';
$form .= '</form>';
return $form;

View file

@ -24,6 +24,13 @@
'<p>Das Aufsetzen der Delegation ist völlig optional und wird nicht für ein Login in Dein Blog mittels OpenID benötigt.</p>'
);
@define('PLUGIN_OPENID_LOGIN_USERS', 'Login mit Benutzer Auswahl');
@define('PLUGIN_OPENID_LOGIN_USERS_DESC',
'Nachdem Autoren dieses Blogs ihre OpenID URL konfiguriert haben, können sie im Login ihren Namen auswählen und einfach einloggen.
Dies ist eine sehr bequeme Art des Logins, aber sie zeigt anderen die Autorennamen dieses Blogs.
Das sollte normaler Weise kein Problem sein, da diese ja auch in der Artikel Ansicht angezeigt werden.
Wenn Du das aber nicht magst, kannst Du diese Auswahl ausschalten. Dann wird beim Login eine normale Eingabe für die OpenID URL ausgegeben.');
@define('PLUGIN_OPENID_SERVER', 'OpenID Server');
@define('PLUGIN_OPENID_SERVER_DESC', 'OpenID Server, der Deine OpenID hostet (benötigt einen Eintrag in "OpenID Delegation")');
@ -45,3 +52,7 @@
@define('PLUGIN_OPENID_SET_YAHOO_OID', 'Deinen Yahoo Account als OpenID setzen');
@define('PLUGIN_OPENID_LOGIN_WITH_AOL', 'Mit Deinem Aol Account einloggen');
@define('PLUGIN_OPENID_SET_AOL_OID', 'Deinen Aol Account als OpenID setzen');
@define('PLUGIN_OPENID_LOGIN_NOOPENID', 'Im Moment gibt es keinen Benutzer mit konfigurierter OpenID URL.<br/>
Wenn Du Dich mit Deiner OpenID anmelden möchtest, dann konfiguriere sie bitte zuerst in den "Eigenen Einstellungen"..<br/>Danke.');

View file

@ -24,6 +24,13 @@
'<p>Settung up delegation is completely optional and not needed for logging into your blog with OpenID.</p>'
);
@define('PLUGIN_OPENID_LOGIN_USERS', 'Login with user selection');
@define('PLUGIN_OPENID_LOGIN_USERS_DESC',
'After authors of this blog have configured their OpenID URL they can select their name and log in.
As this is a very convenient way to log in it shows others the names of the authors of your blog.
This should be no problem normaly as they are visible in your articles, too.
But if you don\'t like that you can switch this off and there will be a normal OpenID URL input only.');
@define('PLUGIN_OPENID_SERVER', 'OpenID server used for delegation');
@define('PLUGIN_OPENID_SERVER_DESC', 'OpenID server to use for delegate (requires OpenID delegate to be populated)');
@ -45,3 +52,6 @@
@define('PLUGIN_OPENID_SET_YAHOO_OID', 'Set your Yahoo account as OpenID');
@define('PLUGIN_OPENID_LOGIN_WITH_AOL', 'Login with your Aol account');
@define('PLUGIN_OPENID_SET_AOL_OID', 'Set your Aol account as OpenID');
@define('PLUGIN_OPENID_LOGIN_NOOPENID', 'At the moment, there is no author having an OpenID URL configured.<br/>
If you want to log in using your OpenID please configure yours first in your personal settings.<br/>Thanks.');

View file

@ -13,7 +13,7 @@ class serendipity_event_openid extends serendipity_event
$propbag->add('description', PLUGIN_OPENID_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Grischa Brockhaus, Rob Richards');
$propbag->add('version', '0.8');
$propbag->add('version', '0.9');
$propbag->add('requirements', array(
'serendipity' => '1.2',
'smarty' => '2.6.7',
@ -30,6 +30,7 @@ class serendipity_event_openid extends serendipity_event
$propbag->add('configuration', array(
'plugin_desc',
'select_authors',
'delegation_desc',
'server',
'delegate',
@ -44,6 +45,12 @@ class serendipity_event_openid extends serendipity_event
$propbag->add('type', 'content');
$propbag->add('default', PLUGIN_OPENID_DESCRIPTION);
break;
case 'select_authors':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_OPENID_LOGIN_USERS);
$propbag->add('description', PLUGIN_OPENID_LOGIN_USERS_DESC);
$propbag->add('default', 'true');
break;
case 'delegation_desc':
$propbag->add('type', 'content');
$propbag->add('default', PLUGIN_OPENID_DELEGATION_DESCRIPTION);
@ -138,8 +145,9 @@ class serendipity_event_openid extends serendipity_event
case 'backend_login_page':
$hidden = array('action'=>'admin');
$useAutorSelector = $this->get_config('select_authors',true);
$eventData['header'] .= '<br/><div align="center">'.
serendipity_common_openid::loginform('serendipity_admin.php', $hidden, NULL).
serendipity_common_openid::loginform('serendipity_admin.php', $hidden, $useAutorSelector).
'</div>';
break;