示例#1
0
 /**
  * Intercept comment submission and check if it includes a valid OpenID.  If it does, save the entire POST
  * array and begin the OpenID authentication process.
  *
  * regarding comment_type: http://trac.wordpress.org/ticket/2659
  *
  * @param object $comment comment object
  * @return object comment object
  */
 function comment_tagging($comment)
 {
     global $openid;
     if ($_REQUEST['oid_skip']) {
         return $comment;
     }
     $openid_url = array_key_exists('openid_url', $_POST) ? $_POST['openid_url'] : $_POST['url'];
     if (!empty($openid_url)) {
         // Comment form's OpenID url is filled in.
         $_SESSION['oid_comment_post'] = $_POST;
         $_SESSION['oid_comment_post']['comment_author_openid'] = $openid_url;
         $_SESSION['oid_comment_post']['oid_skip'] = 1;
         WordPressOpenID_Logic::start_login($openid_url, 'comment');
         // Failure to redirect at all, the URL is malformed or unreachable.
         // Display an error message only if an explicit OpenID field was used.  Otherwise,
         // just ignore the error... it just means the user entered a normal URL.
         if (array_key_exists('openid_url', $_POST)) {
             WordPressOpenID_Interface::repost_comment_anonymously($_SESSION['oid_comment_post']);
         }
     }
     /*
     if (get_option('oid_enable_email_mapping') && !empty($_POST['email'])) {
     	$_SESSION['oid_comment_post'] = $_POST;
     	$_SESSION['oid_comment_post']['comment_author_openid'] = $openid_url;
     	$_SESSION['oid_comment_post']['oid_skip'] = 1;
     
     	set_include_path( dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
     	require_once 'Auth/Yadis/Email.php';
     	$id = Auth_Yadis_Email_getID($_POST['email'], trailingslashit(get_option('home')));
     	WordPressOpenID_Logic::start_login( $id, 'comment');
     }
     */
     return $comment;
 }