Merge "Revert "Adding sanity check to Title::isRedirect().""
[lhc/web/wiklou.git] / includes / api / ApiQueryLangBacklinks.php
index d808cce..efc2e81 100644 (file)
  * @file
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-       // Eclipse helper - will be ignored in production
-       require_once( "ApiQueryBase.php" );
-}
-
 /**
  * This gives links pointing to the given interwiki
  * @ingroup API
@@ -66,14 +61,15 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
                                        'original value returned by the previous query', '_badcontinue' );
                        }
 
-                       $prefix = $this->getDB()->strencode( $cont[0] );
-                       $title = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) );
+                       $db = $this->getDB();
+                       $prefix = $db->addQuotes( $cont[0] );
+                       $title = $db->addQuotes( $this->titleToKey( $cont[1] ) );
                        $from = intval( $cont[2] );
                        $this->addWhere(
-                               "ll_lang > '$prefix' OR " .
-                               "(ll_lang = '$prefix' AND " .
-                               "(ll_title > '$title' OR " .
-                               "(ll_title = '$title' AND " .
+                               "ll_lang > $prefix OR " .
+                               "(ll_lang = $prefix AND " .
+                               "(ll_title > $title OR " .
+                               "(ll_title = $title AND " .
                                "ll_from >= $from)))"
                        );
                }
@@ -94,10 +90,17 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
                                $this->addWhereFld( 'll_title', $params['title'] );
                                $this->addOption( 'ORDER BY', 'll_from' );
                        } else {
-                               $this->addOption( 'ORDER BY', 'll_title, ll_from' );
+                               $this->addOption( 'ORDER BY', array(
+                                       'll_title',
+                                       'll_from'
+                               ));
                        }
                } else {
-                       $this->addOption( 'ORDER BY', 'll_lang, ll_title, ll_from' );
+                       $this->addOption( 'ORDER BY', array(
+                               'll_lang',
+                               'll_title',
+                               'll_from'
+                       ));
                }
 
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
@@ -210,7 +213,7 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
        public function getExamples() {
                return array(
                        'api.php?action=query&list=langbacklinks&lbltitle=Test&lbllang=fr',
-                       'api.php?action=query&generator=langbacklinks&glbltitle=Test&lbllang=fr&prop=info'
+                       'api.php?action=query&generator=langbacklinks&glbltitle=Test&glbllang=fr&prop=info'
                );
        }