+++ /dev/null
-1.3\r
-\r
-Added a reset page. See README.txt for more infomation.
\ No newline at end of file
+++ /dev/null
-/**\r
- * Login using OpenID\r
- * \r
- * @package openid_client\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Kevin Jardine <kevin@radagast.biz>\r
- * @copyright Curverider 2008-2009\r
- * @link http://radagast.biz/\r
- * \r
- */\r
- \r
- Just unzip into your Elgg mod directory and activate.\r
- \r
- There are several configuration options that you can use to add fancier\r
- features. These are available through the "Configure OpenID client" link\r
- in the admin sidebar. But they are not needed for basic operation.\r
- \r
- *Single Sign-On Link*\r
- \r
- You can optionally configure a single-sign-on link of the form:\r
- \r
- http://url-for-your-elgg/pg/openid_client/sso?username=XXX\r
- \r
- where XXX is an OpenID.\r
- \r
- This can be useful if you are integrating Elgg into another application.\r
- Just put that link into your application navigation, and your user will be\r
- automatically logged-in to Elgg using OpenID.\r
- \r
- This feature is turned off by default. You can activate it on the admin page.\r
- \r
- This link may be insecure because it routes around the XSS protection system\r
- normally used by the plugin. You have been warned.\r
- \r
- *Reset page*\r
- \r
- When logged-in as a site admin, you can visit:\r
- \r
- http://url-for-your-elgg/pg/openid_client/reset\r
- \r
- to reset all your OpenID associations and nonces. This may help if your\r
- association data with a particular OpenID server has become corrupted.\r
- \r
- These are just cached values and will temporarily slow down the next people\r
- who login to your site using OpenID, but not by a large amount. Once the\r
- cache is refreshed, things should be back to normal.
\ No newline at end of file
+++ /dev/null
-<?php\r
-\r
-// let admins configure the OpenID client\r
-\r
-require_once(dirname(dirname(__FILE__)).'/models/model.php');\r
-\r
-admin_gatekeeper();\r
-\r
-$always_sync = get_input('always_sync');\r
-$sso = get_input('sso','no');\r
-$default_server = trim(get_input('default_server'));\r
-$greenlist = trim(get_input('greenlist'));\r
-$yellowlist = trim(get_input('yellowlist'));\r
-$redlist = trim(get_input('redlist'));\r
-\r
-set_plugin_setting('default_server',$default_server,'openid_client');\r
-if ($always_sync) {\r
- set_plugin_setting('always_sync',$always_sync,'openid_client');\r
-} else {\r
- set_plugin_setting('always_sync','no','openid_client');\r
-}\r
-if ($sso) {\r
- set_plugin_setting('sso',$sso,'openid_client');\r
-} else {\r
- set_plugin_setting('sso','no','openid_client');\r
-} \r
-set_plugin_setting('greenlist',$greenlist,'openid_client');\r
-set_plugin_setting('yellowlist',$yellowlist,'openid_client');\r
-set_plugin_setting('redlist',$redlist,'openid_client');\r
-\r
-system_message(elgg_echo('openid_client:admin_response'));\r
-\r
-forward($CONFIG->wwwroot . "pg/openid_client/admin");\r
-\r
+++ /dev/null
-<?php\r
-require_once(dirname(dirname(__FILE__)).'/models/model.php');\r
-\r
-openid_client_handle_login();\r
+++ /dev/null
-<?php\r
-require_once(dirname(dirname(__FILE__)).'/models/model.php');\r
-\r
-global $CONFIG;\r
-set_context('openid');\r
-$code = get_input('openid_code');\r
-$name = trim(get_input('name'));\r
-$email = trim(get_input('email'));\r
-$error = false;\r
-if (!$name) {\r
- register_error(elgg_echo("openid_client:missing_name_error"));\r
- $error = true;\r
-}\r
-if (!$email || !validate_email_address($email)) {\r
- register_error(elgg_echo("openid_client:invalid_email_error"));\r
- $error = true;\r
-}\r
-\r
-if (empty($code) || !($details = openid_client_get_invitation($code))) {\r
- register_error(elgg_echo("openid_client:invalid_code_error"));\r
- $error = true;\r
-}\r
-\r
-if (!$error) {\r
- // looks good \r
- \r
- if ($code{0} == 'a') {\r
- // need to confirm first\r
- $details->email = $email;\r
- $details->name = $name;\r
- openid_client_send_activate_confirmation_message($details);\r
- system_message(sprintf(elgg_echo("openid_client:activate_confirmation"),$email));\r
- } elseif ($code{0} == 'n') {\r
- //activate and login\r
- $user = get_user($details->owner);\r
- $user->email = $email;\r
- $user->name = $name;\r
- $user->active = 'yes';\r
- $user->save();\r
- system_message(sprintf(elgg_echo("openid_client:created_openid_account"),$email, $name));\r
- login($user);\r
- }\r
- forward();\r
-} elseif ($details) {\r
- // regenerate the form\r
- $user = get_user($details->owner);\r
- $openid_url = $user->alias;\r
- $email_confirmation = openid_client_check_email_confirmation($openid_url);\r
- $body = openid_client_generate_missing_data_form($openid_url,$email,$fullname,$email_confirmation,$code); \r
- page_draw(elgg_echo('openid_client:information_title'),$body);\r
-} else {\r
- // bad code - not much to do but inform user\r
- forward();\r
-}\r
<?php
/**
- *
+ * OpenID client login action
*/
elgg_load_library('openid_consumer');
<?php
/**
- * Register an OpenID user
+ * Register OpenID user action
*/
elgg_set_context('openid_client');
$email = get_input('email');
$openid_identifier = get_input('openid_identifier');
-$password = 'test';
+$password = generate_random_cleartext_password();
try {
$guid = register_user($username, $password, $name, $email, false);
}
login($user);
-system_message($message);
+system_message(elgg_echo('openid_client:success:register'));
forward();
+++ /dev/null
-<?php\r
-require_once(dirname(dirname(__FILE__)).'/models/model.php');\r
-\r
-set_context('openid');\r
-global $CONFIG;\r
-\r
-if (isloggedin()) {\r
- \r
- $userid = get_loggedin_userid();\r
- $user = get_user($userid);\r
- $namechange = get_input('namechange');\r
- $emailchange = get_input('emailchange');\r
- $nosync = get_input('nosync');\r
- \r
- if ($namechange) {\r
- $name = get_input('new_name');\r
- $user->name = $name;\r
- system_message(sprintf(elgg_echo("openid_client:name_updated"),$name));\r
- }\r
- \r
- if ($emailchange) {\r
- $i_code = get_input('i_code');\r
- if (empty($i_code)) {\r
- $new_email = get_input('new_email');\r
- // this is an email address change request from a yellow OpenID, so the\r
- // email address change must be confirmed with an email message\r
- if (get_user_by_email($email)) {\r
- register_error(sprintf(elgg_echo("openid_client:email_in_use"),$email));\r
- } else {\r
- $details = openid_client_create_invitation('c',$user->username,$userid,$new_email,$user->name);\r
- openid_client_send_change_confirmation_message($details);\r
- system_message(sprintf(elgg_echo("openid_client:change_confirmation"), $email));\r
- }\r
- } elseif (!($details = openid_client_get_invitation($i_code))) {\r
- register_error(elgg_echo("openid_client:invalid_code_error"));\r
- } else {\r
- // this is an email address change request from a green OpenID, so the\r
- // email address change does not need to be confirmed\r
- \r
- $email = $details->email;\r
- $ident = $details->owner;\r
- if (get_user_by_email($email)) {\r
- register_error(sprintf(elgg_echo("openid_client:email_in_use"),$email));\r
- } else {\r
- $user->email;\r
- system_message(sprintf(elgg_echo("openid_client:email_updated"),$email));\r
- }\r
- }\r
- }\r
- \r
- if ($nosync) {\r
- $store = new OpenID_ElggStore();\r
- $store->addNoSyncStatus($user);\r
- }\r
-}\r
-\r
-forward();\r
<?php\r
+/**\r
+ * OpenID client English language file\r
+ */\r
\r
- $english = array( \r
- \r
- 'openid_client_login_title' => "Log in using OpenID",\r
- 'openid_client_login_service' => "Service",\r
- 'openid_client_logon' => "Logon",\r
- 'openid_client_go' => "Go",\r
- 'openid_client_remember_login' => "Remember login",\r
- 'openid_client:already_loggedin' => "You are already logged in.",\r
- 'openid_client:login_success' => "You have been logged on.",\r
- 'openid_client:login_failure' => "The username was not specified. The system could not log you in.",\r
- 'openid_client:disallowed' => "This site does not allow the OpenID that you entered. "\r
- ."Please try another OpenID or contact the site administrator for more information.",\r
- 'openid_client:redirect_error' => "Could not redirect to server: %s",\r
- 'openid_client:authentication_failure' => "OpenID authentication failed: %s is not a valid OpenID URL.",\r
- 'openid_client:authentication_cancelled' => "OpenID authentication cancelled.",\r
- 'openid_client:authentication_failed' => "OpenID authentication failed (status: %s, message: %s )",\r
- 'openid_client:banned' => "You have been banned from the system!",\r
- 'openid_client:email_in_use' => "Cannot change your email address to %s because it is already in use.",\r
- 'openid_client:email_updated' => "Your email address has been updated to %s",\r
- 'openid_client:information_title' => "OpenID information",\r
- 'openid_client:activate_confirmation' => "A confirmation message has been sent to %s ."\r
- ." Please click on the link in that message to activate your account."\r
- ." You will then be able to login using the OpenID you have supplied.",\r
- 'openid_client:change_confirmation' => "Your email address has changed. A confirmation message has been sent to"\r
- ." your new address at %s . Please click on the link in that message to confirm this new email address. ",\r
- 'openid_client:activate_confirmation_subject' => "%s account verification",\r
- 'openid_client:activate_confirmation_body' => "Dear %s,\n\nThank you for registering with %s.\n\n"\r
- ."To complete your registration, visit the following URL:\n\n\t%s\n\nwithin seven days.\n\nRegards,\n\nThe %s team.",\r
- 'openid_client:change_confirmation_subject' => "%s email change",\r
- 'openid_client:change_confirmation_body' => "Dear %s,\n\nWe have received a request to change your email address"\r
- ." registered with %s.\n\nTo change your email address to {%s}, visit the following URL:\n\n\t%s\n\nwithin seven days."\r
- ."\n\nRegards,\n\nThe %s team.", \r
- 'openid_client:email_label' => "Email:",\r
- 'openid_client:name_label' => "Name:",\r
- 'openid_client:submit_label' => "Submit",\r
- 'openid_client:cancel_label' => "Cancel",\r
- 'openid_client:nosync_label' => "Do not notify me again if the data on this system is not the same"\r
- ." as the data on my OpenID server.",\r
- 'openid_client:sync_instructions' => "The information on your Open ID server is not the same as on this system."\r
- ." Tick the check boxes next to the information you would like to update (if any) and press submit.",\r
- 'openid_client:missing_title' => "Please provide missing information",\r
- 'openid_client:sync_title' => "Synchronise your information",\r
- 'openid_client:missing_email' => "a valid email address",\r
- 'openid_client:missing_name' => "your full name",\r
- 'openid_client:and' => "and",\r
- 'openid_client:missing_info_instructions' => "In order to create an account on this site you need to supply %s."\r
- ." Please enter this information below.",\r
- 'openid_client:create_email_in_use' => "Cannot create an account with the email address %s because it is already in use.",\r
- 'openid_client:missing_name_error' => "You must provide a name.",\r
- 'openid_client:invalid_email_error' => "You must provide a valid email address.",\r
- 'openid_client:invalid_code_error' => "Your form code appears to be invalid. Codes only last for seven days;"\r
- ." it's possible that yours is older.",\r
- 'openid_client:user_creation_failed' => "Unable to create OpenID account.",\r
- 'openid_client:created_openid_account' => "Created OpenID account, transferred email %s and name %s from the OpenID server.",\r
- 'openid_client:name_updated' => "Your name has been updated to %s.",\r
- 'openid_client:missing_confirmation_code' => "Your confirmation code appears to be missing. Please check your link and try again.",\r
- 'openid_client:at_least_13' => "You must indicate that you are at least 13 years old to join.",\r
- 'openid_client:account_created' => "Your account was created! You can now log in using the OpenID (%s) you supplied.",\r
- 'openid_client:email_changed' => "Your email address has been changed to {%s} . "\r
- ."You can now login using your OpenID if you are not already logged in.",\r
- 'openid_client:thankyou' => "Thank you for registering for an account with %s!"\r
- ." Registration is completely free, but before you confirm your details,"\r
- ." please take a moment to read the following documents:",\r
- 'openid_client:terms' => "terms and conditions",\r
- 'openid_client:privacy' => "privacy policy",\r
- 'openid_client:acceptance' => "Submitting the form below indicates acceptance of these terms. "\r
- ."Please note that currently you must be at least 13 years of age to join the site.",\r
- 'openid_client:correct_age' => "I am at least thirteen years of age.",\r
- 'openid_client:join_button_label' => "Join",\r
- 'openid_client:confirmation_title' => "OpenID confirmation",\r
- 'openid_client:admin_title' => "Configure OpenID client",\r
- 'openid_client:default_server_title' => "Default server",\r
- 'openid_client:default_server_instructions1' => "You can simplify logging on using OpenID by specifying a default OpenID server."\r
- ." Users who enter a simple account name (eg. \"susan\") during an OpenID login can have it expanded to a full OpenID"\r
- ." if you provide a default server here. Put \"%s\" where you want the account name added. For example, enter"\r
- ." \"http://openidserver.com/%s/\" if you want the OpenID to become \"http://openidserver.com/susan/\" or"\r
- ." \"http://%s.openidserver.com/\" if you want the OpenID to become \"http://susan.openidserver.com/\"",\r
- 'openid_client:default_server_instructions2' => "The presence of dots (\".\") is used to distinguish OpenID URLs from simple"\r
- ." account names, so you can only use this feature for default servers that do not allow dots in their simple account names.",\r
- 'openid_client:server_sync_title' => "Server synchronisation",\r
- 'openid_client:server_sync_instructions' => "Check this box if you want to automatically update this client site if a"\r
- ." user logs in and their email address or name is different from that on their OpenID server. Leave this box unchecked"\r
- ." if you want to allow your users to have the ability to maintain a different name or email address on this system"\r
- ." from the ones on their OpenID server.",\r
- 'openid_client:server_sync_label' => "Automatically update from the OpenID server.",\r
- \r
- 'openid_client:sso_title' => "Single sign-on",\r
- 'openid_client:sso_instructions' => "Check this box if you want to activate the single sign-on link."\r
- ." This link simulates an Elgg OpenID login form submit and can be used to create a one-click single sign-on with Elgg."\r
- ." Note that it is a bit insecure becomes it circumvents Elgg's XSS security"\r
- ." and could in principle be used to log the user into Elgg without his/her knowledge.",\r
- 'openid_client:sso_label' => "Enable single sign-on (SSO) link.",\r
- \r
- 'openid_client:lists_title' => "OpenID lists",\r
- 'openid_client:lists_instruction1' => "You can set up a green, yellow or red list of OpenIDs that this client will accept.",\r
- 'openid_client:lists_instruction2' => "The green list contains OpenIDs that will be accepted to provide identification"\r
- ." and that can supply a trusted email address.",\r
- 'openid_client:lists_instruction3' => "The yellow list contains OpenIDs that will be accepted for identification only."\r
- ." If they provide an email address, a message will be sent to that address for confirmation before registration is allowed.",\r
- 'openid_client:lists_instruction4' => "The red list contains OpenIDs that should be rejected.",\r
- 'openid_client:lists_instruction5' => "If you do not provide a green, yellow or red list, by default all OpenIDs"\r
- ." will be given a green status (they will be accepted for identification and email addresses that they provide will be"\r
- ." accepted without confirmation).",\r
- 'openid_client:lists_instruction6' => "Put one OpenID entry on each line. You can use \"*\" as a wildcard character"\r
- ." to match a number of possible OpenIDs or OpenID servers. Each OpenID must begin with http:// or https:// and end with a"\r
- ." slash (\"/\") - eg. http://*.myopenid.com/",\r
- 'openid_client:green_list_title' => "Green list",\r
- 'openid_client:yellow_list_title' => "Yellow list",\r
- 'openid_client:red_list_title' => "Red list",\r
- 'openid_client:ok_button_label' => "OK",\r
- 'openid_client:admin_response' => "OpenID client configuration values saved."\r
- \r
- );\r
- \r
- add_translation("en",$english);\r
+$english = array(\r
+ 'openid_client:success:register' => 'Your account has been created.',\r
+ 'openid_client:error:bad_register' => 'Unable to create an account. Please contact a site administrator.',\r
+);\r
\r
-?>
\ No newline at end of file
+add_translation('en', $english);\r
<?xml version="1.0" encoding="UTF-8"?>
-<plugin_manifest>
- <field key="author" value="Kevin Jardine" />
- <field key="version" value="1.3" />
- <field key="description" value="OpenID client plugin" />
- <field key="website" value="http://www.elgg.org/" />
- <field key="copyright" value="(C) Curverider 2008-2009" />
- <field key="elgg_version" value="2009022701" />
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>OpenID Client</name>
+ <author>Core developers</author>
+ <version>1.8</version>
+ <description>OpenID consumer for Elgg. Enabled users log in using their credentials from sites like Google and Yahoo.</description>
+ <category>user</category>
+ <website>http://www.elgg.org/</website>
+ <copyright>Cash Costello 2011</copyright>
+ <license>GNU General Public License version 2</license>
+ <requires>
+ <type>elgg_release</type>
+ <version>1.8</version>
+ </requires>
+ <requires>
+ <type>plugin</type>
+ <name>openid_api</name>
+ </requires>
</plugin_manifest>
+++ /dev/null
-<?php\r
-/**\r
- * An Elgg 1.x compatible store implementation \r
- */\r
- \r
-require_once (dirname(__FILE__).'/Auth/OpenID.php');\r
-require_once (dirname(__FILE__).'/Auth/OpenID/Interface.php');\r
-require_once (dirname(__FILE__).'/Auth/OpenID/Consumer.php');\r
-require_once (dirname(__FILE__).'/Auth/OpenID/Nonce.php');\r
-require_once (dirname(__FILE__).'/Auth/OpenID/SReg.php');\r
-\r
- /**\r
- * Require base class for creating a new interface.\r
- */\r
- \r
-\r
-class OpenID_ElggStore extends Auth_OpenID_OpenIDStore {\r
-\r
- function resetAssociations () {\r
- openid_client_delete_entities('object', 'openid_client::association');\r
- }\r
- function resetNonces () {\r
- openid_client_delete_entities('object', 'openid_client::nonce');\r
- }\r
- function getAssociation ($server_url, $handle = null) {\r
- if (isset($handle)) {\r
- $meta_array = array(\r
- 'server_url' => $server_url,\r
- 'handle' => $handle\r
- );\r
- $assocs = get_entities_from_metadata_multi($meta_array, 'object', 'openid_client::association');\r
- } else {\r
- $assocs = get_entities_from_metadata('server_url', $server_url, 'object','openid_client::association');\r
- }\r
- \r
- if (!$assocs || (count($assocs) == 0)) {\r
- return null;\r
- } else {\r
- $associations = array();\r
-\r
- foreach ($assocs as $assoc_row) {\r
- $assoc = new Auth_OpenID_Association($assoc_row->handle,\r
- base64_decode($assoc_row->secret),\r
- $assoc_row->issued,\r
- $assoc_row->lifetime,\r
- $assoc_row->assoc_type);\r
-\r
- if ($assoc->getExpiresIn() == 0) {\r
- OpenID_ElggStore::removeAssociation($server_url, $assoc->handle);\r
- } else {\r
- $associations[] = array($assoc->issued, $assoc);\r
- }\r
- }\r
-\r
- if ($associations) {\r
- $issued = array();\r
- $assocs = array();\r
- foreach ($associations as $key => $assoc) {\r
- $issued[$key] = $assoc[0];\r
- $assocs[$key] = $assoc[1];\r
- }\r
-\r
- array_multisort($issued, SORT_DESC, $assocs, SORT_DESC,\r
- $associations);\r
-\r
- // return the most recently issued one.\r
- list($issued, $assoc) = $associations[0];\r
- return $assoc;\r
- } else {\r
- return null;\r
- }\r
- }\r
- }\r
- \r
- function removeAssociation ($server_url, $handle) {\r
- if (isset($handle)) {\r
- $meta_array = array(\r
- 'server_url' => $server_url,\r
- 'handle' => $handle\r
- );\r
- $entities = get_entities_from_metadata_multi($meta_array, 'object', 'openid_client::association');\r
- } else {\r
- $entities = get_entities_from_metadata('server_url', $server_url, 'object','openid_client::association');\r
- }\r
- foreach ($entities as $entity) {\r
- $entity->delete();\r
- }\r
- }\r
- function reset () {\r
- OpenID_ElggStore::resetAssociations ();\r
- OpenID_ElggStore::resetNonces ();\r
- }\r
- \r
- function storeAssociation ($server_url, $association) {\r
- \r
- // Initialise a new ElggObject\r
- $association_obj = new ElggObject();\r
- \r
- $association_obj->subtype = 'openid_client::association';\r
- $association_obj->owner_guid = 0;\r
- $association_obj->container_guid = 0;\r
- $association_obj->title = 'association';\r
- $association_obj->access_id = 2; \r
- \r
- if ($association_obj->save()) { \r
- $association_obj->server_url = $server_url;\r
- $association_obj->handle = $association->handle;\r
- $association_obj->secret = base64_encode($association->secret);\r
- $association_obj->issued = $association->issued;\r
- $association_obj->lifetime = $association->lifetime;\r
- $association_obj->assoc_type = $association->assoc_type;\r
- return true;\r
- } else {\r
- return false;\r
- }\r
- }\r
- \r
- function useNonce ( $server_url, $timestamp, $salt) {\r
- global $Auth_OpenID_SKEW;\r
-\r
- if ( abs($timestamp - time()) > $Auth_OpenID_SKEW ) {\r
- return false;\r
- }\r
- \r
- // check to see if the nonce already exists\r
- \r
- $meta_array = array(\r
- 'server_url' => $server_url,\r
- 'timestamp' => $timestamp,\r
- 'salt' => $salt\r
- );\r
- \r
- $entities = get_entities_from_metadata_multi($meta_array, 'object', 'openid_client::nonce');\r
- \r
- if ($entities) {\r
- // bad - this nonce is already in use\r
- return false;\r
- } else { \r
- // Initialise a new ElggObject\r
- $nonce_obj = new ElggObject();\r
- \r
- $nonce_obj->subtype = 'openid_client::nonce';\r
- $nonce_obj->owner_guid = 0;\r
- $nonce_obj->container_guid = 0;\r
- $nonce_obj->title = 'nonce';\r
- $nonce_obj->access_id = 2;\r
- \r
- if ($nonce_obj->save()) {\r
- $nonce_obj->server_url = $server_url;\r
- $nonce_obj->timestamp = $timestamp;\r
- $nonce_obj->salt = $salt;\r
- return true;\r
- } else {\r
- return false;\r
- }\r
- }\r
- }\r
- \r
- function getNoSyncStatus($user) {\r
- if (isset($user) && isset($user->openid_client_nosync_status)) {\r
- return $user->openid_client_nosync_status;\r
- } else {\r
- return false;\r
- }\r
- }\r
- \r
- function addNoSyncStatus($user) {\r
- $user->openid_client_nosync_status = 1;\r
- } \r
-}\r
-\r
-function openid_client_create_invitation($prefix,$username,$ident,$email,$fullname) {\r
- \r
- $invite = new ElggObject();\r
- \r
- $invite->subtype = 'invitation';\r
- $invite->owner_guid = 0;\r
- $invite->container_guid = 0;\r
- $invite->title = 'invitation';\r
- $invite->access_id = 2;\r
- if ($invite->save()) {\r
- $invite->new_owner = $ident;\r
- $invite->name = $fullname;\r
- $invite->email = $email;\r
- $invite->username = $username; \r
- $invite->code = $prefix . substr(base_convert(md5(time() . $username), 16, 36), 0, 7);\r
- $invite->added = time();\r
- return $invite;\r
- } else {\r
- return null;\r
- }\r
-}\r
-\r
-function openid_client_get_invitation($code) {\r
- $invitations = get_entities_from_metadata('code', $code, 'object','invitation');\r
- if ($invitations) {\r
- return $invitations[0];\r
- } else {\r
- return null;\r
- } \r
-}\r
-\r
-function openid_client_remove_invitation($code) {\r
- $invitations = get_entities_from_metadata('code', $code, 'object','invitation');\r
- if ($invitations) {\r
- foreach ($invitations as $invitation) {\r
- $invitation->delete();\r
- }\r
- } \r
-}\r
-\r
-function openid_client_get_invitation_by_username($username) {\r
- $invitations = get_entities_from_metadata('username', $username, 'object','invitation');\r
- if ($invitations) {\r
- return $invitations[0];\r
- } else {\r
- return null;\r
- } \r
-}\r
-\r
-function openid_client_send_activate_confirmation_message($details) {\r
- \r
- global $CONFIG;\r
- \r
- // not sure where these should really come from\r
- $site = get_entity($CONFIG->site_guid);\r
- $from_name = $site->name;\r
- $from_email = $site->email;\r
- \r
- $subject = sprintf(elgg_echo('openid_client:activate_confirmation_subject'),$CONFIG->sitename);\r
- $url = $CONFIG->wwwroot . "pg/openid_client/confirm?code=" . $details->code;\r
-\r
- $message = wordwrap(sprintf(elgg_echo('openid_client:activate_confirmation_body'),$details->name,$CONFIG->sitename,$url, $CONFIG->sitename));\r
- openid_client_email_user($details->name, $details->email, $from_name, $from_email, $subject,$message);\r
-}\r
-\r
-function openid_client_send_change_confirmation_message($details) {\r
- global $CONFIG;\r
- \r
- // not sure where these should really come from\r
- $site = get_entity($CONFIG->site_guid);\r
- $from_name = $site->name;\r
- $from_email = $site->email;\r
- \r
- $subject = sprintf(elgg_echo('openid_client:change_confirmation_subject'),$from_name);\r
- $url = $CONFIG->wwwroot . "pg/openid_client/confirm?code=" . $details->code;\r
- $message = wordwrap(sprintf(elgg_echo('openid_client:change_confirmation_body'),\r
- $details->name,$CONFIG->sitename,$url, $CONFIG->sitename));\r
- openid_client_email_user($details->name, $details->email, $from_name, $from_email, $subject,$message);\r
-}\r
-\r
-$emailLabel = elgg_echo('openid_client:email_label');\r
-$nameLabel = elgg_echo('openid_client:name_label');\r
-$submitLabel = elgg_echo('openid_client:submit_label');\r
-$cancelLabel = elgg_echo('openid_client:cancel_label');\r
-\r
-function openid_client_generate_sync_form($new_email,$new_name, $user, $email_confirmation) {\r
- \r
- return elgg_view_layout('one_column',elgg_view_title(elgg_echo('openid_client:sync_title')) . elgg_view("openid_client/forms/sync", \r
- array(\r
- 'userid' => $user->getGUID(),\r
- 'new_email' => $new_email,\r
- 'new_name' => $new_name,\r
- 'email_confirmation' => $email_confirmation\r
- ))); \r
-}\r
-\r
-\r
-function openid_client_generate_missing_data_form($openid_url,$email,$fullname,$email_confirmation,$details) {\r
-\r
- return elgg_view_layout('one_column',elgg_view_title(elgg_echo('openid_client:missing_title')) . elgg_view("openid_client/forms/missing", \r
- array(\r
- 'openid_url' => $openid_url,\r
- 'email' => $email,\r
- 'fullname' => $fullname,\r
- 'email_confirmation' => $email_confirmation,\r
- 'openid_code' => $details->code\r
- )));\r
-}\r
-\r
-function openid_client_check_email_confirmation($openid_url) {\r
- global $CONFIG;\r
- \r
- $done = false; \r
- $email_confirmation = false;\r
- $greenlist = get_plugin_setting('greenlist','openid_client');\r
- $yellowlist = get_plugin_setting('yellowlist','openid_client');\r
- \r
- if ($greenlist) { \r
- foreach (explode("\n",$greenlist) as $entry ) {\r
- if (fnmatch($entry,$openid_url)) {\r
- $email_confirmation = false;\r
- $done = true;\r
- break;\r
- }\r
- }\r
- }\r
- if (!$done && $yellowlist) { \r
- foreach (explode("\n",$yellowlist) as $entry ) {\r
- if (fnmatch($entry,$openid_url)) {\r
- $email_confirmation = true;\r
- break;\r
- }\r
- }\r
- }\r
- return $email_confirmation;\r
-}\r
-\r
-//TODO: replace this function with the openid_client_register_user\r
-\r
-function openid_client_create_openid_user($openid_url,$email, $fullname, $email_confirmation) {\r
- \r
- global $messages;\r
- \r
- if ($email && get_user_by_email($email)) {\r
- register_error(sprintf(elgg_echo('openid_client:create_email_in_use'),$email));\r
- return null;\r
- } else {\r
- \r
- $user = new ElggUser();\r
- $user->email = $email;\r
- $user->name = $fullname;\r
- $user->access_id = ACCESS_PUBLIC;\r
- $user->subtype = 'openid';\r
-\r
- $user->username = openid_client_randomString(8);\r
- \r
- if ($user->save()) { \r
- $id = $user->getGUID(); \r
- $user = get_user($id); \r
- $user->alias = $openid_url; \r
- $user->username = "openid_".$id;\r
- \r
- if ($email_confirmation) {\r
- $user->active = 'no';\r
- } else {\r
- $user->active = 'yes';\r
- }\r
- \r
- $user->save();\r
- \r
- return $user;\r
- } else {\r
- register_error(elgg_echo('openid_client:user_creation_failed'));\r
- forward();\r
- return null;\r
- }\r
- } \r
-}\r
-\r
-/**\r
- * Registers a user, returning false if the username already exists\r
- *\r
- * @param string $username The username of the new user\r
- * @param string $password The password\r
- * @param string $name The user's display name\r
- * @param string $email Their email address\r
- * @param bool $allow_multiple_emails Allow the same email address to be registered multiple times?\r
- * @param int $friend_guid Optionally, GUID of a user this user will friend once fully registered\r
- * @return int|false The new user's GUID; false on failure\r
- * \r
- * Note: there is no way to pass the subtype in or to to change it afterwards,\r
- * so this code is copied here to create users with subtype "openid"\r
- * \r
- */\r
-function openid_client_register_user($username, $password, $name, $email, $allow_multiple_emails = false, $friend_guid = 0, $invitecode = '') {\r
- // Load the configuration\r
- global $CONFIG;\r
-\r
- $username = trim($username);\r
- // no need to trim password.\r
- $password = $password;\r
- $name = trim($name);\r
- $email = trim($email);\r
-\r
- // A little sanity checking\r
- if (empty($username)\r
- || empty($password)\r
- || empty($name)\r
- || empty($email)) {\r
- return false;\r
- }\r
-\r
- // See if it exists and is disabled\r
- $access_status = access_get_show_hidden_status();\r
- access_show_hidden_entities(true);\r
-\r
- // Validate email address\r
- if (!validate_email_address($email)) {\r
- throw new RegistrationException(elgg_echo('registration:emailnotvalid'));\r
- }\r
-\r
- // Validate password\r
- if (!validate_password($password)) {\r
- throw new RegistrationException(elgg_echo('registration:passwordnotvalid'));\r
- }\r
-\r
- // Validate the username\r
- if (!validate_username($username)) {\r
- throw new RegistrationException(elgg_echo('registration:usernamenotvalid'));\r
- }\r
-\r
- // Check to see if $username exists already\r
- if ($user = get_user_by_username($username)) {\r
- //return false;\r
- throw new RegistrationException(elgg_echo('registration:userexists'));\r
- }\r
-\r
- // If we're not allowed multiple emails then see if this address has been used before\r
- if ((!$allow_multiple_emails) && (get_user_by_email($email))) {\r
- throw new RegistrationException(elgg_echo('registration:dupeemail'));\r
- }\r
-\r
- access_show_hidden_entities($access_status);\r
-\r
- // Check to see if we've registered the first admin yet.\r
- // If not, this is the first admin user!\r
- $have_admin = datalist_get('admin_registered');\r
-\r
- // Otherwise ...\r
- $user = new ElggUser();\r
- $user->username = $username;\r
- $user->email = $email;\r
- $user->name = $name;\r
- $user->access_id = ACCESS_PUBLIC;\r
- $user->salt = generate_random_cleartext_password(); // Note salt generated before password!\r
- $user->password = generate_user_password($user, $password);\r
- $user->owner_guid = 0; // Users aren't owned by anyone, even if they are admin created.\r
- $user->container_guid = 0; // Users aren't contained by anyone, even if they are admin created.\r
- $user->subtype = 'openid';\r
- $user->save();\r
-\r
- // Turn on email notifications by default\r
- set_user_notification_setting($user->getGUID(), 'email', true);\r
-\r
- return $user->getGUID();\r
-}\r
-\r
-/**\r
- * Send a notification via email.\r
- * \r
- * TODO: figure out how to replace this (if possible) with notify_user\r
- * \r
- */\r
-function openid_client_email_user($to_name, $to_email, $from_name, $from_email, $subject, $message)\r
-{ \r
- $to = "$to_name <$to_email>";\r
- \r
- $headers = "From: $from_name <$from_email>\r\n";\r
- \r
- return mail($to, $subject, $message, $headers);\r
-} \r
-\r
-\r
-function openid_client_randomString($length)\r
-{\r
- // Generate random 32 character string\r
- $string = md5(time());\r
-\r
- // Position limiting\r
- $highest_startpoint = 32-$length;\r
-\r
- // Take a random starting point in the randomly\r
- // generated string, not going any higher then $highest_startpoint\r
- $randomString = substr($string,rand(0,$highest_startpoint),$length);\r
-\r
- return $randomString;\r
-\r
-}\r
-\r
-function openid_client_delete_entities($type, $subtype = "", $owner_guid = 0) {\r
- // sanity check to make sure "type" is defined\r
- if ($type) {\r
- $entities = get_entities($type, $subtype, $owner_guid, "time_created desc", 0);\r
- \r
- foreach ($entities as $entity) {\r
- $entity->delete();\r
- }\r
- \r
- return true;\r
- }\r
-}\r
-\r
-function openid_client_authenticate_user_login($username) {\r
- \r
- global $CONFIG;\r
- \r
- // match username against green, yellow and red lists\r
- \r
- $greenlist = get_plugin_setting('greenlist','openid_client');\r
- $yellowlist = get_plugin_setting('yellowlist','openid_client');\r
- $redlist = get_plugin_setting('redlist','openid_client');\r
- \r
- $passed = true;\r
- \r
- if ($greenlist || $yellowlist) {\r
- $passed = false;\r
- $yesarray = array_merge(explode("\n",$greenlist),explode("\n",$yellowlist));\r
- foreach ( $yesarray as $entry ) {\r
- if (fnmatch($entry,$username)) {\r
- $passed = true;\r
- break;\r
- }\r
- }\r
- }\r
- \r
- if ($passed) {\r
- if ($redlist) { \r
- foreach (explode("\n",$redlist) as $entry ) {\r
- if (fnmatch($entry,$username)) {\r
- $passed = false;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- \r
- if (!$passed) {\r
- \r
- register_error(elgg_echo("openid_client:disallowed"));\r
- return false;\r
- } \r
-\r
- $identity_url = $username;\r
-\r
- $consumer = new Auth_OpenID_Consumer(new OpenID_ElggStore());\r
-\r
- $auth_request = $consumer->begin($identity_url);\r
-\r
- if ($auth_request) {\r
- $trust_root = $CONFIG->wwwroot;\r
- \r
- $return_url = $CONFIG->wwwroot.'mod/openid_client/return.php';\r
-\r
- // Add simple registration arguments.\r
- \r
- $sreg_request = Auth_OpenID_SRegRequest::build(\r
- // Optional\r
- array('fullname', 'email'));\r
- if ($sreg_request) {\r
- $auth_request->addExtension($sreg_request);\r
- }\r
- \r
- // Store the token for this authentication so we can verify the\r
- // response.\r
- \r
- // For OpenID 1, send a redirect. For OpenID 2, use a Javascript\r
- // form to send a POST request to the server.\r
- \r
- if ($auth_request->shouldSendRedirect()) { \r
- $redirect_url = $auth_request->redirectURL($trust_root,\r
- $return_url);\r
- \r
- // If the redirect URL can't be built, display an error\r
- // message.\r
- if (Auth_OpenID::isFailure($redirect_url)) {\r
- register_error(sprintf(elgg_echo("openid_client:redirect_error"), $redirect_url->message));\r
- } else {\r
- // Send redirect.\r
- forward($redirect_url);\r
- }\r
- } else {\r
- // Generate form markup and render it.\r
- $form_id = 'openid_message';\r
- $form_html = $auth_request->formMarkup($trust_root, $return_url,\r
- false, array('id' => $form_id));\r
- \r
- // Display an error if the form markup couldn't be generated;\r
- // otherwise, render the HTML.\r
- if (Auth_OpenID::isFailure($form_html)) {\r
- register_error(sprintf(elgg_echo("openid_client:redirect_error"), $form_html->message));\r
- } else {\r
- $page_contents = array(\r
- "<html><head><title>",\r
- "OpenID transaction in progress",\r
- "</title></head>",\r
- "<body onload='document.getElementById(\"".$form_id."\").submit()'>",\r
- $form_html,\r
- "</body></html>");\r
- \r
- print implode("\n", $page_contents);\r
- \r
- exit;\r
- }\r
- } \r
- \r
- } else {\r
- register_error(sprintf(elgg_echo('openid_client:authentication_failure'),$username));\r
- }\r
-\r
- return false;\r
-\r
-}\r
-\r
-function openid_client_get_security_bit() {\r
- $ts = time();\r
- $token = generate_action_token($ts);\r
- return "__elgg_token=$token&__elgg_ts=$ts";\r
-}\r
-\r
-function openid_client_handle_login() {\r
- global $CONFIG;\r
-\r
- $passthru_url = get_input('passthru_url');\r
- \r
- if ($passthru_url) {\r
- $redirect_url = $passthru_url;\r
- } else {\r
- $redirect_url = $CONFIG->wwwroot . "index.php";\r
- }\r
- \r
- if (isloggedin()) {\r
- // if we're already logged in, say so and do nothing\r
- register_error(elgg_echo("openid_client:already_loggedin"));\r
- forward();\r
- } else {\r
- set_context('openid');\r
- $username = trim(get_input('username'));\r
- $externalservice = get_input('externalservice');\r
- \r
- if (!empty($externalservice)) {\r
- switch($externalservice) {\r
- \r
- case "livejournal": $username = "http://" . $username . ".livejournal.com";\r
- break;\r
- case "aim": $username = "http://openid.aol.com/" . $username;\r
- break;\r
- case "vox": $username = "http://" . $username . ".vox.com";\r
- break;\r
- case "wordpress": $username = "http://" . $username . ".wordpress.com";\r
- break;\r
- case "pip": $username = "http://" . $username . ".pip.verisignlabs.com";\r
- break;\r
- \r
- }\r
- }\r
- \r
- if (!empty($username)) {\r
- \r
- // normalise username\r
- \r
- if (strpos($username,'.') === false) {\r
- // appears to be a bare account name, so try for a default server\r
- $default_server = get_plugin_setting('default_server','openid_client');\r
- if ($default_server) {\r
- $username = sprintf($default_server,$username);\r
- }\r
- } elseif ((strpos($username,'http://') === false) && (strpos($username,'https://') === false)) {\r
- // allow for OpenID URLs that are missing the "http://" prefix\r
- $username = 'http://'.$username;\r
- }\r
- \r
- //TO DO: Find a replacement for the code below\r
- // Remove any malformed entries\r
- // delete_records('users', 'alias', $username, 'email', '');\r
- // try logging in\r
- $ok = openid_client_authenticate_user_login($username);\r
- if ($ok) {\r
- system_message(elgg_echo("openid_client:login_success"));\r
- } \r
- } else {\r
- register_error(elgg_echo("openid_client:login_failure"));\r
- }\r
- }\r
- \r
- forward($redirect_url);\r
- \r
-}\r
-\r
-if (!function_exists('fnmatch')) {\r
-function fnmatch($pattern, $string) {\r
- for ($op = 0, $npattern = '', $n = 0, $l = strlen($pattern); $n < $l; $n++) {\r
- switch ($c = $pattern[$n]) {\r
- case '\\':\r
- $npattern .= '\\' . @$pattern[++$n];\r
- break;\r
- case '.': case '+': case '^': case '$': case '(': case ')': case '{': case '}': case '=': case '!': case '<': case '>': case '|':\r
- $npattern .= '\\' . $c;\r
- break;\r
- case '?': case '*':\r
- $npattern .= '.' . $c;\r
- break;\r
- case '[': case ']': default:\r
- $npattern .= $c;\r
- if ($c == '[') {\r
- $op++;\r
- } else if ($c == ']') {\r
- if ($op == 0) return false;\r
- $op--;\r
- }\r
- break;\r
- }\r
- }\r
-\r
- if ($op != 0) return false;\r
-\r
- return preg_match('/' . $npattern . '/i', $string);\r
-}\r
-}\r
-\r
-?>\r
+++ /dev/null
-<?php\r
-require_once(dirname(dirname(__FILE__)).'/models/model.php');\r
-\r
-// let admins configure the OpenID client\r
-\r
-admin_gatekeeper();\r
- \r
-set_context('admin');\r
- \r
-$title = elgg_echo('openid_client:admin_title');\r
- \r
-$content = elgg_view_title($title);\r
- \r
-$content .= elgg_view("openid_client/forms/admin",\r
- array(\r
- 'default_server' => get_plugin_setting('default_server','openid_client'),\r
- 'always_sync' => get_plugin_setting('always_sync','openid_client'),\r
- 'sso' => get_plugin_setting('sso','openid_client'),\r
- 'greenlist' => get_plugin_setting('greenlist','openid_client'),\r
- 'yellowlist' => get_plugin_setting('yellowlist','openid_client'),\r
- 'redlist' => get_plugin_setting('redlist','openid_client'),\r
- ));\r
-\r
- \r
-$body = elgg_view_layout("two_column_left_sidebar", '', $content);\r
-\r
-page_draw($title, $body);\r
+++ /dev/null
-<?php\r
-\r
-// This used to be an action, but as it is sent in an email message\r
-// with unknown response time, it cannot have an action time stamp\r
-// and so is now just a page\r
-\r
-require_once(dirname(dirname(__FILE__)).'/models/model.php');\r
-\r
-set_context('openid');\r
-$code = get_input('code');\r
-if (empty($code)) {\r
- register_error(elgg_echo("openid_client:missing_confirmation_code"));\r
-} elseif ($code{0} == 'a') {\r
- // request to activate an account\r
- if (!$details = openid_client_get_invitation($code)) {\r
- register_error(elgg_echo("openid_client:invalid_code_error"));\r
- } else {\r
- // OK, everything seems to be in order, so activate this user\r
- $user = get_user($details->new_owner);\r
- $user->email = $details->email;\r
- $user->name = $details->name;\r
- $user->active = 'yes';\r
- $user->save();\r
- system_message(sprintf(elgg_echo("openid_client:account_created"), $details->username));\r
- openid_client_remove_invitation($code);\r
- }\r
-\r
-} elseif ($code{0} == 'c') { \r
- // request to change an email address\r
- if (!$details = openid_client_get_invitation($code)) {\r
- register_error(elgg_echo("openid_client:invalid_code_error"));\r
- } else {\r
- // OK, everything seems to be in order, so change the email address\r
- $user = get_user($details->new_owner);\r
- $user->email = $details->email;\r
- $user->save();\r
- system_message(sprintf(elgg_echo('openid_client:email_changed'),$details->email));\r
- openid_client_remove_invitation($code);\r
- }\r
-} \r
-\r
-if(isset($body) && $body) {\r
- page_draw(elgg_echo('openid_client:confirmation_title'),$body);\r
-} else {\r
- forward();\r
-}\r
+++ /dev/null
-<?php\r
-require_once(dirname(dirname(__FILE__)).'/models/model.php');\r
-\r
-admin_gatekeeper();\r
-\r
-set_context('openid');\r
-\r
-$store = new OpenID_ElggStore();\r
-$store->resetAssociations();\r
-$store->resetNonces();\r
-\r
-print "OpenID store reset";\r
+++ /dev/null
-<?php\r
-require_once(dirname(dirname(__FILE__)).'/models/model.php');\r
-global $CONFIG;\r
-\r
-$sso = get_plugin_setting('sso','openid_client');\r
-if (!isloggedin() && ($sso == 'yes')) {\r
- openid_client_handle_login();\r
-} else {\r
- forward();\r
-}\r
-exit;\r
-// $url = $CONFIG->wwwroot.'action/openid_client/login';\r
-// $ts = time();\r
-// $token = generate_action_token($ts);\r
-// $fields = array(\r
-// '__elgg_token'=>$token,\r
-// '__elgg_ts'=>$ts,\r
-// 'passthru_url'=>'',\r
-// 'externalservice'=>'',\r
-// 'username'=>urlencode($openid_url),\r
-// );\r
-//\r
-// //url-ify the data for the POST\r
-// foreach($fields as $key=>$value) {\r
-// $fields_string .= $key.'='.$value.'&'; \r
-// }\r
-// rtrim($fields_string,'&');\r
-// \r
-// //open connection\r
-// $ch = curl_init();\r
-// \r
-// //set the url, number of POST vars, POST data\r
-// curl_setopt($ch,CURLOPT_URL,$url);\r
-// //curl_setopt($ch,CURLOPT_POST,count($fields));\r
-// curl_setopt($ch,CURLOPT_POST,true);\r
-// curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);\r
-// curl_setopt($ch,CURLOPT_RETURNTRANSFER,false); \r
-// curl_setopt($ch,CURLOPT_FAILONERROR,true);\r
-// //curl_setopt($ch,CURLOPT_HEADER, true);\r
-// curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);\r
-// \r
-// //execute post\r
-// curl_exec($ch);\r
-// \r
-// //print_r (curl_getinfo($ch));\r
-// \r
-// //print $result;\r
-// \r
-// //close connection\r
-// curl_close($ch);\r
-\r
-?>
\ No newline at end of file
// register the new user\r
$result = openid_client_registration_page_handler($data);\r
if (!$result) {\r
- register_error();\r
+ register_error('openid_client:error:bad_register');\r
forward();\r
}\r
}\r
<?php\r
/**\r
* Elgg OpenID client\r
- * \r
+ *\r
+ * This is a rewrite of the OpenID client written by Kevin Jardine for\r
+ * Curverider Ltd for Elgg 1.0-1.7.\r
*/\r
\r
elgg_register_event_handler('init', 'system', 'openid_client_init');\r
* @uses $vars['name']
*/
-$username_label = '';
+$username_label = elgg_echo('username');
$username_input = elgg_view('input/text', array(
'name' => 'username',
'value' => $vars['username'],
));
-$name_label = elgg_echo();
+$name_label = elgg_echo('name');
$name_input = elgg_view('input/text', array(
'name' => 'name',
'value' => $vars['name'],
));
-$email_label = elgg_echo();
+$email_label = elgg_echo('email');
$email_input = elgg_view('input/email', array(
'name' => 'email',
'value' => $vars['email'],
<?php\r
-\r
- /**\r
- * Elgg OpenID login form css\r
- * \r
- * @package Elgg\r
- * @subpackage openid_client\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Kevin Jardine, Radagast Solutions\r
- * @copyright Curverider Ltd 2008-2009\r
- * @link http://elgg.org/\r
- */\r
+/**\r
+ * OpenID client CSS\r
+ */\r
\r
?>\r
-\r
-\r
-\r
-.river_user_openid_friend {\r
- background: url(<?php echo $vars['url']; ?>_graphics/river_icons/river_icon_friends.gif) no-repeat left -1px;\r
-}\r
-.river_user_openid_update {\r
- background: url(<?php echo $vars['url']; ?>_graphics/river_icons/river_icon_profile.gif) no-repeat left -1px;\r
-}\r
-.river_user_openid_messageboard {\r
- background: url(<?php echo $vars['url']; ?>_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px;\r
-}\r
-\r
-#openid_login #login-box h2 {\r
- margin:0;\r
- padding:5px 0 10px 0;\r
-}\r
-#openid_login #login-box-openid form {\r
- background-color: none;\r
- margin:0;\r
- padding:0;\r
-}\r
-input.openid_login {\r
- background: url(<?php echo $vars['url']; ?>mod/openid_client/graphics/login-bg.gif) no-repeat;\r
- background-color: #fff;\r
- background-position: 0 50%;\r
- color: #000;\r
- width: 160px;\r
-}\r
-#openid_show {\r
- cursor:pointer;\r
-}\r
+++ /dev/null
-<?php\r
-\r
-/**\r
- * Elgg openid_client admin page\r
- * \r
- * @package openid_client\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Kevin Jardiner <kevin@radagast.biz>\r
- * @copyright Curverider Ltd 2008-2009\r
- * @link http://elgg.com/\r
- * \r
- */\r
-\r
-if ($vars['always_sync'] == 'yes') {\r
- $sync_checked = 'checked="checked"';\r
-} else {\r
- $sync_checked = '';\r
-}\r
-\r
-if ($vars['sso'] == 'yes') {\r
- $sso_checked = 'checked="checked"';\r
-} else {\r
- $sso_checked = '';\r
-}\r
-\r
-$default_server = $vars['default_server'];\r
-\r
-$greenlist = $vars['greenlist'];\r
-$yellowlist = $vars['yellowlist'];\r
-$redlist = $vars['redlist'];\r
-\r
-$action = $CONFIG->wwwroot.'action/openid_client/admin';\r
-\r
-$default_server_title = elgg_echo('openid_client:default_server_title');\r
-$default_server_instructions1 = elgg_echo('openid_client:default_server_instructions1');\r
-$default_server_instructions2 = elgg_echo('openid_client:default_server_instructions2');\r
-\r
-$server_sync_title = elgg_echo('openid_client:server_sync_title');\r
-$server_sync_instructions = elgg_echo('openid_client:server_sync_instructions');\r
-$server_sync_label = elgg_echo('openid_client:server_sync_label');\r
-\r
-$sso_title = elgg_echo('openid_client:sso_title');\r
-$sso_instructions = elgg_echo('openid_client:sso_instructions');\r
-$sso_label = elgg_echo('openid_client:sso_label');\r
-\r
-$lists_title = elgg_echo('openid_client:lists_title');\r
-\r
-$lists_instruction1 = elgg_echo('openid_client:lists_instruction1');\r
-$lists_instruction2 = elgg_echo('openid_client:lists_instruction2');\r
-$lists_instruction3 = elgg_echo('openid_client:lists_instruction3');\r
-$lists_instruction4 = elgg_echo('openid_client:lists_instruction4');\r
-$lists_instruction5 = elgg_echo('openid_client:lists_instruction5');\r
-$lists_instruction6 = elgg_echo('openid_client:lists_instruction6');\r
-\r
-$green_list_title = elgg_echo('openid_client:green_list_title');\r
-$yellow_list_title = elgg_echo('openid_client:yellow_list_title');\r
-$red_list_title = elgg_echo('openid_client:red_list_title');\r
-\r
-$ok_button_label = elgg_echo('openid_client:ok_button_label');\r
-\r
-$security_token = elgg_view('input/securitytoken');\r
-\r
-$body = <<<END\r
-<div class="admin_statistics">\r
-<form action="$action" method="post">\r
-$security_token\r
-<h3>$default_server_title</h3>\r
-<p>$default_server_instructions1</p>\r
-<p>$default_server_instructions2</p>\r
-<p><input type="text" size="60" name="default_server" value="$default_server" /></p>\r
-<h3>$server_sync_title</h3>\r
-<p>$server_sync_instructions</p>\r
-<p><input type="checkbox" name="always_sync" value="yes" $sync_checked />\r
-$server_sync_label</p>\r
-<h3>$sso_title</h3>\r
-<p>$sso_instructions</p>\r
-<p><input type="checkbox" name="sso" value="yes" $sso_checked />\r
-$sso_label</p>\r
-<h3>$lists_title</h3>\r
-<p>$lists_instruction1</p>\r
-<p>$lists_instruction2</p>\r
-<p>$lists_instruction3</p>\r
-<p>$lists_instruction4</p>\r
-<p>$lists_instruction5</p>\r
-<p>$lists_instruction6</p>\r
-<h3>$green_list_title</h3>\r
-<p><textarea name="greenlist" rows="5" cols="60">$greenlist</textarea></p>\r
-<h3>$yellow_list_title</h3>\r
-<p><textarea name="yellowlist" rows="5" cols="60">$yellowlist</textarea></p>\r
-<h3>$red_list_title</h3>\r
-<p><textarea name="redlist" rows="5" cols="60">$redlist</textarea></p>\r
-<input type="submit" name="submit" value="$ok_button_label" />\r
-</form>\r
-</div>\r
-END;\r
-\r
-print $body;\r
-\r
-?>
\ No newline at end of file
+++ /dev/null
-<?php\r
-\r
- /**\r
- * Elgg OpenID login form\r
- * \r
- * @package Elgg\r
- * @subpackage openid_client\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Kevin Jardine, Radagast Solutions\r
- * @copyright Curverider Ltd 2008-2009\r
- * @link http://elgg.org/\r
- */\r
- \r
-?>\r
-<script type="text/javascript">\r
-$(document).ready(function() {\r
- $('div#openid_login').hide();\r
- $('#openid_show').click(function(){\r
- $('div#openid_login').slideToggle('medium');\r
- });\r
- });\r
-</script>\r
-<div class="contentWrapper">\r
-<a id="openid_show"><img src="<?php echo $vars['url']; ?>mod/openid_client/graphics/openid.jpg" alt="OpenID" /></a>\r
-\r
-<div id="openid_login">\r
-<div id="login-box-openid">\r
- <form action="<?php echo $vars['url']; ?>action/openid_client/login" method="post">\r
- <?php echo elgg_view('input/securitytoken'); ?>\r
- <input type="hidden" name="passthru_url" value="http://<?php echo $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI'] ?>" />\r
- <table>\r
- <tr>\r
- <td><p>\r
- <label><?php echo elgg_echo('openid_client_login_service'); ?><br /><select name="externalservice">\r
- <option value="">OpenID</option>\r
- <option value="aim">AIM</option>\r
- <option value="livejournal">LiveJournal</option>\r
- <option value="vox">Vox</option>\r
- <option value="pip">Verisign PIP</option>\r
- <option value="wordpress">Wordpress.com</option>\r
- </select>\r
- </label></p>\r
- </tr>\r
- <tr>\r
- <td><div class="loginbox">\r
- <label><?php echo elgg_echo('username'); ?><br /><input class="openid_login" type="text" name="username" id="username" style="size: 200px" /></label>\r
- <br /><input type="submit" name="submit" value="<?php echo elgg_echo('openid_client_go'); ?>" />\r
- <br /><div id="persistent_login"><label><input type="checkbox" name="remember" checked="checked" /><?php echo elgg_echo('openid_client_remember_login'); ?></label></div>\r
- </div>\r
- </td>\r
- </tr> \r
- </table>\r
- </form>\r
-</div>\r
-</div>\r
-\r
-</div>\r
+++ /dev/null
-<?php\r
-\r
-/**\r
- * Elgg openid_client missing data page\r
- * \r
- * @package openid_client\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Kevin Jardiner <kevin@radagast.biz>\r
- * @copyright Curverider Ltd 2008-2009\r
- * @link http://elgg.com/\r
- * \r
- * @uses the following values in $vars:\r
- *\r
- * 'openid_url' the OpenID\r
- * 'email' the user's email (if known)\r
- * 'fullname' the user's full name (if known)\r
- * 'email_confirmation' whether the email address needs to be confirmed\r
- * 'code' a magic code that associates this data with a real user\r
- */\r
- \r
-$emailLabel = elgg_echo('openid_client:email_label');\r
-$nameLabel = elgg_echo('openid_client:name_label');\r
-$submitLabel = elgg_echo('openid_client:submit_label');\r
-$cancelLabel = elgg_echo('openid_client:cancel_label');\r
-\r
-$missing_email = elgg_echo('openid_client:missing_email');\r
-$missing_name = elgg_echo('openid_client:missing_name');\r
-$and = elgg_echo('openid_client:and');\r
-$email_form = "<table><tr><td>$emailLabel</td><td><input type=".'"text" size="50" name="email" value=""></td></tr></table>';\r
-$name_form = "<table><tr><td>$nameLabel</td><td><input type=".'"text" size="50" name="name" value=""></td></tr></table>';\r
-$email_hidden = '<input type="hidden" name="email" value="'.$vars['email'].'" />'."\n";\r
-$name_hidden = '<input type="hidden" name="name" value="'.$vars['fullname'].'" />'."\n";\r
-\r
-if (!$vars['email'] && !$$vars['fullname']) {\r
- $missing_fields = $missing_email.' '.$and.' '.$missing_name;\r
- $visible_fields = $email_form.'<br />'.$name_form;\r
- $hidden_fields = '';\r
-} elseif (!$vars['email']) {\r
- $missing_fields = $missing_email;\r
- $visible_fields = $email_form;\r
- $hidden_fields = $name_hidden;\r
-} elseif (!$vars['fullname']) {\r
- $missing_fields = $missing_name;\r
- $visible_fields = $name_form;\r
- $hidden_fields = $email_hidden;\r
-}\r
-\r
-$hidden_fields .= '<input type="hidden" name="openid_code" value="'.$vars['openid_code'].'" />'."\n";\r
-\r
-$instructions = sprintf(elgg_echo('openid_client:missing_info_instructions'),$missing_fields);\r
-\r
-$action = $CONFIG->wwwroot.'action/openid_client/missing';\r
-$security_token = elgg_view('input/securitytoken');\r
- \r
-$body .= <<< END\r
- $instructions\r
- <form action="$action" method="post">\r
- $security_token\r
- <p>\r
- $visible_fields\r
- </p>\r
- <p>\r
- $hidden_fields\r
- <input type="submit" name="submit" value="$submitLabel" />\r
- <input type="submit" name="cancel" value="$cancelLabel" />\r
- </p>\r
-</form>\r
- \r
-END;\r
-\r
-echo elgg_view('page_elements/contentwrapper',array('body'=>$body));\r
-\r
-?>
\ No newline at end of file
+++ /dev/null
-<?php\r
-\r
-/**\r
- * Elgg openid_client sync data page\r
- * \r
- * @package openid_client\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Kevin Jardiner <kevin@radagast.biz>\r
- * @copyright Curverider Ltd 2008-2009\r
- * @link http://elgg.com/\r
- * \r
- * @uses the following values in $vars:\r
- *\r
- * 'userid' the user's GUID\r
- * 'new_email' the user's new email\r
- * 'new_name' the user's new full name\r
- * 'email_confirmation' whether the email address needs to be confirmed\r
- */\r
- \r
-$emailLabel = elgg_echo('openid_client:email_label');\r
-$nameLabel = elgg_echo('openid_client:name_label');\r
-$submitLabel = elgg_echo('openid_client:submit_label');\r
-$cancelLabel = elgg_echo('openid_client:cancel_label');\r
-$noSyncLabel = elgg_echo('openid_client:nosync_label');\r
-$instructions = elgg_echo('openid_client:sync_instructions');\r
-\r
-$new_email = $vars['new_email'];\r
-$new_name = $vars['new_name'];\r
-$email_confirmation = $vars['email_confirmation'];\r
-\r
-$user = get_user($vars['userid']);\r
-\r
-$old_email = $user->email;\r
-$old_name = $user->name;\r
-$openid_url = $user->alias;\r
-\r
-if ($new_email && $new_email != $old_email) {\r
- $change_fields .= '<table><tr><td><label for="emailchange"><input type="checkbox"'\r
- .' id="emailchange" name="emailchange" value="yes" />'\r
- ." $emailLabel</label></td><td>$old_email => $new_email</td></tr></table>\n";\r
- if (!$email_confirmation) {\r
- // the email address is from a green server, so we can change the email without a confirmation message\r
- // add an invitation code however to prevent this form from being forged\r
- // the user ident and new email address can then securely be stored in the database invitation table\r
- // rather than the form\r
- $details = openid_client_create_invitation('c',$openid_url,$vars['userid'],$new_email,$new_name);\r
- $form_stuff = '<input type="hidden" name="i_code" value="'.$details->code.'" />';\r
- } else {\r
- // the email will be confirmed anyway so it is safe to put it in the form\r
- $form_stuff .= <<< END\r
- <input type="hidden" name="new_email" value="$new_email" />\r
-END;\r
- }\r
- \r
-}\r
-if ($new_name && $new_name != $old_name) {\r
- $change_fields .= '<table><tr><td><label for="namechange"><input type="checkbox"'\r
- .' id="namechange" name="namechange" value="yes" />'\r
- ."$nameLabel</label></td><td>$old_name => $new_name</td></tr></table>\n";\r
-}\r
-\r
-$action = $CONFIG->wwwroot.'action/openid_client/sync';\r
-$security_token = elgg_view('input/securitytoken');\r
- \r
-$body .= <<< END\r
- $instructions\r
- <form action="$action" method="post">\r
- $security_token\r
- <p>\r
- $change_fields\r
- </p>\r
- <p>\r
- <label for="nosync"><input type="checkbox" id="nosync" name="nosync" value="yes" />$noSyncLabel</label>\r
- <br /><br />\r
- $form_stuff\r
- <input type="hidden" name="new_name" value="$new_name" />\r
- <input type="submit" name="submit" value="$submitLabel" />\r
- <input type="submit" name="cancel" value="$cancelLabel" />\r
- </p>\r
-</form>\r
- \r
-END;\r
-\r
-echo elgg_view('page_elements/contentwrapper',array('body'=>$body));\r
- \r
-?>
\ No newline at end of file
<?php
/**
- *
+ * OpenID client login choices
*/
echo elgg_view('output/url', array(