Changeset 1328701
- Timestamp:
- 01/15/2016 02:32:13 AM (10 years ago)
- File:
-
- 1 edited
-
xmpp-auth/trunk/comment.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
xmpp-auth/trunk/comment.php
r1327190 r1328701 27 27 function xmppauth_comment_form_fields($fields) 28 28 { 29 global $configuration;30 $jid_validate = $configuration && (!isset($configuration['disable_comment']) || !$configuration['disable_comment']);29 global $configuration; 30 $jid_validate = $configuration && (!isset($configuration['disable_comment']) || !$configuration['disable_comment']); 31 31 32 $comment_author_jid = isset($_COOKIE['comment_author_jid_' . COOKIEHASH]) ? $_COOKIE['comment_author_jid_' . COOKIEHASH] : ''; 33 34 // XXX: I use the email class as it won't display well for some theme (example: twentyeleven) if there is no. 35 // XXX: the aria-required parameter is apparently for screen readers. Good for accessibility. 32 $comment_author_jid = isset($_COOKIE['comment_author_jid_' . COOKIEHASH]) ? $_COOKIE['comment_author_jid_' . COOKIEHASH] : ''; 33 $transaction_id = base64_encode(random_bytes(21)); 34 35 // XXX: I use the email class as it won't display well for some theme (example: twentyeleven) if there is no. 36 // XXX: the aria-required parameter is apparently for screen readers. Good for accessibility. 36 37 $fields['jid'] = '<p class="comment-form-email"><label for="jid" title="Jabber ID (will not be published)">' 37 38 . __('Instant Messaging address', 'xmpp-auth') 38 39 . ($jid_validate? ' <span class="required">*</span>' : '') 39 40 . '</label>' 40 . '<input id="jid" name="jid" type="text" value="' . $comment_author_jid . '" size="30" aria-required="true" /></p>'; 41 return $fields; 41 . '<input id="jid" name="jid" type="text" value="' . $comment_author_jid . '" size="30" aria-required="true" />' 42 . '<label><em>Transaction ID: ' . $transaction_id . '</label>' 43 . '<input type="hidden" name="transaction_id" id="transaction_id" value="' 44 . $transaction_id 45 .'"/></p>'; 46 return $fields; 42 47 } 43 48 … … 52 57 return $approved; 53 58 54 // I don't change a comment previously disapproved by another system 55 // nor a comment from a registered user. 56 if ($approved === 'spam' || $approved == 'trash' 57 || is_user_logged_in()) 58 return $approved; 59 /* Don't change a comment previously disapproved by another system 60 * nor a comment from a registered user. */ 61 if ($approved === 'spam' || 62 $approved === 'trash' || 63 is_user_logged_in()) 64 return $approved; 59 65 60 66 $comment_content = $commentdata['comment_content']; … … 97 103 $params = array( 98 104 'from' => $_POST['jid'], 99 'transaction_id' => $ comment_content,105 'transaction_id' => $_POST['transaction_id'], 100 106 'thread' => time () . rand (), // Is it random enough? Probably for such use... 101 107 'url' => get_permalink($commentdata['comment_post_ID']), … … 109 115 { 110 116 $xs->quit(); 111 return $approved; 117 /* 1 means "approved". A comment which passes the XMPP auth 118 * bypass normal validation. */ 119 return 1; 112 120 } 113 121 else
Note: See TracChangeset
for help on using the changeset viewer.