示例#1
0
 /**
  * Action method for completing the 'comment' action.  This action is used when leaving a comment.
  *
  * @param string $identity_url verified OpenID URL
  */
 function _finish_openid_comment($identity_url)
 {
     global $openid;
     if (empty($identity_url)) {
         // FIXME unable to authenticate OpenID - give option to post anonymously
         WordPressOpenID_Interface::display_error('unable to authenticate OpenID');
     }
     WordPressOpenID_Logic::set_current_user($identity_url);
     if (is_user_logged_in()) {
         // simulate an authenticated comment submission
         $_SESSION['oid_comment_post']['author'] = null;
         $_SESSION['oid_comment_post']['email'] = null;
         $_SESSION['oid_comment_post']['url'] = null;
     } else {
         // try to get user data from the verified OpenID
         $user_data =& WordPressOpenID_Logic::get_user_data($identity_url);
         if (!empty($user_data['display_name'])) {
             $_SESSION['oid_comment_post']['author'] = $user_data['display_name'];
         }
         if ($oid_user_data['user_email']) {
             $_SESSION['oid_comment_post']['email'] = $user_data['user_email'];
         }
     }
     // 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['oid_posted_comment'] = true;
     $wpp = parse_url(get_option('siteurl'));
     WordPressOpenID_Interface::repost($wpp['path'] . '/wp-comments-post.php', array_filter($_SESSION['oid_comment_post']));
 }