Use Database::addQuotes instead of hardcoded quotes
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 4 Jan 2013 19:07:37 +0000 (20:07 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 4 Jan 2013 19:07:37 +0000 (20:07 +0100)
Change-Id: I29461e5332f3fc6523cbd899e14394aa88865d93

includes/WikiPage.php
includes/actions/HistoryAction.php

index 7620b3a..7ed48ac 100644 (file)
@@ -2062,7 +2062,7 @@ class WikiPage extends Page implements IDBAccessObject {
                                $cutoff = $dbw->timestamp( time() - $wgRCMaxAge );
                                $dbw->delete(
                                        'recentchanges',
-                                       array( "rc_timestamp < '$cutoff'" ),
+                                       array( 'rc_timestamp < ' . $dbw->addQuotes( $cutoff ) ),
                                        __METHOD__
                                );
                        }
index d68ae2b..c33423d 100644 (file)
@@ -222,7 +222,7 @@ class HistoryAction extends FormlessAction {
                }
 
                if ( $offset ) {
-                       $offsets = array( "rev_timestamp $oper '$offset'" );
+                       $offsets = array( 'rev_timestamp $oper ' . $dbr->addQuotes( $dbr->timestamp( $offset ) ) );
                } else {
                        $offsets = array();
                }
@@ -231,7 +231,7 @@ class HistoryAction extends FormlessAction {
 
                return $dbr->select( 'revision',
                        Revision::selectFields(),
-                       array_merge( array( "rev_page=$page_id" ), $offsets ),
+                       array_merge( array( 'rev_page' => $page_id ), $offsets ),
                        __METHOD__,
                        array( 'ORDER BY' => "rev_timestamp $dirs",
                                'USE INDEX' => 'page_timestamp', 'LIMIT' => $limit )