r46910 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46909‎ | r46910 | r46911 >
Date:11:05, 6 February 2009
Author:aaron
Status:deferred
Tags:
Comment:
Use addQuotes()
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/ReaderFeedback_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/ReaderFeedback_body.php
@@ -205,8 +205,7 @@
206206 # Use page_latest if $revId not given
207207 $revId = $revId ? $revId : $title->getLatestRevID( GAID_FOR_UPDATE );
208208 $rev = Revision::newFromTitle( $title, $revId );
209 - if( !$rev )
210 - return false; // shouldn't happen; just in case
 209+ if( !$rev ) return false; // shouldn't happen; just in case
211210 # Check if this revision is by this user...
212211 if( $rev->getUserText() === $wgUser->getName() ) {
213212 # Check if the previous revisions is theirs and they
@@ -223,10 +222,10 @@
224223 # Check if user already voted before...
225224 $dbw = wfGetDB( DB_MASTER );
226225 if( $wgUser->getId() ) {
227 - $ipSafe = $dbw->strencode( wfGetIP() );
 226+ $ipSafe = $dbw->addQuotes( wfGetIP() );
228227 $userVoted = $dbw->selectField( 'reader_feedback', '1',
229228 array( 'rfb_rev_id' => $revId,
230 - "(rfb_user = ".$wgUser->getId().") OR (rfb_user = 0 AND rfb_ip = '$ipSafe')" ),
 229+ "(rfb_user = ".$wgUser->getId().") OR (rfb_user = 0 AND rfb_ip = $ipSafe)" ),
231230 __METHOD__ );
232231 if( $userVoted ) {
233232 return true;

Status & tagging log