r38113 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38112‎ | r38113 | r38114 >
Date:22:11, 27 July 2008
Author:aaron
Status:old
Tags:
Comment:
Add extra form check
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ReaderFeedback_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -1473,7 +1473,8 @@
14741474 $form .= Xml::hidden( 'validatedParams', ReaderFeedback::validationKey( $id, $wgUser->getId() ) );
14751475 $form .= Xml::hidden( 'action', 'submit') . "\n";
14761476 $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken() ) . "\n";
1477 - # Add review parameters
 1477+ # Honeypot input
 1478+ $form .= Xml::input( 'commentary', 12, '', array('style' => 'display:none;') ) . "\n";
14781479 $form .= Xml::closeElement( 'fieldset' );
14791480 $form .= Xml::closeElement( 'form' );
14801481 if( $top ) {
Index: trunk/extensions/FlaggedRevs/specialpages/ReaderFeedback_body.php
@@ -50,9 +50,11 @@
5151 if( $this->validatedParams != self::validationKey( $this->oldid, $wgUser->getId() ) ) {
5252 $wgOut->redirect( $this->page->getLocalUrl() );
5353 }
54 - # Submit valid requests
55 - if( $wgUser->matchEditToken( $wgRequest->getVal('wpEditToken') ) && $wgRequest->wasPosted() ) {
 54+ # Submit valid requests. Check honeypot value for bots.
 55+ if( $confirm && !$wgRequest->getVal( 'commentary' ) ) {
5656 $ok = $this->submit();
 57+ } else {
 58+ $ok = false;
5759 }
5860 # Go to graphs!
5961 if( $ok ) {

Status & tagging log