summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/openid')
-rw-r--r--plugins/openid/.editorconfig11
-rw-r--r--plugins/openid/admin_panels.php779
-rw-r--r--plugins/openid/comments.php26
-rw-r--r--plugins/openid/common.php44
-rw-r--r--plugins/openid/consumer.php24
-rw-r--r--plugins/openid/lib/Auth/OpenID.php30
-rw-r--r--plugins/openid/lib/Auth/OpenID/AX.php28
-rw-r--r--plugins/openid/lib/Auth/OpenID/Association.php93
-rw-r--r--plugins/openid/lib/Auth/OpenID/BigMath.php29
-rw-r--r--plugins/openid/lib/Auth/OpenID/Consumer.php134
-rw-r--r--plugins/openid/lib/Auth/OpenID/DatabaseConnection.php10
-rw-r--r--plugins/openid/lib/Auth/OpenID/Discover.php93
-rw-r--r--plugins/openid/lib/Auth/OpenID/FileStore.php32
-rw-r--r--plugins/openid/lib/Auth/OpenID/Interface.php2
-rw-r--r--plugins/openid/lib/Auth/OpenID/KVForm.php4
-rw-r--r--plugins/openid/lib/Auth/OpenID/MDB2Store.php138
-rw-r--r--plugins/openid/lib/Auth/OpenID/MemcachedStore.php2
-rw-r--r--plugins/openid/lib/Auth/OpenID/Message.php119
-rw-r--r--plugins/openid/lib/Auth/OpenID/Nonce.php2
-rw-r--r--plugins/openid/lib/Auth/OpenID/PAPE.php25
-rw-r--r--plugins/openid/lib/Auth/OpenID/Parse.php42
-rw-r--r--plugins/openid/lib/Auth/OpenID/PostgreSQLStore.php27
-rw-r--r--plugins/openid/lib/Auth/OpenID/SQLStore.php114
-rw-r--r--plugins/openid/lib/Auth/OpenID/SReg.php42
-rw-r--r--plugins/openid/lib/Auth/OpenID/Server.php86
-rw-r--r--plugins/openid/lib/Auth/OpenID/TrustRoot.php22
-rw-r--r--plugins/openid/lib/Auth/OpenID/URINorm.php14
-rw-r--r--plugins/openid/lib/Auth/Yadis/HTTPFetcher.php2
-rw-r--r--plugins/openid/lib/Auth/Yadis/Manager.php44
-rw-r--r--plugins/openid/lib/Auth/Yadis/Misc.php50
-rw-r--r--plugins/openid/lib/Auth/Yadis/ParanoidHTTPFetcher.php14
-rw-r--r--plugins/openid/lib/Auth/Yadis/ParseHTML.php47
-rw-r--r--plugins/openid/lib/Auth/Yadis/PlainHTTPFetcher.php29
-rw-r--r--plugins/openid/lib/Auth/Yadis/XML.php26
-rw-r--r--plugins/openid/lib/Auth/Yadis/XRDS.php44
-rw-r--r--plugins/openid/lib/Auth/Yadis/XRI.php10
-rw-r--r--plugins/openid/lib/Auth/Yadis/XRIRes.php12
-rw-r--r--plugins/openid/lib/Auth/Yadis/Yadis.php28
-rw-r--r--plugins/openid/localization/openid.pot323
-rw-r--r--plugins/openid/login.php148
-rw-r--r--plugins/openid/openid.php6
-rw-r--r--plugins/openid/readme.txt17
-rw-r--r--plugins/openid/server.php65
-rw-r--r--plugins/openid/server_ext.php14
-rw-r--r--plugins/openid/store.php417
45 files changed, 1760 insertions, 1508 deletions
diff --git a/plugins/openid/.editorconfig b/plugins/openid/.editorconfig
new file mode 100644
index 00000000..9acbda73
--- /dev/null
+++ b/plugins/openid/.editorconfig
@@ -0,0 +1,11 @@
+# EditorConfig is awesome: http://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+[*]
+end_of_line = lf
+trim_trailing_whitespace = true
+charset = utf-8
+indent_style = tab
+indent_size = 4
diff --git a/plugins/openid/admin_panels.php b/plugins/openid/admin_panels.php
index d40bb8e8..193a4aef 100644
--- a/plugins/openid/admin_panels.php
+++ b/plugins/openid/admin_panels.php
@@ -23,16 +23,22 @@ function openid_admin_panels() {
// global options page
$hookname = add_options_page( __( 'OpenID options', 'openid' ), __( 'OpenID', 'openid' ), 'manage_options', 'openid', 'openid_options_page' );
- add_action( "load-$hookname", function() {
- add_thickbox();
- } );
+ add_action(
+ "load-$hookname",
+ function() {
+ add_thickbox();
+ }
+ );
add_action( "load-$hookname", 'openid_style' );
// all users can setup external OpenIDs
$hookname = add_users_page( __( 'Your OpenIDs', 'openid' ), __( 'Your OpenIDs', 'openid' ), 'read', 'your_openids', 'openid_profile_panel' );
- add_action( "load-$hookname", function() {
- wp_enqueue_script( 'admin-forms' );
- } );
+ add_action(
+ "load-$hookname",
+ function() {
+ wp_enqueue_script( 'admin-forms' );
+ }
+ );
add_action( "load-$hookname", 'openid_profile_management' );
add_action( "load-$hookname", 'openid_style' );
@@ -45,12 +51,21 @@ function openid_admin_panels() {
add_action( 'load-profile.php', 'openid_style' );
if ( ! get_user_meta( $user->ID, 'openid_delegate', true ) ) {
- $hookname = add_submenu_page( 'profile.php', __( 'Your Trusted Sites', 'openid' ),
- __( 'Your Trusted Sites', 'openid' ), 'read', 'openid_trusted_sites', 'openid_manage_trusted_sites' );
+ $hookname = add_submenu_page(
+ 'profile.php',
+ __( 'Your Trusted Sites', 'openid' ),
+ __( 'Your Trusted Sites', 'openid' ),
+ 'read',
+ 'openid_trusted_sites',
+ 'openid_manage_trusted_sites'
+ );
add_action( "load-$hookname", 'openid_style' );
- add_action( "load-$hookname", function() {
- wp_enqueue_script( 'admin-forms' );
- } );
+ add_action(
+ "load-$hookname",
+ function() {
+ wp_enqueue_script( 'admin-forms' );
+ }
+ );
}
}
@@ -63,8 +78,13 @@ function openid_admin_panels() {
// 'users_can_register' option, so only add the OpenID Settings if that is set. If additional OpenID settings
// are added to the General Settings page, this check may no longer be necessary
if ( get_option( 'users_can_register' ) ) {
- add_settings_field( 'openid_general_settings', __( 'OpenID Settings', 'openid' ), 'openid_general_settings',
- 'general', 'default');
+ add_settings_field(
+ 'openid_general_settings',
+ __( 'OpenID Settings', 'openid' ),
+ 'openid_general_settings',
+ 'general',
+ 'default'
+ );
}
}
@@ -163,18 +183,32 @@ function openid_options_page() {
<h2><?php _e( 'OpenID Settings', 'openid' ); ?></h2>
- <div class="updated fade"><p><?php _e( 'Please note that all OpenID Consumer options have been moved to their respective sections of the '
- . '<a href="options-general.php">General Settings</a> and <a href="options-discussion.php">Discussion Settings</a> pages.', 'openid' ); ?></p></div>
+ <div class="updated fade"><p>
+ <?php
+ _e(
+ 'Please note that all OpenID Consumer options have been moved to their respective sections of the '
+ . '<a href="options-general.php">General Settings</a> and <a href="options-discussion.php">Discussion Settings</a> pages.',
+ 'openid'
+ );
+ ?>
+ </p></div>
<?php
- $current_user = wp_get_current_user();
+ $current_user = wp_get_current_user();
$current_user_url = get_author_posts_url( $current_user->ID );
?>
- <p><?php _e( 'The OpenID Provider allows authorized '
- . 'users to use their author URL as an OpenID, either using their '
- . 'local WordPress username and password, or by delegating to another OpenID Provider.', 'openid' ); ?></p>
+ <p>
+ <?php
+ _e(
+ 'The OpenID Provider allows authorized '
+ . 'users to use their author URL as an OpenID, either using their '
+ . 'local WordPress username and password, or by delegating to another OpenID Provider.',
+ 'openid'
+ );
+ ?>
+ </p>
<table class="form-table optiontable editform">
<tr valign="top">
@@ -186,9 +220,9 @@ function openid_options_page() {
<p>
<?php
foreach ( $wp_roles->role_names as $key => $name ) {
- $name = _x( $name, null );
- $role = $wp_roles->get_role( $key );
- $checked = $role->has_cap( 'use_openid_provider' ) ? ' checked="checked"' : '';
+ $name = _x( $name, null );
+ $role = $wp_roles->get_role( $key );
+ $checked = $role->has_cap( 'use_openid_provider' ) ? ' checked="checked"' : '';
$option_name = 'openid_cap[' . htmlentities( $key ) . ']';
echo '<input type="checkbox" id="' . $option_name . '" name="' . $option_name . '"' . $checked . ' /><label for="' . $option_name . '"> ' . $name . '</label><br />' . PHP_EOL;
}
@@ -199,49 +233,63 @@ function openid_options_page() {
<?php
$users = get_users();
- $users = array_filter( $users, function( $u ) {
- $u = new WP_User( $u->ID );
- return $u->has_cap( 'use_openid_provider' );
- } );
+ $users = array_filter(
+ $users,
+ function( $u ) {
+ $u = new WP_User( $u->ID );
+ return $u->has_cap( 'use_openid_provider' );
+ }
+ );
- if ( ! empty( $users ) ):
+ if ( ! empty( $users ) ) :
?>
<tr valign="top">
- <th scope="row"><?php _e('Blog Owner', 'openid') ?></th>
+ <th scope="row"><?php _e( 'Blog Owner', 'openid' ); ?></th>
<td>
- <p><?php printf( __( 'Authorized accounts on this blog can use their author URL (i.e. <em>%1$s</em>) as an OpenID. '
- . 'The Blog Owner will be able to use the blog address (%2$s) as their OpenID. If this is a '
- . 'single-user blog, you should set this to your account.', 'openid'),
- sprintf( '<a href="%1$s">%1$s</a>', $current_user_url ), sprintf('<a href="%1$s">%1$s</a>', trailingslashit( get_option( 'home') ) )
- ); ?></p>
+ <p>
+ <?php
+ printf(
+ __(
+ 'Authorized accounts on this blog can use their author URL (i.e. <em>%1$s</em>) as an OpenID. '
+ . 'The Blog Owner will be able to use the blog address (%2$s) as their OpenID. If this is a '
+ . 'single-user blog, you should set this to your account.',
+ 'openid'
+ ),
+ sprintf( '<a href="%1$s">%1$s</a>', $current_user_url ),
+ sprintf( '<a href="%1$s">%1$s</a>', trailingslashit( get_option( 'home' ) ) )
+ );
+ ?>
+ </p>
- <?php
+ <?php
if ( defined( 'OPENID_DISALLOW_OWNER' ) && OPENID_DISALLOW_OWNER ) {
echo '
- <p class="error">' . __( 'A Blog Owner cannot be set for this blog. To set a Blog Owner, '
- . 'first remove the following line from your <code>wp-config.php</code>:', 'openid')
+ <p class="error">' . __(
+ 'A Blog Owner cannot be set for this blog. To set a Blog Owner, '
+ . 'first remove the following line from your <code>wp-config.php</code>:',
+ 'openid'
+ )
. '<br /><code style="margin:1em;">define("OPENID_DISALLOW_OWNER", 1);</code>
</p>';
} else {
$blog_owner = get_option( 'openid_blog_owner' );
- if ( empty( $blog_owner ) || $blog_owner == $current_user->user_login) {
- echo '<select id="openid_blog_owner" name="openid_blog_owner"><option value="">' . __('(none)', 'openid') . '</option>';
-
+ if ( empty( $blog_owner ) || $blog_owner == $current_user->user_login ) {
+ echo '<select id="openid_blog_owner" name="openid_blog_owner"><option value="">' . __( '(none)', 'openid' ) . '</option>';
- foreach ($users as $user) {
- $selected = (get_option('openid_blog_owner') == $user->user_login) ? ' selected="selected"' : '';
- echo '<option value="'.$user->user_login.'"'.$selected.'>'.$user->user_login.'</option>';
+ foreach ( $users as $user ) {
+ $selected = ( get_option( 'openid_blog_owner' ) == $user->user_login ) ? ' selected="selected"' : '';
+ echo '<option value="' . $user->user_login . '"' . $selected . '>' . $user->user_login . '</option>';
}
echo '</select>';
} else {
- echo '<p class="error">' . sprintf(__('Only the current Blog Owner (%s) can change this setting.', 'openid'), $blog_owner) . '</p>';
+ echo '<p class="error">' . sprintf( __( 'Only the current Blog Owner (%s) can change this setting.', 'openid' ), $blog_owner ) . '</p>';
}
}
- ?>
+ ?>
</td>
</tr>
<?php endif; //!empty($users) ?>
@@ -249,18 +297,25 @@ function openid_options_page() {
<table class="form-table optiontable editform">
<tr valign="top">
- <th scope="row"><?php _e('Troubleshooting', 'openid') ?></th>
+ <th scope="row"><?php _e( 'Troubleshooting', 'openid' ); ?></th>
<td>
<?php openid_printSystemStatus(); ?>
- <p><?php printf(__('If users are experiencing problems logging in with OpenID, it may help to %1$srefresh the cache%2$s.', 'openid'),
- '<a href="' . wp_nonce_url(add_query_arg('action', 'rebuild_tables'), 'rebuild_tables') . '">', '</a>'); ?></p>
+ <p>
+ <?php
+ printf(
+ __( 'If users are experiencing problems logging in with OpenID, it may help to %1$srefresh the cache%2$s.', 'openid' ),
+ '<a href="' . wp_nonce_url( add_query_arg( 'action', 'rebuild_tables' ), 'rebuild_tables' ) . '">',
+ '</a>'
+ );
+ ?>
+ </p>
</td>
</tr>
</table>
- <?php settings_fields('openid'); ?>
- <p class="submit"><input type="submit" class="button-primary" name="info_update" value="<?php _e('Save Changes') ?>" /></p>
+ <?php settings_fields( 'openid' ); ?>
+ <p class="submit"><input type="submit" class="button-primary" name="info_update" value="<?php _e( 'Save Changes' ); ?>" /></p>
</form>
</div>
<?php
@@ -275,45 +330,52 @@ function openid_options_page() {
function openid_profile_panel() {
global $error;
- if( !current_user_can('read') ) return;
+ if ( ! current_user_can( 'read' ) ) {
+ return;
+ }
$user = wp_get_current_user();
$status = openid_status();
- if( 'success' == $status ) {
- echo '<div class="updated"><p><strong>'.__('Success:', 'openid').'</strong> '.openid_message().'</p></div>';
- }
- elseif( 'warning' == $status ) {
- echo '<div class="error"><p><strong>'.__('Warning:', 'openid').'</strong> '.openid_message().'</p></div>';
- }
- elseif( 'error' == $status ) {
- echo '<div class="error"><p><strong>'.__('Error:', 'openid').'</strong> '.openid_message().'</p></div>';
+ if ( 'success' == $status ) {
+ echo '<div class="updated"><p><strong>' . __( 'Success:', 'openid' ) . '</strong> ' . openid_message() . '</p></div>';
+ } elseif ( 'warning' == $status ) {
+ echo '<div class="error"><p><strong>' . __( 'Warning:', 'openid' ) . '</strong> ' . openid_message() . '</p></div>';
+ } elseif ( 'error' == $status ) {
+ echo '<div class="error"><p><strong>' . __( 'Error:', 'openid' ) . '</strong> ' . openid_message() . '</p></div>';
}
- if (!empty($error)) {
- echo '<div class="error"><p><strong>'.__('Error:', 'openid').'</strong> '.$error.'</p></div>';
- unset($error);
+ if ( ! empty( $error ) ) {
+ echo '<div class="error"><p><strong>' . __( 'Error:', 'openid' ) . '</strong> ' . $error . '</p></div>';
+ unset( $error );
}
?>
<style type="text/css">
- #icon-openid { background-image: url("<?php echo plugin_dir_url(__FILE__) . 'f/icon.png'; ?>"); }
+ #icon-openid { background-image: url("<?php echo plugin_dir_url( __FILE__ ) . 'f/icon.png'; ?>"); }
</style>
<div class="wrap">
- <form action="<?php printf('%s?page=%s', $_SERVER['PHP_SELF'], $_REQUEST['page']); ?>" method="post">
- <h2><?php _e('Your Verified OpenIDs', 'openid') ?></h2>
+ <form action="<?php printf( '%s?page=%s', $_SERVER['PHP_SELF'], $_REQUEST['page'] ); ?>" method="post">
+ <h2><?php _e( 'Your Verified OpenIDs', 'openid' ); ?></h2>
- <p><?php _e('You may associate one or more OpenIDs with your account. This will '
- . 'allow you to login to WordPress with your OpenID instead of a username and password. '
- . '<a href="http://openid.net/what/" target="_blank">Learn more...</a>', 'openid')?></p>
+ <p>
+ <?php
+ _e(
+ 'You may associate one or more OpenIDs with your account. This will '
+ . 'allow you to login to WordPress with your OpenID instead of a username and password. '
+ . '<a href="http://openid.net/what/" target="_blank">Learn more...</a>',
+ 'openid'
+ )
+ ?>
+ </p>
<div class="tablenav">
<div class="alignleft actions">
<select name="action">
- <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
- <option value="delete"><?php _e('Delete'); ?></option>
+ <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option>
+ <option value="delete"><?php _e( 'Delete' ); ?></option>
</select>
- <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
- <?php wp_nonce_field('openid-delete_openids'); ?>
+ <input type="submit" value="<?php _e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" />
+ <?php wp_nonce_field( 'openid-delete_openids' ); ?>
</div>
<div class="clear"></div>
</div>
@@ -324,25 +386,25 @@ function openid_profile_panel() {
<thead>
<tr>
<td class="check-column"><input type="checkbox" /></td>
- <th scope="col"><?php _e('Account', 'openid'); ?></th>
+ <th scope="col"><?php _e( 'Account', 'openid' ); ?></th>
</tr>
</thead>
<tbody>
<?php
- $urls = get_user_openids($user->ID);
+ $urls = get_user_openids( $user->ID );
- if (empty($urls)) {
- echo '<tr><td colspan="2">'.__('No Verified Accounts.', 'openid').'</td></tr>';
- } else {
- foreach ($urls as $url) {
- echo '
+ if ( empty( $urls ) ) {
+ echo '<tr><td colspan="2">' . __( 'No Verified Accounts.', 'openid' ) . '</td></tr>';
+ } else {
+ foreach ( $urls as $url ) {
+ echo '
<tr>
- <th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="'.md5($url).'" /></th>
- <td>'.openid_display_identity($url).'</td>
+ <th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="' . md5( $url ) . '" /></th>
+ <td>' . openid_display_identity( $url ) . '</td>
</tr>';
- }
}
+ }
?>
</tbody>
@@ -352,101 +414,116 @@ function openid_profile_panel() {
<form method="post">
<table class="form-table">
<tr>
- <th scope="row"><label for="openid_identifier"><?php _e('Add OpenID', 'openid') ?></label></th>
+ <th scope="row"><label for="openid_identifier"><?php _e( 'Add OpenID', 'openid' ); ?></label></th>
<td><input id="openid_identifier" class="regular-text code" name="openid_identifier" /></td>
</tr>
</table>
- <?php wp_nonce_field('openid-add_openid'); ?>
+ <?php wp_nonce_field( 'openid-add_openid' ); ?>
<p class="submit">
- <input type="submit" class="button-primary" value="<?php _e('Add OpenID', 'openid') ?>" />
+ <input type="submit" class="button-primary" value="<?php _e( 'Add OpenID', 'openid' ); ?>" />
<input type="hidden" name="action" value="add" >
</p>
</form>
</div>
-<?php
+ <?php
}
function openid_manage_trusted_sites() {
$user = wp_get_current_user();
- switch (@$_REQUEST['action']) {
- case 'add':
- check_admin_referer('openid-add_trusted_sites');
+ switch ( @$_REQUEST['action'] ) {
+ case 'add':
+ check_admin_referer( 'openid-add_trusted_sites' );
- $trusted_sites = get_user_meta($user->ID, 'openid_trusted_sites', true);
- if (!is_array($trusted_sites)) $trusted_sites = array();
- $sites = explode(PHP_EOL, $_REQUEST['sites']);
+ $trusted_sites = get_user_meta( $user->ID, 'openid_trusted_sites', true );
+ if ( ! is_array( $trusted_sites ) ) {
+ $trusted_sites = array();
+ }
+ $sites = explode( PHP_EOL, $_REQUEST['sites'] );
- $count = 0;
- foreach ($sites as $site) {
- $site = trim($site);
- if (empty($site)) continue;
+ $count = 0;
+ foreach ( $sites as $site ) {
+ $site = trim( $site );
+ if ( empty( $site ) ) {
+ continue;
+ }
- if (strpos($site, 'http') === false || strpos($site, 'http') != 0) {
- $site = 'http://' . $site;
- }
+ if ( strpos( $site, 'http' ) === false || strpos( $site, 'http' ) != 0 ) {
+ $site = 'http://' . $site;
+ }
- $site = esc_url($site);
- $site_hash = md5($site);
+ $site = esc_url( $site );
+ $site_hash = md5( $site );
- if (array_key_exists($site_hash, $trusted_sites)) continue;
+ if ( array_key_exists( $site_hash, $trusted_sites ) ) {
+ continue;
+ }
- $count++;
- $trusted_sites[$site_hash] = array('url' => $site);
- }
+ $count++;
+ $trusted_sites[ $site_hash ] = array( 'url' => $site );
+ }
- if ($count) {
- update_user_meta($user->ID, 'openid_trusted_sites', $trusted_sites);
- echo '<div class="updated"><p>';
- printf( _n('Added %d trusted site.', 'Added %d trusted sites.', $count, 'openid'), $count);
- echo '</p></div>';
- }
- break;
+ if ( $count ) {
+ update_user_meta( $user->ID, 'openid_trusted_sites', $trusted_sites );
+ echo '<div class="updated"><p>';
+ printf( _n( 'Added %d trusted site.', 'Added %d trusted sites.', $count, 'openid' ), $count );
+ echo '</p></div>';
+ }
+ break;
- case 'delete':
- if (empty($_REQUEST['delete'])) break;
+ case 'delete':
+ if ( empty( $_REQUEST['delete'] ) ) {
+ break;
+ }
- check_admin_referer('openid-delete_trusted_sites');
+ check_admin_referer( 'openid-delete_trusted_sites' );
- $trusted_sites = get_user_meta($user->ID, 'openid_trusted_sites', true);
- $count = 0;
- foreach ($_REQUEST['delete'] as $site_hash) {
- if (array_key_exists($site_hash, $trusted_sites)) {
- $trusted_sites[$site_hash] = null;
- $count++;
+ $trusted_sites = get_user_meta( $user->ID, 'openid_trusted_sites', true );
+ $count = 0;
+ foreach ( $_REQUEST['delete'] as $site_hash ) {
+ if ( array_key_exists( $site_hash, $trusted_sites ) ) {
+ $trusted_sites[ $site_hash ] = null;
+ $count++;
+ }
}
- }
- update_user_meta($user->ID, 'openid_trusted_sites', array_filter($trusted_sites));
+ update_user_meta( $user->ID, 'openid_trusted_sites', array_filter( $trusted_sites ) );
- if ($count) {
- echo '<div class="updated"><p>';
- printf( _n('Deleted %d trusted site.', 'Deleted %d trusted sites.', $count, 'openid'), $count);
- echo '</p></div>';
- }
- break;
+ if ( $count ) {
+ echo '<div class="updated"><p>';
+ printf( _n( 'Deleted %d trusted site.', 'Deleted %d trusted sites.', $count, 'openid' ), $count );
+ echo '</p></div>';
+ }
+ break;
}
?>
<style type="text/css">
- #icon-openid { background-image: url("<?php echo plugin_dir_url(__FILE__) . 'f/icon.png'; ?>"); }
+ #icon-openid { background-image: url("<?php echo plugin_dir_url( __FILE__ ) . 'f/icon.png'; ?>"); }
</style>
<div class="wrap">
- <h2><?php _e('Your Trusted Sites', 'openid'); ?></h2>
+ <h2><?php _e( 'Your Trusted Sites', 'openid' ); ?></h2>
- <p><?php _e('This is a list of sites that you can automatically login to using your OpenID account. '
- . 'You will not be asked to approve OpenID login requests for your trusted sites.' , 'openid'); ?></p>
+ <p>
+ <?php
+ _e(
+ 'This is a list of sites that you can automatically login to using your OpenID account. '
+ . 'You will not be asked to approve OpenID login requests for your trusted sites.',
+ 'openid'
+ );
+ ?>
+ </p>
<form method="post">
<div class="tablenav">
<div class="alignleft actions">
<select name="action">
- <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
- <option value="delete"><?php _e('Delete'); ?></option>
+ <option value="-1" selected="selected"><?php _e( 'Bulk Actions' ); ?></option>
+ <option value="delete"><?php _e( 'Delete' ); ?></option>
</select>
- <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
- <?php wp_nonce_field('openid-delete_trusted_sites'); ?>
+ <input type="submit" value="<?php _e( 'Apply' ); ?>" name="doaction" id="doaction" class="button-secondary action" />
+ <?php wp_nonce_field( 'openid-delete_trusted_sites' ); ?>
</div>
<div class="clear"></div>
</div>
@@ -457,32 +534,32 @@ function openid_manage_trusted_sites() {
<thead>
<tr>
<td class="check-column"><input type="checkbox" /></td>
- <th scope="col"><?php _e('URL'); ?></th>
- <th scope="col"><?php _e('Last Login', 'openid'); ?></th>
+ <th scope="col"><?php _e( 'URL' ); ?></th>
+ <th scope="col"><?php _e( 'Last Login', 'openid' ); ?></th>
</tr>
</thead>
<tbody>
<?php
- $trusted_sites = get_user_meta($user->ID, 'openid_trusted_sites', true);
- if(empty($trusted_sites)) {
- echo '<tr><td colspan="3">'.__('No Trusted Sites.', 'openid').'</td></tr>';
- } else {
- foreach( $trusted_sites as $site_hash => $site ) {
- if (array_key_exists('last_login', $site) && $site['last_login']) {
- $last_login = date(get_option('date_format') . ' - ' . get_option('time_format'), $site['last_login']);
- } else {
- $last_login = '-';
- }
+ $trusted_sites = get_user_meta( $user->ID, 'openid_trusted_sites', true );
+ if ( empty( $trusted_sites ) ) {
+ echo '<tr><td colspan="3">' . __( 'No Trusted Sites.', 'openid' ) . '</td></tr>';
+ } else {
+ foreach ( $trusted_sites as $site_hash => $site ) {
+ if ( array_key_exists( 'last_login', $site ) && $site['last_login'] ) {
+ $last_login = date( get_option( 'date_format' ) . ' - ' . get_option( 'time_format' ), $site['last_login'] );
+ } else {
+ $last_login = '-';
+ }
- echo '
+ echo '
<tr>
- <th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="'.$site_hash.'" /></th>
- <td>'.$site['url'].'</td>
- <td>'.$last_login.'</td>
+ <th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="' . $site_hash . '" /></th>
+ <td>' . $site['url'] . '</td>
+ <td>' . $last_login . '</td>
</tr>';
- }
}
+ }
?>
</tbody>
@@ -497,29 +574,29 @@ function openid_manage_trusted_sites() {
<form method="post">
- <h3><?php _e('Import Trusted Sites', 'openid'); ?></h3>
+ <h3><?php _e( 'Import Trusted Sites', 'openid' ); ?></h3>
- <p><?php _e('Enter a list of URLs to be added to your Trusted Sites.', 'openid'); ?></p>
+ <p><?php _e( 'Enter a list of URLs to be added to your Trusted Sites.', 'openid' ); ?></p>
<table class="form-table" style="margin-top: 0">
<tr>
- <th scope="row"><label for="sites"><?php _e('Add Sites', 'openid') ?></label></th>
+ <th scope="row"><label for="sites"><?php _e( 'Add Sites', 'openid' ); ?></label></th>
<td>
- <textarea id="sites" name="sites" cols="60" rows="5"></textarea><br /><?php _e('(One URL per line)', 'openid'); ?>
+ <textarea id="sites" name="sites" cols="60" rows="5"></textarea><br /><?php _e( '(One URL per line)', 'openid' ); ?>
</td>
</tr>
</table>
- <?php wp_nonce_field('openid-add_trusted_sites'); ?>
+ <?php wp_nonce_field( 'openid-add_trusted_sites' ); ?>
<p class="submit">
- <input type="submit" class="button-primary" value="<?php _e('Add Sites', 'openid') ?>" />
+ <input type="submit" class="button-primary" value="<?php _e( 'Add Sites', 'openid' ); ?>" />
<input type="hidden" name="action" value="add" >
</p>
</form>
</div>
-<?php
+ <?php
}
@@ -529,95 +606,101 @@ function openid_manage_trusted_sites() {
function openid_printSystemStatus() {
global $wp_version, $wpdb;
- $paths = explode(PATH_SEPARATOR, get_include_path());
- for($i=0; $i<sizeof($paths); $i++ ) {
- $paths[$i] = @realpath($paths[$i]);
- if (empty($paths[$i])) unset($paths[$i]);
+ $paths = explode( PATH_SEPARATOR, get_include_path() );
+ for ( $i = 0; $i < sizeof( $paths ); $i++ ) {
+ $paths[ $i ] = @realpath( $paths[ $i ] );
+ if ( empty( $paths[ $i ] ) ) {
+ unset( $paths[ $i ] );
+ }
}
- $status = array();
+ $status = array();
$status[] = array( 'PHP version', 'info', phpversion() );
- $status[] = array( 'PHP memory limit', 'info', ini_get('memory_limit') );
+ $status[] = array( 'PHP memory limit', 'info', ini_get( 'memory_limit' ) );
$status[] = array( 'Include Path', 'info', $paths );
$status[] = array( 'WordPress version', 'info', $wp_version );
$status[] = array( 'PHP OpenID Library Version', 'info', Auth_OpenID_VERSION );
- $status[] = array( 'MySQL version', 'info', function_exists('mysql_get_client_info') ? mysql_get_client_info() : 'Mysql client information not available. Very strange, as WordPress requires MySQL.' );
-
- $status[] = array('WordPress\' table prefix', 'info', isset($wpdb->base_prefix) ? $wpdb->base_prefix : $wpdb->prefix );
+ $status[] = array( 'MySQL version', 'info', function_exists( 'mysql_get_client_info' ) ? mysql_get_client_info() : 'Mysql client information not available. Very strange, as WordPress requires MySQL.' );
+ $status[] = array( 'WordPress\' table prefix', 'info', isset( $wpdb->base_prefix ) ? $wpdb->base_prefix : $wpdb->prefix );
- if ( extension_loaded('suhosin') ) {
+ if ( extension_loaded( 'suhosin' ) ) {
$status[] = array( 'Curl', false, 'Hardened php (suhosin) extension active -- curl version checking skipped.' );
} else {
$curl_message = '';
- if( function_exists('curl_version') ) {
+ if ( function_exists( 'curl_version' ) ) {
$curl_version = curl_version();
- if(isset($curl_version['version']))
+ if ( isset( $curl_version['version'] ) ) {
$curl_message .= 'Version ' . $curl_version['version'] . '. ';
- if(isset($curl_version['ssl_version']))
+ }
+ if ( isset( $curl_version['ssl_version'] ) ) {
$curl_message .= 'SSL: ' . $curl_version['ssl_version'] . '. ';
- if(isset($curl_message['libz_version']))
+ }
+ if ( isset( $curl_message['libz_version'] ) ) {
$curl_message .= 'zlib: ' . $curl_version['libz_version'] . '. ';
- if(isset($curl_version['protocols'])) {
- if (is_array($curl_version['protocols'])) {
- $curl_message .= 'Supports: ' . implode(', ',$curl_version['protocols']) . '. ';
+ }
+ if ( isset( $curl_version['protocols'] ) ) {
+ if ( is_array( $curl_version['protocols'] ) ) {
+ $curl_message .= 'Supports: ' . implode( ', ', $curl_version['protocols'] ) . '. ';
} else {
$curl_message .= 'Supports: ' . $curl_version['protocols'] . '. ';
}
}
} else {
- $curl_message = 'This PHP installation does not have support for libcurl. Some functionality, such as '
+ $curl_message = 'This PHP installation does not have support for libcurl. Some functionality, such as '
. 'fetching https:// URLs, will be missing and performance will slightly impared. See '
. '<a href="http://www.php.net/manual/en/ref.curl.php">php.net/manual/en/ref.curl.php</a> about '
. 'enabling libcurl support for PHP.';
}
- $status[] = array( 'Curl Support', isset($curl_version), $curl_message );
+ $status[] = array( 'Curl Support', isset( $curl_version ), $curl_message );
}
- if (extension_loaded('gmp') and @gmp_add(1,1)==2) {
+ if ( extension_loaded( 'gmp' ) and @gmp_add( 1, 1 ) == 2 ) {
$status[] = array( 'Big Integer support', true, 'GMP is installed.' );
- } elseif (extension_loaded('bcmath') and @bcadd(1,1)==2) {
+ } elseif ( extension_loaded( 'bcmath' ) and @bcadd( 1, 1 ) == 2 ) {
$status[] = array( 'Big Integer support', true, 'BCMath is installed (though <a href="http://www.php.net/gmp">GMP</a> is preferred).' );
- } elseif (defined('Auth_OpenID_NO_MATH_SUPPORT')) {
+ } elseif ( defined( 'Auth_OpenID_NO_MATH_SUPPORT' ) ) {
$status[] = array( 'Big Integer support', false, 'The OpenID Library is operating in Dumb Mode. Recommend installing <a href="http://www.php.net/gmp">GMP</a> support.' );
}
+ $status[] = array( 'Plugin Revision', 'info', OPENID_PLUGIN_REVISION );
+ $status[] = array( 'Plugin Database Revision', 'info', get_option( 'openid_db_revision' ) );
- $status[] = array( 'Plugin Revision', 'info', OPENID_PLUGIN_REVISION);
- $status[] = array( 'Plugin Database Revision', 'info', get_option('openid_db_revision'));
-
- if (function_exists('xrds_meta')) {
- $status[] = array( 'XRDS-Simple', 'info', 'XRDS-Simple plugin is installed.');
+ if ( function_exists( 'xrds_meta' ) ) {
+ $status[] = array( 'XRDS-Simple', 'info', 'XRDS-Simple plugin is installed.' );
} else {
- $status[] = array( 'XRDS-Simple', false, '<a href="http://wordpress.org/extend/plugins/xrds-simple/">XRDS-Simple</a> plugin is not installed. Some features may not work properly (including providing OpenIDs).');
+ $status[] = array( 'XRDS-Simple', false, '<a href="http://wordpress.org/extend/plugins/xrds-simple/">XRDS-Simple</a> plugin is not installed. Some features may not work properly (including providing OpenIDs).' );
}
$openid_enabled = openid_enabled();
- $status[] = array( '<strong>Overall Plugin Status</strong>', ($openid_enabled),
- ($openid_enabled ? '' : 'There are problems above that must be dealt with before the plugin can be used.') );
-
- if( $openid_enabled ) { // Display status information
- echo'<p><strong>' . __('Status information:', 'openid') . '</strong> ' . __('All Systems Nominal', 'openid')
- . '<small> (<a href="#TB_inline?height=600&width=800&inlineId=openid_system_status" id="openid_status_link" class="thickbox" title="' . __('System Status', 'openid') . '">' . __('Toggle More/Less', 'openid') . '</a>)</small> </p>';
+ $status[] = array(
+ '<strong>Overall Plugin Status</strong>',
+ ( $openid_enabled ),
+ ( $openid_enabled ? '' : 'There are problems above that must be dealt with before the plugin can be used.' ),
+ );
+
+ if ( $openid_enabled ) { // Display status information
+ echo'<p><strong>' . __( 'Status information:', 'openid' ) . '</strong> ' . __( 'All Systems Nominal', 'openid' )
+ . '<small> (<a href="#TB_inline?height=600&width=800&inlineId=openid_system_status" id="openid_status_link" class="thickbox" title="' . __( 'System Status', 'openid' ) . '">' . __( 'Toggle More/Less', 'openid' ) . '</a>)</small> </p>';
} else {
- echo '<p><strong>' . __('Plugin is currently disabled. Fix the problem, then Deactivate/Reactivate the plugin.', 'openid')
+ echo '<p><strong>' . __( 'Plugin is currently disabled. Fix the problem, then Deactivate/Reactivate the plugin.', 'openid' )
. '</strong></p>';
}
echo '<div id="openid_system_status" class="updated">';
- foreach( $status as $s ) {
+ foreach ( $status as $s ) {
list ($name, $state, $message) = $s;
echo '<div><strong>';
- if( $state === false ) {
- echo "<span style='color:red;'>[".__('FAIL', 'openid')."]</span> $name";
- } elseif( $state === true ) {
- echo "<span style='color:green;'>[".__('OK', 'openid')."]</span> $name";
+ if ( $state === false ) {
+ echo "<span style='color:red;'>[" . __( 'FAIL', 'openid' ) . "]</span> $name";
+ } elseif ( $state === true ) {
+ echo "<span style='color:green;'>[" . __( 'OK', 'openid' ) . "]</span> $name";
} else {
- echo "<span style='color:grey;'>[".__('INFO', 'openid')."]</span> $name";
+ echo "<span style='color:grey;'>[" . __( 'INFO', 'openid' ) . "]</span> $name";
}
- echo ($message ? ': ' : '') . '</strong>';
- echo (is_array($message) ? '<ul><li>' . implode('</li><li>', $message) . '</li></ul>' : $message);
+ echo ( $message ? ': ' : '' ) . '</strong>';
+ echo ( is_array( $message ) ? '<ul><li>' . implode( '</li><li>', $message ) . '</li></ul>' : $message );
echo '</div>';
}
echo '</div>
@@ -633,63 +716,63 @@ function openid_printSystemStatus() {
function openid_profile_management() {
global $action;
- wp_reset_vars( array('action') );
+ wp_reset_vars( array( 'action' ) );
- switch( $action ) {
+ switch ( $action ) {
case 'add':
- check_admin_referer('openid-add_openid');
+ check_admin_referer( 'openid-add_openid' );
$user = wp_get_current_user();
- $auth_request = openid_begin_consumer($_POST['openid_identifier']);
+ $auth_request = openid_begin_consumer( $_POST['openid_identifier'] );
- $userid = get_user_by_openid($auth_request->endpoint->claimed_id);
+ $userid = get_user_by_openid( $auth_request->endpoint->claimed_id );
- if ($userid) {
+ if ( $userid ) {
global $error;
- if ($user->ID == $userid) {
- $error = __('You already have this OpenID!', 'openid');
+ if ( $user->ID == $userid ) {
+ $error = __( 'You already have this OpenID!', 'openid' );
} else {
- $error = __('This OpenID is already associated with another user.', 'openid');
+ $error = __( 'This OpenID is already associated with another user.', 'openid' );
}
return;
}
- $finish_url = admin_url(current_user_can('edit_users') ? 'users.php' : 'profile.php');
- $finish_url = add_query_arg('page', $_REQUEST['page'], $finish_url);
+ $finish_url = admin_url( current_user_can( 'edit_users' ) ? 'users.php' : 'profile.php' );
+ $finish_url = add_query_arg( 'page', $_REQUEST['page'], $finish_url );
- openid_start_login($_POST['openid_identifier'], 'verify', $finish_url);
+ openid_start_login( $_POST['openid_identifier'], 'verify', $finish_url );
break;
case 'delete':
- openid_profile_delete_openids($_REQUEST['delete']);
+ openid_profile_delete_openids( $_REQUEST['delete'] );
break;
default:
- if ( array_key_exists('message', $_REQUEST) ) {
+ if ( array_key_exists( 'message', $_REQUEST ) ) {
$message = $_REQUEST['message'];
$messages = array(
'',
- __('Unable to authenticate OpenID.', 'openid'),
- __('OpenID assertion successful, but this URL is already associated with another user on this blog.', 'openid'),
- __('Added association with OpenID.', 'openid')
+ __( 'Unable to authenticate OpenID.', 'openid' ),
+ __( 'OpenID assertion successful, but this URL is already associated with another user on this blog.', 'openid' ),
+ __( 'Added association with OpenID.', 'openid' ),
);
- if (is_numeric($message)) {
- $message = $messages[$message];
+ if ( is_numeric( $message ) ) {
+ $message = $messages[ $message ];
} else {
$message = htmlentities2( $message );
}
- $message = __($message, 'openid');
+ $message = __( $message, 'openid' );
- if (array_key_exists('update_url', $_REQUEST) && $_REQUEST['update_url']) {
- $message .= '<br />' . __('<strong>Note:</strong> For security reasons, your profile URL has been updated to match your OpenID.', 'openid');
+ if ( array_key_exists( 'update_url', $_REQUEST ) && $_REQUEST['update_url'] ) {
+ $message .= '<br />' . __( '<strong>Note:</strong> For security reasons, your profile URL has been updated to match your OpenID.', 'openid' );
}
- openid_message($message);
- openid_status($_REQUEST['status']);
+ openid_message( $message );
+ openid_status( $_REQUEST['status'] );
}
break;
}
@@ -701,67 +784,72 @@ function openid_profile_management() {
*
* @param int $id id of identity URL to remove
*/
-function openid_profile_delete_openids($delete) {
+function openid_profile_delete_openids( $delete ) {
- if (empty($delete) || array_key_exists('cancel', $_REQUEST)) return;
- check_admin_referer('openid-delete_openids');
+ if ( empty( $delete ) || array_key_exists( 'cancel', $_REQUEST ) ) {
+ return;
+ }
+ check_admin_referer( 'openid-delete_openids' );
$user = wp_get_current_user();
- $urls = get_user_openids($user->ID);
+ $urls = get_user_openids( $user->ID );
- if (sizeof($urls) == sizeof($delete) && !@$_REQUEST['confirm']) {
+ if ( sizeof( $urls ) == sizeof( $delete ) && ! @$_REQUEST['confirm'] ) {
$html = '
- <h1>'.__('OpenID Warning', 'openid').'</h1>
- <form action='.sprintf('%s?page=%s', $_SERVER['PHP_SELF'], $_REQUEST['page']).' method="post">
- <p>'.__('Are you sure you want to delete all of your OpenID associations? Doing so may prevent you from logging in.', 'openid').'</p>
+ <h1>' . __( 'OpenID Warning', 'openid' ) . '</h1>
+ <form action=' . sprintf( '%s?page=%s', $_SERVER['PHP_SELF'], $_REQUEST['page'] ) . ' method="post">
+ <p>' . __( 'Are you sure you want to delete all of your OpenID associations? Doing so may prevent you from logging in.', 'openid' ) . '</p>
<div class="submit">
- <input type="submit" name="confirm" value="'.__("Yes I'm sure. Delete.", 'openid').'" />
- <input type="submit" name="cancel" value="'.__("No, don't delete.", 'openid').'" />
+ <input type="submit" name="confirm" value="' . __( "Yes I'm sure. Delete.", 'openid' ) . '" />
+ <input type="submit" name="cancel" value="' . __( "No, don't delete.", 'openid' ) . '" />
</div>';
- foreach ($delete as $d) {
- $html .= '<input type="hidden" name="delete[]" value="'.$d.'" />';
+ foreach ( $delete as $d ) {
+ $html .= '<input type="hidden" name="delete[]" value="' . $d . '" />';
}
-
- $html .= wp_nonce_field('openid-delete_openids', '_wpnonce', true, false) . '
+ $html .= wp_nonce_field( 'openid-delete_openids', '_wpnonce', true, false ) . '
<input type="hidden" name="action" value="delete" />
</form>';
- openid_page($html, __('OpenID Warning', 'openid'));
+ openid_page( $html, __( 'OpenID Warning', 'openid' ) );
return;
}
-
$count = 0;
- foreach ($urls as $url) {
- if (in_array(md5($url), $_REQUEST['delete'])) {
- if (openid_drop_identity($user->ID, $url)) {
+ foreach ( $urls as $url ) {
+ if ( in_array( md5( $url ), $_REQUEST['delete'] ) ) {
+ if ( openid_drop_identity( $user->ID, $url ) ) {
$count++;
}
}
}
- if ($count) {
- openid_message( sprintf(_n('Deleted %d OpenID association.', 'Deleted %d OpenID associations.', $count, 'openid'), $count) );
- openid_status('success');
+ if ( $count ) {
+ openid_message( sprintf( _n( 'Deleted %d OpenID association.', 'Deleted %d OpenID associations.', $count, 'openid' ), $count ) );
+ openid_status( 'success' );
// ensure that profile URL is still a verified OpenID
require_once 'Auth/OpenID.php';
- @include_once(ABSPATH . WPINC . '/registration.php'); // WP < 2.3
- @include_once(ABSPATH . 'wp-admin/includes/admin.php'); // WP >= 2.3
-
- if (!openid_ensure_url_match($user)) {
- $identities = get_user_openids($user->ID);
- wp_update_user( array('ID' => $user->ID, 'user_url' => $identities[0]) );
- openid_message(openid_message() . '<br />'.__('<strong>Note:</strong> For security reasons, your profile URL has been updated to match your OpenID.', 'openid'));
+ @include_once( ABSPATH . WPINC . '/registration.php' ); // WP < 2.3
+ @include_once( ABSPATH . 'wp-admin/includes/admin.php' ); // WP >= 2.3
+
+ if ( ! openid_ensure_url_match( $user ) ) {
+ $identities = get_user_openids( $user->ID );
+ wp_update_user(
+ array(
+ 'ID' => $user->ID,
+ 'user_url' => $identities[0],
+ )
+ );
+ openid_message( openid_message() . '<br />' . __( '<strong>Note:</strong> For security reasons, your profile URL has been updated to match your OpenID.', 'openid' ) );
}
return;
}
- openid_message(__('OpenID association delete failed: Unknown reason.', 'openid'));
- openid_status('error');
+ openid_message( __( 'OpenID association delete failed: Unknown reason.', 'openid' ) );
+ openid_status( 'error' );
}
@@ -771,39 +859,48 @@ function openid_profile_delete_openids($delete) {
*
* @param string $identity_url verified OpenID URL
*/
-function openid_finish_verify($identity_url, $action) {
- if ($action != 'verify') return;
+function openid_finish_verify( $identity_url, $action ) {
+ if ( $action != 'verify' ) {
+ return;
+ }
$message;
$user = wp_get_current_user();
- if (empty($identity_url)) {
+ if ( empty( $identity_url ) ) {
$message = openid_message();
- if (empty($message)) $message = 1;
+ if ( empty( $message ) ) {
+ $message = 1;
+ }
} else {
- if( !openid_add_identity($user->ID, $identity_url) ) {
+ if ( ! openid_add_identity( $user->ID, $identity_url ) ) {
$message = 2;
} else {
$message = 3;
// ensure that profile URL is a verified OpenID
require_once 'Auth/OpenID.php';
- require_once(ABSPATH . 'wp-admin/includes/admin.php');
-
- if (!openid_ensure_url_match($user)) {
- wp_update_user( array('ID' => $user->ID, 'user_url' => $identity_url) );
+ require_once( ABSPATH . 'wp-admin/includes/admin.php' );
+
+ if ( ! openid_ensure_url_match( $user ) ) {
+ wp_update_user(
+ array(
+ 'ID' => $user->ID,
+ 'user_url' => $identity_url,
+ )
+ );
$update_url = 1;
}
}
}
$finish_url = $_SESSION['openid_finish_url'];
- $finish_url = add_query_arg('status', openid_status(), $finish_url);
- $finish_url = add_query_arg('message', $message, $finish_url);
- if ( isset($update_url) && $update_url ) {
- $finish_url = add_query_arg('update_url', $update_url, $finish_url);
+ $finish_url = add_query_arg( 'status', openid_status(), $finish_url );
+ $finish_url = add_query_arg( 'message', $message, $finish_url );
+ if ( isset( $update_url ) && $update_url ) {
+ $finish_url = add_query_arg( 'update_url', $update_url, $finish_url );
}
- wp_safe_redirect($finish_url);
+ wp_safe_redirect( $finish_url );
exit;
}
@@ -814,9 +911,13 @@ function openid_finish_verify($identity_url, $action) {
function openid_personal_options_update() {
$user = wp_get_current_user();
- if (!openid_ensure_url_match($user, $_POST['url'])) {
- wp_die(sprintf(__('For security reasons, your profile URL must be one of your claimed OpenIDs: %s', 'openid'),
- '<ul><li>' . join('</li><li>', get_user_openids($user->ID)) . '</li></ul>'));
+ if ( ! openid_ensure_url_match( $user, $_POST['url'] ) ) {
+ wp_die(
+ sprintf(
+ __( 'For security reasons, your profile URL must be one of your claimed OpenIDs: %s', 'openid' ),
+ '<ul><li>' . join( '</li><li>', get_user_openids( $user->ID ) ) . '</li></ul>'
+ )
+ );
}
}
@@ -824,18 +925,24 @@ function openid_personal_options_update() {
/**
* Ensure that the user's profile URL matches one of their OpenIDs
*/
-function openid_ensure_url_match($user, $url = null) {
- $identities = get_user_openids($user->ID);
- if (empty($identities)) return true;
+function openid_ensure_url_match( $user, $url = null ) {
+ $identities = get_user_openids( $user->ID );
+ if ( empty( $identities ) ) {
+ return true;
+ }
require_once 'Auth/OpenID.php';
- if ($url == null) $url = $user->user_url;
- $url = Auth_OpenID::normalizeUrl($url);
+ if ( $url == null ) {
+ $url = $user->user_url;
+ }
+ $url = Auth_OpenID::normalizeUrl( $url );
- foreach ($identities as $id) {
- $id = Auth_OpenID::normalizeUrl($id);
- if ($id == $url) return true;
+ foreach ( $identities as $id ) {
+ $id = Auth_OpenID::normalizeUrl( $id );
+ if ( $id == $url ) {
+ return true;
+ }
}
return false;
@@ -851,12 +958,12 @@ function openid_extend_profile() {
echo '
<table class="form-table">
<tr>
- <th><label for="openid_delegate">'.__('OpenID Delegation', 'openid').'</label></th>
+ <th><label for="openid_delegate">' . __( 'OpenID Delegation', 'openid' ) . '</label></th>
<td>
- <p style="margin-top:0;">'.__('OpenID Delegation allows you to use an external OpenID provider of your choice.', 'openid').'</p>
+ <p style="margin-top:0;">' . __( 'OpenID Delegation allows you to use an external OpenID provider of your choice.', 'openid' ) . '</p>
<p>
- <input type="text" id="openid_delegate" name="openid_delegate" class="regular-text code openid_link" value="'.get_user_meta($user->ID, 'openid_delegate', true).'" /> '
- . __('To delegate, enter a valid OpenID. Otherwise leave this blank.', 'openid')
+ <input type="text" id="openid_delegate" name="openid_delegate" class="regular-text code openid_link" value="' . get_user_meta( $user->ID, 'openid_delegate', true ) . '" /> '
+ . __( 'To delegate, enter a valid OpenID. Otherwise leave this blank.', 'openid' )
. '</p>
</td>
</tr>
@@ -868,15 +975,15 @@ function openid_extend_profile() {
/**
* Update OpenID options set from the WordPress user profile page.
*/
-function openid_profile_update($user_id) {
+function openid_profile_update( $user_id ) {
global $openid_user_delegation_info;
- if ( empty($_POST['openid_delegate']) ) {
- delete_user_meta($user_id, 'openid_delegate');
- delete_user_meta($user_id, 'openid_delegate_services');
+ if ( empty( $_POST['openid_delegate'] ) ) {
+ delete_user_meta( $user_id, 'openid_delegate' );
+ delete_user_meta( $user_id, 'openid_delegate_services' );
} else {
- update_user_meta($user_id, 'openid_delegate', $openid_user_delegation_info['url']);
- update_user_meta($user_id, 'openid_delegate_services', $openid_user_delegation_info['services']);
+ update_user_meta( $user_id, 'openid_delegate', $openid_user_delegation_info['url'] );
+ update_user_meta( $user_id, 'openid_delegate_services', $openid_user_delegation_info['services'] );
}
}
@@ -884,26 +991,28 @@ function openid_profile_update($user_id) {
/**
* Report any OpenID errors during user profile updating.
*/
-function openid_profile_update_errors($errors, $update, $user) {
+function openid_profile_update_errors( $errors, $update, $user ) {
global $openid_user_delegation_info;
- $delegate = Auth_OpenID::normalizeUrl($_POST['openid_delegate']);
- if ( empty($delegate) ) return $errors;
+ $delegate = Auth_OpenID::normalizeUrl( $_POST['openid_delegate'] );
+ if ( empty( $delegate ) ) {
+ return $errors;
+ }
- $openid_user_delegation_info = openid_server_get_delegation_info($user->ID, $delegate);
+ $openid_user_delegation_info = openid_server_get_delegation_info( $user->ID, $delegate );
- if (!$openid_user_delegation_info) {
- $errors->add('openid_delegate', sprintf(__('Unable to find any OpenID information for delegate URL %s', 'openid'), '<strong>'.$delegate.'</strong>'));
+ if ( ! $openid_user_delegation_info ) {
+ $errors->add( 'openid_delegate', sprintf( __( 'Unable to find any OpenID information for delegate URL %s', 'openid' ), '<strong>' . $delegate . '</strong>' ) );
} else {
$id_select_count = 0;
- foreach ($openid_user_delegation_info['services'] as $service) {
- if ( array_key_exists('LocalID', $service) && $service['LocalID'] == Auth_OpenID_IDENTIFIER_SELECT ) {
+ foreach ( $openid_user_delegation_info['services'] as $service ) {
+ if ( array_key_exists( 'LocalID', $service ) && $service['LocalID'] == Auth_OpenID_IDENTIFIER_SELECT ) {
$id_select_count++;
}
}
- if ( count($openid_user_delegation_info['services']) <= $id_select_count ) {
- $errors->add('openid_delegate', sprintf(__('You cannot delegate to an OpenID provider which uses Identifier Select.', 'openid')));
+ if ( count( $openid_user_delegation_info['services'] ) <= $id_select_count ) {
+ $errors->add( 'openid_delegate', sprintf( __( 'You cannot delegate to an OpenID provider which uses Identifier Select.', 'openid' ) ) );
}
}
@@ -914,17 +1023,17 @@ function openid_profile_update_errors($errors, $update, $user) {
* Add OpenID options to the WordPress MU site options page.
*/
function openid_wpmu_options() {
- $registration = get_site_option('registration');
- if ( $registration == 'all' || $registration == 'user' ):
-?>
+ $registration = get_site_option( 'registration' );
+ if ( $registration == 'all' || $registration == 'user' ) :
+ ?>
<table id="openid_options" class="wp-list-table widefat fixed striped">
<tr valign="top">
<th scope="row"></th>
<td>
<label for="openid_required_for_registration">
<input type="checkbox" name="openid_required_for_registration" id="openid_required_for_registration" value="1"
- <?php checked(true, get_site_option('openid_required_for_registration')) ?> />
- <?php _e('New accounts can only be created with verified OpenIDs.', 'openid') ?>
+ <?php checked( true, get_site_option( 'openid_required_for_registration' ) ); ?> />
+ <?php _e( 'New accounts can only be created with verified OpenIDs.', 'openid' ); ?>
</label>
</td>
</tr>
@@ -937,7 +1046,7 @@ function openid_wpmu_options() {
jQuery('#openid_required_for_registration').parent().insertBefore(lastp).wrap('<p></p>');
});
</script>
-<?php
+ <?php
endif;
}
@@ -946,11 +1055,11 @@ function openid_wpmu_options() {
* Update the OpenID options set from the WordPress MU site options page.
*/
function openid_update_wpmu_options() {
- $openid_required = array_key_exists('openid_required_for_registration', $_POST);
- if ($openid_required) {
- update_site_option('openid_required_for_registration', '1');
+ $openid_required = array_key_exists( 'openid_required_for_registration', $_POST );
+ if ( $openid_required ) {
+ update_site_option( 'openid_required_for_registration', '1' );
} else {
- update_site_option('openid_required_for_registration', '0');
+ update_site_option( 'openid_required_for_registration', '0' );
}
}
@@ -959,11 +1068,12 @@ function openid_update_wpmu_options() {
* Add OpenID options to the WordPress general settings page.
*/
function openid_general_settings() {
- if ( get_option('users_can_register') ): ?>
+ if ( get_option( 'users_can_register' ) ) :
+ ?>
<label for="openid_required_for_registration">
<input type="checkbox" name="openid_required_for_registration" id="openid_required_for_registration" value="1"
- <?php checked(true, get_option('openid_required_for_registration')) ?> />
- <?php _e('New accounts can only be created with verified OpenIDs.', 'openid') ?>
+ <?php checked( true, get_option( 'openid_required_for_registration' ) ); ?> />
+ <?php _e( 'New accounts can only be created with verified OpenIDs.', 'openid' ); ?>
</label>
<?php endif; ?>
@@ -974,7 +1084,7 @@ function openid_general_settings() {
.parent().prepend('<br />').insertAfter('label:has(#users_can_register)');
});
</script>
-<?php
+ <?php
}
@@ -982,34 +1092,43 @@ function openid_general_settings() {
* Add OpenID options to the WordPress discussion settings page.
*/
function openid_discussion_settings() {
-?>
+ ?>
<fieldset>
<label for="openid_enable_commentform">
- <input type="checkbox" name="openid_enable_commentform" id="openid_enable_commentform" value="1" <?php
- echo checked(true, get_option('openid_enable_commentform')); ?> />
- <?php _e('Enable OpenID for comments', 'openid') ?>
+ <input type="checkbox" name="openid_enable_commentform" id="openid_enable_commentform" value="1"
+ <?php
+ echo checked( true, get_option( 'openid_enable_commentform' ) );
+ ?>
+ />
+ <?php _e( 'Enable OpenID for comments', 'openid' ); ?>
</label>
<br />
- <?php if ( get_option('openid_enable_commentform') ): ?>
+ <?php if ( get_option( 'openid_enable_commentform' ) ) : ?>
- <?php if ( get_option('require_name_email') ): ?>
+ <?php if ( get_option( 'require_name_email' ) ) : ?>
<label for="openid_no_require_name">
- <input type="checkbox" name="openid_no_require_name" id="openid_no_require_name" value="1" <?php
- echo checked(true, get_option('openid_no_require_name')) ; ?> />
- <?php _e('Do not require name and e-mail for comments left with a verified OpenID', 'openid') ?>
+ <input type="checkbox" name="openid_no_require_name" id="openid_no_require_name" value="1"
+ <?php
+ echo checked( true, get_option( 'openid_no_require_name' ) );
+ ?>
+ />
+ <?php _e( 'Do not require name and e-mail for comments left with a verified OpenID', 'openid' ); ?>
</label>
<br />
<?php endif; ?>
<label for="openid_enable_approval">
- <input type="checkbox" name="openid_enable_approval" id="openid_enable_approval" value="1" <?php
- echo checked(true, get_option('openid_enable_approval')); ?> />
- <?php _e('Always approve comments left with a verified OpenID', 'openid'); ?>
+ <input type="checkbox" name="openid_enable_approval" id="openid_enable_approval" value="1"
+ <?php
+ echo checked( true, get_option( 'openid_enable_approval' ) );
+ ?>
+ />
+ <?php _e( 'Always approve comments left with a verified OpenID', 'openid' ); ?>
</label>
<br />
<?php endif; ?>
</fieldset>
-<?php
+ <?php
}
diff --git a/plugins/openid/comments.php b/plugins/openid/comments.php
index 1e5bd06d..11950ee2 100644
--- a/plugins/openid/comments.php
+++ b/plugins/openid/comments.php
@@ -65,7 +65,7 @@ function openid_process_comment( $comment ) {
if ( array_key_exists( 'openid_identifier', $_POST ) ) {
$openid_url = $_POST['openid_identifier'];
- } elseif ( $_REQUEST['login_with_openid'] ) {
+ } elseif ( array_key_exists( 'login_with_openid', $_REQUEST ) && $_REQUEST['login_with_openid'] ) {
$openid_url = $_POST['url'];
}
@@ -73,9 +73,9 @@ function openid_process_comment( $comment ) {
unset( $_SESSION['openid_posted_comment'] );
if ( ! empty( $openid_url ) ) { // Comment form's OpenID url is filled in.
- $_SESSION['openid_comment_post'] = $_POST;
+ $_SESSION['openid_comment_post'] = $_POST;
$_SESSION['openid_comment_post']['comment_author_openid'] = $openid_url;
- $_SESSION['openid_comment_post']['openid_skip'] = 1;
+ $_SESSION['openid_comment_post']['openid_skip'] = 1;
openid_start_login( $openid_url, 'comment' );
@@ -102,8 +102,8 @@ function openid_process_comment( $comment ) {
* address.
*/
function openid_require_name_email( $comment ) {
- $user = wp_get_current_user();
- $comment_author = $comment['comment_author'];
+ $user = wp_get_current_user();
+ $comment_author = $comment['comment_author'];
$comment_author_email = $comment['comment_author_email'];
if ( get_option( 'require_name_email' ) && ! $user->ID ) {
@@ -185,9 +185,11 @@ function openid_sanitize_comment_cookies() {
// this might be an i-name, so we don't want to run clean_url()
remove_filter( 'pre_comment_author_url', 'clean_url' );
- $comment_author_url = apply_filters( 'pre_comment_author_url',
- $_COOKIE[ 'comment_author_openid_' . COOKIEHASH ] );
- $comment_author_url = stripslashes( $comment_author_url );
+ $comment_author_url = apply_filters(
+ 'pre_comment_author_url',
+ $_COOKIE[ 'comment_author_openid_' . COOKIEHASH ]
+ );
+ $comment_author_url = stripslashes( $comment_author_url );
$_COOKIE[ 'comment_author_url_' . COOKIEHASH ] = $comment_author_url;
}
}
@@ -343,7 +345,7 @@ function openid_finish_comment( $identity_url, $action ) {
* @param int $id id of comment to set as OpenID
*/
function set_comment_openid( $id ) {
- $comment = get_comment( $id );
+ $comment = get_comment( $id );
$openid_comments = get_post_meta( $comment->comment_post_ID, 'openid_comments', true );
if ( ! is_array( $openid_comments ) ) {
$openid_comments = array();
@@ -359,7 +361,7 @@ function set_comment_openid( $id ) {
* @param int $id id of comment to set as OpenID
*/
function unset_comment_openid( $id ) {
- $comment = get_comment( $id );
+ $comment = get_comment( $id );
$openid_comments = get_post_meta( $comment->comment_post_ID, 'openid_comments', true );
if ( is_array( $openid_comments ) && in_array( $id, $openid_comments ) ) {
@@ -396,9 +398,9 @@ function openid_get_user_data_form( $data, $identity_url ) {
}
if ( $comment['author'] ) {
- $data['nickname'] = $comment['author'];
+ $data['nickname'] = $comment['author'];
$data['user_nicename'] = $comment['author'];
- $data['display_name'] = $comment['author'];
+ $data['display_name'] = $comment['author'];
}
return $data;
diff --git a/plugins/openid/common.php b/plugins/openid/common.php
index 7c54b664..df7737f8 100644
--- a/plugins/openid/common.php
+++ b/plugins/openid/common.php
@@ -195,7 +195,7 @@ function openid_cleanup() {
/*
* Customer error handler for calls into the JanRain library
*/
-function openid_customer_error_handler( $errno, $errmsg, $filename, $linenum, $vars ) {
+function openid_customer_error_handler( $errno, $errmsg, $filename, $linenum, $vars = null ) {
if ( 2048 == ( 2048 & $errno ) ) {
return;
}
@@ -232,10 +232,10 @@ function openid_customer_error_handler( $errno, $errmsg, $filename, $linenum, $v
*/
function openid_generate_new_username( $url, $append = true ) {
$base = openid_normalize_username( $url );
- $i = '';
+ $i = '';
while ( true ) {
$username = openid_normalize_username( $base . $i );
- $user = get_user_by( 'login', $username );
+ $user = get_user_by( 'login', $username );
if ( $user ) {
if ( ! $append ) {
return null;
@@ -349,25 +349,25 @@ function openid_create_new_user( $identity_url, &$user_data ) {
$username = openid_generate_new_username( $identity_url );
}
- $user_data['user_login'] = $username;
+ $user_data['user_login'] = $username;
$user_data['display_name'] = $username;
- $user_data['user_pass'] = substr( md5( uniqid( microtime() ) ), 0, 7 );
- $user_id = wp_insert_user( $user_data );
+ $user_data['user_pass'] = substr( md5( uniqid( microtime() ) ), 0, 7 );
+ $user_id = wp_insert_user( $user_data );
if ( $user_id instanceof WP_Error ) {
openid_message( $user_id->get_error_message() );
openid_status( 'error' );
return;
- } else if ( is_integer( $user_id ) ) { // created ok
+ } elseif ( is_integer( $user_id ) ) { // created ok
$user_data['ID'] = $user_id;
// XXX this all looks redundant, see openid_set_current_user
- $user = new WP_User( $user_id );
+ $user = new WP_User( $user_id );
$credentials = array(
- 'user_login' => $user->user_login,
+ 'user_login' => $user->user_login,
'user_password' => $user_data['user_pass'],
- 'remember' => true,
+ 'remember' => true,
);
if ( ! wp_signon( $credentials ) ) {
@@ -419,10 +419,10 @@ function openid_create_new_user( $identity_url, &$user_data ) {
*/
function openid_get_user_data( $identity_url ) {
$data = array(
- 'ID' => null,
- 'user_url' => $identity_url,
+ 'ID' => null,
+ 'user_url' => $identity_url,
'user_nicename' => $identity_url,
- 'display_name' => $identity_url,
+ 'display_name' => $identity_url,
);
// create proper website URL if OpenID is an i-name
@@ -462,7 +462,7 @@ function openid_get_user_data_ax( $data, $identity_url ) {
require_once( 'Auth/OpenID/AX.php' );
$response = openid_response();
- $ax = Auth_OpenID_AX_FetchResponse::fromSuccessResponse( $response );
+ $ax = Auth_OpenID_AX_FetchResponse::fromSuccessResponse( $response );
if ( ! $ax ) {
return $data;
@@ -475,9 +475,9 @@ function openid_get_user_data_ax( $data, $identity_url ) {
$nickname = $ax->getSingle( 'http://axschema.org/namePerson/friendly' );
if ( $nickname && ! is_a( $nickname, 'Auth_OpenID_AX_Error' ) ) {
- $data['nickname'] = $ax->getSingle( 'http://axschema.org/namePerson/friendly' );
+ $data['nickname'] = $ax->getSingle( 'http://axschema.org/namePerson/friendly' );
$data['user_nicename'] = $ax->getSingle( 'http://axschema.org/namePerson/friendly' );
- $data['display_name'] = $ax->getSingle( 'http://axschema.org/namePerson/friendly' );
+ $data['display_name'] = $ax->getSingle( 'http://axschema.org/namePerson/friendly' );
}
$fullname = $ax->getSingle( 'http://axschema.org/namePerson' );
@@ -505,9 +505,9 @@ function openid_get_user_data_ax( $data, $identity_url ) {
*/
function openid_get_user_data_sreg( $data, $identity_url ) {
require_once( 'Auth/OpenID/SReg.php' );
- $response = openid_response();
+ $response = openid_response();
$sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse( $response );
- $sreg = $sreg_resp->contents();
+ $sreg = $sreg_resp->contents();
if ( ! $sreg ) {
return $data;
@@ -518,9 +518,9 @@ function openid_get_user_data_sreg( $data, $identity_url ) {
}
if ( array_key_exists( 'nickname', $sreg ) && $sreg['nickname'] ) {
- $data['nickname'] = $sreg['nickname'];
+ $data['nickname'] = $sreg['nickname'];
$data['user_nicename'] = $sreg['nickname'];
- $data['display_name'] = $sreg['nickname'];
+ $data['display_name'] = $sreg['nickname'];
}
if ( array_key_exists( 'fullname', $sreg ) && $sreg['fullname'] ) {
@@ -625,7 +625,7 @@ function openid_clean_request() {
unset( $_GET['q'] );
- $vars = explode( '&', $_SERVER['QUERY_STRING'] );
+ $vars = explode( '&', $_SERVER['QUERY_STRING'] );
$clean = array();
foreach ( $vars as $v ) {
@@ -642,7 +642,7 @@ function openid_clean_request() {
// This results in the QUERY_STRING not having the correct information, but fortunately we
// can pull it out of REQUEST_URI
- list($path, $query) = explode( '?', $_SERVER['REQUEST_URI'], 2 );
+ list($path, $query) = explode( '?', $_SERVER['REQUEST_URI'], 2 );
$_SERVER['QUERY_STRING'] = $query;
}
}
diff --git a/plugins/openid/consumer.php b/plugins/openid/consumer.php
index 2c3ab5bc..c1cbd296 100644
--- a/plugins/openid/consumer.php
+++ b/plugins/openid/consumer.php
@@ -21,7 +21,7 @@ function openid_getConsumer() { // phpcs:ignore
if ( ! $consumer ) {
require_once 'Auth/OpenID/Consumer.php';
- $store = openid_getStore();
+ $store = openid_getStore();
$consumer = new Auth_OpenID_Consumer( $store );
if ( null === $consumer ) {
openid_error( 'OpenID consumer could not be created properly.' );
@@ -98,7 +98,7 @@ function finish_openid_auth() {
openid_status( 'success' );
$identity_url = $response->identity_url;
- $escaped_url = htmlspecialchars( $identity_url, ENT_QUOTES );
+ $escaped_url = htmlspecialchars( $identity_url, ENT_QUOTES );
return $escaped_url;
default:
@@ -124,7 +124,7 @@ function openid_begin_consumer( $url ) {
set_error_handler( 'openid_customer_error_handler' );
$consumer = openid_getConsumer();
- $request = $consumer->begin( $url );
+ $request = $consumer->begin( $url );
restore_error_handler();
}
@@ -150,16 +150,18 @@ function openid_start_login( $claimed_url, $action, $finish_url = null ) {
if ( null === $auth_request ) {
openid_status( 'error' );
- openid_message(sprintf(
- __( 'Could not discover an OpenID identity server endpoint at the url: %s', 'openid' ),
- htmlentities( $claimed_url )
- ));
+ openid_message(
+ sprintf(
+ __( 'Could not discover an OpenID identity server endpoint at the url: %s', 'openid' ),
+ htmlentities( $claimed_url )
+ )
+ );
return;
}
@session_start();
- $_SESSION['openid_action'] = $action;
+ $_SESSION['openid_action'] = $action;
$_SESSION['openid_finish_url'] = $finish_url;
$extensions = apply_filters( 'openid_auth_request_extensions', array(), $auth_request );
@@ -192,7 +194,7 @@ function openid_add_ax_extension( $extensions, $auth_request ) {
Auth_OpenID_AX_AttrInfo::make( 'http://axschema.org/contact/email', 1, true ),
Auth_OpenID_AX_AttrInfo::make( 'http://axschema.org/namePerson', 1, true ),
);
- $fields = apply_filters( 'openid_consumer_ax_fields', $default_fields );
+ $fields = apply_filters( 'openid_consumer_ax_fields', $default_fields );
$ax_request = new Auth_OpenID_AX_FetchRequest();
foreach ( $fields as $field ) {
@@ -218,8 +220,8 @@ function openid_add_sreg_extension( $extensions, $auth_request ) {
require_once( 'Auth/OpenID/SReg.php' );
if ( $auth_request->endpoint->usesExtension( Auth_OpenID_SREG_NS_URI_1_0 ) || $auth_request->endpoint->usesExtension( Auth_OpenID_SREG_NS_URI_1_1 ) ) {
- $required = apply_filters( 'openid_consumer_sreg_required_fields', array() );
- $optional = apply_filters( 'openid_consumer_sreg_optional_fields', array( 'nickname', 'email', 'fullname' ) );
+ $required = apply_filters( 'openid_consumer_sreg_required_fields', array() );
+ $optional = apply_filters( 'openid_consumer_sreg_optional_fields', array( 'nickname', 'email', 'fullname' ) );
$extensions[] = Auth_OpenID_SRegRequest::build( $required, $optional );
}
}
diff --git a/plugins/openid/lib/Auth/OpenID.php b/plugins/openid/lib/Auth/OpenID.php
index 4d8fffa3..ba26c012 100644
--- a/plugins/openid/lib/Auth/OpenID.php
+++ b/plugins/openid/lib/Auth/OpenID.php
@@ -20,7 +20,7 @@
/**
* The library version string
*/
-define('Auth_OpenID_VERSION', '2.2.2');
+define('Auth_OpenID_VERSION', '3.0.3');
/**
* Require the fetcher code.
@@ -148,7 +148,7 @@ class Auth_OpenID {
*/
static function getQuery($query_str=null)
{
- $data = array();
+ $data = [];
if ($query_str !== null) {
$data = Auth_OpenID::params_from_string($query_str);
@@ -170,7 +170,7 @@ class Auth_OpenID {
$str = file_get_contents('php://input');
if ($str === false) {
- $post = array();
+ $post = [];
} else {
$post = Auth_OpenID::params_from_string($str);
}
@@ -186,7 +186,7 @@ class Auth_OpenID {
{
$chunks = explode("&", $str);
- $data = array();
+ $data = [];
foreach ($chunks as $chunk) {
$parts = explode("=", $chunk, 2);
@@ -237,7 +237,7 @@ class Auth_OpenID {
*/
static function addPrefix($values, $prefix)
{
- $new_values = array();
+ $new_values = [];
foreach ($values as $s) {
$new_values[] = $prefix . $s;
}
@@ -286,7 +286,7 @@ class Auth_OpenID {
$parts = explode('&', $query);
- $new_parts = array();
+ $new_parts = [];
for ($i = 0; $i < count($parts); $i++) {
$pair = explode('=', $parts[$i]);
@@ -314,7 +314,7 @@ class Auth_OpenID {
*/
static function httpBuildQuery($data)
{
- $pairs = array();
+ $pairs = [];
foreach ($data as $key => $value) {
if (is_array($value)) {
$pairs[] = urlencode($value[0])."=".urlencode($value[1]);
@@ -354,9 +354,9 @@ class Auth_OpenID {
} else {
$keys = array_keys($args);
sort($keys);
- $new_args = array();
+ $new_args = [];
foreach ($keys as $key) {
- $new_args[] = array($key, $args[$key]);
+ $new_args[] = [$key, $args[$key]];
}
$args = $new_args;
}
@@ -440,7 +440,7 @@ class Auth_OpenID {
if (isset($parsed['scheme']) &&
isset($parsed['host'])) {
$scheme = strtolower($parsed['scheme']);
- if (!in_array($scheme, array('http', 'https'))) {
+ if (!in_array($scheme, ['http', 'https'])) {
return null;
}
} else {
@@ -497,10 +497,10 @@ class Auth_OpenID {
$hex = bin2hex($str);
if (!$hex) {
- return array();
+ return [];
}
- $b = array();
+ $b = [];
for ($i = 0; $i < strlen($hex); $i += 2) {
$b[] = chr(base_convert(substr($hex, $i, 2), 16, 10));
}
@@ -513,7 +513,7 @@ class Auth_OpenID {
$parts = explode("#", $url, 2);
if (count($parts) == 1) {
- return array($parts[0], "");
+ return [$parts[0], ""];
} else {
return $parts;
}
@@ -521,10 +521,10 @@ class Auth_OpenID {
static function filter($callback, &$sequence)
{
- $result = array();
+ $result = [];
foreach ($sequence as $item) {
- if (call_user_func_array($callback, array($item))) {
+ if (call_user_func_array($callback, [$item])) {
$result[] = $item;
}
}
diff --git a/plugins/openid/lib/Auth/OpenID/AX.php b/plugins/openid/lib/Auth/OpenID/AX.php
index acc9af52..82b354d1 100644
--- a/plugins/openid/lib/Auth/OpenID/AX.php
+++ b/plugins/openid/lib/Auth/OpenID/AX.php
@@ -130,7 +130,7 @@ class Auth_OpenID_AX_Message extends Auth_OpenID_Extension {
*/
function _newArgs()
{
- return array('mode' => $this->mode);
+ return ['mode' => $this->mode];
}
}
@@ -248,7 +248,7 @@ class Auth_OpenID_AX_AttrInfo {
*/
function Auth_OpenID_AX_toTypeURIs($namespace_map, $alias_list_s)
{
- $uris = array();
+ $uris = [];
if ($alias_list_s) {
foreach (explode(',', $alias_list_s) as $alias) {
@@ -295,7 +295,7 @@ class Auth_OpenID_AX_FetchRequest extends Auth_OpenID_AX_Message {
*
* @var array
*/
- private $requested_attributes = array();
+ private $requested_attributes = [];
function __construct($update_url=null)
{
@@ -331,8 +331,8 @@ class Auth_OpenID_AX_FetchRequest extends Auth_OpenID_AX_Message {
{
$aliases = new Auth_OpenID_NamespaceMap();
- $required = array();
- $if_available = array();
+ $required = [];
+ $if_available = [];
$ax_args = $this->_newArgs();
@@ -383,7 +383,7 @@ class Auth_OpenID_AX_FetchRequest extends Auth_OpenID_AX_Message {
*/
function getRequiredAttrs()
{
- $required = array();
+ $required = [];
foreach ($this->requested_attributes as $type_uri => $attribute) {
if ($attribute->required) {
$required[] = $type_uri;
@@ -559,7 +559,7 @@ class Auth_OpenID_AX_FetchRequest extends Auth_OpenID_AX_Message {
class Auth_OpenID_AX_KeyValueMessage extends Auth_OpenID_AX_Message {
/** @var array */
- protected $data = array();
+ protected $data = [];
/**
* Add a single value for the given attribute type to the
@@ -574,7 +574,7 @@ class Auth_OpenID_AX_KeyValueMessage extends Auth_OpenID_AX_Message {
function addValue($type_uri, $value)
{
if (!array_key_exists($type_uri, $this->data)) {
- $this->data[$type_uri] = array();
+ $this->data[$type_uri] = [];
}
$values =& $this->data[$type_uri];
@@ -609,7 +609,7 @@ class Auth_OpenID_AX_KeyValueMessage extends Auth_OpenID_AX_Message {
$aliases = new Auth_OpenID_NamespaceMap();
}
- $ax_args = array();
+ $ax_args = [];
foreach ($this->data as $type_uri => $values) {
$alias = $aliases->add($type_uri);
@@ -683,7 +683,7 @@ class Auth_OpenID_AX_KeyValueMessage extends Auth_OpenID_AX_Message {
);
}
- $values = array();
+ $values = [];
for ($i = 1; $i < $count + 1; $i++) {
$value_key = sprintf('value.%s.%d', $alias, $i);
@@ -710,9 +710,9 @@ class Auth_OpenID_AX_KeyValueMessage extends Auth_OpenID_AX_Message {
$value = $ax_args['value.' . $alias];
if ($value == '') {
- $values = array();
+ $values = [];
} else {
- $values = array($value);
+ $values = [$value];
}
}
@@ -828,7 +828,7 @@ class Auth_OpenID_AX_FetchResponse extends Auth_OpenID_AX_KeyValueMessage {
{
$aliases = new Auth_OpenID_NamespaceMap();
- $zero_value_types = array();
+ $zero_value_types = [];
if ($request !== null) {
// Validate the data in the context of the request (the
@@ -865,7 +865,7 @@ class Auth_OpenID_AX_FetchResponse extends Auth_OpenID_AX_KeyValueMessage {
if (array_key_exists($attr_info->type_uri, $this->data)) {
$values = $this->data[$attr_info->type_uri];
} else {
- $values = array();
+ $values = [];
$zero_value_types[] = $attr_info;
}
diff --git a/plugins/openid/lib/Auth/OpenID/Association.php b/plugins/openid/lib/Auth/OpenID/Association.php
index 23ced3a4..ef166b78 100644
--- a/plugins/openid/lib/Auth/OpenID/Association.php
+++ b/plugins/openid/lib/Auth/OpenID/Association.php
@@ -55,19 +55,19 @@ class Auth_OpenID_Association {
*
* @access private
*/
- public $assoc_keys = array(
- 'version',
- 'handle',
- 'secret',
- 'issued',
- 'lifetime',
- 'assoc_type'
- );
-
- public $_macs = array(
- 'HMAC-SHA1' => 'Auth_OpenID_HMACSHA1',
- 'HMAC-SHA256' => 'Auth_OpenID_HMACSHA256'
- );
+ public $assoc_keys = [
+ 'version',
+ 'handle',
+ 'secret',
+ 'issued',
+ 'lifetime',
+ 'assoc_type',
+ ];
+
+ public $_macs = [
+ 'HMAC-SHA1' => 'Auth_OpenID_HMACSHA1',
+ 'HMAC-SHA256' => 'Auth_OpenID_HMACSHA256',
+ ];
/**
* This is an alternate constructor (factory method) used by the
@@ -186,14 +186,14 @@ class Auth_OpenID_Association {
*/
function serialize()
{
- $data = array(
- 'version' => '2',
- 'handle' => $this->handle,
- 'secret' => base64_encode($this->secret),
- 'issued' => strval(intval($this->issued)),
- 'lifetime' => strval(intval($this->lifetime)),
- 'assoc_type' => $this->assoc_type
- );
+ $data = [
+ 'version' => '2',
+ 'handle' => $this->handle,
+ 'secret' => base64_encode($this->secret),
+ 'issued' => strval(intval($this->issued)),
+ 'lifetime' => strval(intval($this->lifetime)),
+ 'assoc_type' => $this->assoc_type,
+ ];
assert(array_keys($data) == $this->assoc_keys);
@@ -211,8 +211,8 @@ class Auth_OpenID_Association {
static function deserialize($class_name, $assoc_s)
{
$pairs = Auth_OpenID_KVForm::toArray($assoc_s, $strict = true);
- $keys = array();
- $values = array();
+ $keys = [];
+ $values = [];
foreach ($pairs as $key => $value) {
if (is_array($value)) {
list($key, $value) = $value;
@@ -269,7 +269,7 @@ class Auth_OpenID_Association {
/* Invalid association types should be caught at constructor */
$callback = $this->_macs[$this->assoc_type];
- return call_user_func_array($callback, array($this->secret, $kv));
+ return call_user_func_array($callback, [$this->secret, $kv]);
}
/**
@@ -304,7 +304,7 @@ class Auth_OpenID_Association {
$this->handle);
$message_keys = array_keys($signed_message->toPostArgs());
- $signed_list = array();
+ $signed_list = [];
$signed_prefix = 'openid.';
foreach ($message_keys as $k) {
@@ -341,12 +341,14 @@ class Auth_OpenID_Association {
}
$signed_list = explode(',', $signed);
- $pairs = array();
+ $pairs = [];
$data = $message->toPostArgs();
foreach ($signed_list as $field) {
- $pairs[] = array($field, Auth_OpenID::arrayGet($data,
+ $pairs[] = [
+ $field, Auth_OpenID::arrayGet($data,
'openid.' .
- $field, ''));
+ $field, '')
+ ];
}
return $pairs;
}
@@ -400,12 +402,12 @@ function Auth_OpenID_getSecretSize($assoc_type)
function Auth_OpenID_getAllAssociationTypes()
{
- return array('HMAC-SHA1', 'HMAC-SHA256');
+ return ['HMAC-SHA1', 'HMAC-SHA256'];
}
function Auth_OpenID_getSupportedAssociationTypes()
{
- $a = array('HMAC-SHA1');
+ $a = ['HMAC-SHA1'];
if (Auth_OpenID_HMACSHA256_SUPPORTED) {
$a[] = 'HMAC-SHA256';
@@ -420,15 +422,16 @@ function Auth_OpenID_getSupportedAssociationTypes()
*/
function Auth_OpenID_getSessionTypes($assoc_type)
{
- $assoc_to_session = array(
- 'HMAC-SHA1' => array('DH-SHA1', 'no-encryption'));
+ $assoc_to_session = [
+ 'HMAC-SHA1' => ['DH-SHA1', 'no-encryption']
+ ];
if (Auth_OpenID_HMACSHA256_SUPPORTED) {
$assoc_to_session['HMAC-SHA256'] =
- array('DH-SHA256', 'no-encryption');
+ ['DH-SHA256', 'no-encryption'];
}
- return Auth_OpenID::arrayGet($assoc_to_session, $assoc_type, array());
+ return Auth_OpenID::arrayGet($assoc_to_session, $assoc_type, []);
}
function Auth_OpenID_checkSessionType($assoc_type, $session_type)
@@ -443,20 +446,20 @@ function Auth_OpenID_checkSessionType($assoc_type, $session_type)
function Auth_OpenID_getDefaultAssociationOrder()
{
- $order = array();
+ $order = [];
if (!Auth_OpenID_noMathSupport()) {
- $order[] = array('HMAC-SHA1', 'DH-SHA1');
+ $order[] = ['HMAC-SHA1', 'DH-SHA1'];
if (Auth_OpenID_HMACSHA256_SUPPORTED) {
- $order[] = array('HMAC-SHA256', 'DH-SHA256');
+ $order[] = ['HMAC-SHA256', 'DH-SHA256'];
}
}
- $order[] = array('HMAC-SHA1', 'no-encryption');
+ $order[] = ['HMAC-SHA1', 'no-encryption'];
if (Auth_OpenID_HMACSHA256_SUPPORTED) {
- $order[] = array('HMAC-SHA256', 'no-encryption');
+ $order[] = ['HMAC-SHA256', 'no-encryption'];
}
return $order;
@@ -464,7 +467,7 @@ function Auth_OpenID_getDefaultAssociationOrder()
function Auth_OpenID_getOnlyEncryptedOrder()
{
- $result = array();
+ $result = [];
foreach (Auth_OpenID_getDefaultAssociationOrder() as $pair) {
list($assoc, $session) = $pair;
@@ -538,7 +541,7 @@ function Auth_OpenID_getEncryptedNegotiator()
class Auth_OpenID_SessionNegotiator {
function __construct($allowed_types)
{
- $this->allowed_types = array();
+ $this->allowed_types = [];
$this->setAllowedTypes($allowed_types);
}
@@ -576,7 +579,7 @@ class Auth_OpenID_SessionNegotiator {
function addAllowedType($assoc_type, $session_type = null)
{
if ($this->allowed_types === null) {
- $this->allowed_types = array();
+ $this->allowed_types = [];
}
if ($session_type === null) {
@@ -591,7 +594,7 @@ class Auth_OpenID_SessionNegotiator {
}
} else {
if (Auth_OpenID_checkSessionType($assoc_type, $session_type)) {
- $this->allowed_types[] = array($assoc_type, $session_type);
+ $this->allowed_types[] = [$assoc_type, $session_type];
} else {
return false;
}
@@ -603,7 +606,7 @@ class Auth_OpenID_SessionNegotiator {
// Is this combination of association type and session type allowed?
function isAllowed($assoc_type, $session_type)
{
- $assoc_good = in_array(array($assoc_type, $session_type),
+ $assoc_good = in_array([$assoc_type, $session_type],
$this->allowed_types);
$matches = in_array($session_type,
@@ -619,7 +622,7 @@ class Auth_OpenID_SessionNegotiator {
function getAllowedType()
{
if (!$this->allowed_types) {
- return array(null, null);
+ return [null, null];
}
return $this->allowed_types[0];
diff --git a/plugins/openid/lib/Auth/OpenID/BigMath.php b/plugins/openid/lib/Auth/OpenID/BigMath.php
index 6a33322a..512b1a43 100644
--- a/plugins/openid/lib/Auth/OpenID/BigMath.php
+++ b/plugins/openid/lib/Auth/OpenID/BigMath.php
@@ -55,7 +55,7 @@ abstract class Auth_OpenID_MathLibrary {
return "\x00";
}
- $bytes = array();
+ $bytes = [];
while ($this->cmp($long, 0) > 0) {
array_unshift($bytes, $this->mod($long, 256));
@@ -137,7 +137,7 @@ abstract class Auth_OpenID_MathLibrary {
*/
function rand($stop)
{
- static $duplicate_cache = array();
+ static $duplicate_cache = [];
// Used as the key for the duplicate cache
$rbytes = $this->longToBinary($stop);
@@ -158,10 +158,10 @@ abstract class Auth_OpenID_MathLibrary {
$duplicate = $this->mod($mxrand, $stop);
if (count($duplicate_cache) > 10) {
- $duplicate_cache = array();
+ $duplicate_cache = [];
}
- $duplicate_cache[$rbytes] = array($duplicate, $nbytes);
+ $duplicate_cache[$rbytes] = [$duplicate, $nbytes];
}
do {
@@ -391,18 +391,21 @@ class Auth_OpenID_GmpMathWrapper extends Auth_OpenID_MathLibrary{
*/
function Auth_OpenID_math_extensions()
{
- $result = array();
+ $result = [];
if (!defined('Auth_OpenID_BUGGY_GMP')) {
- $result[] =
- array('modules' => array('gmp', 'php_gmp'),
- 'extension' => 'gmp',
- 'class' => 'Auth_OpenID_GmpMathWrapper');
+ $result[] = [
+ 'modules' => ['gmp', 'php_gmp'],
+ 'extension' => 'gmp',
+ 'class' => 'Auth_OpenID_GmpMathWrapper',
+ ];
}
- $result[] = array('modules' => array('bcmath', 'php_bcmath'),
- 'extension' => 'bcmath',
- 'class' => 'Auth_OpenID_BcMathWrapper');
+ $result[] = [
+ 'modules' => ['bcmath', 'php_bcmath'],
+ 'extension' => 'bcmath',
+ 'class' => 'Auth_OpenID_BcMathWrapper',
+ ];
return $result;
}
@@ -466,7 +469,7 @@ function Auth_OpenID_getMathLib()
// works.
$ext = Auth_OpenID_detectMathLibrary(Auth_OpenID_math_extensions());
if ($ext === false) {
- $tried = array();
+ $tried = [];
foreach (Auth_OpenID_math_extensions() as $extinfo) {
$tried[] = $extinfo['extension'];
}
diff --git a/plugins/openid/lib/Auth/OpenID/Consumer.php b/plugins/openid/lib/Auth/OpenID/Consumer.php
index fb1257ef..f4b4df34 100644
--- a/plugins/openid/lib/Auth/OpenID/Consumer.php
+++ b/plugins/openid/lib/Auth/OpenID/Consumer.php
@@ -214,14 +214,20 @@ define('Auth_OpenID_PARSE_ERROR', 'parse error');
*/
class Auth_OpenID_Consumer {
+ /** @var Auth_OpenID_GenericConsumer */
+ public $consumer;
+
+ /** @var Auth_Yadis_PHPSession */
+ public $session;
+
private $discoverMethod = 'Auth_OpenID_discover';
private $session_key_prefix = "_openid_consumer_";
private $_token_suffix = "last_token";
- /** @var Auth_OpenID_GenericConsumer */
- public $consumer;
+ /** @var string */
+ private $_token_key;
/**
* Initialize a Consumer instance.
@@ -426,8 +432,7 @@ class Auth_OpenID_Consumer {
$current_url);
$this->session->del($this->_token_key);
- if (in_array($response->status, array(Auth_OpenID_SUCCESS,
- Auth_OpenID_CANCEL))) {
+ if (in_array($response->status, [Auth_OpenID_SUCCESS, Auth_OpenID_CANCEL])) {
if ($response->identity_url !== null) {
$disco = $this->getDiscoveryObject($this->session,
$response->identity_url,
@@ -449,7 +454,10 @@ class Auth_OpenID_DiffieHellmanSHA1ConsumerSession {
public $session_type = 'DH-SHA1';
public $hash_func = 'Auth_OpenID_SHA1';
public $secret_size = 20;
- public $allowed_assoc_types = array('HMAC-SHA1');
+ public $allowed_assoc_types = ['HMAC-SHA1'];
+
+ /** @var Auth_OpenID_DiffieHellman */
+ protected $dh;
function __construct($dh = null)
{
@@ -466,14 +474,15 @@ class Auth_OpenID_DiffieHellmanSHA1ConsumerSession {
$cpub = $math->longToBase64($this->dh->public);
- $args = array('dh_consumer_public' => $cpub);
+ $args = ['dh_consumer_public' => $cpub];
if (!$this->dh->usingDefaultValues()) {
- $args = array_merge($args, array(
+ $args = array_merge($args, [
'dh_modulus' =>
$math->longToBase64($this->dh->mod),
'dh_gen' =>
- $math->longToBase64($this->dh->gen)));
+ $math->longToBase64($this->dh->gen)
+ ]);
}
return $args;
@@ -516,7 +525,7 @@ class Auth_OpenID_DiffieHellmanSHA256ConsumerSession extends
public $session_type = 'DH-SHA256';
public $hash_func = 'Auth_OpenID_SHA256';
public $secret_size = 32;
- public $allowed_assoc_types = array('HMAC-SHA256');
+ public $allowed_assoc_types = ['HMAC-SHA256'];
}
/**
@@ -526,11 +535,11 @@ class Auth_OpenID_DiffieHellmanSHA256ConsumerSession extends
*/
class Auth_OpenID_PlainTextConsumerSession {
public $session_type = 'no-encryption';
- public $allowed_assoc_types = array('HMAC-SHA1', 'HMAC-SHA256');
+ public $allowed_assoc_types = ['HMAC-SHA1', 'HMAC-SHA256'];
function getRequest()
{
- return array();
+ return [];
}
/**
@@ -553,10 +562,11 @@ class Auth_OpenID_PlainTextConsumerSession {
*/
function Auth_OpenID_getAvailableSessionTypes()
{
- $types = array(
+ $types = [
'no-encryption' => 'Auth_OpenID_PlainTextConsumerSession',
'DH-SHA1' => 'Auth_OpenID_DiffieHellmanSHA1ConsumerSession',
- 'DH-SHA256' => 'Auth_OpenID_DiffieHellmanSHA256ConsumerSession');
+ 'DH-SHA256' => 'Auth_OpenID_DiffieHellmanSHA256ConsumerSession'
+ ];
return $types;
}
@@ -596,6 +606,15 @@ class Auth_OpenID_GenericConsumer {
*/
public $openid1_return_to_identifier_name = 'openid1_claimed_id';
+ /** @var Auth_Yadis_ParanoidHTTPFetcher|Auth_Yadis_PlainHTTPFetcher */
+ public $fetcher;
+
+ /** @var array */
+ public $session_types;
+
+ /** @var Auth_OpenID_SessionNegotiator */
+ public $negotiator;
+
/**
* This method initializes a new {@link Auth_OpenID_Consumer}
* instance to access the library.
@@ -662,18 +681,18 @@ class Auth_OpenID_GenericConsumer {
$mode = $message->getArg(Auth_OpenID_OPENID_NS, 'mode',
'<no mode set>');
- $mode_methods = array(
+ $mode_methods = [
'cancel' => '_complete_cancel',
'error' => '_complete_error',
'setup_needed' => '_complete_setup_needed',
'id_res' => '_complete_id_res',
- );
+ ];
$method = Auth_OpenID::arrayGet($mode_methods, $mode,
'_completeInvalid');
- return call_user_func_array(array($this, $method),
- array($message, $endpoint, $return_to));
+ return call_user_func_array([$this, $method],
+ [$message, $endpoint, $return_to]);
}
/**
@@ -883,7 +902,7 @@ class Auth_OpenID_GenericConsumer {
// The URL scheme, authority, and path MUST be the same
// between the two URLs.
- foreach (array('scheme', 'host', 'port', 'path') as $component) {
+ foreach (['scheme', 'host', 'port', 'path'] as $component) {
// If the url component is absent in either URL, fail.
// There should always be a scheme, host, port, and path.
if (!array_key_exists($component, $return_to_parts)) {
@@ -927,7 +946,7 @@ class Auth_OpenID_GenericConsumer {
$parsed_url = parse_url($return_to);
- $q = array();
+ $q = [];
if (array_key_exists('query', $parsed_url)) {
$rt_query = $parsed_url['query'];
$q = Auth_OpenID::parse_str($rt_query);
@@ -1049,7 +1068,7 @@ class Auth_OpenID_GenericConsumer {
}
$to_match = new Auth_OpenID_ServiceEndpoint();
- $to_match->type_uris = array(Auth_OpenID_TYPE_1_1);
+ $to_match->type_uris = [Auth_OpenID_TYPE_1_1];
$to_match->local_id = $message->getArg(Auth_OpenID_OPENID1_NS,
'identity');
@@ -1062,7 +1081,7 @@ class Auth_OpenID_GenericConsumer {
}
$to_match_1_0 = $to_match->copy();
- $to_match_1_0->type_uris = array(Auth_OpenID_TYPE_1_0);
+ $to_match_1_0->type_uris = [Auth_OpenID_TYPE_1_0];
if ($endpoint !== null) {
$result = $this->_verifyDiscoverySingle($endpoint, $to_match);
@@ -1084,7 +1103,7 @@ class Auth_OpenID_GenericConsumer {
// Endpoint is either bad (failed verification) or None
return $this->_discoverAndVerify($to_match->claimed_id,
- array($to_match, $to_match_1_0));
+ [$to_match, $to_match_1_0]);
}
/**
@@ -1150,7 +1169,7 @@ class Auth_OpenID_GenericConsumer {
function _verifyDiscoveryResultsOpenID2($message, $endpoint)
{
$to_match = new Auth_OpenID_ServiceEndpoint();
- $to_match->type_uris = array(Auth_OpenID_TYPE_2_0);
+ $to_match->type_uris = [Auth_OpenID_TYPE_2_0];
$to_match->claimed_id = $message->getArg(Auth_OpenID_OPENID2_NS,
'claimed_id');
@@ -1194,7 +1213,7 @@ class Auth_OpenID_GenericConsumer {
// the original request.
// oidutil.log('No pre-discovered information supplied.')
return $this->_discoverAndVerify($to_match->claimed_id,
- array($to_match));
+ [$to_match]);
} else {
// The claimed ID matches, so we use the endpoint that we
@@ -1204,7 +1223,7 @@ class Auth_OpenID_GenericConsumer {
if (Auth_OpenID::isFailure($result)) {
$endpoint = $this->_discoverAndVerify($to_match->claimed_id,
- array($to_match));
+ [$to_match]);
if (Auth_OpenID::isFailure($endpoint)) {
return $endpoint;
}
@@ -1230,10 +1249,10 @@ class Auth_OpenID_GenericConsumer {
{
// oidutil.log('Performing discovery on %s' % (claimed_id,))
list(, $services) = call_user_func_array($this->discoverMethod,
- array(
+ [
$claimed_id,
$this->fetcher,
- ));
+ ]);
if (!$services) {
return new Auth_OpenID_FailureResponse(null,
@@ -1342,26 +1361,28 @@ class Auth_OpenID_GenericConsumer {
*/
function _idResCheckForFields($message)
{
- $basic_fields = array('return_to', 'assoc_handle', 'sig', 'signed');
- $basic_sig_fields = array('return_to', 'identity');
+ $basic_fields = ['return_to', 'assoc_handle', 'sig', 'signed'];
+ $basic_sig_fields = ['return_to', 'identity'];
- $require_fields = array(
+ $require_fields = [
Auth_OpenID_OPENID2_NS => array_merge($basic_fields,
- array('op_endpoint')),
+ ['op_endpoint']),
Auth_OpenID_OPENID1_NS => array_merge($basic_fields,
- array('identity'))
- );
+ ['identity'])
+ ];
- $require_sigs = array(
+ $require_sigs = [
Auth_OpenID_OPENID2_NS => array_merge($basic_sig_fields,
- array('response_nonce',
+ [
+ 'response_nonce',
'claimed_id',
'assoc_handle',
- 'op_endpoint')),
+ 'op_endpoint'
+ ]),
Auth_OpenID_OPENID1_NS => array_merge($basic_sig_fields,
- array('nonce'))
- );
+ ['nonce'])
+ ];
foreach ($require_fields[$message->getOpenIDNamespace()] as $field) {
if (!$message->hasKey(Auth_OpenID_OPENID_NS, $field)) {
@@ -1562,7 +1583,7 @@ class Auth_OpenID_GenericConsumer {
$session_type)) {
return null;
} else {
- return array($assoc_type, $session_type);
+ return [$assoc_type, $session_type];
}
}
@@ -1756,9 +1777,10 @@ class Auth_OpenID_GenericConsumer {
return null;
}
- $args = array(
+ $args = [
'mode' => 'associate',
- 'assoc_type' => $assoc_type);
+ 'assoc_type' => $assoc_type
+ ];
if (!$endpoint->compatibilityMode()) {
$args['ns'] = Auth_OpenID_OPENID2_NS;
@@ -1773,7 +1795,7 @@ class Auth_OpenID_GenericConsumer {
$args = array_merge($args, $assoc_session->getRequest());
$message = Auth_OpenID_Message::fromOpenIDArgs($args);
- return array($assoc_session, $message);
+ return [$assoc_session, $message];
}
/**
@@ -1825,6 +1847,21 @@ class Auth_OpenID_GenericConsumer {
*/
class Auth_OpenID_AuthRequest {
+ /** @var Auth_OpenID_Association */
+ public $assoc;
+
+ /** @var Auth_OpenID_ServiceEndpoint */
+ public $endpoint;
+
+ /** @var array */
+ public $return_to_args;
+
+ /** @var Auth_OpenID_Message */
+ public $message;
+
+ /** @var bool */
+ public $_anonymous;
+
/**
* Initialize an authentication request with the specified token,
* association, and endpoint.
@@ -1840,7 +1877,7 @@ class Auth_OpenID_AuthRequest {
{
$this->assoc = $assoc;
$this->endpoint = $endpoint;
- $this->return_to_args = array();
+ $this->return_to_args = [];
$this->message = new Auth_OpenID_Message($endpoint->preferredNamespace());
$this->_anonymous = false;
}
@@ -1964,10 +2001,11 @@ class Auth_OpenID_AuthRequest {
}
$message->updateArgs(Auth_OpenID_OPENID_NS,
- array(
+ [
$realm_key => $realm,
'mode' => $mode,
- 'return_to' => $return_to));
+ 'return_to' => $return_to
+ ]);
if (!$this->_anonymous) {
if ($this->endpoint->isOPIdentifier()) {
@@ -2139,7 +2177,7 @@ class Auth_OpenID_SuccessResponse extends Auth_OpenID_ConsumerResponse {
public $status = Auth_OpenID_SUCCESS;
/** @var array */
- public $signed_args = array();
+ public $signed_args = [];
/** @var Auth_OpenID_Message */
public $message;
@@ -2285,10 +2323,10 @@ class Auth_OpenID_TypeURIMismatch extends Auth_OpenID_FailureResponse {
class Auth_OpenID_ServerErrorContainer {
/** @var Auth_OpenID_Message */
- private $message;
+ public $message;
/** @var string */
- private $error_code;
+ public $error_code;
/** @var string */
private $error_text;
diff --git a/plugins/openid/lib/Auth/OpenID/DatabaseConnection.php b/plugins/openid/lib/Auth/OpenID/DatabaseConnection.php
index b74f0afe..903bba31 100644
--- a/plugins/openid/lib/Auth/OpenID/DatabaseConnection.php
+++ b/plugins/openid/lib/Auth/OpenID/DatabaseConnection.php
@@ -48,7 +48,7 @@ class Auth_OpenID_DatabaseConnection {
* underlying database engine. This method is usually used when
* the result of a query is not important, like a DDL query.
*/
- function query($sql, $params = array())
+ function query($sql, $params = [])
{
return null;
}
@@ -89,7 +89,7 @@ class Auth_OpenID_DatabaseConnection {
* first row of the result set. False if no such result was
* found.
*/
- function getOne($sql, $params = array())
+ function getOne($sql, $params = [])
{
return false;
}
@@ -108,7 +108,7 @@ class Auth_OpenID_DatabaseConnection {
* @return array|bool $result The first row of the result set, if any,
* keyed on column name. False if no such result was found.
*/
- function getRow($sql, $params = array())
+ function getRow($sql, $params = [])
{
return false;
}
@@ -126,9 +126,9 @@ class Auth_OpenID_DatabaseConnection {
* @return array $result An array of arrays representing the
* result of the query; each array is keyed on column name.
*/
- function getAll($sql, $params = array())
+ function getAll($sql, $params = [])
{
- return array();
+ return [];
}
}
diff --git a/plugins/openid/lib/Auth/OpenID/Discover.php b/plugins/openid/lib/Auth/OpenID/Discover.php
index 95c32f45..177d4880 100644
--- a/plugins/openid/lib/Auth/OpenID/Discover.php
+++ b/plugins/openid/lib/Auth/OpenID/Discover.php
@@ -24,16 +24,18 @@ define('Auth_OpenID_RP_RETURN_TO_URL_TYPE',
function Auth_OpenID_getOpenIDTypeURIs()
{
- return array(Auth_OpenID_TYPE_2_0_IDP,
- Auth_OpenID_TYPE_2_0,
- Auth_OpenID_TYPE_1_2,
- Auth_OpenID_TYPE_1_1,
- Auth_OpenID_TYPE_1_0);
+ return [
+ Auth_OpenID_TYPE_2_0_IDP,
+ Auth_OpenID_TYPE_2_0,
+ Auth_OpenID_TYPE_1_2,
+ Auth_OpenID_TYPE_1_1,
+ Auth_OpenID_TYPE_1_0,
+ ];
}
function Auth_OpenID_getOpenIDConsumerTypeURIs()
{
- return array(Auth_OpenID_RP_RETURN_TO_URL_TYPE);
+ return [Auth_OpenID_RP_RETURN_TO_URL_TYPE];
}
@@ -67,7 +69,7 @@ class Auth_OpenID_ServiceEndpoint {
{
$this->claimed_id = null;
$this->server_url = null;
- $this->type_uris = array();
+ $this->type_uris = [];
$this->local_id = null;
$this->canonicalID = null;
$this->used_yadis = false; // whether this came from an XRDS
@@ -123,7 +125,7 @@ class Auth_OpenID_ServiceEndpoint {
*/
function matchTypes($type_uris)
{
- $result = array();
+ $result = [];
foreach ($type_uris as $test_uri) {
if ($this->supportsType($test_uri)) {
$result[] = $test_uri;
@@ -157,7 +159,7 @@ class Auth_OpenID_ServiceEndpoint {
// a given OP Endpoint URL
$obj = new Auth_OpenID_ServiceEndpoint();
$obj->server_url = $op_endpoint_url;
- $obj->type_uris = array(Auth_OpenID_TYPE_2_0_IDP);
+ $obj->type_uris = [Auth_OpenID_TYPE_2_0_IDP];
return $obj;
}
@@ -210,7 +212,7 @@ class Auth_OpenID_ServiceEndpoint {
if ($xrds) {
$yadis_services =
- $xrds->services(array('filter_MatchesAnyOpenIDConsumerType'));
+ $xrds->services(['filter_MatchesAnyOpenIDConsumerType']);
return Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services);
}
@@ -229,7 +231,7 @@ class Auth_OpenID_ServiceEndpoint {
if ($xrds) {
$yadis_services =
- $xrds->services(array('filter_MatchesAnyOpenIDType'));
+ $xrds->services(['filter_MatchesAnyOpenIDType']);
return Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services);
}
@@ -258,14 +260,20 @@ class Auth_OpenID_ServiceEndpoint {
static function fromHTML($uri, $html)
{
- $discovery_types = array(
- array(Auth_OpenID_TYPE_2_0,
- 'openid2.provider', 'openid2.local_id'),
- array(Auth_OpenID_TYPE_1_1,
- 'openid.server', 'openid.delegate')
- );
-
- $services = array();
+ $discovery_types = [
+ [
+ Auth_OpenID_TYPE_2_0,
+ 'openid2.provider',
+ 'openid2.local_id',
+ ],
+ [
+ Auth_OpenID_TYPE_1_1,
+ 'openid.server',
+ 'openid.delegate',
+ ],
+ ];
+
+ $services = [];
foreach ($discovery_types as $triple) {
list($type_uri, $server_rel, $delegate_rel) = $triple;
@@ -283,7 +291,7 @@ class Auth_OpenID_ServiceEndpoint {
$service->claimed_id = $uri;
$service->local_id = $delegate_url;
$service->server_url = $server_url;
- $service->type_uris = array($type_uri);
+ $service->type_uris = [$type_uri];
$services[] = $service;
}
@@ -326,7 +334,7 @@ function Auth_OpenID_findOPLocalIdentifier($service, $type_uris)
$parser = $service->parser;
- $permitted_tags = array();
+ $permitted_tags = [];
if (in_array(Auth_OpenID_TYPE_1_1, $type_uris) ||
in_array(Auth_OpenID_TYPE_1_0, $type_uris)) {
@@ -416,11 +424,13 @@ function Auth_OpenID_arrangeByType($service_list, $preferred_types)
// Build a list with the service elements in tuples whose
// comparison will prefer the one with the best matching service
- $prio_services = array();
+ $prio_services = [];
foreach ($service_list as $index => $service) {
- $prio_services[] = array(Auth_OpenID_bestMatchingService($service,
- $preferred_types),
- $index, $service);
+ $prio_services[] = [
+ Auth_OpenID_bestMatchingService($service, $preferred_types),
+ $index,
+ $service,
+ ];
}
sort($prio_services);
@@ -443,11 +453,9 @@ function Auth_OpenID_arrangeByType($service_list, $preferred_types)
// Returns a list of OpenIDServiceEndpoint objects."""
function Auth_OpenID_getOPOrUserServices($openid_services)
{
- $op_services = Auth_OpenID_arrangeByType($openid_services,
- array(Auth_OpenID_TYPE_2_0_IDP));
+ $op_services = Auth_OpenID_arrangeByType($openid_services, [Auth_OpenID_TYPE_2_0_IDP]);
- $openid_services = Auth_OpenID_arrangeByType($openid_services,
- Auth_OpenID_getOpenIDTypeURIs());
+ $openid_services = Auth_OpenID_arrangeByType($openid_services, Auth_OpenID_getOpenIDTypeURIs());
if ($op_services) {
return $op_services;
@@ -463,7 +471,7 @@ function Auth_OpenID_getOPOrUserServices($openid_services)
*/
function Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services)
{
- $s = array();
+ $s = [];
if (!$yadis_services) {
return $s;
@@ -504,16 +512,15 @@ function Auth_OpenID_discoverWithYadis($uri, $fetcher,
// OpenID 1.0 discovery on the same URL will help, so don't bother
// to catch it.
if ($discover_function === null) {
- $discover_function = array('Auth_Yadis_Yadis', 'discover');
+ $discover_function = ['Auth_Yadis_Yadis', 'discover'];
}
- $response = call_user_func_array($discover_function,
- array($uri, $fetcher));
+ $response = call_user_func_array($discover_function, [$uri, $fetcher]);
$yadis_url = $response->normalized_uri;
if ($response->isFailure() && !$response->isXRDS()) {
- return array($uri, array());
+ return [$uri, []];
}
$openid_services = Auth_OpenID_ServiceEndpoint::fromXRDS(
@@ -534,9 +541,9 @@ function Auth_OpenID_discoverWithYadis($uri, $fetcher,
}
$openid_services = call_user_func_array($endpoint_filter,
- array($openid_services));
+ [$openid_services]);
- return array($yadis_url, $openid_services);
+ return [$yadis_url, $openid_services];
}
function Auth_OpenID_discoverURI($uri, $fetcher)
@@ -555,7 +562,7 @@ function Auth_OpenID_discoverWithoutYadis($uri, $fetcher)
$http_resp = @$fetcher->get($uri);
if ($http_resp->status != 200 and $http_resp->status != 206) {
- return array($uri, array());
+ return [$uri, []];
}
$identity_url = $http_resp->final_url;
@@ -566,7 +573,7 @@ function Auth_OpenID_discoverWithoutYadis($uri, $fetcher)
$identity_url,
$http_resp->body);
- return array($identity_url, $openid_services);
+ return [$identity_url, $openid_services];
}
function Auth_OpenID_discoverXRI($iname, $fetcher)
@@ -575,7 +582,7 @@ function Auth_OpenID_discoverXRI($iname, $fetcher)
list($canonicalID, $yadis_services) =
$resolver->query($iname,
Auth_OpenID_getOpenIDTypeURIs(),
- array('filter_MatchesAnyOpenIDType'));
+ ['filter_MatchesAnyOpenIDType']);
$openid_services = Auth_OpenID_makeOpenIDEndpoints($iname,
$yadis_services);
@@ -589,7 +596,7 @@ function Auth_OpenID_discoverXRI($iname, $fetcher)
}
// FIXME: returned xri should probably be in some normal form
- return array($iname, $openid_services);
+ return [$iname, $openid_services];
}
/**
@@ -602,7 +609,7 @@ function Auth_OpenID_discover($uri, $fetcher)
// If the fetcher (i.e., PHP) doesn't support SSL, we can't do
// discovery on an HTTPS URL.
if ($fetcher->isHTTPS($uri) && !$fetcher->supportsSSL()) {
- return array($uri, array());
+ return [$uri, []];
}
if (Auth_Yadis_identifierScheme($uri) == 'XRI') {
@@ -614,7 +621,7 @@ function Auth_OpenID_discover($uri, $fetcher)
// If the fetcher doesn't support SSL, we can't interact with
// HTTPS server URLs; remove those endpoints from the list.
if (!$fetcher->supportsSSL()) {
- $http_endpoints = array();
+ $http_endpoints = [];
list($new_uri, $endpoints) = $result;
foreach ($endpoints as $e) {
@@ -623,7 +630,7 @@ function Auth_OpenID_discover($uri, $fetcher)
}
}
- $result = array($new_uri, $http_endpoints);
+ $result = [$new_uri, $http_endpoints];
}
return $result;
diff --git a/plugins/openid/lib/Auth/OpenID/FileStore.php b/plugins/openid/lib/Auth/OpenID/FileStore.php
index afeaf2b2..f8378b87 100644
--- a/plugins/openid/lib/Auth/OpenID/FileStore.php
+++ b/plugins/openid/lib/Auth/OpenID/FileStore.php
@@ -117,11 +117,11 @@ class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore {
$name = Auth_OpenID_FileStore::_mkstemp($dir = $this->temp_dir);
$file_obj = @fopen($name, 'wb');
if ($file_obj !== false) {
- return array($file_obj, $name);
+ return [$file_obj, $name];
} else {
Auth_OpenID_FileStore::_removeIfPresent($name);
}
- return array();
+ return [];
}
function cleanupNonces()
@@ -265,7 +265,7 @@ class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore {
} else {
$association_files =
Auth_OpenID_FileStore::_listdir($this->association_dir);
- $matching_files = array();
+ $matching_files = [];
// strip off the path to do the comparison
$name = basename($filename);
@@ -276,18 +276,20 @@ class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore {
}
}
- $matching_associations = array();
+ $matching_associations = [];
// read the matching files and sort by time issued
foreach ($matching_files as $full_name) {
$association = $this->_getAssociation($full_name);
if ($association !== null) {
- $matching_associations[] = array($association->issued,
- $association);
+ $matching_associations[] = [
+ $association->issued,
+ $association
+ ];
}
}
- $issued = array();
- $assocs = array();
+ $issued = [];
+ $assocs = [];
foreach ($matching_associations as $key => $assoc) {
$issued[$key] = $assoc[0];
$assocs[$key] = $assoc[1];
@@ -436,7 +438,7 @@ class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore {
*/
function _allAssocs()
{
- $all_associations = array();
+ $all_associations = [];
$association_filenames =
Auth_OpenID_FileStore::_listdir($this->association_dir);
@@ -459,8 +461,10 @@ class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore {
$association_filename);
} else {
if ($association->getExpiresIn() == 0) {
- $all_associations[] = array($association_filename,
- $association);
+ $all_associations[] = [
+ $association_filename,
+ $association,
+ ];
}
}
}
@@ -509,7 +513,7 @@ class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore {
if ($handle = opendir($dir)) {
while (false !== ($item = readdir($handle))) {
- if (!in_array($item, array('.', '..'))) {
+ if (!in_array($item, ['.', '..'])) {
if (is_dir($dir . $item)) {
if (!Auth_OpenID_FileStore::_rmtree($dir . $item)) {
@@ -580,9 +584,9 @@ class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore {
function _listdir($dir)
{
$handle = opendir($dir);
- $files = array();
+ $files = [];
while (false !== ($filename = readdir($handle))) {
- if (!in_array($filename, array('.', '..'))) {
+ if (!in_array($filename, ['.', '..'])) {
$files[] = $dir . DIRECTORY_SEPARATOR . $filename;
}
}
diff --git a/plugins/openid/lib/Auth/OpenID/Interface.php b/plugins/openid/lib/Auth/OpenID/Interface.php
index a8a335d5..5335d9f2 100644
--- a/plugins/openid/lib/Auth/OpenID/Interface.php
+++ b/plugins/openid/lib/Auth/OpenID/Interface.php
@@ -89,7 +89,7 @@ class Auth_OpenID_OpenIDStore {
*/
function cleanup()
{
- return array($this->cleanupNonces(), $this->cleanupAssociations());
+ return [$this->cleanupNonces(), $this->cleanupAssociations()];
}
/**
diff --git a/plugins/openid/lib/Auth/OpenID/KVForm.php b/plugins/openid/lib/Auth/OpenID/KVForm.php
index f7806533..82ead9cf 100644
--- a/plugins/openid/lib/Auth/OpenID/KVForm.php
+++ b/plugins/openid/lib/Auth/OpenID/KVForm.php
@@ -41,7 +41,7 @@ class Auth_OpenID_KVForm {
}
}
- $values = array();
+ $values = [];
for ($lineno = 0; $lineno < count($lines); $lineno++) {
$line = $lines[$lineno];
@@ -94,7 +94,7 @@ class Auth_OpenID_KVForm {
$serialized = '';
foreach ($values as $key => $value) {
if (is_array($value)) {
- list($key, $value) = array($value[0], $value[1]);
+ list($key, $value) = [$value[0], $value[1]];
}
if (strpos($key, ':') !== false) {
diff --git a/plugins/openid/lib/Auth/OpenID/MDB2Store.php b/plugins/openid/lib/Auth/OpenID/MDB2Store.php
index 9349702e..e6cb4c47 100644
--- a/plugins/openid/lib/Auth/OpenID/MDB2Store.php
+++ b/plugins/openid/lib/Auth/OpenID/MDB2Store.php
@@ -84,7 +84,7 @@ class Auth_OpenID_MDB2Store extends Auth_OpenID_OpenIDStore {
// Be sure to set the fetch mode so the results are keyed on
// column name instead of column index.
$this->connection->setFetchMode(MDB2_FETCHMODE_ASSOC);
-
+
if (@PEAR::isError($this->connection->loadModule('Extended'))) {
trigger_error("Unable to load MDB2_Extended module", E_USER_ERROR);
return;
@@ -144,38 +144,38 @@ class Auth_OpenID_MDB2Store extends Auth_OpenID_OpenIDStore {
$this->connection->loadModule('Manager'))) {
return false;
}
- $fields = array(
- "server_url" => array(
+ $fields = [
+ "server_url" => [
"type" => "text",
"length" => 2047,
"notnull" => true
- ),
- "timestamp" => array(
+ ],
+ "timestamp" => [
"type" => "integer",
"notnull" => true
- ),
- "salt" => array(
+ ],
+ "salt" => [
"type" => "text",
"length" => 40,
"fixed" => true,
"notnull" => true
- )
- );
- $constraint = array(
+ ]
+ ];
+ $constraint = [
"unique" => 1,
- "fields" => array(
+ "fields" => [
"server_url" => true,
"timestamp" => true,
"salt" => true
- )
- );
-
+ ]
+ ];
+
$r = $this->connection->createTable($this->nonces_table_name,
$fields);
if (@PEAR::isError($r)) {
return false;
}
-
+
$r = $this->connection->createConstraint(
$this->nonces_table_name,
$this->nonces_table_name . "_constraint",
@@ -217,43 +217,43 @@ class Auth_OpenID_MDB2Store extends Auth_OpenID_OpenIDStore {
$this->connection->loadModule('Manager'))) {
return false;
}
- $fields = array(
- "server_url" => array(
+ $fields = [
+ "server_url" => [
"type" => "text",
"length" => 2047,
"notnull" => true
- ),
- "handle" => array(
+ ],
+ "handle" => [
"type" => "text",
"length" => 255,
"notnull" => true
- ),
- "secret" => array(
+ ],
+ "secret" => [
"type" => "blob",
"length" => "255",
"notnull" => true
- ),
- "issued" => array(
+ ],
+ "issued" => [
"type" => "integer",
"notnull" => true
- ),
- "lifetime" => array(
+ ],
+ "lifetime" => [
"type" => "integer",
"notnull" => true
- ),
- "assoc_type" => array(
+ ],
+ "assoc_type" => [
"type" => "text",
"length" => 64,
"notnull" => true
- )
- );
- $options = array(
- "primary" => array(
+ ]
+ ];
+ $options = [
+ "primary" => [
"server_url" => true,
"handle" => true
- )
- );
-
+ ]
+ ];
+
$r = $this->connection->createTable(
$this->associations_table_name,
$fields,
@@ -269,30 +269,30 @@ class Auth_OpenID_MDB2Store extends Auth_OpenID_OpenIDStore {
function storeAssociation($server_url, $association)
{
- $fields = array(
- "server_url" => array(
+ $fields = [
+ "server_url" => [
"value" => $server_url,
"key" => true
- ),
- "handle" => array(
+ ],
+ "handle" => [
"value" => $association->handle,
"key" => true
- ),
- "secret" => array(
+ ],
+ "secret" => [
"value" => $association->secret,
"type" => "blob"
- ),
- "issued" => array(
+ ],
+ "issued" => [
"value" => $association->issued
- ),
- "lifetime" => array(
+ ],
+ "lifetime" => [
"value" => $association->lifetime
- ),
- "assoc_type" => array(
+ ],
+ "assoc_type" => [
"value" => $association->assoc_type
- )
- );
-
+ ]
+ ];
+
return !@PEAR::isError($this->connection->replace(
$this->associations_table_name,
$fields));
@@ -319,25 +319,25 @@ class Auth_OpenID_MDB2Store extends Auth_OpenID_OpenIDStore {
{
$sql = "";
$params = null;
- $types = array(
- "text",
- "blob",
- "integer",
- "integer",
- "text"
- );
+ $types = [
+ "text",
+ "blob",
+ "integer",
+ "integer",
+ "text",
+ ];
if ($handle !== null) {
$sql = sprintf("SELECT handle, secret, issued, lifetime, assoc_type " .
"FROM %s WHERE server_url = ? AND handle = ?",
$this->associations_table_name);
- $params = array($server_url, $handle);
+ $params = [$server_url, $handle];
} else {
$sql = sprintf("SELECT handle, secret, issued, lifetime, assoc_type " .
"FROM %s WHERE server_url = ? ORDER BY issued DESC",
$this->associations_table_name);
- $params = array($server_url);
+ $params = [$server_url];
}
-
+
$assoc = $this->connection->getRow($sql, $types, $params);
if (!$assoc || @PEAR::isError($assoc)) {
@@ -359,8 +359,8 @@ class Auth_OpenID_MDB2Store extends Auth_OpenID_OpenIDStore {
$r = $this->connection->execParam(
sprintf("DELETE FROM %s WHERE server_url = ? AND handle = ?",
$this->associations_table_name),
- array($server_url, $handle));
-
+ [$server_url, $handle]);
+
if (@PEAR::isError($r) || $r == 0) {
return false;
}
@@ -374,21 +374,21 @@ class Auth_OpenID_MDB2Store extends Auth_OpenID_OpenIDStore {
if (abs($timestamp - time()) > $Auth_OpenID_SKEW ) {
return false;
}
-
- $fields = array(
- "timestamp" => $timestamp,
- "salt" => $salt
- );
-
+
+ $fields = [
+ "timestamp" => $timestamp,
+ "salt" => $salt,
+ ];
+
if (!empty($server_url)) {
$fields["server_url"] = $server_url;
}
-
+
$r = $this->connection->autoExecute(
$this->nonces_table_name,
$fields,
MDB2_AUTOQUERY_INSERT);
-
+
if (@PEAR::isError($r)) {
return false;
}
diff --git a/plugins/openid/lib/Auth/OpenID/MemcachedStore.php b/plugins/openid/lib/Auth/OpenID/MemcachedStore.php
index 5badd0ab..900549b0 100644
--- a/plugins/openid/lib/Auth/OpenID/MemcachedStore.php
+++ b/plugins/openid/lib/Auth/OpenID/MemcachedStore.php
@@ -74,7 +74,7 @@ class Auth_OpenID_MemcachedStore extends Auth_OpenID_OpenIDStore {
// if no such list, initialize it with empty array
if (!$serverAssociations) {
- $serverAssociations = array();
+ $serverAssociations = [];
}
// and store given association key in it
$serverAssociations[$association->issued] = $associationKey;
diff --git a/plugins/openid/lib/Auth/OpenID/Message.php b/plugins/openid/lib/Auth/OpenID/Message.php
index f2cbb3b6..7614d90d 100644
--- a/plugins/openid/lib/Auth/OpenID/Message.php
+++ b/plugins/openid/lib/Auth/OpenID/Message.php
@@ -56,17 +56,18 @@ define('Auth_OpenID_OPENID1_URL_LIMIT', 2047);
// All OpenID protocol fields. Used to check namespace aliases.
global $Auth_OpenID_OPENID_PROTOCOL_FIELDS;
-$Auth_OpenID_OPENID_PROTOCOL_FIELDS = array(
+$Auth_OpenID_OPENID_PROTOCOL_FIELDS = [
'ns', 'mode', 'error', 'return_to', 'contact', 'reference',
'signed', 'assoc_type', 'session_type', 'dh_modulus', 'dh_gen',
'dh_consumer_public', 'claimed_id', 'identity', 'realm',
'invalidate_handle', 'op_endpoint', 'response_nonce', 'sig',
- 'assoc_handle', 'trust_root', 'openid');
+ 'assoc_handle', 'trust_root', 'openid'
+];
// Global namespace / alias registration map. See
// Auth_OpenID_registerNamespaceAlias.
global $Auth_OpenID_registered_aliases;
-$Auth_OpenID_registered_aliases = array();
+$Auth_OpenID_registered_aliases = [];
/**
* Registers a (namespace URI, alias) mapping in a global namespace
@@ -131,6 +132,10 @@ function Auth_OpenID_removeNamespaceAlias($namespace_uri, $alias)
* @package OpenID
*/
class Auth_OpenID_Mapping {
+
+ private $keys = [];
+ private $values = [];
+
/**
* Initialize a mapping. If $classic_array is specified, its keys
* and values are used to populate the mapping.
@@ -139,9 +144,6 @@ class Auth_OpenID_Mapping {
*/
function __construct($classic_array = null)
{
- $this->keys = array();
- $this->values = array();
-
if (is_array($classic_array)) {
foreach ($classic_array as $key => $value) {
$this->set($key, $value);
@@ -183,11 +185,13 @@ class Auth_OpenID_Mapping {
*/
function items()
{
- $temp = array();
+ $temp = [];
for ($i = 0; $i < count($this->keys); $i++) {
- $temp[] = array($this->keys[$i],
- $this->values[$i]);
+ $temp[] = [
+ $this->keys[$i],
+ $this->values[$i]
+ ];
}
return $temp;
}
@@ -204,7 +208,7 @@ class Auth_OpenID_Mapping {
* Sets a key-value pair in the mapping. If the key already
* exists, its value is replaced with the new value.
*
- * @param string $key
+ * @param string|array $key
* @param mixed $value
*/
function set($key, $value)
@@ -224,7 +228,7 @@ class Auth_OpenID_Mapping {
* specified key. If the key does not exist in the mapping,
* $default is returned instead.
*
- * @param string $key
+ * @param string|array $key
* @param mixed $default
* @return mixed|null
*/
@@ -249,8 +253,8 @@ class Auth_OpenID_Mapping {
$old_keys = $this->keys;
$old_values = $this->values;
- $this->keys = array();
- $this->values = array();
+ $this->keys = [];
+ $this->values = [];
foreach ($old_keys as $k) {
$this->keys[] = $k;
@@ -265,7 +269,7 @@ class Auth_OpenID_Mapping {
* Deletes a key-value pair from the mapping with the specified
* key.
*
- * @param string $key
+ * @param string|array $key
* @return bool
*/
function del($key)
@@ -285,12 +289,12 @@ class Auth_OpenID_Mapping {
* Returns true if the specified value has a key in the mapping;
* false if not.
*
- * @param string $value
+ * @param string|array $key
* @return bool
*/
- function contains($value)
+ function contains($key)
{
- return (array_search($value, $this->keys) !== false);
+ return array_search($key, $this->keys) !== false;
}
}
@@ -300,11 +304,27 @@ class Auth_OpenID_Mapping {
* @package OpenID
*/
class Auth_OpenID_NamespaceMap {
+
+ /**
+ * @var Auth_OpenID_Mapping
+ */
+ private $alias_to_namespace;
+
+ /**
+ * @var Auth_OpenID_Mapping
+ */
+ private $namespace_to_alias;
+
+ /**
+ * @var array
+ */
+ private $implicit_namespaces = [];
+
function __construct()
{
$this->alias_to_namespace = new Auth_OpenID_Mapping();
$this->namespace_to_alias = new Auth_OpenID_Mapping();
- $this->implicit_namespaces = array();
+ $this->implicit_namespaces = [];
}
function getAlias($namespace_uri)
@@ -440,19 +460,32 @@ class Auth_OpenID_NamespaceMap {
*/
class Auth_OpenID_Message {
+ private $allowed_openid_namespaces = [
+ Auth_OpenID_OPENID1_NS,
+ Auth_OpenID_THE_OTHER_OPENID1_NS,
+ Auth_OpenID_OPENID2_NS
+ ];
+
+ /**
+ * @var Auth_OpenID_Mapping
+ */
+ private $args;
+
+ /**
+ * @var Auth_OpenID_NamespaceMap
+ */
+ public $namespaces;
+
+ /**
+ * @var null|string
+ */
+ private $_openid_ns_uri = null;
+
function __construct($openid_namespace = null)
{
- // Create an empty Message
- $this->allowed_openid_namespaces = array(
- Auth_OpenID_OPENID1_NS,
- Auth_OpenID_THE_OTHER_OPENID1_NS,
- Auth_OpenID_OPENID2_NS);
-
$this->args = new Auth_OpenID_Mapping();
$this->namespaces = new Auth_OpenID_NamespaceMap();
- if ($openid_namespace === null) {
- $this->_openid_ns_uri = null;
- } else {
+ if ($openid_namespace !== null) {
$implicit = Auth_OpenID_isOpenID1($openid_namespace);
$this->setOpenIDNamespace($openid_namespace, $implicit);
}
@@ -478,7 +511,7 @@ class Auth_OpenID_Message {
$obj = new Auth_OpenID_Message();
// Partition into "openid." args and bare args
- $openid_args = array();
+ $openid_args = [];
foreach ($args as $key => $value) {
if (is_array($value)) {
@@ -495,7 +528,7 @@ class Auth_OpenID_Message {
}
if ($prefix != 'openid') {
- $obj->args->set(array(Auth_OpenID_BARE_NS, $key), $value);
+ $obj->args->set([Auth_OpenID_BARE_NS, $key], $value);
} else {
$openid_args[$rest] = $value;
}
@@ -534,7 +567,7 @@ class Auth_OpenID_Message {
$openid_args = new Auth_OpenID_Mapping($openid_args);
}
- $ns_args = array();
+ $ns_args = [];
// Resolve namespaces
foreach ($openid_args->items() as $pair) {
@@ -560,7 +593,7 @@ class Auth_OpenID_Message {
return false;
}
} else {
- $ns_args[] = array($ns_alias, $ns_key, $value);
+ $ns_args[] = [$ns_alias, $ns_key, $value];
}
}
@@ -645,7 +678,7 @@ class Auth_OpenID_Message {
// Return all arguments with openid. in front of namespaced
// arguments.
- $args = array();
+ $args = [];
// Add namespace definitions to the output
foreach ($this->namespaces->iteritems() as $pair) {
@@ -676,7 +709,7 @@ class Auth_OpenID_Message {
// Return all namespaced arguments, failing if any
// non-namespaced arguments exist.
$post_args = $this->toPostArgs();
- $kvargs = array();
+ $kvargs = [];
foreach ($post_args as $k => $v) {
if (strpos($k, 'openid.') !== 0) {
// raise ValueError(
@@ -703,7 +736,7 @@ class Auth_OpenID_Message {
"enctype=\"application/x-www-form-urlencoded\"";
if (!$form_tag_attrs) {
- $form_tag_attrs = array();
+ $form_tag_attrs = [];
}
$form_tag_attrs['action'] = $action_url;
@@ -752,10 +785,10 @@ class Auth_OpenID_Message {
function toURLEncoded()
{
// Generate an x-www-urlencoded string
- $args = array();
+ $args = [];
foreach ($this->toPostArgs() as $k => $v) {
- $args[] = array($k, $v);
+ $args[] = [$k, $v];
}
sort($args);
@@ -812,7 +845,7 @@ class Auth_OpenID_Message {
// XXX log me
return false;
} else {
- return $this->args->contains(array($namespace, $ns_key));
+ return $this->args->contains([$namespace, $ns_key]);
}
}
@@ -857,13 +890,13 @@ class Auth_OpenID_Message {
if (Auth_OpenID::isFailure($namespace)) {
return $namespace;
} else {
- if ((!$this->args->contains(array($namespace, $key))) &&
- ($default == Auth_OpenID_NO_DEFAULT)) {
+ if ((!$this->args->contains([$namespace, $key])) &&
+ ($default == Auth_OpenID_NO_DEFAULT)) {
$err_msg = sprintf("Namespace %s missing required field %s",
$namespace, $key);
return new Auth_OpenID_FailureResponse(null, $err_msg);
} else {
- return $this->args->get(array($namespace, $key), $default);
+ return $this->args->get([$namespace, $key], $default);
}
}
}
@@ -876,7 +909,7 @@ class Auth_OpenID_Message {
if (Auth_OpenID::isFailure($namespace)) {
return $namespace;
} else {
- $stuff = array();
+ $stuff = [];
foreach ($this->args->items() as $pair) {
list($key, $value) = $pair;
list($pair_ns, $ns_key) = $key;
@@ -913,7 +946,7 @@ class Auth_OpenID_Message {
if (Auth_OpenID::isFailure($namespace)) {
return $namespace;
} else {
- $this->args->set(array($namespace, $key), $value);
+ $this->args->set([$namespace, $key], $value);
if ($namespace !== Auth_OpenID_BARE_NS) {
$this->namespaces->add($namespace);
}
@@ -928,7 +961,7 @@ class Auth_OpenID_Message {
if (Auth_OpenID::isFailure($namespace)) {
return $namespace;
} else {
- return $this->args->del(array($namespace, $key));
+ return $this->args->del([$namespace, $key]);
}
}
diff --git a/plugins/openid/lib/Auth/OpenID/Nonce.php b/plugins/openid/lib/Auth/OpenID/Nonce.php
index 41bb3c32..523eab31 100644
--- a/plugins/openid/lib/Auth/OpenID/Nonce.php
+++ b/plugins/openid/lib/Auth/OpenID/Nonce.php
@@ -53,7 +53,7 @@ function Auth_OpenID_splitNonce($nonce_string)
return null;
}
- return array($timestamp, $uniquifier);
+ return [$timestamp, $uniquifier];
}
function Auth_OpenID_checkTimestamp($nonce_string,
diff --git a/plugins/openid/lib/Auth/OpenID/PAPE.php b/plugins/openid/lib/Auth/OpenID/PAPE.php
index f3db7774..8ab7e5f7 100644
--- a/plugins/openid/lib/Auth/OpenID/PAPE.php
+++ b/plugins/openid/lib/Auth/OpenID/PAPE.php
@@ -38,13 +38,13 @@ class Auth_OpenID_PAPE_Request extends Auth_OpenID_Extension {
public $ns_uri = Auth_OpenID_PAPE_NS_URI;
private $max_auth_age = 0;
- private $preferred_auth_policies = array();
+ private $preferred_auth_policies = [];
function __construct($preferred_auth_policies=null,
$max_auth_age=null)
{
if ($preferred_auth_policies === null) {
- $preferred_auth_policies = array();
+ $preferred_auth_policies = [];
}
$this->preferred_auth_policies = $preferred_auth_policies;
@@ -78,10 +78,9 @@ class Auth_OpenID_PAPE_Request extends Auth_OpenID_Extension {
*/
function getExtensionArgs($request = null)
{
- $ns_args = array(
- 'preferred_auth_policies' =>
- implode(' ', $this->preferred_auth_policies)
- );
+ $ns_args = [
+ 'preferred_auth_policies' => implode(' ', $this->preferred_auth_policies),
+ ];
if ($this->max_auth_age !== null) {
$ns_args['max_auth_age'] = strval($this->max_auth_age);
@@ -102,7 +101,7 @@ class Auth_OpenID_PAPE_Request extends Auth_OpenID_Extension {
$obj = new Auth_OpenID_PAPE_Request();
$args = $request->message->getArgs(Auth_OpenID_PAPE_NS_URI);
- if ($args === null || $args === array()) {
+ if ($args === null || $args === []) {
return null;
}
@@ -120,7 +119,7 @@ class Auth_OpenID_PAPE_Request extends Auth_OpenID_Extension {
{
// preferred_auth_policies is a space-separated list of policy
// URIs
- $this->preferred_auth_policies = array();
+ $this->preferred_auth_policies = [];
$policies_str = Auth_OpenID::arrayGet($args, 'preferred_auth_policies');
if ($policies_str) {
@@ -156,7 +155,7 @@ class Auth_OpenID_PAPE_Request extends Auth_OpenID_Extension {
*/
function preferredTypes($supported_types)
{
- $result = array();
+ $result = [];
foreach ($supported_types as $st) {
if (in_array($st, $this->preferred_auth_policies)) {
@@ -178,7 +177,7 @@ class Auth_OpenID_PAPE_Response extends Auth_OpenID_Extension {
private $auth_time = 0;
private $nist_auth_level = 0;
- private $auth_policies = array();
+ private $auth_policies = [];
function __construct($auth_policies=null, $auth_time=null,
$nist_auth_level=null)
@@ -186,7 +185,7 @@ class Auth_OpenID_PAPE_Response extends Auth_OpenID_Extension {
if ($auth_policies) {
$this->auth_policies = $auth_policies;
} else {
- $this->auth_policies = array();
+ $this->auth_policies = [];
}
$this->auth_time = $auth_time;
@@ -227,7 +226,7 @@ class Auth_OpenID_PAPE_Response extends Auth_OpenID_Extension {
// PAPE requires that the args be signed.
$args = $success_response->getSignedNS(Auth_OpenID_PAPE_NS_URI);
- if ($args === null || $args === array()) {
+ if ($args === null || $args === []) {
return null;
}
@@ -299,7 +298,7 @@ class Auth_OpenID_PAPE_Response extends Auth_OpenID_Extension {
*/
function getExtensionArgs($request = null)
{
- $ns_args = array();
+ $ns_args = [];
if (count($this->auth_policies) > 0) {
$ns_args['auth_policies'] = implode(' ', $this->auth_policies);
} else {
diff --git a/plugins/openid/lib/Auth/OpenID/Parse.php b/plugins/openid/lib/Auth/OpenID/Parse.php
index 2e830e9c..fe4b8d24 100644
--- a/plugins/openid/lib/Auth/OpenID/Parse.php
+++ b/plugins/openid/lib/Auth/OpenID/Parse.php
@@ -113,12 +113,12 @@ class Auth_OpenID_Parse {
$this->_link_find = sprintf("/<link\b(?!:)([^>]*)(?!<)>/%s",
$this->_re_flags);
- $this->_entity_replacements = array(
- 'amp' => '&',
- 'lt' => '<',
- 'gt' => '>',
- 'quot' => '"'
- );
+ $this->_entity_replacements = [
+ 'amp' => '&',
+ 'lt' => '<',
+ 'gt' => '>',
+ 'quot' => '"',
+ ];
$this->_attr_find = sprintf("/%s/%s",
$this->_attr_find,
@@ -146,7 +146,7 @@ class Auth_OpenID_Parse {
$expr = $this->_tag_expr;
if ($close_tags) {
- $options = implode("|", array_merge(array($tag_name), $close_tags));
+ $options = implode("|", array_merge([$tag_name], $close_tags));
$closer = sprintf("(?:%s)", $options);
} else {
$closer = $tag_name;
@@ -170,7 +170,7 @@ class Auth_OpenID_Parse {
function htmlBegin($s)
{
- $matches = array();
+ $matches = [];
$result = preg_match($this->openTag('html'), $s,
$matches, PREG_OFFSET_CAPTURE);
if ($result === false || !$matches) {
@@ -182,7 +182,7 @@ class Auth_OpenID_Parse {
function htmlEnd($s)
{
- $matches = array();
+ $matches = [];
$result = preg_match($this->closeTag('html'), $s,
$matches, PREG_OFFSET_CAPTURE);
if ($result === false || !$matches) {
@@ -194,7 +194,7 @@ class Auth_OpenID_Parse {
function headFind()
{
- return $this->tagMatcher('head', array('body', 'html'));
+ return $this->tagMatcher('head', ['body', 'html']);
}
function replaceEntities($str)
@@ -207,7 +207,7 @@ class Auth_OpenID_Parse {
function removeQuotes($str)
{
- $matches = array();
+ $matches = [];
$double = '/^"(.*)"$/';
$single = "/^\'(.*)\'$/";
@@ -251,7 +251,7 @@ class Auth_OpenID_Parse {
$html_end = $this->htmlEnd($stripped);
if ($html_begin === false) {
- return array();
+ return [];
}
if ($html_end === false) {
@@ -266,25 +266,25 @@ class Auth_OpenID_Parse {
// Try to find the <HEAD> tag.
$head_re = $this->headFind();
- $head_match = array();
+ $head_match = [];
if (!$this->match($head_re, $stripped, $head_match)) {
ini_set( 'pcre.backtrack_limit', $old_btlimit );
- return array();
+ return [];
}
- $link_data = array();
- $link_matches = array();
+ $link_data = [];
+ $link_matches = [];
if (!preg_match_all($this->_link_find, $head_match[0],
$link_matches)) {
ini_set( 'pcre.backtrack_limit', $old_btlimit );
- return array();
+ return [];
}
foreach ($link_matches[0] as $link) {
- $attr_matches = array();
+ $attr_matches = [];
preg_match_all($this->_attr_find, $link, $attr_matches);
- $link_attrs = array();
+ $link_attrs = [];
foreach ($attr_matches[0] as $index => $full_match) {
$name = $attr_matches[1][$index];
$value = $this->replaceEntities(
@@ -328,7 +328,7 @@ class Auth_OpenID_Parse {
// Filter the list of link attributes on whether it has
// target_rel as a relationship.
// XXX: TESTME
- $result = array();
+ $result = [];
foreach ($link_attrs_list as $attr) {
if ($this->linkHasRel($attr, $target_rel)) {
$result[] = $attr;
@@ -368,7 +368,7 @@ function Auth_OpenID_legacy_discover($html_text, $server_rel,
} else {
$delegate_url = $p->findFirstHref($link_attrs,
$delegate_rel);
- return array($delegate_url, $server_url);
+ return [$delegate_url, $server_url];
}
}
diff --git a/plugins/openid/lib/Auth/OpenID/PostgreSQLStore.php b/plugins/openid/lib/Auth/OpenID/PostgreSQLStore.php
index d90e43e0..a3a33684 100644
--- a/plugins/openid/lib/Auth/OpenID/PostgreSQLStore.php
+++ b/plugins/openid/lib/Auth/OpenID/PostgreSQLStore.php
@@ -29,7 +29,7 @@ class Auth_OpenID_PostgreSQLStore extends Auth_OpenID_SQLStore {
"UNIQUE (server_url, timestamp, salt))";
$this->sql['assoc_table'] =
- "CREATE TABLE %s (server_url VARCHAR(2047) NOT NULL, ".
+ "CREATE TABLE %s (server_url VARCHAR(2047) NOT NULL, ".
"handle VARCHAR(255) NOT NULL, ".
"secret BYTEA NOT NULL, ".
"issued INTEGER NOT NULL, ".
@@ -40,14 +40,14 @@ class Auth_OpenID_PostgreSQLStore extends Auth_OpenID_SQLStore {
"(LENGTH(secret) <= 128))";
$this->sql['set_assoc'] =
- array(
+ [
'insert_assoc' => "INSERT INTO %s (server_url, handle, ".
"secret, issued, lifetime, assoc_type) VALUES ".
"(?, ?, '!', ?, ?, ?)",
'update_assoc' => "UPDATE %s SET secret = '!', issued = ?, ".
"lifetime = ?, assoc_type = ? WHERE server_url = ? AND ".
"handle = ?"
- );
+ ];
$this->sql['get_assocs'] =
"SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
@@ -82,14 +82,27 @@ class Auth_OpenID_PostgreSQLStore extends Auth_OpenID_SQLStore {
if ($result) {
// Update the table since this associations already exists.
$this->connection->query($this->sql['set_assoc']['update_assoc'],
- array($secret, $issued, $lifetime,
- $assoc_type, $server_url, $handle));
+ [
+ $secret,
+ $issued,
+ $lifetime,
+ $assoc_type,
+ $server_url,
+ $handle,
+ ]);
} else {
// Insert a new record because this association wasn't
// found.
$this->connection->query($this->sql['set_assoc']['insert_assoc'],
- array($server_url, $handle, $secret,
- $issued, $lifetime, $assoc_type));
+ [
+ $server_url,
+ $handle,
+ $secret,
+ $issued,
+ $lifetime,
+ $assoc_type,
+ ]
+ );
}
}
diff --git a/plugins/openid/lib/Auth/OpenID/SQLStore.php b/plugins/openid/lib/Auth/OpenID/SQLStore.php
index b2a953d6..0829abb4 100644
--- a/plugins/openid/lib/Auth/OpenID/SQLStore.php
+++ b/plugins/openid/lib/Auth/OpenID/SQLStore.php
@@ -69,7 +69,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
protected $max_nonce_age = 0;
/** @var array */
- protected $sql = array();
+ protected $sql = [];
/**
* This creates a new SQLStore instance. It requires an
@@ -136,7 +136,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
$this->connection->autoCommit(false);
// Create an empty SQL strings array.
- $this->sql = array();
+ $this->sql = [];
// Call this method (which should be overridden by subclasses)
// to populate the $this->sql array with SQL strings.
@@ -223,17 +223,17 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
*/
function _verifySQL()
{
- $missing = array();
- $empty = array();
-
- $required_sql_keys = array(
- 'nonce_table',
- 'assoc_table',
- 'set_assoc',
- 'get_assoc',
- 'get_assocs',
- 'remove_assoc'
- );
+ $missing = [];
+ $empty = [];
+
+ $required_sql_keys = [
+ 'nonce_table',
+ 'assoc_table',
+ 'set_assoc',
+ 'get_assoc',
+ 'get_assocs',
+ 'remove_assoc',
+ ];
foreach ($required_sql_keys as $key) {
if (!array_key_exists($key, $this->sql)) {
@@ -243,7 +243,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
}
}
- return array($missing, $empty);
+ return [$missing, $empty];
}
/**
@@ -251,23 +251,27 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
*/
function _fixSQL()
{
- $replacements = array(
- array(
- 'value' => $this->nonces_table_name,
- 'keys' => array('nonce_table',
- 'add_nonce',
- 'clean_nonce')
- ),
- array(
- 'value' => $this->associations_table_name,
- 'keys' => array('assoc_table',
- 'set_assoc',
- 'get_assoc',
- 'get_assocs',
- 'remove_assoc',
- 'clean_assoc')
- )
- );
+ $replacements = [
+ [
+ 'value' => $this->nonces_table_name,
+ 'keys' => [
+ 'nonce_table',
+ 'add_nonce',
+ 'clean_nonce',
+ ],
+ ],
+ [
+ 'value' => $this->associations_table_name,
+ 'keys' => [
+ 'assoc_table',
+ 'set_assoc',
+ 'get_assoc',
+ 'get_assocs',
+ 'remove_assoc',
+ 'clean_assoc',
+ ],
+ ],
+ ];
foreach ($replacements as $item) {
$value = $item['value'];
@@ -276,8 +280,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
foreach ($keys as $k) {
if (is_array($this->sql[$k])) {
foreach ($this->sql[$k] as $part_key => $part_value) {
- $this->sql[$k][$part_key] = sprintf($part_value,
- $value);
+ $this->sql[$k][$part_key] = sprintf($part_value, $value);
}
} else {
$this->sql[$k] = sprintf($this->sql[$k], $value);
@@ -342,13 +345,14 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
$lifetime, $assoc_type)
{
return $this->connection->query($this->sql['set_assoc'],
- array(
- $server_url,
- $handle,
- $secret,
- $issued,
- $lifetime,
- $assoc_type));
+ [
+ $server_url,
+ $handle,
+ $secret,
+ $issued,
+ $lifetime,
+ $assoc_type,
+ ]);
}
function storeAssociation($server_url, $association)
@@ -377,7 +381,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
function _get_assoc($server_url, $handle)
{
$result = $this->connection->getRow($this->sql['get_assoc'],
- array($server_url, $handle));
+ [$server_url, $handle]);
if ($this->isError($result)) {
return null;
} else {
@@ -393,10 +397,10 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
function _get_assocs($server_url)
{
$result = $this->connection->getAll($this->sql['get_assocs'],
- array($server_url));
+ [$server_url]);
if ($this->isError($result)) {
- return array();
+ return [];
} else {
return $result;
}
@@ -410,7 +414,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
if ($this->resultToBool($this->connection->query(
$this->sql['remove_assoc'],
- array($server_url, $handle)))) {
+ [$server_url, $handle]))) {
$this->connection->commit();
} else {
$this->connection->rollback();
@@ -424,7 +428,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
if ($handle !== null) {
$assoc = $this->_get_assoc($server_url, $handle);
- $assocs = array();
+ $assocs = [];
if ($assoc) {
$assocs[] = $assoc;
}
@@ -435,7 +439,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
if (!$assocs || (count($assocs) == 0)) {
return null;
} else {
- $associations = array();
+ $associations = [];
foreach ($assocs as $assoc_row) {
$assoc = new Auth_OpenID_Association($assoc_row['handle'],
@@ -449,13 +453,13 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
if ($assoc->getExpiresIn() == 0) {
$this->removeAssociation($server_url, $assoc->handle);
} else {
- $associations[] = array($assoc->issued, $assoc);
+ $associations[] = [$assoc->issued, $assoc];
}
}
if ($associations) {
- $issued = array();
- $assocs = array();
+ $issued = [];
+ $assocs = [];
foreach ($associations as $key => $assoc) {
$issued[$key] = $assoc[0];
$assocs[$key] = $assoc[1];
@@ -483,9 +487,11 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
function _add_nonce($server_url, $timestamp, $salt)
{
$sql = $this->sql['add_nonce'];
- $result = $this->connection->query($sql, array($server_url,
- $timestamp,
- $salt));
+ $result = $this->connection->query($sql, [
+ $server_url,
+ $timestamp,
+ $salt,
+ ]);
if ($this->isError($result)) {
$this->connection->rollback();
} else {
@@ -571,7 +577,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
global $Auth_OpenID_SKEW;
$v = time() - $Auth_OpenID_SKEW;
- $this->connection->query($this->sql['clean_nonce'], array($v));
+ $this->connection->query($this->sql['clean_nonce'], [$v]);
$num = $this->connection->affectedRows();
$this->connection->commit();
return $num;
@@ -579,7 +585,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore {
function cleanupAssociations()
{
- $this->connection->query($this->sql['clean_assoc'], array(time()));
+ $this->connection->query($this->sql['clean_assoc'], [time()]);
$num = $this->connection->affectedRows();
$this->connection->commit();
return $num;
diff --git a/plugins/openid/lib/Auth/OpenID/SReg.php b/plugins/openid/lib/Auth/OpenID/SReg.php
index 78259f3a..a3d2715e 100644
--- a/plugins/openid/lib/Auth/OpenID/SReg.php
+++ b/plugins/openid/lib/Auth/OpenID/SReg.php
@@ -47,16 +47,17 @@ require_once 'Auth/OpenID/Extension.php';
// The data fields that are listed in the sreg spec
global $Auth_OpenID_sreg_data_fields;
-$Auth_OpenID_sreg_data_fields = array(
- 'fullname' => 'Full Name',
- 'nickname' => 'Nickname',
- 'dob' => 'Date of Birth',
- 'email' => 'E-mail Address',
- 'gender' => 'Gender',
- 'postcode' => 'Postal Code',
- 'country' => 'Country',
- 'language' => 'Language',
- 'timezone' => 'Time Zone');
+$Auth_OpenID_sreg_data_fields = [
+ 'fullname' => 'Full Name',
+ 'nickname' => 'Nickname',
+ 'dob' => 'Date of Birth',
+ 'email' => 'E-mail Address',
+ 'gender' => 'Gender',
+ 'postcode' => 'Postal Code',
+ 'country' => 'Country',
+ 'language' => 'Language',
+ 'timezone' => 'Time Zone',
+];
/**
* Check to see that the given value is a valid simple registration
@@ -135,8 +136,7 @@ class Auth_OpenID_SRegBase extends Auth_OpenID_Extension {
// See if there exists an alias for one of the two defined
// simple registration types.
- foreach (array(Auth_OpenID_SREG_NS_URI_1_1,
- Auth_OpenID_SREG_NS_URI_1_0) as $sreg_ns_uri) {
+ foreach ([Auth_OpenID_SREG_NS_URI_1_1, Auth_OpenID_SREG_NS_URI_1_0] as $sreg_ns_uri) {
$alias = $message->namespaces->getAlias($sreg_ns_uri);
if ($alias !== null) {
$found_ns_uri = $sreg_ns_uri;
@@ -177,9 +177,9 @@ class Auth_OpenID_SRegRequest extends Auth_OpenID_SRegBase {
/** @var string */
public $ns_alias = 'sreg';
/** @var array */
- public $required = array();
+ public $required = [];
/** @var array */
- public $optional = array();
+ public $optional = [];
/** @var string */
public $policy_url = '';
@@ -201,8 +201,8 @@ class Auth_OpenID_SRegRequest extends Auth_OpenID_SRegBase {
/** @var Auth_OpenID_SRegRequest $obj */
$obj = new $cls();
- $obj->required = array();
- $obj->optional = array();
+ $obj->required = [];
+ $obj->optional = [];
$obj->policy_url = $policy_url;
$obj->ns_uri = $sreg_ns_uri;
@@ -241,8 +241,8 @@ class Auth_OpenID_SRegRequest extends Auth_OpenID_SRegBase {
static function fromOpenIDRequest($request, $cls='Auth_OpenID_SRegRequest')
{
- $obj = call_user_func_array(array($cls, 'build'),
- array(null, null, null, Auth_OpenID_SREG_NS_URI, $cls));
+ $obj = call_user_func_array([$cls, 'build'],
+ [null, null, null, Auth_OpenID_SREG_NS_URI, $cls]);
// Since we're going to mess with namespace URI mapping, don't
// mutate the object that was passed in.
@@ -290,7 +290,7 @@ class Auth_OpenID_SRegRequest extends Auth_OpenID_SRegBase {
*/
function parseExtensionArgs($args, $strict=false)
{
- foreach (array('required', 'optional') as $list_name) {
+ foreach (['required', 'optional'] as $list_name) {
$required = ($list_name == 'required');
$items = Auth_OpenID::arrayGet($args, $list_name);
if ($items) {
@@ -433,7 +433,7 @@ class Auth_OpenID_SRegRequest extends Auth_OpenID_SRegBase {
*/
function getExtensionArgs($request = null)
{
- $args = array();
+ $args = [];
if ($this->required) {
$args['required'] = implode(',', $this->required);
@@ -465,7 +465,7 @@ class Auth_OpenID_SRegResponse extends Auth_OpenID_SRegBase {
public $ns_alias = 'sreg';
/** @var array */
- public $data = array();
+ public $data = [];
function __construct($data=null, $sreg_ns_uri=Auth_OpenID_SREG_NS_URI)
{
diff --git a/plugins/openid/lib/Auth/OpenID/Server.php b/plugins/openid/lib/Auth/OpenID/Server.php
index 0901d507..6af8c7c3 100644
--- a/plugins/openid/lib/Auth/OpenID/Server.php
+++ b/plugins/openid/lib/Auth/OpenID/Server.php
@@ -111,8 +111,10 @@ define('AUTH_OPENID_HTTP_ERROR', 400);
* @access private
*/
global $_Auth_OpenID_Request_Modes;
-$_Auth_OpenID_Request_Modes = array('checkid_setup',
- 'checkid_immediate');
+$_Auth_OpenID_Request_Modes = [
+ 'checkid_setup',
+ 'checkid_immediate',
+];
/**
* @access private
@@ -222,8 +224,11 @@ class Auth_OpenID_ServerError {
function encodeToKVForm()
{
return Auth_OpenID_KVForm::fromArray(
- array('mode' => 'error',
- 'error' => $this->toString()));
+ [
+ 'mode' => 'error',
+ 'error' => $this->toString(),
+ ]
+ );
}
function toFormMarkup($form_tag_attrs=null)
@@ -411,7 +416,7 @@ class Auth_OpenID_CheckAuthRequest extends Auth_OpenID_Request {
*/
static function fromMessage($message)
{
- $required_keys = array('assoc_handle', 'sig', 'signed');
+ $required_keys = ['assoc_handle', 'sig', 'signed'];
foreach ($required_keys as $k) {
if (!$message->getArg(Auth_OpenID_OPENID_NS, $k)) {
@@ -478,7 +483,7 @@ class Auth_OpenID_PlainTextServerSession {
*/
public $session_type = 'no-encryption';
public $needs_math = false;
- public $allowed_assoc_types = array('HMAC-SHA1', 'HMAC-SHA256');
+ public $allowed_assoc_types = ['HMAC-SHA1', 'HMAC-SHA256'];
static function fromMessage()
{
@@ -487,7 +492,7 @@ class Auth_OpenID_PlainTextServerSession {
function answer($secret)
{
- return array('mac_key' => base64_encode($secret));
+ return ['mac_key' => base64_encode($secret)];
}
}
@@ -504,7 +509,7 @@ class Auth_OpenID_DiffieHellmanSHA1ServerSession {
public $session_type = 'DH-SHA1';
public $needs_math = true;
- public $allowed_assoc_types = array('HMAC-SHA1');
+ public $allowed_assoc_types = ['HMAC-SHA1'];
public $hash_func = 'Auth_OpenID_SHA1';
/** @var Auth_OpenID_DiffieHellman */
@@ -579,7 +584,7 @@ class Auth_OpenID_DiffieHellmanSHA1ServerSession {
"dh_consumer_public is not base64");
}
- return array($dh, $consumer_pubkey);
+ return [$dh, $consumer_pubkey];
}
static function fromMessage($message)
@@ -600,10 +605,11 @@ class Auth_OpenID_DiffieHellmanSHA1ServerSession {
$lib = Auth_OpenID_getMathLib();
$mac_key = $this->dh->xorSecret($this->consumer_pubkey, $secret,
$this->hash_func);
- return array(
+ return [
'dh_server_public' =>
$lib->longToBase64($this->dh->public),
- 'enc_mac_key' => base64_encode($mac_key));
+ 'enc_mac_key' => base64_encode($mac_key)
+ ];
}
}
@@ -617,7 +623,7 @@ class Auth_OpenID_DiffieHellmanSHA256ServerSession
public $session_type = 'DH-SHA256';
public $hash_func = 'Auth_OpenID_SHA256';
- public $allowed_assoc_types = array('HMAC-SHA256');
+ public $allowed_assoc_types = ['HMAC-SHA256'];
static function fromMessage($message)
{
@@ -648,10 +654,11 @@ class Auth_OpenID_AssociateRequest extends Auth_OpenID_Request {
static function getSessionClasses()
{
- return array(
+ return [
'no-encryption' => 'Auth_OpenID_PlainTextServerSession',
'DH-SHA1' => 'Auth_OpenID_DiffieHellmanSHA1ServerSession',
- 'DH-SHA256' => 'Auth_OpenID_DiffieHellmanSHA256ServerSession');
+ 'DH-SHA256' => 'Auth_OpenID_DiffieHellmanSHA256ServerSession'
+ ];
}
/**
@@ -702,7 +709,7 @@ class Auth_OpenID_AssociateRequest extends Auth_OpenID_Request {
$session_type);
}
- $session = call_user_func(array($session_class, 'fromMessage'),
+ $session = call_user_func([$session_class, 'fromMessage'],
$message);
if (is_a($session, 'Auth_OpenID_ServerError')) {
return $session;
@@ -731,10 +738,12 @@ class Auth_OpenID_AssociateRequest extends Auth_OpenID_Request {
{
$response = new Auth_OpenID_ServerResponse($this);
$response->fields->updateArgs(Auth_OpenID_OPENID_NS,
- array(
- 'expires_in' => sprintf('%d', $assoc->getExpiresIn()),
- 'assoc_type' => $this->assoc_type,
- 'assoc_handle' => $assoc->handle));
+ [
+ 'expires_in' => sprintf('%d', $assoc->getExpiresIn()),
+ 'assoc_type' => $this->assoc_type,
+ 'assoc_handle' => $assoc->handle,
+ ]
+ );
$response->fields->updateArgs(Auth_OpenID_OPENID_NS,
$this->session->answer($assoc->secret));
@@ -925,7 +934,7 @@ class Auth_OpenID_CheckIDRequest extends Auth_OpenID_Request {
{
$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
return call_user_func_array($this->verifyReturnTo,
- array($this->trust_root, $this->return_to, $fetcher));
+ [$this->trust_root, $this->return_to, $fetcher]);
}
/**
@@ -1171,9 +1180,12 @@ class Auth_OpenID_CheckIDRequest extends Auth_OpenID_Request {
}
$response->fields->updateArgs(Auth_OpenID_OPENID_NS,
- array('mode' => $mode,
- 'return_to' => $this->return_to,
- 'response_nonce' => Auth_OpenID_mkNonce()));
+ [
+ 'mode' => $mode,
+ 'return_to' => $this->return_to,
+ 'response_nonce' => Auth_OpenID_mkNonce(),
+ ]
+ );
if (!$this->message->isOpenID1()) {
$response->fields->setArg(Auth_OpenID_OPENID_NS,
@@ -1241,10 +1253,12 @@ class Auth_OpenID_CheckIDRequest extends Auth_OpenID_Request {
// Encodable too. That's right, code imported from alternate
// realities all for the love of you, id_res/user_setup_url.
- $q = array('mode' => $this->mode,
- 'identity' => $this->identity,
- 'claimed_id' => $this->claimed_id,
- 'return_to' => $this->return_to);
+ $q = [
+ 'mode' => $this->mode,
+ 'identity' => $this->identity,
+ 'claimed_id' => $this->claimed_id,
+ 'return_to' => $this->return_to,
+ ];
if ($this->trust_root) {
if ($this->message->isOpenID1()) {
@@ -1399,7 +1413,7 @@ class Auth_OpenID_WebResponse {
if ($headers !== null) {
$this->headers = $headers;
} else {
- $this->headers = array();
+ $this->headers = [];
}
if ($body !== null) {
@@ -1608,9 +1622,9 @@ class Auth_OpenID_Encoder {
} else if ($encode_as == Auth_OpenID_ENCODE_URL) {
$location = $response->encodeToURL();
$wr = new $cls(AUTH_OPENID_HTTP_REDIRECT,
- array('location' => $location));
+ ['location' => $location]);
} else if ($encode_as == Auth_OpenID_ENCODE_HTML_FORM) {
- $wr = new $cls(AUTH_OPENID_HTTP_OK, array(),
+ $wr = new $cls(AUTH_OPENID_HTTP_OK, [],
$response->toHTML());
} else {
return new Auth_OpenID_EncodingError($response);
@@ -1682,12 +1696,12 @@ class Auth_OpenID_Decoder {
/** @var Auth_OpenID_Server */
private $server;
- private $handlers = array(
+ private $handlers = [
'checkid_setup' => 'Auth_OpenID_CheckIDRequest',
'checkid_immediate' => 'Auth_OpenID_CheckIDRequest',
'check_authentication' => 'Auth_OpenID_CheckAuthRequest',
'associate' => 'Auth_OpenID_AssociateRequest'
- );
+ ];
/**
* Auth_OpenID_Decoder constructor.
@@ -1746,8 +1760,8 @@ class Auth_OpenID_Decoder {
$this->defaultDecoder($message));
if (!is_a($handlerCls, 'Auth_OpenID_ServerError')) {
- return call_user_func_array(array($handlerCls, 'fromMessage'),
- array($message, $this->server));
+ return call_user_func_array([$handlerCls, 'fromMessage'],
+ [$message, $this->server]);
} else {
return $handlerCls;
}
@@ -1909,8 +1923,8 @@ class Auth_OpenID_Server {
function handleRequest($request)
{
if (method_exists($this, "openid_" . $request->mode)) {
- $handler = array($this, "openid_" . $request->mode);
- return call_user_func_array($handler, array($request));
+ $handler = [$this, "openid_" . $request->mode];
+ return call_user_func_array($handler, [$request]);
}
return null;
}
diff --git a/plugins/openid/lib/Auth/OpenID/TrustRoot.php b/plugins/openid/lib/Auth/OpenID/TrustRoot.php
index 379366b7..8842fb5a 100644
--- a/plugins/openid/lib/Auth/OpenID/TrustRoot.php
+++ b/plugins/openid/lib/Auth/OpenID/TrustRoot.php
@@ -109,14 +109,14 @@ class Auth_OpenID_TrustRoot {
return false;
}
- $required_parts = array('scheme', 'host');
- $forbidden_parts = array('user', 'pass', 'fragment');
+ $required_parts = ['scheme', 'host'];
+ $forbidden_parts = ['user', 'pass', 'fragment'];
$keys = array_keys($parts);
if (array_intersect($keys, $required_parts) != $required_parts) {
return false;
}
- if (array_intersect($keys, $forbidden_parts) != array()) {
+ if (array_intersect($keys, $forbidden_parts) != []) {
return false;
}
@@ -125,7 +125,7 @@ class Auth_OpenID_TrustRoot {
}
$scheme = strtolower($parts['scheme']);
- $allowed_schemes = array('http', 'https');
+ $allowed_schemes = ['http', 'https'];
if (!in_array($scheme, $allowed_schemes)) {
return false;
}
@@ -343,7 +343,7 @@ class Auth_OpenID_TrustRoot {
*/
function filter_extractReturnURL($endpoint)
{
- if ($endpoint->matchTypes(array(Auth_OpenID_RP_RETURN_TO_URL_TYPE))) {
+ if ($endpoint->matchTypes([Auth_OpenID_RP_RETURN_TO_URL_TYPE])) {
return $endpoint;
} else {
return null;
@@ -352,7 +352,7 @@ function filter_extractReturnURL($endpoint)
function &Auth_OpenID_extractReturnURL(&$endpoint_list)
{
- $result = array();
+ $result = [];
foreach ($endpoint_list as $endpoint) {
if (filter_extractReturnURL($endpoint)) {
@@ -398,10 +398,10 @@ function Auth_OpenID_getAllowedReturnURLs($relying_party_url, $fetcher,
$discover_function=null)
{
if ($discover_function === null) {
- $discover_function = array('Auth_Yadis_Yadis', 'discover');
+ $discover_function = ['Auth_Yadis_Yadis', 'discover'];
}
- $xrds_parse_cb = array('Auth_OpenID_ServiceEndpoint', 'consumerFromXRDS');
+ $xrds_parse_cb = ['Auth_OpenID_ServiceEndpoint', 'consumerFromXRDS'];
list($rp_url_after_redirects, $endpoints) =
Auth_Yadis_getServiceEndpoints($relying_party_url, $xrds_parse_cb,
@@ -413,9 +413,9 @@ function Auth_OpenID_getAllowedReturnURLs($relying_party_url, $fetcher,
}
call_user_func_array($discover_function,
- array($relying_party_url, $fetcher));
+ [$relying_party_url, $fetcher]);
- $return_to_urls = array();
+ $return_to_urls = [];
$matching_endpoints = Auth_OpenID_extractReturnURL($endpoints);
foreach ($matching_endpoints as $e) {
@@ -445,7 +445,7 @@ function Auth_OpenID_verifyReturnTo($realm_str, $return_to, $fetcher,
}
$allowable_urls = call_user_func_array($_vrfy,
- array($disco_url, $fetcher));
+ [$disco_url, $fetcher]);
// The realm_str could not be parsed.
if ($allowable_urls === false) {
diff --git a/plugins/openid/lib/Auth/OpenID/URINorm.php b/plugins/openid/lib/Auth/OpenID/URINorm.php
index f8c73ada..b088f6f3 100644
--- a/plugins/openid/lib/Auth/OpenID/URINorm.php
+++ b/plugins/openid/lib/Auth/OpenID/URINorm.php
@@ -40,7 +40,7 @@ function Auth_OpenID_getURLIllegalCharRE()
function Auth_OpenID_getUnreserved()
{
- $_unreserved = array();
+ $_unreserved = [];
for ($i = 0; $i < 256; $i++) {
$_unreserved[$i] = false;
}
@@ -67,7 +67,7 @@ function Auth_OpenID_getUnreserved()
function Auth_OpenID_getEscapeRE()
{
- $parts = array();
+ $parts = [];
foreach (array_merge(Auth_Yadis_getUCSChars(),
Auth_Yadis_getIPrivateChars()) as $pair) {
list($m, $n) = $pair;
@@ -105,7 +105,7 @@ function Auth_OpenID_pct_encoded_replace($mo)
function Auth_OpenID_remove_dot_segments($path)
{
- $result_segments = array();
+ $result_segments = [];
while ($path) {
if (Auth_Yadis_startswith($path, '../')) {
@@ -148,7 +148,7 @@ function Auth_OpenID_remove_dot_segments($path)
function Auth_OpenID_urinorm($uri)
{
- $uri_matches = array();
+ $uri_matches = [];
preg_match(Auth_OpenID_getURIPattern(), $uri, $uri_matches);
if (count($uri_matches) < 9) {
@@ -157,7 +157,7 @@ function Auth_OpenID_urinorm($uri)
}
}
- $illegal_matches = array();
+ $illegal_matches = [];
preg_match(Auth_OpenID_getURLIllegalCharRE(),
$uri, $illegal_matches);
if ($illegal_matches) {
@@ -171,7 +171,7 @@ function Auth_OpenID_urinorm($uri)
}
$scheme = strtolower($scheme);
- if (!in_array($scheme, array('http', 'https'))) {
+ if (!in_array($scheme, ['http', 'https'])) {
// Not an absolute HTTP or HTTPS URI
return null;
}
@@ -182,7 +182,7 @@ function Auth_OpenID_urinorm($uri)
return null;
}
- $authority_matches = array();
+ $authority_matches = [];
preg_match(Auth_OpenID_getAuthorityPattern(),
$authority, $authority_matches);
if (count($authority_matches) === 0) {
diff --git a/plugins/openid/lib/Auth/Yadis/HTTPFetcher.php b/plugins/openid/lib/Auth/Yadis/HTTPFetcher.php
index a6e6814e..0d07f5c6 100644
--- a/plugins/openid/lib/Auth/Yadis/HTTPFetcher.php
+++ b/plugins/openid/lib/Auth/Yadis/HTTPFetcher.php
@@ -27,7 +27,7 @@ class Auth_Yadis_HTTPResponse {
public $final_url = '';
public $status = '';
public $body = '';
- public $headers = array();
+ public $headers = [];
function __construct($final_url = null, $status = null,
$headers = null, $body = null)
diff --git a/plugins/openid/lib/Auth/Yadis/Manager.php b/plugins/openid/lib/Auth/Yadis/Manager.php
index 8aae2da4..a057d920 100644
--- a/plugins/openid/lib/Auth/Yadis/Manager.php
+++ b/plugins/openid/lib/Auth/Yadis/Manager.php
@@ -19,7 +19,7 @@ class Auth_Yadis_PHPSession {
* Set a session key/value pair.
*
* @param string $name The name of the session key to add.
- * @param string $value The value to add to the session.
+ * @param mixed $value The value to add to the session.
*/
function set($name, $value)
{
@@ -143,7 +143,7 @@ abstract class Auth_Yadis_SessionLoader {
*/
function prepareForLoad($data)
{
- return array();
+ return [];
}
/**
@@ -173,7 +173,7 @@ abstract class Auth_Yadis_SessionLoader {
*/
function toSession($obj)
{
- $data = array();
+ $data = [];
foreach ($obj as $k => $v) {
$data[$k] = $v;
}
@@ -198,7 +198,7 @@ abstract class Auth_Yadis_SessionLoader {
*/
function prepareForSave($obj)
{
- return array();
+ return [];
}
}
@@ -216,7 +216,7 @@ class Auth_OpenID_ServiceEndpointLoader extends Auth_Yadis_SessionLoader {
function requiredKeys()
{
$obj = new Auth_OpenID_ServiceEndpoint();
- $data = array();
+ $data = [];
foreach ($obj as $k => $v) {
$data[] = $k;
}
@@ -237,20 +237,22 @@ class Auth_OpenID_ServiceEndpointLoader extends Auth_Yadis_SessionLoader {
class Auth_Yadis_ManagerLoader extends Auth_Yadis_SessionLoader {
function requiredKeys()
{
- return array('starting_url',
- 'yadis_url',
- 'services',
- 'session_key',
- '_current',
- 'stale');
+ return [
+ 'starting_url',
+ 'yadis_url',
+ 'services',
+ 'session_key',
+ '_current',
+ 'stale',
+ ];
}
function newObject($data)
{
return new Auth_Yadis_Manager($data['starting_url'],
- $data['yadis_url'],
- $data['services'],
- $data['session_key']);
+ $data['yadis_url'],
+ $data['services'],
+ $data['session_key']);
}
function check($data)
@@ -261,21 +263,21 @@ class Auth_Yadis_ManagerLoader extends Auth_Yadis_SessionLoader {
function prepareForLoad($data)
{
$loader = new Auth_OpenID_ServiceEndpointLoader();
- $services = array();
+ $services = [];
foreach ($data['services'] as $s) {
$services[] = $loader->fromSession($s);
}
- return array('services' => $services);
+ return ['services' => $services];
}
function prepareForSave($obj)
{
$loader = new Auth_OpenID_ServiceEndpointLoader();
- $services = array();
+ $services = [];
foreach ($obj->services as $s) {
$services[] = $loader->toSession($s);
}
- return array('services' => $services);
+ return ['services' => $services];
}
}
@@ -378,7 +380,7 @@ class Auth_Yadis_Manager {
*/
function forURL($url)
{
- return in_array($url, array($this->starting_url, $this->yadis_url));
+ return in_array($url, [$this->starting_url, $this->yadis_url]);
}
/**
@@ -451,10 +453,10 @@ class Auth_Yadis_Discovery {
$this->destroyManager();
list($yadis_url, $services) = call_user_func_array($discover_cb,
- array(
+ [
$this->url,
$fetcher,
- ));
+ ]);
$manager = $this->createManager($services, $yadis_url);
}
diff --git a/plugins/openid/lib/Auth/Yadis/Misc.php b/plugins/openid/lib/Auth/Yadis/Misc.php
index a5afa8e9..f4bcc674 100644
--- a/plugins/openid/lib/Auth/Yadis/Misc.php
+++ b/plugins/openid/lib/Auth/Yadis/Misc.php
@@ -11,34 +11,34 @@
function Auth_Yadis_getUCSChars()
{
- return array(
- array(0xA0, 0xD7FF),
- array(0xF900, 0xFDCF),
- array(0xFDF0, 0xFFEF),
- array(0x10000, 0x1FFFD),
- array(0x20000, 0x2FFFD),
- array(0x30000, 0x3FFFD),
- array(0x40000, 0x4FFFD),
- array(0x50000, 0x5FFFD),
- array(0x60000, 0x6FFFD),
- array(0x70000, 0x7FFFD),
- array(0x80000, 0x8FFFD),
- array(0x90000, 0x9FFFD),
- array(0xA0000, 0xAFFFD),
- array(0xB0000, 0xBFFFD),
- array(0xC0000, 0xCFFFD),
- array(0xD0000, 0xDFFFD),
- array(0xE1000, 0xEFFFD)
- );
+ return [
+ [0xA0, 0xD7FF],
+ [0xF900, 0xFDCF],
+ [0xFDF0, 0xFFEF],
+ [0x10000, 0x1FFFD],
+ [0x20000, 0x2FFFD],
+ [0x30000, 0x3FFFD],
+ [0x40000, 0x4FFFD],
+ [0x50000, 0x5FFFD],
+ [0x60000, 0x6FFFD],
+ [0x70000, 0x7FFFD],
+ [0x80000, 0x8FFFD],
+ [0x90000, 0x9FFFD],
+ [0xA0000, 0xAFFFD],
+ [0xB0000, 0xBFFFD],
+ [0xC0000, 0xCFFFD],
+ [0xD0000, 0xDFFFD],
+ [0xE1000, 0xEFFFD],
+ ];
}
function Auth_Yadis_getIPrivateChars()
{
- return array(
- array(0xE000, 0xF8FF),
- array(0xF0000, 0xFFFFD),
- array(0x100000, 0x10FFFD)
- );
+ return [
+ [0xE000, 0xF8FF],
+ [0xF0000, 0xFFFFD],
+ [0x100000, 0x10FFFD],
+ ];
}
function Auth_Yadis_pct_escape_unicode($char_match)
@@ -46,7 +46,7 @@ function Auth_Yadis_pct_escape_unicode($char_match)
$c = $char_match[0];
$result = "";
for ($i = 0; $i < strlen($c); $i++) {
- $result .= "%".sprintf("%X", ord($c[$i]));
+ $result .= "%" . sprintf("%X", ord($c[$i]));
}
return $result;
}
diff --git a/plugins/openid/lib/Auth/Yadis/ParanoidHTTPFetcher.php b/plugins/openid/lib/Auth/Yadis/ParanoidHTTPFetcher.php
index 29acf3b1..f2ad7c3c 100644
--- a/plugins/openid/lib/Auth/Yadis/ParanoidHTTPFetcher.php
+++ b/plugins/openid/lib/Auth/Yadis/ParanoidHTTPFetcher.php
@@ -28,7 +28,7 @@ require_once "Auth/OpenID.php";
*/
class Auth_Yadis_ParanoidHTTPFetcher extends Auth_Yadis_HTTPFetcher {
- private $headers = array();
+ private $headers = [];
private $data = '';
function __construct()
@@ -38,7 +38,7 @@ class Auth_Yadis_ParanoidHTTPFetcher extends Auth_Yadis_HTTPFetcher {
function reset()
{
- $this->headers = array();
+ $this->headers = [];
$this->data = "";
}
@@ -133,9 +133,9 @@ class Auth_Yadis_ParanoidHTTPFetcher extends Auth_Yadis_HTTPFetcher {
}
curl_setopt($c, CURLOPT_WRITEFUNCTION,
- array($this, "_writeData"));
+ [$this, "_writeData"]);
curl_setopt($c, CURLOPT_HEADERFUNCTION,
- array($this, "_writeHeader"));
+ [$this, "_writeHeader"]);
if ($extra_headers) {
curl_setopt($c, CURLOPT_HTTPHEADER, $extra_headers);
@@ -182,7 +182,7 @@ class Auth_Yadis_ParanoidHTTPFetcher extends Auth_Yadis_HTTPFetcher {
return null;
}
- if (in_array($code, array(301, 302, 303, 307))) {
+ if (in_array($code, [301, 302, 303, 307])) {
$url = $this->_findRedirect($headers, $url);
$redir = true;
} else {
@@ -195,7 +195,7 @@ class Auth_Yadis_ParanoidHTTPFetcher extends Auth_Yadis_HTTPFetcher {
Auth_OpenID::log('OpenID: Verified SSL host %s using '.
'curl/get', $url);
}
- $new_headers = array();
+ $new_headers = [];
foreach ($headers as $header) {
if (strpos($header, ': ')) {
@@ -237,7 +237,7 @@ class Auth_Yadis_ParanoidHTTPFetcher extends Auth_Yadis_HTTPFetcher {
curl_setopt($c, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_WRITEFUNCTION,
- array($this, "_writeData"));
+ [$this, "_writeData"]);
if (defined('Auth_OpenID_VERIFY_HOST')) {
// set SSL verification options only if Auth_OpenID_VERIFY_HOST
diff --git a/plugins/openid/lib/Auth/Yadis/ParseHTML.php b/plugins/openid/lib/Auth/Yadis/ParseHTML.php
index 8b8b33f2..2085cd2c 100644
--- a/plugins/openid/lib/Auth/Yadis/ParseHTML.php
+++ b/plugins/openid/lib/Auth/Yadis/ParseHTML.php
@@ -52,12 +52,12 @@ class Auth_Yadis_ParseHTML {
$this->_removed_re,
$this->_re_flags);
- $this->_entity_replacements = array(
- 'amp' => '&',
- 'lt' => '<',
- 'gt' => '>',
- 'quot' => '"'
- );
+ $this->_entity_replacements = [
+ 'amp' => '&',
+ 'lt' => '<',
+ 'gt' => '>',
+ 'quot' => '"',
+ ];
$this->_ent_replace =
sprintf("&(%s);", implode("|",
@@ -75,7 +75,7 @@ class Auth_Yadis_ParseHTML {
*/
function removeQuotes($str)
{
- $matches = array();
+ $matches = [];
$double = '/^"(.*)"$/';
$single = "/^'(.*)'$/";
@@ -136,16 +136,19 @@ class Auth_Yadis_ParseHTML {
"",
$html_string);
- $key_tags = array($this->tagPattern('html', false, false),
+ $key_tags = [
+ $this->tagPattern('html', false, false),
$this->tagPattern('head', false, false),
$this->tagPattern('head', true, false),
$this->tagPattern('html', true, false),
- $this->tagPattern(array(
+ $this->tagPattern([
'body', 'frameset', 'frame', 'p', 'div',
- 'table','span','a'), 'maybe', 'maybe'));
- $key_tags_pos = array();
+ 'table','span','a'
+ ], 'maybe', 'maybe')
+ ];
+ $key_tags_pos = [];
foreach ($key_tags as $pat) {
- $matches = array();
+ $matches = [];
preg_match($pat, $html_string, $matches, PREG_OFFSET_CAPTURE);
if($matches) {
$key_tags_pos[] = $matches[0][1];
@@ -155,41 +158,41 @@ class Auth_Yadis_ParseHTML {
}
// no opening head tag
if (is_null($key_tags_pos[1])) {
- return array();
+ return [];
}
// the effective </head> is the min of the following
if (is_null($key_tags_pos[2])) {
$key_tags_pos[2] = strlen($html_string);
}
- foreach (array($key_tags_pos[3], $key_tags_pos[4]) as $pos) {
+ foreach ([$key_tags_pos[3], $key_tags_pos[4]] as $pos) {
if (!is_null($pos) && $pos < $key_tags_pos[2]) {
$key_tags_pos[2] = $pos;
}
}
// closing head tag comes before opening head tag
if ($key_tags_pos[1] > $key_tags_pos[2]) {
- return array();
+ return [];
}
// if there is an opening html tag, make sure the opening head tag
// comes after it
if (!is_null($key_tags_pos[0]) && $key_tags_pos[1] < $key_tags_pos[0]) {
- return array();
+ return [];
}
$html_string = substr($html_string, $key_tags_pos[1],
($key_tags_pos[2]-$key_tags_pos[1]));
- $link_data = array();
- $link_matches = array();
+ $link_data = [];
+ $link_matches = [];
if (!preg_match_all($this->tagPattern('meta', false, 'maybe'),
$html_string, $link_matches)) {
- return array();
+ return [];
}
foreach ($link_matches[0] as $link) {
- $attr_matches = array();
+ $attr_matches = [];
preg_match_all($this->_attr_find, $link, $attr_matches);
- $link_attrs = array();
+ $link_attrs = [];
foreach ($attr_matches[0] as $index => $full_match) {
$name = $attr_matches[1][$index];
$value = html_entity_decode(
@@ -221,7 +224,7 @@ class Auth_Yadis_ParseHTML {
foreach ($meta_tags as $tag) {
if (array_key_exists('http-equiv', $tag) &&
(in_array(strtolower($tag['http-equiv']),
- array('x-xrds-location', 'x-yadis-location'))) &&
+ ['x-xrds-location', 'x-yadis-location'])) &&
array_key_exists('content', $tag)) {
return $tag['content'];
}
diff --git a/plugins/openid/lib/Auth/Yadis/PlainHTTPFetcher.php b/plugins/openid/lib/Auth/Yadis/PlainHTTPFetcher.php
index 7a1bbba9..714fc265 100644
--- a/plugins/openid/lib/Auth/Yadis/PlainHTTPFetcher.php
+++ b/plugins/openid/lib/Auth/Yadis/PlainHTTPFetcher.php
@@ -49,7 +49,7 @@ class Auth_Yadis_PlainHTTPFetcher extends Auth_Yadis_HTTPFetcher {
$stop = time() + $this->timeout;
$off = $this->timeout;
- $headers = array();
+ $headers = [];
$code = '';
$body = '';
@@ -83,15 +83,16 @@ class Auth_Yadis_PlainHTTPFetcher extends Auth_Yadis_HTTPFetcher {
$user_agent = Auth_OpenID_USER_AGENT;
- $headers = array(
- "GET ".$parts['path'].
- (array_key_exists('query', $parts) ?
- "?".$parts['query'] : "").
- " HTTP/1.0",
- "User-Agent: $user_agent",
- "Host: ".$parts['host'].
- ($specify_port ? ":".$parts['port'] : ""),
- "Port: ".$parts['port']);
+ $headers = [
+ "GET " . $parts['path'] .
+ (array_key_exists('query', $parts) ?
+ "?" . $parts['query'] : "") .
+ " HTTP/1.0",
+ "User-Agent: $user_agent",
+ "Host: " . $parts['host'] .
+ ($specify_port ? ":" . $parts['port'] : ""),
+ "Port: " . $parts['port'],
+ ];
$errno = 0;
$errstr = '';
@@ -129,7 +130,7 @@ class Auth_Yadis_PlainHTTPFetcher extends Auth_Yadis_HTTPFetcher {
$http_code = explode(" ", $headers[0]);
$code = $http_code[1];
- if (in_array($code, array('301', '302'))) {
+ if (in_array($code, ['301', '302'])) {
$url = $this->_findRedirect($headers, $url);
$redir = true;
} else {
@@ -139,7 +140,7 @@ class Auth_Yadis_PlainHTTPFetcher extends Auth_Yadis_HTTPFetcher {
$off = $stop - time();
}
- $new_headers = array();
+ $new_headers = [];
foreach ($headers as $header) {
if (preg_match("/:/", $header)) {
@@ -164,7 +165,7 @@ class Auth_Yadis_PlainHTTPFetcher extends Auth_Yadis_HTTPFetcher {
$parts = parse_url($url);
- $headers = array();
+ $headers = [];
$post_path = $parts['path'];
if (isset($parts['query'])) {
@@ -239,7 +240,7 @@ class Auth_Yadis_PlainHTTPFetcher extends Auth_Yadis_HTTPFetcher {
$http_code = explode(" ", $headers[0]);
$code = $http_code[1];
- $new_headers = array();
+ $new_headers = [];
foreach ($headers as $header) {
if (preg_match("/:/", $header)) {
diff --git a/plugins/openid/lib/Auth/Yadis/XML.php b/plugins/openid/lib/Auth/Yadis/XML.php
index 3039d54e..04132f44 100644
--- a/plugins/openid/lib/Auth/Yadis/XML.php
+++ b/plugins/openid/lib/Auth/Yadis/XML.php
@@ -96,7 +96,7 @@ class Auth_Yadis_XMLParser {
function &evalXPath($xpath, $node = null)
{
// Not implemented.
- return array();
+ return [];
}
/**
@@ -125,7 +125,7 @@ class Auth_Yadis_XMLParser {
function attributes($node)
{
// Not implemented.
- return array();
+ return [];
}
}
@@ -144,7 +144,7 @@ class Auth_Yadis_domxml extends Auth_Yadis_XMLParser {
$this->xml = null;
$this->doc = null;
$this->xpath = null;
- $this->errors = array();
+ $this->errors = [];
}
function setXML($xml_string)
@@ -176,12 +176,12 @@ class Auth_Yadis_domxml extends Auth_Yadis_XMLParser {
}
if (!$result) {
- $n = array();
+ $n = [];
return $n;
}
if (!$result->nodeset) {
- $n = array();
+ $n = [];
return $n;
}
@@ -199,7 +199,7 @@ class Auth_Yadis_domxml extends Auth_Yadis_XMLParser {
{
if ($node) {
$arr = $node->attributes();
- $result = array();
+ $result = [];
if ($arr) {
foreach ($arr as $attrnode) {
@@ -231,7 +231,7 @@ class Auth_Yadis_dom extends Auth_Yadis_XMLParser {
/** @var DOMXPath */
protected $xpath = null;
- protected $errors = array();
+ protected $errors = [];
function setXML($xml_string)
{
@@ -284,7 +284,7 @@ class Auth_Yadis_dom extends Auth_Yadis_XMLParser {
$result = @$this->xpath->query($xpath);
}
- $n = array();
+ $n = [];
if (!$result) {
return $n;
@@ -314,7 +314,7 @@ class Auth_Yadis_dom extends Auth_Yadis_XMLParser {
if ($node) {
/** @var DOMNamedNodeMap $arr */
$arr = $node->attributes;
- $result = array();
+ $result = [];
if ($arr) {
for ($i = 0; $i < $arr->length; $i++) {
@@ -325,7 +325,7 @@ class Auth_Yadis_dom extends Auth_Yadis_XMLParser {
return $result;
}
- return array();
+ return [];
}
}
@@ -349,8 +349,10 @@ function Auth_Yadis_setDefaultParser($parser)
function Auth_Yadis_getSupportedExtensions()
{
- return array('dom' => 'Auth_Yadis_dom',
- 'domxml' => 'Auth_Yadis_domxml');
+ return [
+ 'dom' => 'Auth_Yadis_dom',
+ 'domxml' => 'Auth_Yadis_domxml',
+ ];
}
/**
diff --git a/plugins/openid/lib/Auth/Yadis/XRDS.php b/plugins/openid/lib/Auth/Yadis/XRDS.php
index 81e0c91b..f6287dae 100644
--- a/plugins/openid/lib/Auth/Yadis/XRDS.php
+++ b/plugins/openid/lib/Auth/Yadis/XRDS.php
@@ -48,8 +48,10 @@ define('Auth_Yadis_XMLNS_XRDS', 'xri://$xrds');
function Auth_Yadis_getNSMap()
{
- return array('xrds' => Auth_Yadis_XMLNS_XRDS,
- 'xrd' => Auth_Yadis_XMLNS_XRD_2_0);
+ return [
+ 'xrds' => Auth_Yadis_XMLNS_XRDS,
+ 'xrd' => Auth_Yadis_XMLNS_XRD_2_0,
+ ];
}
/**
@@ -59,7 +61,7 @@ function Auth_Yadis_getNSMap()
*/
function Auth_Yadis_array_scramble($arr)
{
- $result = array();
+ $result = [];
while (count($arr)) {
$index = array_rand($arr, 1);
@@ -97,7 +99,7 @@ class Auth_Yadis_Service {
*/
function getTypes()
{
- $t = array();
+ $t = [];
foreach ($this->getElements('xrd:Type') as $elem) {
$c = $this->parser->content($elem);
if ($c) {
@@ -109,7 +111,7 @@ class Auth_Yadis_Service {
function matchTypes($type_uris)
{
- $result = array();
+ $result = [];
foreach ($this->getTypes() as $typ) {
if (in_array($typ, $type_uris)) {
@@ -128,8 +130,8 @@ class Auth_Yadis_Service {
*/
function getURIs()
{
- $uris = array();
- $last = array();
+ $uris = [];
+ $last = [];
foreach ($this->getElements('xrd:URI') as $elem) {
$uri_string = $this->parser->content($elem);
@@ -138,7 +140,7 @@ class Auth_Yadis_Service {
array_key_exists('priority', $attrs)) {
$priority = intval($attrs['priority']);
if (!array_key_exists($priority, $uris)) {
- $uris[$priority] = array();
+ $uris[$priority] = [];
}
$uris[$priority][] = $uri_string;
@@ -151,7 +153,7 @@ class Auth_Yadis_Service {
sort($keys);
// Rebuild array of URIs.
- $result = array();
+ $result = [];
foreach ($keys as $k) {
$new_uris = Auth_Yadis_array_scramble($uris[$k]);
$result = array_merge($result, $new_uris);
@@ -271,7 +273,7 @@ class Auth_Yadis_XRDS {
$this->parser = $xmlParser;
$this->xrdNode = $xrdNodes[count($xrdNodes) - 1];
$this->allXrdNodes = $xrdNodes;
- $this->serviceList = array();
+ $this->serviceList = [];
$this->_parse();
}
@@ -346,7 +348,7 @@ class Auth_Yadis_XRDS {
$priority = intval($priority);
if (!array_key_exists($priority, $this->serviceList)) {
- $this->serviceList[$priority] = array();
+ $this->serviceList[$priority] = [];
}
$this->serviceList[$priority][] = $service;
@@ -360,7 +362,7 @@ class Auth_Yadis_XRDS {
*/
function _parse()
{
- $this->serviceList = array();
+ $this->serviceList = [];
$services = $this->parser->evalXPath('xrd:Service', $this->xrdNode);
@@ -415,7 +417,7 @@ class Auth_Yadis_XRDS {
if (!$filters ||
(!is_array($filters))) {
- $result = array();
+ $result = [];
foreach ($pri_keys as $pri) {
$result = array_merge($result, $this->serviceList[$pri]);
}
@@ -424,14 +426,16 @@ class Auth_Yadis_XRDS {
}
// If a bad filter mode is specified, return null.
- if (!in_array($filter_mode, array(SERVICES_YADIS_MATCH_ANY,
- SERVICES_YADIS_MATCH_ALL))) {
+ if (!in_array($filter_mode, [
+ SERVICES_YADIS_MATCH_ANY,
+ SERVICES_YADIS_MATCH_ALL,
+ ])) {
return null;
}
// Otherwise, use the callbacks in the filter list to
// determine which services are returned.
- $filtered = array();
+ $filtered = [];
foreach ($pri_keys as $priority_value) {
$service_obj_list = $this->serviceList[$priority_value];
@@ -442,7 +446,7 @@ class Auth_Yadis_XRDS {
foreach ($filters as $filter) {
- if (call_user_func_array($filter, array($service))) {
+ if (call_user_func_array($filter, [$service])) {
$matches++;
if ($filter_mode == SERVICES_YADIS_MATCH_ANY) {
@@ -452,7 +456,7 @@ class Auth_Yadis_XRDS {
}
if (!array_key_exists($pri, $filtered)) {
- $filtered[$pri] = array();
+ $filtered[$pri] = [];
}
$filtered[$pri][] = $service;
@@ -470,7 +474,7 @@ class Auth_Yadis_XRDS {
}
if (!array_key_exists($pri, $filtered)) {
- $filtered[$pri] = array();
+ $filtered[$pri] = [];
}
$filtered[$pri][] = $service;
}
@@ -480,7 +484,7 @@ class Auth_Yadis_XRDS {
$pri_keys = array_keys($filtered);
sort($pri_keys, SORT_NUMERIC);
- $result = array();
+ $result = [];
foreach ($pri_keys as $pri) {
$result = array_merge($result, $filtered[$pri]);
}
diff --git a/plugins/openid/lib/Auth/Yadis/XRI.php b/plugins/openid/lib/Auth/Yadis/XRI.php
index 50c291f9..cd8b9600 100644
--- a/plugins/openid/lib/Auth/Yadis/XRI.php
+++ b/plugins/openid/lib/Auth/Yadis/XRI.php
@@ -20,12 +20,12 @@ function Auth_Yadis_getDefaultProxy()
function Auth_Yadis_getXRIAuthorities()
{
- return array('!', '=', '@', '+', '$', '(');
+ return ['!', '=', '@', '+', '$', '('];
}
function Auth_Yadis_getEscapeRE()
{
- $parts = array();
+ $parts = [];
foreach (array_merge(Auth_Yadis_getUCSChars(),
Auth_Yadis_getIPrivateChars()) as $pair) {
list($m, $n) = $pair;
@@ -112,9 +112,9 @@ function Auth_Yadis_XRIAppendArgs($url, $args)
} else {
$keys = array_keys($args);
sort($keys);
- $new_args = array();
+ $new_args = [];
foreach ($keys as $key) {
- $new_args[] = array($key, $args[$key]);
+ $new_args[] = [$key, $args[$key]];
}
$args = $new_args;
}
@@ -166,7 +166,7 @@ function Auth_Yadis_rootAuthority($xri)
} else {
// IRI reference.
$_segments = explode("!", $authority);
- $segments = array();
+ $segments = [];
foreach ($_segments as $s) {
$segments = array_merge($segments, explode("*", $s));
}
diff --git a/plugins/openid/lib/Auth/Yadis/XRIRes.php b/plugins/openid/lib/Auth/Yadis/XRIRes.php
index cdf7ef58..388f4335 100644
--- a/plugins/openid/lib/Auth/Yadis/XRIRes.php
+++ b/plugins/openid/lib/Auth/Yadis/XRIRes.php
@@ -26,9 +26,9 @@ class Auth_Yadis_ProxyResolver {
// trim off the xri:// prefix
$qxri = substr(Auth_Yadis_toURINormal($xri), 6);
$hxri = $this->proxy_url . $qxri;
- $args = array(
- '_xrd_r' => 'application/xrds+xml'
- );
+ $args = [
+ '_xrd_r' => 'application/xrds+xml',
+ ];
if ($service_type) {
$args['_xrd_t'] = $service_type;
@@ -41,9 +41,9 @@ class Auth_Yadis_ProxyResolver {
return $query;
}
- function query($xri, $service_types, $filters = array())
+ function query($xri, $service_types, $filters = [])
{
- $services = array();
+ $services = [];
$canonicalID = null;
foreach ($service_types as $service_type) {
$url = $this->queryURL($xri, $service_type);
@@ -69,7 +69,7 @@ class Auth_Yadis_ProxyResolver {
// almost certainly going to have duplicated service
// entries and broken priority ordering.
}
- return array($canonicalID, $services);
+ return [$canonicalID, $services];
}
}
diff --git a/plugins/openid/lib/Auth/Yadis/Yadis.php b/plugins/openid/lib/Auth/Yadis/Yadis.php
index 70dc944d..5e435eb8 100644
--- a/plugins/openid/lib/Auth/Yadis/Yadis.php
+++ b/plugins/openid/lib/Auth/Yadis/Yadis.php
@@ -144,25 +144,27 @@ function Auth_Yadis_getServiceEndpoints($input_url, $xrds_parse_func,
$discover_func=null, $fetcher=null)
{
if ($discover_func === null) {
- $discover_func = array('Auth_Yadis_Yadis', 'discover');
+ $discover_func = ['Auth_Yadis_Yadis', 'discover'];
}
$yadis_result = call_user_func_array($discover_func,
- array($input_url, $fetcher));
+ [$input_url, $fetcher]);
if ($yadis_result === null) {
- return array($input_url, array());
+ return [$input_url, []];
}
$endpoints = call_user_func_array($xrds_parse_func,
- array($yadis_result->normalized_uri,
- $yadis_result->response_text));
+ [
+ $yadis_result->normalized_uri,
+ $yadis_result->response_text,
+ ]);
if ($endpoints === null) {
- $endpoints = array();
+ $endpoints = [];
}
- return array($yadis_result->normalized_uri, $endpoints);
+ return [$yadis_result->normalized_uri, $endpoints];
}
/**
@@ -334,8 +336,10 @@ class Auth_Yadis_Yadis {
{
$result = new Auth_Yadis_DiscoveryResult($uri);
- $headers = array("Accept: " . Auth_Yadis_CONTENT_TYPE .
- ', text/html; q=0.3, application/xhtml+xml; q=0.5');
+ $headers = [
+ "Accept: " . Auth_Yadis_CONTENT_TYPE .
+ ', text/html; q=0.3, application/xhtml+xml; q=0.5',
+ ];
if ($fetcher === null) {
$fetcher = Auth_Yadis_Yadis::getHTTPFetcher($timeout);
@@ -352,7 +356,7 @@ class Auth_Yadis_Yadis {
$result->normalized_uri = $response->final_url;
$result->content_type = Auth_Yadis_Yadis::_getHeader(
$response->headers,
- array('content-type'));
+ ['content-type']);
if ($result->content_type &&
(Auth_Yadis_Yadis::_getContentType($result->content_type) ==
@@ -361,7 +365,7 @@ class Auth_Yadis_Yadis {
} else {
$yadis_location = Auth_Yadis_Yadis::_getHeader(
$response->headers,
- array(Auth_Yadis_HEADER_NAME));
+ [Auth_Yadis_HEADER_NAME]);
if (!$yadis_location) {
$parser = new Auth_Yadis_ParseHTML();
@@ -381,7 +385,7 @@ class Auth_Yadis_Yadis {
$result->content_type = Auth_Yadis_Yadis::_getHeader(
$response->headers,
- array('content-type'));
+ ['content-type']);
}
}
diff --git a/plugins/openid/localization/openid.pot b/plugins/openid/localization/openid.pot
index 49d3e9fc..1ec5e6cf 100644
--- a/plugins/openid/localization/openid.pot
+++ b/plugins/openid/localization/openid.pot
@@ -1,538 +1,475 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR DiSo Development Team
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
+# Copyright (C) 2022 DiSo Development Team
+# This file is distributed under the Apache 2.0.
msgid ""
msgstr ""
-"Project-Id-Version: OpenID 3.4-trunk\n"
-"Report-Msgid-Bugs-To: http://wordpress.org/tag/openid\n"
-"POT-Creation-Date: 2009-10-01 15:34-0700\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
+"Project-Id-Version: OpenID 3.6.1\n"
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wordpress-openid\n"
+"POT-Creation-Date: 2022-06-12 18:23:39+00:00\n"
"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+"PO-Revision-Date: 2022-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"X-Generator: grunt-wp-i18n 1.0.3\n"
#: admin_panels.php:25
msgid "OpenID options"
msgstr ""
-#. #-#-#-#-# openid.pot (OpenID 3.4-trunk) #-#-#-#-#
-#. Plugin Name of an extension
-#: admin_panels.php:25
+#. Plugin Name of the plugin/theme
msgid "OpenID"
msgstr ""
-#: admin_panels.php:30
+#: admin_panels.php:35
msgid "Your OpenIDs"
msgstr ""
-#: admin_panels.php:44 admin_panels.php:45 admin_panels.php:423
+#: admin_panels.php:56 admin_panels.php:57 admin_panels.php:506
msgid "Your Trusted Sites"
msgstr ""
-#: admin_panels.php:57 admin_panels.php:61 admin_panels.php:149
+#: admin_panels.php:83 admin_panels.php:92 admin_panels.php:184
msgid "OpenID Settings"
msgstr ""
-#: admin_panels.php:112
+#: admin_panels.php:149
msgid "Settings"
msgstr ""
-#: admin_panels.php:133
+#: admin_panels.php:170
msgid "OpenID cache refreshed."
msgstr ""
-#: admin_panels.php:151
-msgid ""
-"Please note that all OpenID Consumer options have been moved to their "
-"respective sections of the <a href=\"options-general.php\">General Settings</"
-"a> and <a href=\"options-discussion.php\">Discussion Settings</a> pages."
-msgstr ""
-
-#: admin_panels.php:160
-msgid ""
-"The OpenID Provider allows authorized users to use their author URL as an "
-"OpenID, either using their local WordPress username and password, or by "
-"delegating to another OpenID Provider."
-msgstr ""
-
-#: admin_panels.php:166
+#: admin_panels.php:215
msgid "Enable OpenID"
msgstr ""
-#: admin_panels.php:169
+#: admin_panels.php:218
msgid "Enable the local OpenID Provider for these roles:"
msgstr ""
-#: admin_panels.php:192
+#: admin_panels.php:247
msgid "Blog Owner"
msgstr ""
-#: admin_panels.php:195
-#, php-format
-msgid ""
-"Authorized accounts on this blog can use their author URL (i.e. <em>%1$s</"
-"em>) as an OpenID. The Blog Owner will be able to use the blog address (%2"
-"$s) as their OpenID. If this is a single-user blog, you should set this to "
-"your account."
-msgstr ""
-
-#: admin_panels.php:205
-msgid ""
-"A Blog Owner cannot be set for this blog. To set a Blog Owner, first remove "
-"the following line from your <code>wp-config.php</code>:"
-msgstr ""
-
-#: admin_panels.php:213
+#: admin_panels.php:279
msgid "(none)"
msgstr ""
-#: admin_panels.php:223
-#, php-format
+#: admin_panels.php:288
msgid "Only the current Blog Owner (%s) can change this setting."
msgstr ""
-#: admin_panels.php:235
+#: admin_panels.php:300
msgid "Troubleshooting"
msgstr ""
-#: admin_panels.php:239
-#, php-format
+#: admin_panels.php:307
msgid ""
-"If users are experiencing problems logging in with OpenID, it may help to %1"
-"$srefresh the cache%2$s."
+"If users are experiencing problems logging in with OpenID, it may help to "
+"%1$srefresh the cache%2$s."
msgstr ""
-#: admin_panels.php:246
+#: admin_panels.php:318
msgid "Save Changes"
msgstr ""
-#: admin_panels.php:266
+#: admin_panels.php:340
msgid "Success:"
msgstr ""
-#: admin_panels.php:269
+#: admin_panels.php:342
msgid "Warning:"
msgstr ""
-#: admin_panels.php:272 admin_panels.php:276
+#: admin_panels.php:344 admin_panels.php:348
msgid "Error:"
msgstr ""
-#: admin_panels.php:288
+#: admin_panels.php:358
msgid "Your Verified OpenIDs"
msgstr ""
-#: admin_panels.php:290
-msgid ""
-"You may associate one or more OpenIDs with your account. This will allow "
-"you to login to WordPress with your OpenID instead of a username and "
-"password. <a href=\"http://openid.net/what/\" target=\"_blank\">Learn "
-"more...</a>"
-msgstr ""
-
-#: admin_panels.php:297 admin_panels.php:432
+#: admin_panels.php:374 admin_panels.php:522
msgid "Bulk Actions"
msgstr ""
-#: admin_panels.php:298 admin_panels.php:433
+#: admin_panels.php:375 admin_panels.php:523
msgid "Delete"
msgstr ""
-#: admin_panels.php:300 admin_panels.php:435
+#: admin_panels.php:377 admin_panels.php:525
msgid "Apply"
msgstr ""
-#: admin_panels.php:312
+#: admin_panels.php:389
msgid "Account"
msgstr ""
-#: admin_panels.php:321
+#: admin_panels.php:398
msgid "No Verified Accounts."
msgstr ""
-#: admin_panels.php:340 admin_panels.php:346
+#: admin_panels.php:417 admin_panels.php:423
msgid "Add OpenID"
msgstr ""
-#: admin_panels.php:387
-#, php-format
+#: admin_panels.php:470
msgid "Added %d trusted site."
msgid_plural "Added %d trusted sites."
msgstr[0] ""
msgstr[1] ""
-#: admin_panels.php:410
-#, php-format
+#: admin_panels.php:495
msgid "Deleted %d trusted site."
msgid_plural "Deleted %d trusted sites."
msgstr[0] ""
msgstr[1] ""
-#: admin_panels.php:425
-msgid ""
-"This is a list of sites that you can automatically login to using your "
-"OpenID account. You will not be asked to approve OpenID login requests for "
-"your trusted sites."
-msgstr ""
-
-#: admin_panels.php:447
+#: admin_panels.php:537
msgid "URL"
msgstr ""
-#: admin_panels.php:448
+#: admin_panels.php:538
msgid "Last Login"
msgstr ""
-#: admin_panels.php:456
+#: admin_panels.php:546
msgid "No Trusted Sites."
msgstr ""
-#: admin_panels.php:487
+#: admin_panels.php:577
msgid "Import Trusted Sites"
msgstr ""
-#: admin_panels.php:489
+#: admin_panels.php:579
msgid "Enter a list of URLs to be added to your Trusted Sites."
msgstr ""
-#: admin_panels.php:493 admin_panels.php:503
+#: admin_panels.php:583 admin_panels.php:593
msgid "Add Sites"
msgstr ""
-#: admin_panels.php:495
+#: admin_panels.php:585
msgid "(One URL per line)"
msgstr ""
-#: admin_panels.php:589
+#: admin_panels.php:685
msgid "Status information:"
msgstr ""
-#: admin_panels.php:589
+#: admin_panels.php:685
msgid "All Systems Nominal"
msgstr ""
-#: admin_panels.php:590
+#: admin_panels.php:686
msgid "System Status"
msgstr ""
-#: admin_panels.php:590
+#: admin_panels.php:686
msgid "Toggle More/Less"
msgstr ""
-#: admin_panels.php:592
+#: admin_panels.php:688
msgid ""
"Plugin is currently disabled. Fix the problem, then Deactivate/Reactivate "
"the plugin."
msgstr ""
-#: admin_panels.php:600
+#: admin_panels.php:696
msgid "FAIL"
msgstr ""
-#: admin_panels.php:602
+#: admin_panels.php:698
msgid "OK"
msgstr ""
-#: admin_panels.php:604
+#: admin_panels.php:700
msgid "INFO"
msgstr ""
-#: admin_panels.php:638
+#: admin_panels.php:734
msgid "You already have this OpenID!"
msgstr ""
-#: admin_panels.php:640
+#: admin_panels.php:736
msgid "This OpenID is already associated with another user."
msgstr ""
-#: admin_panels.php:661
+#: admin_panels.php:757
msgid "Unable to authenticate OpenID."
msgstr ""
-#: admin_panels.php:662
+#: admin_panels.php:758
msgid ""
-"OpenID assertion successful, but this URL is already associated with another "
-"user on this blog."
+"OpenID assertion successful, but this URL is already associated with "
+"another user on this blog."
msgstr ""
-#: admin_panels.php:663
+#: admin_panels.php:759
msgid "Added association with OpenID."
msgstr ""
-#: admin_panels.php:675 admin_panels.php:745
+#: admin_panels.php:771 admin_panels.php:845
msgid ""
"<strong>Note:</strong> For security reasons, your profile URL has been "
"updated to match your OpenID."
msgstr ""
-#: admin_panels.php:701 admin_panels.php:718
+#: admin_panels.php:799 admin_panels.php:815
msgid "OpenID Warning"
msgstr ""
-#: admin_panels.php:703
+#: admin_panels.php:801
msgid ""
"Are you sure you want to delete all of your OpenID associations? Doing so "
"may prevent you from logging in."
msgstr ""
-#: admin_panels.php:705
+#: admin_panels.php:803
msgid "Yes I'm sure. Delete."
msgstr ""
-#: admin_panels.php:706
+#: admin_panels.php:804
msgid "No, don't delete."
msgstr ""
-#: admin_panels.php:733
-#, php-format
+#: admin_panels.php:829
msgid "Deleted %d OpenID association."
msgid_plural "Deleted %d OpenID associations."
msgstr[0] ""
msgstr[1] ""
-#: admin_panels.php:751
+#: admin_panels.php:851
msgid "OpenID association delete failed: Unknown reason."
msgstr ""
-#: admin_panels.php:807
-#, php-format
+#: admin_panels.php:917
msgid ""
-"For security reasons, your profile URL must be one of your claimed OpenIDs: %"
-"s"
+"For security reasons, your profile URL must be one of your claimed OpenIDs: "
+"%s"
msgstr ""
-#: admin_panels.php:844
+#: admin_panels.php:961
msgid "OpenID Delegation"
msgstr ""
-#: admin_panels.php:846
+#: admin_panels.php:963
msgid ""
"OpenID Delegation allows you to use an external OpenID provider of your "
"choice."
msgstr ""
-#: admin_panels.php:849
+#: admin_panels.php:966
msgid "To delegate, enter a valid OpenID. Otherwise leave this blank."
msgstr ""
-#: admin_panels.php:886
-#, php-format
+#: admin_panels.php:1005
msgid "Unable to find any OpenID information for delegate URL %s"
msgstr ""
-#: admin_panels.php:896
+#: admin_panels.php:1015
msgid "You cannot delegate to an OpenID provider which uses Identifier Select."
msgstr ""
-#: admin_panels.php:917
+#: admin_panels.php:1036 admin_panels.php:1076
msgid "New accounts can only be created with verified OpenIDs."
msgstr ""
-#: admin_panels.php:956
-msgid "New accounts can only be created with verified OpenIDs"
-msgstr ""
-
-#: admin_panels.php:979
+#: admin_panels.php:1103
msgid "Enable OpenID for comments"
msgstr ""
-#: admin_panels.php:989
+#: admin_panels.php:1116
msgid "Do not require name and e-mail for comments left with a verified OpenID"
msgstr ""
-#: admin_panels.php:997
+#: admin_panels.php:1127
msgid "Always approve comments left with a verified OpenID"
msgstr ""
-#: comments.php:106
+#: comments.php:111
msgid "Error: please fill the required fields (name, email)."
msgstr ""
-#: comments.php:108
+#: comments.php:113
msgid "Error: please enter a valid email address."
msgstr ""
-#: comments.php:258
-msgid ""
-"Authenticate this comment using <span class=\"openid_link\">OpenID</span>."
+#: comments.php:264
+msgid "Authenticate this comment using <span class=\"openid_link\">OpenID</span>."
msgstr ""
-#: comments.php:271 comments.php:289
+#: comments.php:277 comments.php:294
msgid "OpenID Authentication Error"
msgstr ""
-#: comments.php:272
+#: comments.php:278
msgid ""
-"We were unable to authenticate your claimed OpenID, however you can continue "
-"to post your comment without OpenID:"
+"We were unable to authenticate your claimed OpenID, however you can "
+"continue to post your comment without OpenID:"
msgstr ""
-#: comments.php:280
+#: comments.php:285
msgid "Submit Comment"
msgstr ""
-#: common.php:342
+#: common.php:374
msgid ""
-"User was created fine, but wp_login() for the new user failed. This is "
+"User was created fine, but wp_signon() for the new user failed. This is "
"probably a bug."
msgstr ""
-#: common.php:363
+#: common.php:398
msgid ""
"OpenID authentication successful, but failed to create WordPress user. This "
"is probably a bug."
msgstr ""
-#: common.php:680
+#: common.php:728
msgid ""
"Since your browser does not support JavaScript, you must press the Continue "
"button once to proceed."
msgstr ""
-#: common.php:688 server.php:236 server.php:480
+#: common.php:738 server.php:285 server.php:534
msgid "Continue"
msgstr ""
-#: common.php:692
+#: common.php:742
msgid "Please Wait..."
msgstr ""
-#: common.php:696
+#: common.php:746
msgid "OpenID Authentication Redirect"
msgstr ""
-#: consumer.php:90
+#: consumer.php:87
msgid "OpenID login was cancelled."
msgstr ""
-#: consumer.php:95
-#, php-format
+#: consumer.php:92
msgid "OpenID login failed: %s"
msgstr ""
-#: consumer.php:100
+#: consumer.php:97
msgid "OpenID login successful"
msgstr ""
-#: consumer.php:108
+#: consumer.php:105
msgid "Unknown Status. Bind not successful. This is probably a bug."
msgstr ""
#: consumer.php:155
-#, php-format
msgid "Could not discover an OpenID identity server endpoint at the url: %s"
msgstr ""
-#: login.php:47
+#: login.php:39
+msgid "Error during OpenID authentication. Please try again. (invalid nonce)"
+msgstr ""
+
+#: login.php:48
msgid ""
"Your have entered a valid OpenID, but this site is not currently accepting "
"new accounts."
msgstr ""
-#: login.php:126
+#: login.php:82
+msgid "Unable to create a new user."
+msgstr ""
+
+#: login.php:149
msgid "Or login using an OpenID"
msgstr ""
-#: login.php:131 login.php:179
+#: login.php:154 login.php:194
msgid "Learn about OpenID"
msgstr ""
-#: login.php:146
+#: login.php:172
msgid "Register using an OpenID:"
msgstr ""
-#: login.php:159
+#: login.php:174
msgid "Or register using an OpenID:"
msgstr ""
-#: login.php:205 login.php:216
+#: login.php:222 login.php:233
msgid "<strong>ERROR</strong>: "
msgstr ""
-#: login.php:205
+#: login.php:222
msgid "New users must register using OpenID."
msgstr ""
-#: server.php:227
+#: server.php:276
msgid "OpenID Login Error"
msgstr ""
-#: server.php:229
-#, php-format
+#: server.php:278
msgid ""
"Because you have delegated your OpenID, you cannot login with the URL "
"<strong>%s</strong>. Instead, you must use your full OpenID when logging in."
msgstr ""
-#: server.php:231
-#, php-format
+#: server.php:280
msgid "Your full OpenID is: %s"
msgstr ""
-#: server.php:459
-#, php-format
+#: server.php:513
msgid "Logged in as %1$s (%2$s). <a href=\"%3$s\">Use a different account?</a>"
msgstr ""
-#: server.php:466 server.php:500
+#: server.php:520 server.php:556
msgid "Verify Your Identity"
msgstr ""
-#: server.php:468
-#, php-format
+#: server.php:522
msgid "%s has asked to verify your identity."
msgstr ""
-#: server.php:472
+#: server.php:526
msgid ""
"Click <strong>Continue</strong> to verify your identity and login without "
"creating a new password."
msgstr ""
-#: server.php:479
+#: server.php:533
msgid "Cancel and go back"
msgstr ""
-#: server.php:484
-#, php-format
+#: server.php:539
msgid ""
"Manage or remove access on the <a href=\"%s\" target=\"_blank\">Trusted "
"Sites</a> page."
msgstr ""
-#: server.php:488
-#, php-format
+#: server.php:544
msgid ""
"<a href=\"%s\" target=\"_blank\">Edit your profile</a> to change the "
"information that gets shared with Trusted Sites."
msgstr ""
#: server_ext.php:63
-#, php-format
msgid "Also grant access to see my %s."
msgstr ""
-#. Plugin URI of an extension
-msgid "http://wordpress.org/extend/plugins/openid"
+#. Plugin URI of the plugin/theme
+msgid "https://wordpress.org/plugins/openid"
msgstr ""
-#. Description of an extension
+#. Description of the plugin/theme
msgid ""
"Allows the use of OpenID for account registration, authentication, and "
"commenting. Also includes an OpenID provider which can turn WordPress "
"author URLs into OpenIDs."
msgstr ""
-#. Author of an extension
+#. Author of the plugin/theme
msgid "DiSo Development Team"
msgstr ""
-#. Author URI of an extension
+#. Author URI of the plugin/theme
msgid "http://diso-project.org/"
-msgstr ""
+msgstr "" \ No newline at end of file
diff --git a/plugins/openid/login.php b/plugins/openid/login.php
index c0b95a1d..0c21bec7 100644
--- a/plugins/openid/login.php
+++ b/plugins/openid/login.php
@@ -5,13 +5,13 @@
*/
-add_action( 'login_head', 'openid_wp_login_head');
-add_action( 'login_form', 'openid_wp_login_form');
-add_action( 'register_form', 'openid_wp_register_form', 9);
-add_action( 'register_post', 'openid_register_post', 10, 3);
-add_action( 'openid_finish_auth', 'openid_finish_login', 10, 2);
-add_filter( 'registration_errors', 'openid_clean_registration_errors', -99);
-add_filter( 'registration_errors', 'openid_registration_errors');
+add_action( 'login_head', 'openid_wp_login_head' );
+add_action( 'login_form', 'openid_wp_login_form' );
+add_action( 'register_form', 'openid_wp_register_form', 9 );
+add_action( 'register_post', 'openid_register_post', 10, 3 );
+add_action( 'openid_finish_auth', 'openid_finish_login', 10, 2 );
+add_filter( 'registration_errors', 'openid_clean_registration_errors', -99 );
+add_filter( 'registration_errors', 'openid_registration_errors' );
add_action( 'init', 'openid_login_errors' );
@@ -20,37 +20,36 @@ add_action( 'init', 'openid_login_errors' );
*
* @param mixed $user authenticated user object, or WP_Error or null
*/
-function openid_authenticate($user) {
- if ( array_key_exists('openid_identifier', $_POST) && $_POST['openid_identifier'] ) {
+function openid_authenticate( $user ) {
+ if ( array_key_exists( 'openid_identifier', $_POST ) && $_POST['openid_identifier'] ) {
- $redirect_to = array_key_exists('redirect_to', $_REQUEST) ? $_REQUEST['redirect_to'] : null;
- openid_start_login($_POST['openid_identifier'], 'login', $redirect_to);
+ $redirect_to = array_key_exists( 'redirect_to', $_REQUEST ) ? $_REQUEST['redirect_to'] : null;
+ openid_start_login( $_POST['openid_identifier'], 'login', $redirect_to );
// if we got this far, something is wrong
global $error;
$error = openid_message();
- $user = new WP_Error( 'openid_login_error', $error );
+ $user = new WP_Error( 'openid_login_error', $error );
- } else if ( array_key_exists('finish_openid', $_REQUEST) ) {
+ } elseif ( array_key_exists( 'finish_openid', $_REQUEST ) ) {
- $identity_url= $_REQUEST['identity_url'];
+ $identity_url = $_REQUEST['identity_url'];
- if ( !wp_verify_nonce($_REQUEST['_wpnonce'], 'openid_login_' . md5($identity_url)) ) {
- $user = new WP_Error('openid_login_error', __('Error during OpenID authentication. Please try again. (invalid nonce)', 'openid'));
+ if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'openid_login_' . md5( $identity_url ) ) ) {
+ $user = new WP_Error( 'openid_login_error', __( 'Error during OpenID authentication. Please try again. (invalid nonce)', 'openid' ) );
return $user;
}
if ( $identity_url ) {
- $user_id = get_user_by_openid($identity_url);
+ $user_id = get_user_by_openid( $identity_url );
if ( $user_id ) {
- $user = new WP_User($user_id);
+ $user = new WP_User( $user_id );
} else {
- $user = new WP_Error('openid_registration_closed', __('Your have entered a valid OpenID, but this site is not currently accepting new accounts.', 'openid'));
+ $user = new WP_Error( 'openid_registration_closed', __( 'Your have entered a valid OpenID, but this site is not currently accepting new accounts.', 'openid' ) );
}
- } else if ( array_key_exists('openid_error', $_REQUEST) ) {
- $user = new WP_Error('openid_login_error', htmlentities2($_REQUEST['openid_error']));
+ } elseif ( array_key_exists( 'openid_error', $_REQUEST ) ) {
+ $user = new WP_Error( 'openid_login_error', htmlentities2( $_REQUEST['openid_error'] ) );
}
-
}
return $user;
@@ -64,46 +63,51 @@ add_action( 'authenticate', 'openid_authenticate' );
*
* @param string $identity_url verified OpenID URL
*/
-function openid_finish_login($identity_url, $action) {
- if ($action != 'login') return;
+function openid_finish_login( $identity_url, $action ) {
+ if ( $action != 'login' ) {
+ return;
+ }
- if ($identity_url) {
+ if ( $identity_url ) {
// create new user account if appropriate
- $user_id = get_user_by_openid($identity_url);
- $user_data = openid_get_user_data($identity_url);
+ $user_id = get_user_by_openid( $identity_url );
+ $user_data = openid_get_user_data( $identity_url );
- if (!$user_id) {
- if (get_option('users_can_register')) {
+ if ( ! $user_id ) {
+ if ( get_option( 'users_can_register' ) ) {
// registration is enabled so create a new user
- openid_create_new_user($identity_url, $user_data);
+ openid_create_new_user( $identity_url, $user_data );
} else {
// generate a error because it is not possible to create a new user
- openid_message(__('Unable to create a new user.', 'openid'));
- openid_status('error');
+ openid_message( __( 'Unable to create a new user.', 'openid' ) );
+ openid_status( 'error' );
}
} else {
- do_action('openid_consumer_update_user_custom_data', $user_id, $user_data);
+ do_action( 'openid_consumer_update_user_custom_data', $user_id, $user_data );
}
}
// return to wp-login page
- $url = get_option('siteurl') . '/wp-login.php';
+ $url = get_option( 'siteurl' ) . '/wp-login.php';
$status = openid_status();
- $error = openid_message();
+ $error = openid_message();
- if ($status == 'error' && !empty($error)) {
- $url = add_query_arg('openid_error', openid_message(), $url);
+ if ( $status == 'error' && ! empty( $error ) ) {
+ $url = add_query_arg( 'openid_error', openid_message(), $url );
}
- $url = add_query_arg( array(
- 'finish_openid' => 1,
- 'identity_url' => urlencode($identity_url),
- 'redirect_to' => $_SESSION['openid_finish_url'],
- '_wpnonce' => wp_create_nonce('openid_login_' . md5($identity_url)),
- ), $url);
-
- wp_safe_redirect($url);
+ $url = add_query_arg(
+ array(
+ 'finish_openid' => 1,
+ 'identity_url' => urlencode( $identity_url ),
+ 'redirect_to' => $_SESSION['openid_finish_url'],
+ '_wpnonce' => wp_create_nonce( 'openid_login_' . md5( $identity_url ) ),
+ ),
+ $url
+ );
+
+ wp_safe_redirect( $url );
exit;
}
@@ -113,11 +117,13 @@ function openid_finish_login($identity_url, $action) {
*/
function openid_login_errors() {
$self = basename( $GLOBALS['pagenow'] );
- if ($self != 'wp-login.php') return;
+ if ( $self != 'wp-login.php' ) {
+ return;
+ }
- if ( array_key_exists('openid_error', $_REQUEST) ) {
+ if ( array_key_exists( 'openid_error', $_REQUEST ) ) {
global $error;
- $error = htmlentities2($_REQUEST['openid_error']);
+ $error = htmlentities2( $_REQUEST['openid_error'] );
}
}
@@ -140,12 +146,12 @@ function openid_wp_login_form() {
echo '
<p style="margin-bottom: 8px;">
- <label style="display: block; margin-bottom: 5px;">' . __('Or login using an OpenID', 'openid') . '<br />
+ <label style="display: block; margin-bottom: 5px;">' . __( 'Or login using an OpenID', 'openid' ) . '<br />
<input type="text" name="openid_identifier" id="openid_identifier" class="input openid_identifier" value="" size="20" tabindex="25" /></label>
</p>
<p style="font-size: 0.9em; margin: 8px 0 24px 0;" id="what_is_openid">
- <a href="http://openid.net/what/" target="_blank">'.__('Learn about OpenID', 'openid').'</a>
+ <a href="http://openid.net/what/" target="_blank">' . __( 'Learn about OpenID', 'openid' ) . '</a>
</p>';
}
@@ -159,13 +165,13 @@ function openid_wp_register_form() {
echo '
<div style="width:100%;">'; //Added to fix IE problem
- if (get_option('openid_required_for_registration')) {
- wp_enqueue_script('jquery');
- wp_enqueue_script('openid-register', plugin_dir_url(__FILE__) . 'f/register.js', array('jquery'), OPENID_PLUGIN_REVISION);
+ if ( get_option( 'openid_required_for_registration' ) ) {
+ wp_enqueue_script( 'jquery' );
+ wp_enqueue_script( 'openid-register', plugin_dir_url( __FILE__ ) . 'f/register.js', array( 'jquery' ), OPENID_PLUGIN_REVISION );
- $label = __('Register using an OpenID:', 'openid');
+ $label = __( 'Register using an OpenID:', 'openid' );
} else {
- $label = __('Or register using an OpenID:', 'openid');
+ $label = __( 'Or register using an OpenID:', 'openid' );
echo '<hr id="openid_split" style="clear: both; margin-bottom: 1.5em; border: 0; border-top: 1px solid #999; height: 1px;" />';
@@ -185,7 +191,7 @@ function openid_wp_register_form() {
</p>
<p style="float: left; font-size: 0.8em; margin: 0.8em 0;" id="what_is_openid">
- <a href="http://openid.net/what/" target="_blank">'.__('Learn about OpenID', 'openid').'</a>
+ <a href="http://openid.net/what/" target="_blank">' . __( 'Learn about OpenID', 'openid' ) . '</a>
</p>
</div>';
@@ -196,22 +202,24 @@ function openid_wp_register_form() {
/**
* Clean out registration errors that don't apply.
*/
-function openid_clean_registration_errors($errors) {
- if (get_option('openid_required_for_registration') || !empty($_POST['openid_identifier'])) {
+function openid_clean_registration_errors( $errors ) {
+ if ( get_option( 'openid_required_for_registration' ) || ! empty( $_POST['openid_identifier'] ) ) {
$new = new WP_Error();
- foreach ($errors->get_error_codes() as $code) {
- if (in_array($code, array('empty_username', 'empty_email'))) continue;
+ foreach ( $errors->get_error_codes() as $code ) {
+ if ( in_array( $code, array( 'empty_username', 'empty_email' ) ) ) {
+ continue;
+ }
- $message = $errors->get_error_message($code);
- $data = $errors->get_error_data($code);
- $new->add($code, $message, $data);
+ $message = $errors->get_error_message( $code );
+ $data = $errors->get_error_data( $code );
+ $new->add( $code, $message, $data );
}
$errors = $new;
}
- if (get_option('openid_required_for_registration') && empty($_POST['openid_identifier'])) {
- $errors->add('openid_only', __('<strong>ERROR</strong>: ', 'openid') . __('New users must register using OpenID.', 'openid'));
+ if ( get_option( 'openid_required_for_registration' ) && empty( $_POST['openid_identifier'] ) ) {
+ $errors->add( 'openid_only', __( '<strong>ERROR</strong>: ', 'openid' ) . __( 'New users must register using OpenID.', 'openid' ) );
}
return $errors;
@@ -220,9 +228,9 @@ function openid_clean_registration_errors($errors) {
/**
* Handle WordPress registration errors.
*/
-function openid_registration_errors($errors) {
- if (!empty($_POST['openid_identifier'])) {
- $errors->add('invalid_openid', __('<strong>ERROR</strong>: ', 'openid') . openid_message());
+function openid_registration_errors( $errors ) {
+ if ( ! empty( $_POST['openid_identifier'] ) ) {
+ $errors->add( 'invalid_openid', __( '<strong>ERROR</strong>: ', 'openid' ) . openid_message() );
}
return $errors;
@@ -232,8 +240,8 @@ function openid_registration_errors($errors) {
/**
* Handle WordPress registrations.
*/
-function openid_register_post($username, $password, $errors) {
- if ( !empty($_POST['openid_identifier']) ) {
+function openid_register_post( $username, $password, $errors ) {
+ if ( ! empty( $_POST['openid_identifier'] ) ) {
wp_signon();
}
}
diff --git a/plugins/openid/openid.php b/plugins/openid/openid.php
index 86fb4725..5a2ecd0a 100644
--- a/plugins/openid/openid.php
+++ b/plugins/openid/openid.php
@@ -5,8 +5,8 @@
* Description: Allows the use of OpenID for account registration, authentication, and commenting. Also includes an OpenID provider which can turn WordPress author URLs into OpenIDs.
* Author: DiSo Development Team
* Author URI: http://diso-project.org/
- * Version: 3.5.0
- * Requires PHP: 5.3
+ * Version: 3.6.1
+ * Requires PHP: 5.6
* License: Apache 2.0
* License URI: https://www.apache.org/licenses/LICENSE-2.0
* Text Domain: openid
@@ -186,7 +186,7 @@ if ( ! function_exists( 'get_userdata_by_various' ) ) :
return false;
}
return $user->data;
- } else if ( is_numeric( $id_or_name ) ) {
+ } elseif ( is_numeric( $id_or_name ) ) {
return get_user_by( 'id', $id_or_name );
} else {
return get_user_by( 'login', $id_or_name );
diff --git a/plugins/openid/readme.txt b/plugins/openid/readme.txt
index 56cbd1c9..5ec8714d 100644
--- a/plugins/openid/readme.txt
+++ b/plugins/openid/readme.txt
@@ -2,10 +2,10 @@
Contributors: willnorris, factoryjoe, pfefferle
Tags: openid, authentication, login, comments
Requires at least: 2.8
-Tested up to: 5.1
-Stable tag: 3.5.0
-Requires PHP: 5.3
-License: Apache 2.0
+Tested up to: 6.0
+Stable tag: 3.6.1
+Requires PHP: 5.6
+License: Apache-2.0
License URI: https://www.apache.org/licenses/LICENSE-2.0
Allows WordPress to provide and consumer OpenIDs for authentication of users and comments.
@@ -99,6 +99,15 @@ report at <http://code.google.com/p/diso/issues/list>.
Project maintined on github at
[diso/wordpress-openid](https://github.com/diso/wordpress-openid).
+= version 3.6.1 (June 2022) =
+ - fixed PHP 8 issue (props to mscherer)
+ - updated code to match the WordPress Coding Standard
+
+= version 3.6.0 (Mai 2022) =
+ - fixed issue with ActivityPub plugin
+ - updated to latest OpenID library
+ - added CI/CD toolings
+
= version 3.5.0 (Feb 12, 2019) =
- fixed PHP warnings and deprecation messages
diff --git a/plugins/openid/server.php b/plugins/openid/server.php
index 2804fcd1..05ca5d37 100644
--- a/plugins/openid/server.php
+++ b/plugins/openid/server.php
@@ -48,8 +48,8 @@ function openid_provider_xrds_simple( $xrds ) {
if ( ! $user && get_option( 'openid_blog_owner' ) ) {
$url_parts = parse_url( get_option( 'home' ) );
- $path = array_key_exists( 'path', $url_parts ) ? $url_parts['path'] : '';
- $path = trailingslashit( $path );
+ $path = array_key_exists( 'path', $url_parts ) ? $url_parts['path'] : '';
+ $path = trailingslashit( $path );
$script = preg_replace( '/index.php$/', '', $_SERVER['SCRIPT_NAME'] );
$script = trailingslashit( $script );
@@ -76,32 +76,32 @@ function openid_provider_xrds_simple( $xrds ) {
$services = array();
$tmp_types = apply_filters( 'openid_server_xrds_types', array( 'http://specs.openid.net/auth/2.0/signon' ) );
- $types = array();
+ $types = array();
foreach ( $tmp_types as $t ) {
$types[] = array( 'content' => $t );
}
$services[] = array(
- 'Type' => $types,
- 'URI' => openid_server_url(),
+ 'Type' => $types,
+ 'URI' => openid_server_url(),
'LocalID' => get_author_posts_url( $user->ID ),
);
$tmp_types = apply_filters( 'openid_server_xrds_types', array( 'http://openid.net/signon/1.1' ) );
- $types = array();
+ $types = array();
foreach ( $tmp_types as $t ) {
$types[] = array( 'content' => $t );
}
$services[] = array(
- 'Type' => $types,
- 'URI' => openid_server_url(),
+ 'Type' => $types,
+ 'URI' => openid_server_url(),
'openid:Delegate' => get_author_posts_url( $user->ID ),
);
}
} else {
$services = array(
array(
- 'Type' => array( array( 'content' => 'http://specs.openid.net/auth/2.0/server' ) ),
- 'URI' => openid_server_url(),
+ 'Type' => array( array( 'content' => 'http://specs.openid.net/auth/2.0/server' ) ),
+ 'URI' => openid_server_url(),
'LocalID' => 'http://specs.openid.net/auth/2.0/identifier_select',
),
);
@@ -136,19 +136,19 @@ function openid_provider_webfinger( $webfinger, $resource, $user ) {
if ( get_user_meta( $user->ID, 'openid_delegate', true ) ) {
$webfinger['links'][] = array(
'href' => get_user_meta( $user->ID, 'openid_delegate', true ),
- 'rel' => 'http://specs.openid.net/auth/2.0/provider',
+ 'rel' => 'http://specs.openid.net/auth/2.0/provider',
);
} else {
// check if WebFinger user is "blog-owner"
if ( get_option( 'openid_blog_owner' ) && get_option( 'openid_blog_owner' ) == $user->user_login ) {
$webfinger['links'][] = array(
'href' => site_url( '/' ),
- 'rel' => 'http://specs.openid.net/auth/2.0/provider',
+ 'rel' => 'http://specs.openid.net/auth/2.0/provider',
);
} else { // otherwise use author-url
$webfinger['links'][] = array(
'href' => get_author_posts_url( $user->ID ),
- 'rel' => 'http://specs.openid.net/auth/2.0/provider',
+ 'rel' => 'http://specs.openid.net/auth/2.0/provider',
);
}
}
@@ -248,15 +248,20 @@ function openid_server_auth_request( $request ) {
do_action( 'openid_server_post_auth', $request );
// get some user data
- $user = wp_get_current_user();
+ $user = wp_get_current_user();
$author_url = get_author_posts_url( $user->ID );
- $id_select = $request->idSelect();
+ $id_select = ( $request->identity == 'http://specs.openid.net/auth/2.0/identifier_select' );
// bail if user does not have access to OpenID provider
if ( ! $user->has_cap( 'use_openid_provider' ) ) {
return $request->answer( false );
}
+ // bail if user doesn't own identity and not using id select
+ if ( ! $id_select && ( $author_url != $request->identity ) ) {
+ return $request->answer( false );
+ }
+
// if using id select but user is delegating, display error to user (unless checkid_immediate)
if ( $id_select && get_user_meta( $user->ID, 'openid_delegate', true ) ) {
if ( 'checkid_immediate' != $request->mode ) {
@@ -270,14 +275,14 @@ function openid_server_auth_request( $request ) {
echo '<h1>' . __( 'OpenID Login Error', 'openid' ) . '</h1>';
echo '<p>';
- printf( __( 'Because you have delegated your OpenID, you cannot login with the URL <strong>%s</strong>. Instead, you must use your full OpenID when logging in.', 'openid'), trailingslashit( get_option( 'home' ) ) );
+ printf( __( 'Because you have delegated your OpenID, you cannot login with the URL <strong>%s</strong>. Instead, you must use your full OpenID when logging in.', 'openid' ), trailingslashit( get_option( 'home' ) ) );
echo'</p>';
- echo '<p>' . sprintf( __( 'Your full OpenID is: %s', 'openid'), '<strong>' . $author_url . '</strong>' ) . '</p>';
+ echo '<p>' . sprintf( __( 'Your full OpenID is: %s', 'openid' ), '<strong>' . $author_url . '</strong>' ) . '</p>';
echo '
<form method="post">
<p class="submit">
- <input type="submit" value="'.__('Continue').'" />
+ <input type="submit" value="' . __( 'Continue' ) . '" />
<input type="hidden" name="action" value="cancel" />
<input type="hidden" name="openid_server" value="1" />
</p>'
@@ -293,7 +298,7 @@ function openid_server_auth_request( $request ) {
// if user trusts site, we're done
$trusted_sites = get_user_meta( $user->ID, 'openid_trusted_sites', true );
- $site_hash = md5( $request->trust_root );
+ $site_hash = md5( $request->trust_root );
if ( is_array( $trusted_sites ) && array_key_exists( $site_hash, $trusted_sites ) ) {
$trusted_sites[ $site_hash ]['last_login'] = time();
update_user_meta( $user->ID, 'openid_trusted_sites', $trusted_sites );
@@ -421,7 +426,7 @@ function openid_provider_link_tags() {
}
}
} else {
- $server = openid_server_url();
+ $server = openid_server_url();
$identifier = get_author_posts_url( $user->ID );
echo '
@@ -471,8 +476,8 @@ function openid_server_user_trust( $request ) {
);
$site = apply_filters( 'openid_server_store_trusted_site', $site );
- $trusted_sites = get_user_meta( $user->ID, 'openid_trusted_sites', true );
- $site_hash = md5( $request->trust_root );
+ $trusted_sites = get_user_meta( $user->ID, 'openid_trusted_sites', true );
+ $site_hash = md5( $request->trust_root );
$trusted_sites[ $site_hash ] = $site;
update_user_meta( $user->ID, 'openid_trusted_sites', $trusted_sites );
@@ -502,7 +507,7 @@ function openid_server_user_trust( $request ) {
<div id="site">' . get_option( 'blogname' ) . '</div>';
if ( is_user_logged_in() ) {
- $user = wp_get_current_user();
+ $user = wp_get_current_user();
$logout_url = site_url( 'wp-login.php?action=logout&redirect_to=' . urlencode( openid_server_url() ), 'login' );
echo '
<div id="loggedin">' . sprintf( __( 'Logged in as %1$s (%2$s). <a href="%3$s">Use a different account?</a>', 'openid' ), $user->display_name, $user->user_login, $logout_url ) . '</div>';
@@ -530,8 +535,10 @@ function openid_server_user_trust( $request ) {
</p>
<p style="margin: 3em 0 1em 0; font-size: 0.8em;">'
- . sprintf( __( 'Manage or remove access on the <a href="%s" target="_blank">Trusted Sites</a> page.', 'openid' ),
- admin_url( ( current_user_can( 'edit_users' ) ? 'users.php' : 'profile.php' ) . '?page=openid_trusted_sites' ) )
+ . sprintf(
+ __( 'Manage or remove access on the <a href="%s" target="_blank">Trusted Sites</a> page.', 'openid' ),
+ admin_url( ( current_user_can( 'edit_users' ) ? 'users.php' : 'profile.php' ) . '?page=openid_trusted_sites' )
+ )
. '</p>
<p style="margin: 1em 0; font-size: 0.8em;">'
. sprintf( __( '<a href="%s" target="_blank">Edit your profile</a> to change the information that gets shared with Trusted Sites.', 'openid' ), admin_url( 'profile.php' ) )
@@ -603,8 +610,8 @@ function openid_server_get_delegation_info( $userid, $url = null ) {
}
$html_content = $response->body;
- $p = new Auth_OpenID_Parse();
- $link_attrs = $p->parseLinkAttrs( $html_content );
+ $p = new Auth_OpenID_Parse();
+ $link_attrs = $p->parseLinkAttrs( $html_content );
// check HTML for OpenID2
$server_url = $p->findFirstHref( $link_attrs, 'openid2.provider' );
@@ -614,8 +621,8 @@ function openid_server_get_delegation_info( $userid, $url = null ) {
$openid_url = $url;
}
$services[] = array(
- 'Type' => array( array( 'content' => Auth_OpenID_Type_1_1 ) ),
- 'URI' => $server_url,
+ 'Type' => array( array( 'content' => Auth_OpenID_Type_1_1 ) ),
+ 'URI' => $server_url,
'LocalID' => $openid_url,
);
}
diff --git a/plugins/openid/server_ext.php b/plugins/openid/server_ext.php
index b0fced72..33caa547 100644
--- a/plugins/openid/server_ext.php
+++ b/plugins/openid/server_ext.php
@@ -33,7 +33,7 @@ function openid_server_sreg_post_auth( $request ) {
*/
function openid_server_sreg_trust_form( $attributes ) {
$sreg_request = $GLOBALS['openid_server_sreg_request'];
- $sreg_fields = $sreg_request->allRequestedFields();
+ $sreg_fields = $sreg_request->allRequestedFields();
if ( ! empty( $sreg_fields ) ) {
foreach ( $sreg_fields as $field ) {
@@ -79,9 +79,9 @@ function openid_server_attributes_string( $fields, $string = '' ) {
return join( ' and ', $fields );
}
$string = array_shift( $fields );
- } else if ( sizeof( $fields ) == 1 ) {
+ } elseif ( sizeof( $fields ) == 1 ) {
$string .= ', and ' . array_shift( $fields );
- } else if ( sizeof( $fields ) > 1 ) {
+ } elseif ( sizeof( $fields ) > 1 ) {
$string .= ', ' . array_shift( $fields );
}
@@ -123,8 +123,8 @@ function openid_server_sreg_auth_response( $response ) {
$include_sreg = $GLOBALS['openid_server_sreg_trust'];
} else {
$trusted_sites = get_user_meta( $user->ID, 'openid_trusted_sites', true );
- $request = $response->request;
- $site_hash = md5( $request->trust_root );
+ $request = $response->request;
+ $site_hash = md5( $request->trust_root );
if ( is_array( $trusted_sites ) && array_key_exists( $site_hash, $trusted_sites ) ) {
$include_sreg = $trusted_sites[ $site_hash ]['release_attributes'];
}
@@ -159,7 +159,7 @@ function openid_server_sreg_auth_response( $response ) {
* where '*' is the name of the sreg attribute.
*/
function openid_server_sreg_from_profile( $field ) {
- $user = wp_get_current_user();
+ $user = wp_get_current_user();
$value = '';
switch ( $field ) {
@@ -173,7 +173,7 @@ function openid_server_sreg_from_profile( $field ) {
case 'fullname':
$user_data = get_userdata( $user->ID );
- $value = $user_data->display_name;
+ $value = $user_data->display_name;
break;
}
diff --git a/plugins/openid/store.php b/plugins/openid/store.php
index 838d41af..0986b3c1 100644
--- a/plugins/openid/store.php
+++ b/plugins/openid/store.php
@@ -9,192 +9,213 @@
require_once 'Auth/OpenID/Interface.php';
require_once 'Auth/OpenID/Association.php';
-if (!class_exists('WordPress_OpenID_OptionStore')):
-/**
- * OpenID store that uses the WordPress options table for storage. Originally
- * written by Simon Willison for use in the mu-open-id plugin. Modified a fair
- * amount for use in WordPress OpenID.
- */
-class WordPress_OpenID_OptionStore extends Auth_OpenID_OpenIDStore {
-
- function storeAssociation($server_url, $association) {
- $key = $this->_getAssociationKey($server_url, $association->handle);
- $association_s = $association->serialize();
- // prevent the likelihood of a race condition - don't rely on cache
- wp_cache_delete('openid_associations', 'options');
- $associations = get_option('openid_associations');
- if ($associations == null) {
- $associations = array();
+if ( ! class_exists( 'WordPress_OpenID_OptionStore' ) ) :
+ /**
+ * OpenID store that uses the WordPress options table for storage. Originally
+ * written by Simon Willison for use in the mu-open-id plugin. Modified a fair
+ * amount for use in WordPress OpenID.
+ */
+ class WordPress_OpenID_OptionStore extends Auth_OpenID_OpenIDStore {
+
+ function storeAssociation( $server_url, $association ) {
+ $key = $this->_getAssociationKey( $server_url, $association->handle );
+ $association_s = $association->serialize();
+ // prevent the likelihood of a race condition - don't rely on cache
+ wp_cache_delete( 'openid_associations', 'options' );
+ $associations = get_option( 'openid_associations' );
+ if ( $associations == null ) {
+ $associations = array();
+ }
+ $associations[ $key ] = $association_s;
+ update_option( 'openid_associations', $associations );
}
- $associations[$key] = $association_s;
- update_option('openid_associations', $associations);
- }
- function getAssociation($server_url, $handle = null) {
- //wp_cache_delete('openid_associations', 'options');
- if ($handle === null) {
- $handle = '';
- }
- $key = $this->_getAssociationKey($server_url, $handle);
- $associations = get_option('openid_associations');
- if ($handle && array_key_exists($key, $associations)) {
- return Auth_OpenID_Association::deserialize(
- 'Auth_OpenID_Association', $associations[$key]
- );
- } else {
- // Return the most recently issued association
- $matching_keys = array();
- foreach (array_keys($associations) as $assoc_key) {
- if (strpos($assoc_key, $key) === 0) {
- $matching_keys[] = $assoc_key;
- }
+ function getAssociation( $server_url, $handle = null ) {
+ //wp_cache_delete('openid_associations', 'options');
+ if ( $handle === null ) {
+ $handle = '';
}
- $matching_associations = array();
- // sort by time issued
- foreach ($matching_keys as $assoc_key) {
- if (array_key_exists($assoc_key, $associations)) {
- $association = Auth_OpenID_Association::deserialize(
- 'Auth_OpenID_Association', $associations[$assoc_key]
- );
+ $key = $this->_getAssociationKey( $server_url, $handle );
+ $associations = get_option( 'openid_associations' );
+ if ( $handle && array_key_exists( $key, $associations ) ) {
+ return Auth_OpenID_Association::deserialize(
+ 'Auth_OpenID_Association',
+ $associations[ $key ]
+ );
+ } else {
+ // Return the most recently issued association
+ $matching_keys = array();
+ foreach ( array_keys( $associations ) as $assoc_key ) {
+ if ( strpos( $assoc_key, $key ) === 0 ) {
+ $matching_keys[] = $assoc_key;
+ }
}
- if ($association !== null) {
- $matching_associations[] = array(
- $association->issued, $association
- );
+ $matching_associations = array();
+ // sort by time issued
+ foreach ( $matching_keys as $assoc_key ) {
+ if ( array_key_exists( $assoc_key, $associations ) ) {
+ $association = Auth_OpenID_Association::deserialize(
+ 'Auth_OpenID_Association',
+ $associations[ $assoc_key ]
+ );
+ }
+ if ( $association !== null ) {
+ $matching_associations[] = array(
+ $association->issued,
+ $association,
+ );
+ }
+ }
+ $issued = array();
+ $assocs = array();
+ foreach ( $matching_associations as $assoc_key => $assoc ) {
+ $issued[ $assoc_key ] = $assoc[0];
+ $assocs[ $assoc_key ] = $assoc[1];
+ }
+ array_multisort(
+ $issued,
+ SORT_DESC,
+ $assocs,
+ SORT_DESC,
+ $matching_associations
+ );
+
+ // return the most recently issued one.
+ if ( $matching_associations ) {
+ list($issued, $assoc) = $matching_associations[0];
+ return $assoc;
+ } else {
+ return null;
}
}
- $issued = array();
- $assocs = array();
- foreach ($matching_associations as $assoc_key => $assoc) {
- $issued[$assoc_key] = $assoc[0];
- $assocs[$assoc_key] = $assoc[1];
- }
- array_multisort($issued, SORT_DESC, $assocs, SORT_DESC,
- $matching_associations);
+ }
- // return the most recently issued one.
- if ($matching_associations) {
- list($issued, $assoc) = $matching_associations[0];
- return $assoc;
- } else {
+ function _getAssociationKey( $server_url, $handle ) {
+ if ( strpos( $server_url, '://' ) === false ) {
+ trigger_error(
+ sprintf( 'Bad server URL: %s', $server_url ),
+ E_USER_WARNING
+ );
return null;
}
+ list($proto, $rest) = explode( '://', $server_url, 2 );
+ $parts = explode( '/', $rest );
+ $domain = $parts[0];
+ $url_hash = base64_encode( $server_url );
+ if ( $handle ) {
+ $handle_hash = base64_encode( $handle );
+ } else {
+ $handle_hash = '';
+ }
+ return sprintf(
+ '%s-%s-%s-%s',
+ $proto,
+ $domain,
+ $url_hash,
+ $handle_hash
+ );
}
- }
-
- function _getAssociationKey($server_url, $handle) {
- if (strpos($server_url, '://') === false) {
- trigger_error(sprintf("Bad server URL: %s", $server_url),
- E_USER_WARNING);
- return null;
- }
- list($proto, $rest) = explode('://', $server_url, 2);
- $parts = explode('/', $rest);
- $domain = $parts[0];
- $url_hash = base64_encode($server_url);
- if ($handle) {
- $handle_hash = base64_encode($handle);
- } else {
- $handle_hash = '';
- }
- return sprintf('%s-%s-%s-%s',
- $proto, $domain, $url_hash, $handle_hash);
- }
- function removeAssociation($server_url, $handle) {
- // Remove the matching association if it's found, and
- // returns whether the association was removed or not.
- $key = $this->_getAssociationKey($server_url, $handle);
- $assoc = $this->getAssociation($server_url, $handle);
- if ($assoc === null) {
- return false;
- } else {
- $associations = get_option('openid_associations');
- if (isset($associations[$key])) {
- unset($associations[$key]);
- update_option('openid_associations', $associations);
- return true;
- } else {
+ function removeAssociation( $server_url, $handle ) {
+ // Remove the matching association if it's found, and
+ // returns whether the association was removed or not.
+ $key = $this->_getAssociationKey( $server_url, $handle );
+ $assoc = $this->getAssociation( $server_url, $handle );
+ if ( $assoc === null ) {
return false;
+ } else {
+ $associations = get_option( 'openid_associations' );
+ if ( isset( $associations[ $key ] ) ) {
+ unset( $associations[ $key ] );
+ update_option( 'openid_associations', $associations );
+ return true;
+ } else {
+ return false;
+ }
}
}
- }
-
- function useNonce($server_url, $timestamp, $salt) {
- global $Auth_OpenID_SKEW;
- if ( abs($timestamp - time()) > $Auth_OpenID_SKEW ) {
- return false;
- }
+ function useNonce( $server_url, $timestamp, $salt ) {
+ global $Auth_OpenID_SKEW;
- $key = $this->_getNonceKey($server_url, $timestamp, $salt);
+ if ( abs( $timestamp - time() ) > $Auth_OpenID_SKEW ) {
+ return false;
+ }
- // prevent the likelihood of a race condition - don't rely on cache
- wp_cache_delete('openid_nonces', 'options');
- $nonces = get_option('openid_nonces');
- if ($nonces == null) {
- $nonces = array();
- }
+ $key = $this->_getNonceKey( $server_url, $timestamp, $salt );
- if (array_key_exists($key, $nonces)) {
- return false;
- } else {
- $nonces[$key] = $timestamp;
- update_option('openid_nonces', $nonces);
- return true;
- }
- }
+ // prevent the likelihood of a race condition - don't rely on cache
+ wp_cache_delete( 'openid_nonces', 'options' );
+ $nonces = get_option( 'openid_nonces' );
+ if ( $nonces == null ) {
+ $nonces = array();
+ }
- function _getNonceKey($server_url, $timestamp, $salt) {
- if ($server_url) {
- list($proto, $rest) = explode('://', $server_url, 2);
- } else {
- $proto = '';
- $rest = '';
+ if ( array_key_exists( $key, $nonces ) ) {
+ return false;
+ } else {
+ $nonces[ $key ] = $timestamp;
+ update_option( 'openid_nonces', $nonces );
+ return true;
+ }
}
- $parts = explode('/', $rest, 2);
- $domain = $parts[0];
- $url_hash = base64_encode($server_url);
- $salt_hash = base64_encode($salt);
+ function _getNonceKey( $server_url, $timestamp, $salt ) {
+ if ( $server_url ) {
+ list($proto, $rest) = explode( '://', $server_url, 2 );
+ } else {
+ $proto = '';
+ $rest = '';
+ }
- return sprintf('%08x-%s-%s-%s-%s', $timestamp, $proto,
- $domain, $url_hash, $salt_hash);
- }
+ $parts = explode( '/', $rest, 2 );
+ $domain = $parts[0];
+ $url_hash = base64_encode( $server_url );
+ $salt_hash = base64_encode( $salt );
+
+ return sprintf(
+ '%08x-%s-%s-%s-%s',
+ $timestamp,
+ $proto,
+ $domain,
+ $url_hash,
+ $salt_hash
+ );
+ }
- function cleanupNonces() {
- global $Auth_OpenID_SKEW;
+ function cleanupNonces() {
+ global $Auth_OpenID_SKEW;
- $nonces = get_option('openid_nonces');
+ $nonces = get_option( 'openid_nonces' );
- foreach ($nonces as $nonce => $time) {
- if ( abs($time - time()) > $Auth_OpenID_SKEW ) {
- unset($nonces[$nonce]);
+ foreach ( $nonces as $nonce => $time ) {
+ if ( abs( $time - time() ) > $Auth_OpenID_SKEW ) {
+ unset( $nonces[ $nonce ] );
+ }
}
- }
- update_option('openid_nonces', $nonces);
- }
+ update_option( 'openid_nonces', $nonces );
+ }
- function cleanupAssociations() {
- $associations = get_option('openid_associations');
+ function cleanupAssociations() {
+ $associations = get_option( 'openid_associations' );
- foreach ($associations as $key => $assoc_s) {
- $assoc = Auth_OpenID_Association::deserialize('Auth_OpenID_Association', $assoc_s);
+ foreach ( $associations as $key => $assoc_s ) {
+ $assoc = Auth_OpenID_Association::deserialize( 'Auth_OpenID_Association', $assoc_s );
- if ( $assoc->getExpiresIn() == 0) {
- unset($associations[$key]);
+ if ( $assoc->getExpiresIn() == 0 ) {
+ unset( $associations[ $key ] );
+ }
}
- }
- update_option('openid_associations', $associations);
- }
+ update_option( 'openid_associations', $associations );
+ }
- function reset() {
- update_option('openid_nonces', array());
- update_option('openid_associations', array());
+ function reset() {
+ update_option( 'openid_nonces', array() );
+ update_option( 'openid_associations', array() );
+ }
}
-}
endif;
@@ -204,24 +225,24 @@ endif;
* @param bool $retry if true, tables will try to be recreated if they are not okay
* @return bool if tables are okay
*/
-function openid_check_tables($retry=true) {
+function openid_check_tables( $retry = true ) {
global $wpdb;
- $ok = true;
+ $ok = true;
$message = array();
- $tables = array(
+ $tables = array(
openid_identity_table(),
);
- foreach( $tables as $t ) {
- if( $wpdb->get_var("SHOW TABLES LIKE '$t'") != $t ) {
- $ok = false;
+ foreach ( $tables as $t ) {
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '$t'" ) != $t ) {
+ $ok = false;
$message[] = "Table $t doesn't exist.";
} else {
$message[] = "Table $t exists.";
}
}
- if( $retry and !$ok) {
+ if ( $retry and ! $ok ) {
openid_create_tables();
$ok = openid_check_tables( false );
}
@@ -231,17 +252,16 @@ function openid_check_tables($retry=true) {
/**
* Create OpenID related tables in the WordPress database.
*/
-function openid_create_tables()
-{
+function openid_create_tables() {
global $wpdb;
$store = openid_getStore();
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
// Create the SQL and call the WP schema upgrade function
$statements = array(
- "CREATE TABLE ".openid_identity_table()." (
+ 'CREATE TABLE ' . openid_identity_table() . " (
uurl_id bigint(20) NOT NULL auto_increment,
user_id bigint(20) NOT NULL default '0',
url text,
@@ -253,10 +273,10 @@ function openid_create_tables()
)",
);
- $sql = implode(';', $statements);
- dbDelta($sql);
+ $sql = implode( ';', $statements );
+ dbDelta( $sql );
- update_option('openid_db_revision', OPENID_DB_REVISION);
+ update_option( 'openid_db_revision', OPENID_DB_REVISION );
}
@@ -265,18 +285,18 @@ function openid_create_tables()
*/
function openid_delete_tables() {
global $wpdb;
- $wpdb->query('DROP TABLE IF EXISTS ' . openid_identity_table());
- $wpdb->query( $wpdb->prepare('DELETE FROM ' . $wpdb->postmeta . ' WHERE meta_key=%s', 'openid_comments') );
+ $wpdb->query( 'DROP TABLE IF EXISTS ' . openid_identity_table() );
+ $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->postmeta . ' WHERE meta_key=%s', 'openid_comments' ) );
// old database changes... just to make sure
- $wpdb->query('DROP TABLE IF EXISTS ' . openid_table_prefix(true) . 'openid_nonces');
- $wpdb->query('DROP TABLE IF EXISTS ' . openid_table_prefix(true) . 'openid_associations');
+ $wpdb->query( 'DROP TABLE IF EXISTS ' . openid_table_prefix( true ) . 'openid_nonces' );
+ $wpdb->query( 'DROP TABLE IF EXISTS ' . openid_table_prefix( true ) . 'openid_associations' );
// clear old way of storing OpenID comments
- $openid_column = $wpdb->get_row('SHOW COLUMNS FROM ' . openid_table_prefix(true) . 'comments LIKE "openid"');
- if ($openid_column) {
- $wpdb->query('ALTER table ' . $comments_table . ' DROP COLUMN openid');
- $wpdb->query( $wpdb->prepare('UPDATE ' . $comments_table . ' SET comment_type=%s WHERE comment_type=%s', '', 'openid') );
+ $openid_column = $wpdb->get_row( 'SHOW COLUMNS FROM ' . openid_table_prefix( true ) . 'comments LIKE "openid"' );
+ if ( $openid_column ) {
+ $wpdb->query( 'ALTER table ' . $comments_table . ' DROP COLUMN openid' );
+ $wpdb->query( $wpdb->prepare( 'UPDATE ' . $comments_table . ' SET comment_type=%s WHERE comment_type=%s', '', 'openid' ) );
}
}
@@ -288,50 +308,51 @@ function openid_migrate_old_data() {
global $wpdb;
// remove old nonce and associations tables
- $wpdb->query('DROP TABLE IF EXISTS ' . openid_table_prefix(true) . 'openid_nonces');
- $wpdb->query('DROP TABLE IF EXISTS ' . openid_table_prefix(true) . 'openid_associations');
+ $wpdb->query( 'DROP TABLE IF EXISTS ' . openid_table_prefix( true ) . 'openid_nonces' );
+ $wpdb->query( 'DROP TABLE IF EXISTS ' . openid_table_prefix( true ) . 'openid_associations' );
- $openid_column = $wpdb->get_row('SHOW COLUMNS FROM ' . openid_table_prefix(true) . 'comments LIKE "openid"');
- if ($openid_column) {
+ $openid_column = $wpdb->get_row( 'SHOW COLUMNS FROM ' . openid_table_prefix( true ) . 'comments LIKE "openid"' );
+ if ( $openid_column ) {
// update old style of marking openid comments. For performance reason, we
// migrate them en masse rather than using set_comment_openid()
- $comments_table = openid_table_prefix(true) . 'comments';
- $comment_data = $wpdb->get_results( $wpdb->prepare('SELECT comment_ID, comment_post_ID from ' . $comments_table . ' WHERE openid=%s OR comment_type=%s', 1, 'openid') );
- if (!empty($comment_data)) {
+ $comments_table = openid_table_prefix( true ) . 'comments';
+ $comment_data = $wpdb->get_results( $wpdb->prepare( 'SELECT comment_ID, comment_post_ID from ' . $comments_table . ' WHERE openid=%s OR comment_type=%s', 1, 'openid' ) );
+ if ( ! empty( $comment_data ) ) {
$openid_comments = array();
- foreach ($comment_data as $comment) {
- if (!array_key_exists($comment->comment_post_ID, $openid_comments)) {
- $openid_comments[$comment->comment_post_ID] = array();
+ foreach ( $comment_data as $comment ) {
+ if ( ! array_key_exists( $comment->comment_post_ID, $openid_comments ) ) {
+ $openid_comments[ $comment->comment_post_ID ] = array();
}
- $openid_comments[$comment->comment_post_ID][] = $comment->comment_ID;
+ $openid_comments[ $comment->comment_post_ID ][] = $comment->comment_ID;
}
- foreach ($openid_comments as $post_id => $comments) {
- $current = get_post_meta($post_id, 'openid_comments', true);
- if (!empty($current)) $comments = array_merge($comments, $current);
- update_post_meta($post_id, 'openid_comments', array_unique($comments));
+ foreach ( $openid_comments as $post_id => $comments ) {
+ $current = get_post_meta( $post_id, 'openid_comments', true );
+ if ( ! empty( $current ) ) {
+ $comments = array_merge( $comments, $current );
+ }
+ update_post_meta( $post_id, 'openid_comments', array_unique( $comments ) );
}
}
- $wpdb->query('ALTER table ' . $comments_table . ' DROP COLUMN openid');
- $wpdb->query( $wpdb->prepare('UPDATE ' . $comments_table . ' SET comment_type=%s WHERE comment_type=%s', '', 'openid') );
+ $wpdb->query( 'ALTER table ' . $comments_table . ' DROP COLUMN openid' );
+ $wpdb->query( $wpdb->prepare( 'UPDATE ' . $comments_table . ' SET comment_type=%s WHERE comment_type=%s', '', 'openid' ) );
}
-
// remove old style of marking openid users
- $usermeta_table = defined('CUSTOM_USER_META_TABLE') ? CUSTOM_USER_META_TABLE : openid_table_prefix() . 'usermeta';
- $wpdb->query( $wpdb->prepare('DELETE FROM ' . $usermeta_table . ' WHERE meta_key=%s OR meta_key=%s', 'has_openid', 'registered_with_openid') );
+ $usermeta_table = defined( 'CUSTOM_USER_META_TABLE' ) ? CUSTOM_USER_META_TABLE : openid_table_prefix() . 'usermeta';
+ $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $usermeta_table . ' WHERE meta_key=%s OR meta_key=%s', 'has_openid', 'registered_with_openid' ) );
}
-function openid_table_prefix($blog_specific = false) {
+function openid_table_prefix( $blog_specific = false ) {
global $wpdb;
- if (is_multisite() && isset($wpdb->base_prefix)) {
- return $wpdb->base_prefix . ($blog_specific ? $wpdb->blogid . '_' : '');
+ if ( is_multisite() && isset( $wpdb->base_prefix ) ) {
+ return $wpdb->base_prefix . ( $blog_specific ? $wpdb->blogid . '_' : '' );
} else {
return $wpdb->prefix;
}
}
function openid_identity_table() {
- return (defined('CUSTOM_OPENID_IDENTITY_TABLE') ? CUSTOM_OPENID_IDENTITY_TABLE : openid_table_prefix() . 'openid_identities');
+ return ( defined( 'CUSTOM_OPENID_IDENTITY_TABLE' ) ? CUSTOM_OPENID_IDENTITY_TABLE : openid_table_prefix() . 'openid_identities' );
}