summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/openid/comments.php')
-rw-r--r--plugins/openid/comments.php31
1 files changed, 15 insertions, 16 deletions
diff --git a/plugins/openid/comments.php b/plugins/openid/comments.php
index d08f798d..cd4538b4 100644
--- a/plugins/openid/comments.php
+++ b/plugins/openid/comments.php
@@ -1,6 +1,6 @@
<?php
/**
- * All the code required for handling OpenID comments. These functions should not be considered public,
+ * All the code required for handling OpenID comments. These functions should not be considered public,
* and may change without notice.
*/
@@ -86,7 +86,7 @@ function openid_process_comment( $comment ) {
// duplicate name and email check from wp-comments-post.php
if ( $comment['comment_type'] == '') {
- openid_require_name_email();
+ openid_require_name_email( $comment );
}
return $comment;
@@ -94,14 +94,15 @@ function openid_process_comment( $comment ) {
/**
- * Duplicated code from wp-comments-post.php to check for presence of comment author name and email
+ * Duplicated code from wp-comments-post.php to check for presence of comment author name and email
* address.
*/
-function openid_require_name_email() {
+function openid_require_name_email( $comment ) {
$user = wp_get_current_user();
- global $comment_author, $comment_author_email;
-
- if ( get_option('require_name_email') && !$user->ID ) {
+ $comment_author = $comment['comment_author'];
+ $comment_author_email = $comment['comment_author_email'];
+
+ if ( get_option('require_name_email') && !$user->ID ) {
if ( 6 > strlen($comment_author_email) || '' == $comment_author ) {
wp_die( __('Error: please fill the required fields (name, email).', 'openid') );
} elseif ( !is_email($comment_author_email)) {
@@ -134,7 +135,7 @@ function openid_comment_approval($approved) {
* @see get_user_data
*/
function openid_option_require_name_email( $value ) {
-
+
$comment_page = (defined('OPENID_COMMENTS_POST_PAGE') ? OPENID_COMMENTS_POST_PAGE : 'wp-comments-post.php');
if ($GLOBALS['pagenow'] != $comment_page) {
@@ -144,7 +145,7 @@ function openid_option_require_name_email( $value ) {
if (array_key_exists('openid_skip', $_REQUEST) && $_REQUEST['openid_skip']) {
return get_option('openid_no_require_name') ? false : $value;
}
-
+
// make sure we only process this once per request
static $bypass;
if ($bypass) {
@@ -284,7 +285,7 @@ function openid_repost_comment_anonymously($post) {
<input type="hidden" name="'.$name.'" value="'.$value.'" />';
}
}
-
+
$html .= '</form>';
openid_page($html, __('OpenID Authentication Error', 'openid'));
}
@@ -301,9 +302,9 @@ function openid_finish_comment($identity_url, $action) {
if (empty($identity_url)) {
openid_repost_comment_anonymously($_SESSION['openid_comment_post']);
}
-
+
openid_set_current_user($identity_url);
-
+
if (is_user_logged_in()) {
// simulate an authenticated comment submission
$_SESSION['openid_comment_post']['author'] = null;
@@ -311,7 +312,7 @@ function openid_finish_comment($identity_url, $action) {
$_SESSION['openid_comment_post']['url'] = null;
} else {
// try to get user data from the verified OpenID
- $user_data =& openid_get_user_data($identity_url);
+ $user_data = openid_get_user_data($identity_url);
if (!empty($user_data['display_name'])) {
$_SESSION['openid_comment_post']['author'] = $user_data['display_name'];
@@ -321,7 +322,7 @@ function openid_finish_comment($identity_url, $action) {
}
$_SESSION['openid_comment_post']['url'] = $identity_url;
}
-
+
// record that we're about to post an OpenID authenticated comment.
// We can't actually record it in the database until after the repost below.
$_SESSION['openid_posted_comment'] = true;
@@ -414,5 +415,3 @@ function openid_recent_comments() {
}
}
}
-
-?>