summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/logout.php2
-rw-r--r--actions/public.php18
-rw-r--r--actions/xrds.php4
-rw-r--r--index.php3
-rw-r--r--lib/accountsettingsaction.php3
-rw-r--r--lib/logingroupnav.php5
-rw-r--r--lib/router.php9
-rw-r--r--lib/util.php3
-rw-r--r--plugins/OpenID/OpenIDPlugin.php159
-rw-r--r--plugins/OpenID/User_openid.php (renamed from classes/User_openid.php)0
-rw-r--r--plugins/OpenID/finishaddopenid.php (renamed from actions/finishaddopenid.php)2
-rw-r--r--plugins/OpenID/finishopenidlogin.php (renamed from actions/finishopenidlogin.php)2
-rw-r--r--plugins/OpenID/openid.php (renamed from lib/openid.php)2
-rw-r--r--plugins/OpenID/openidlogin.php (renamed from actions/openidlogin.php)2
-rw-r--r--plugins/OpenID/openidsettings.php (renamed from actions/openidsettings.php)2
-rw-r--r--plugins/OpenID/publicxrds.php (renamed from actions/publicxrds.php)2
16 files changed, 172 insertions, 46 deletions
diff --git a/actions/logout.php b/actions/logout.php
index 3fcfb4f4e..cb20a26b5 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -32,8 +32,6 @@ if (!defined('LACONICA')) {
exit(1);
}
-require_once INSTALLDIR.'/lib/openid.php';
-
/**
* Logout action class.
*
diff --git a/actions/public.php b/actions/public.php
index d0317ac70..322a52963 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -101,8 +101,6 @@ class PublicAction extends Action
{
parent::handle($args);
- header('X-XRDS-Location: '. common_local_url('publicxrds'));
-
$this->showPage();
}
@@ -144,22 +142,6 @@ class PublicAction extends Action
}
/**
- * Extra head elements
- *
- * We include a <meta> element linking to the publicxrds page, for OpenID
- * client-side authentication.
- *
- * @return void
- */
-
- function extraHead()
- {
- // for client side of OpenID authentication
- $this->element('meta', array('http-equiv' => 'X-XRDS-Location',
- 'content' => common_local_url('publicxrds')));
- }
-
- /**
* Show tabset for this page
*
* Uses the PublicGroupNav widget
diff --git a/actions/xrds.php b/actions/xrds.php
index 9327a3c83..3c7521884 100644
--- a/actions/xrds.php
+++ b/actions/xrds.php
@@ -1,7 +1,7 @@
<?php
/**
- * XRDS for OpenID
+ * XRDS for OpenMicroBlogging
*
* PHP version 5
*
@@ -36,7 +36,7 @@ if (!defined('LACONICA')) {
require_once INSTALLDIR.'/lib/omb.php';
/**
- * XRDS for OpenID
+ * XRDS for OpenMicroBlogging
*
* @category Action
* @package Laconica
diff --git a/index.php b/index.php
index 372a8536e..c1245136e 100644
--- a/index.php
+++ b/index.php
@@ -107,8 +107,7 @@ function checkMirror($action_obj)
function isLoginAction($action)
{
- static $loginActions = array('login', 'openidlogin', 'finishopenidlogin',
- 'recoverpassword', 'api', 'doc', 'register');
+ static $loginActions = array('login', 'recoverpassword', 'api', 'doc', 'register');
$login = null;
diff --git a/lib/accountsettingsaction.php b/lib/accountsettingsaction.php
index 9814c48ab..9a7c69124 100644
--- a/lib/accountsettingsaction.php
+++ b/lib/accountsettingsaction.php
@@ -116,9 +116,6 @@ class AccountSettingsNav extends Widget
'emailsettings' =>
array(_('Email'),
_('Change email handling')),
- 'openidsettings' =>
- array(_('OpenID'),
- _('Add or remove OpenIDs')),
'userdesignsettings' =>
array(_('Design'),
_('Design your profile')),
diff --git a/lib/logingroupnav.php b/lib/logingroupnav.php
index bae45b077..59f313302 100644
--- a/lib/logingroupnav.php
+++ b/lib/logingroupnav.php
@@ -87,11 +87,6 @@ class LoginGroupNav extends Widget
$action_name === 'register');
}
- $this->action->menuItem(common_local_url('openidlogin'),
- _('OpenID'),
- _('Login or register with OpenID'),
- $action_name === 'openidlogin');
-
Event::handle('EndLoginGroupNav', array(&$this->action));
}
diff --git a/lib/router.php b/lib/router.php
index 19839b997..90ffaec16 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -50,8 +50,7 @@ class Router
var $m = null;
static $inst = null;
static $bare = array('requesttoken', 'accesstoken', 'userauthorization',
- 'postnotice', 'updateprofile', 'finishremotesubscribe',
- 'finishopenidlogin', 'finishaddopenid');
+ 'postnotice', 'updateprofile', 'finishremotesubscribe');
static function get()
{
@@ -76,7 +75,6 @@ class Router
$m->connect('', array('action' => 'public'));
$m->connect('rss', array('action' => 'publicrss'));
- $m->connect('xrds', array('action' => 'publicxrds'));
$m->connect('featuredrss', array('action' => 'featuredrss'));
$m->connect('favoritedrss', array('action' => 'favoritedrss'));
$m->connect('opensearch/people', array('action' => 'opensearch',
@@ -131,7 +129,6 @@ class Router
// exceptional
- $m->connect('main/openid', array('action' => 'openidlogin'));
$m->connect('main/remote', array('action' => 'remotesubscribe'));
$m->connect('main/remote?nickname=:nickname', array('action' => 'remotesubscribe'), array('nickname' => '[A-Za-z0-9_-]+'));
@@ -141,7 +138,7 @@ class Router
// settings
- foreach (array('profile', 'avatar', 'password', 'openid', 'im',
+ foreach (array('profile', 'avatar', 'password', 'im',
'email', 'sms', 'twitter', 'userdesign', 'other') as $s) {
$m->connect('settings/'.$s, array('action' => $s.'settings'));
}
@@ -434,7 +431,7 @@ class Router
// user stuff
foreach (array('subscriptions', 'subscribers',
- 'nudge', 'xrds', 'all', 'foaf',
+ 'nudge', 'all', 'foaf', 'xrds',
'replies', 'inbox', 'outbox', 'microsummary') as $a) {
$m->connect(':nickname/'.$a,
array('action' => $a),
diff --git a/lib/util.php b/lib/util.php
index cd9bd9ed8..1f9dd429c 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -735,8 +735,7 @@ function common_local_url($action, $args=null, $params=null, $fragment=null)
function common_is_sensitive($action)
{
static $sensitive = array('login', 'register', 'passwordsettings',
- 'twittersettings', 'finishopenidlogin',
- 'finishaddopenid', 'api');
+ 'twittersettings', 'api');
$ssl = null;
if (Event::handle('SensitiveAction', array($action, &$ssl))) {
diff --git a/plugins/OpenID/OpenIDPlugin.php b/plugins/OpenID/OpenIDPlugin.php
new file mode 100644
index 000000000..a395f9107
--- /dev/null
+++ b/plugins/OpenID/OpenIDPlugin.php
@@ -0,0 +1,159 @@
+<?php
+/**
+ * Laconica, the distributed open-source microblogging tool
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Plugin
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @copyright 2009 Control Yourself, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ */
+
+if (!defined('LACONICA')) {
+ exit(1);
+}
+
+/**
+ * Plugin for OpenID authentication and identity
+ *
+ * This class enables consumer support for OpenID, the distributed authentication
+ * and identity system.
+ *
+ * @category Plugin
+ * @package Laconica
+ * @author Evan Prodromou <evan@controlyourself.ca>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://laconi.ca/
+ * @link http://openid.net/
+ */
+
+class OpenIDPlugin extends Plugin
+{
+ /**
+ * Initializer for the plugin.
+ */
+
+ function __construct()
+ {
+ parent::__construct();
+ }
+
+ /**
+ * Add OpenID-related paths to the router table
+ *
+ * Hook for RouterInitialized event.
+ *
+ * @return boolean hook return
+ */
+
+ function onRouterInitialized(&$m)
+ {
+ $m->connect('main/openid', array('action' => 'openidlogin'));
+ $m->connect('settings/openid', array('action' => 'openidsettings'));
+ $m->connect('xrds', array('action' => 'publicxrds'));
+ $m->connect('index.php?action=finishopenidlogin', array('action' => 'finishopenidlogin'));
+ $m->connect('index.php?action=finishaddopenid', array('action' => 'finishaddopenid'));
+
+ return true;
+ }
+
+ function onEndLoginGroupNav(&$action)
+ {
+ $action_name = $action->trimmed('action');
+
+ $action->menuItem(common_local_url('openidlogin'),
+ _('OpenID'),
+ _('Login or register with OpenID'),
+ $action_name === 'openidlogin');
+
+ return true;
+ }
+
+ function onEndAccountSettingsNav(&$action)
+ {
+ $action_name = $action->trimmed('action');
+
+ $action->menuItem(common_local_url('openidsettings'),
+ _('OpenID'),
+ _('Add or remove OpenIDs'),
+ $action_name === 'openidsettings');
+
+ return true;
+ }
+
+ function onAutoload($cls)
+ {
+ switch ($cls)
+ {
+ case 'OpenidloginAction':
+ case 'FinishopenidloginAction':
+ case 'FinishaddopenidAction':
+ case 'XrdsAction':
+ case 'PublicxrdsAction':
+ case 'OpenidsettingsAction':
+ require_once(INSTALLDIR.'/plugins/OpenID/' . strtolower(mb_substr($cls, 0, -6)) . '.php');
+ return false;
+ case 'User_openid':
+ require_once(INSTALLDIR.'/plugins/OpenID/User_openid.php');
+ return false;
+ default:
+ return true;
+ }
+ }
+
+ function onSensitiveAction($action, &$ssl)
+ {
+ switch ($action)
+ {
+ case 'finishopenidlogin':
+ case 'finishaddopenid':
+ $ssl = true;
+ return false;
+ default:
+ return true;
+ }
+ }
+
+ function onLoginAction($action, &$login)
+ {
+ switch ($action)
+ {
+ case 'openidlogin':
+ case 'finishopenidlogin':
+ $login = true;
+ return false;
+ default:
+ return true;
+ }
+ }
+
+ /**
+ * We include a <meta> element linking to the publicxrds page, for OpenID
+ * client-side authentication.
+ *
+ * @return void
+ */
+
+ function onEndHeadChildren($action)
+ {
+ // for client side of OpenID authentication
+ $action->element('meta', array('http-equiv' => 'X-XRDS-Location',
+ 'content' => common_local_url('publicxrds')));
+ }
+}
diff --git a/classes/User_openid.php b/plugins/OpenID/User_openid.php
index f4fda1c72..f4fda1c72 100644
--- a/classes/User_openid.php
+++ b/plugins/OpenID/User_openid.php
diff --git a/actions/finishaddopenid.php b/plugins/OpenID/finishaddopenid.php
index 32bceecfd..7753158d5 100644
--- a/actions/finishaddopenid.php
+++ b/plugins/OpenID/finishaddopenid.php
@@ -31,7 +31,7 @@ if (!defined('LACONICA')) {
exit(1);
}
-require_once INSTALLDIR.'/lib/openid.php';
+require_once INSTALLDIR.'/plugins/OpenID/openid.php';
/**
* Complete adding an OpenID
diff --git a/actions/finishopenidlogin.php b/plugins/OpenID/finishopenidlogin.php
index ff0b35218..516625e41 100644
--- a/actions/finishopenidlogin.php
+++ b/plugins/OpenID/finishopenidlogin.php
@@ -19,7 +19,7 @@
if (!defined('LACONICA')) { exit(1); }
-require_once(INSTALLDIR.'/lib/openid.php');
+require_once INSTALLDIR.'/plugins/OpenID/openid.php';
class FinishopenidloginAction extends Action
{
diff --git a/lib/openid.php b/plugins/OpenID/openid.php
index 0b7633284..4787cd605 100644
--- a/lib/openid.php
+++ b/plugins/OpenID/openid.php
@@ -19,7 +19,7 @@
if (!defined('LACONICA')) { exit(1); }
-require_once(INSTALLDIR.'/classes/User_openid.php');
+require_once(INSTALLDIR.'/plugins/OpenID/User_openid.php');
require_once('Auth/OpenID.php');
require_once('Auth/OpenID/Consumer.php');
diff --git a/actions/openidlogin.php b/plugins/OpenID/openidlogin.php
index a8d052096..3d968c56e 100644
--- a/actions/openidlogin.php
+++ b/plugins/OpenID/openidlogin.php
@@ -19,7 +19,7 @@
if (!defined('LACONICA')) { exit(1); }
-require_once(INSTALLDIR.'/lib/openid.php');
+require_once INSTALLDIR.'/plugins/OpenID/openid.php';
class OpenidloginAction extends Action
{
diff --git a/actions/openidsettings.php b/plugins/OpenID/openidsettings.php
index 5f59ebc01..26bf64836 100644
--- a/actions/openidsettings.php
+++ b/plugins/OpenID/openidsettings.php
@@ -32,7 +32,7 @@ if (!defined('LACONICA')) {
}
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
-require_once INSTALLDIR.'/lib/openid.php';
+require_once INSTALLDIR.'/plugins/OpenID/openid.php';
/**
* Settings for OpenID
diff --git a/actions/publicxrds.php b/plugins/OpenID/publicxrds.php
index 0a1421550..f088c25d1 100644
--- a/actions/publicxrds.php
+++ b/plugins/OpenID/publicxrds.php
@@ -33,7 +33,7 @@ if (!defined('LACONICA')) {
exit(1);
}
-require_once INSTALLDIR.'/lib/openid.php';
+require_once INSTALLDIR.'/plugins/OpenID/openid.php';
/**
* Public XRDS for OpenID