]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OpenID/openid.php
Remove more contractions
[quix0rs-gnu-social.git] / plugins / OpenID / openid.php
index 4787cd605dd65add814e770fdc6a064431819631..4a76a8791e23b1a011ee215f414972b9601f9881 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, Control Yourself, Inc.
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
  *
  * 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
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
 
 require_once(INSTALLDIR.'/plugins/OpenID/User_openid.php');
 
 require_once('Auth/OpenID.php');
 require_once('Auth/OpenID/Consumer.php');
+require_once('Auth/OpenID/Server.php');
 require_once('Auth/OpenID/SReg.php');
 require_once('Auth/OpenID/MySQLStore.php');
 
@@ -35,7 +36,7 @@ function oid_store()
 {
     static $store = null;
     if (!$store) {
-        # Can't be called statically
+        # Cannot be called statically
         $user = new User();
         $conn = $user->getDatabaseConnection();
         $store = new Auth_OpenID_MySQLStore($conn);
@@ -50,6 +51,13 @@ function oid_consumer()
     return $consumer;
 }
 
+function oid_server()
+{
+    $store = oid_store();
+    $server = new Auth_OpenID_Server($store, common_local_url('openidserver'));
+    return $server;
+}
+
 function oid_clear_last()
 {
     oid_set_last('');
@@ -179,12 +187,12 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
         $form_html = $auth_request->formMarkup($trust_root, $process_url,
                                                $immediate, array('id' => $form_id));
 
-        # XXX: This is cheap, but things choke if we don't escape ampersands
+        # XXX: This is cheap, but things choke if we do not escape ampersands
         # in the HTML attributes
 
         $form_html = preg_replace('/&/', '&amp;', $form_html);
 
-        // Display an error if the form markup couldn't be generated;
+        // Display an error if the form markup could not be generated;
         // otherwise, render the HTML.
         if (Auth_OpenID::isFailure($form_html)) {
             common_server_error(sprintf(_('Could not create OpenID form: %s'), $form_html->message));
@@ -241,7 +249,7 @@ function oid_update_user(&$user, &$sreg)
 
     $orig_user = clone($user);
 
-    if ($sreg['email'] && Validate::email($sreg['email'], true)) {
+    if ($sreg['email'] && Validate::email($sreg['email'], common_config('email', 'check_domain'))) {
         $user->email = $sreg['email'];
     }