Merge "escape HTML elements in docblock with double quotes"
[lhc/web/wiklou.git] / includes / api / ApiQueryLinks.php
index 6e6da53..e54e2e8 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Created on May 12, 2007
  *
- * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -119,7 +119,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                        $op = $params['dir'] == 'descending' ? '<' : '>';
                        $plfrom = intval( $cont[0] );
                        $plns = intval( $cont[1] );
-                       $pltitle = $this->getDB()->addQuotes( $this->titleToKey( $cont[2] ) );
+                       $pltitle = $this->getDB()->addQuotes( $cont[2] );
                        $this->addWhere(
                                "{$this->prefix}_from $op $plfrom OR " .
                                "({$this->prefix}_from = $plfrom AND " .
@@ -129,7 +129,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                        );
                }
 
-               $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+               $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
                // Here's some MySQL craziness going on: if you use WHERE foo='bar'
                // and later ORDER BY foo MySQL doesn't notice the ORDER BY is pointless
                // but instead goes and filesorts, because the index for foo was used
@@ -137,13 +137,13 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                // clause from the ORDER BY clause
                $order = array();
                if ( count( $this->getPageSet()->getGoodTitles() ) != 1 ) {
-                       $order[] = $this->prefix . '_from' . $dir;
+                       $order[] = $this->prefix . '_from' . $sort;
                }
                if ( count( $params['namespace'] ) != 1 ) {
-                       $order[] = $this->prefix . '_namespace' . $dir;
+                       $order[] = $this->prefix . '_namespace' . $sort;
                }
 
-               $order[] = $this->prefix . "_title" . $dir;
+               $order[] = $this->prefix . '_title' . $sort;
                $this->addOption( 'ORDER BY', $order );
                $this->addOption( 'USE INDEX', $this->prefix . '_from' );
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
@@ -157,8 +157,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                                        // We've reached the one extra which shows that
                                        // there are additional pages to be had. Stop here...
                                        $this->setContinueEnumParameter( 'continue',
-                                               "{$row->pl_from}|{$row->pl_namespace}|" .
-                                               $this->keyToTitle( $row->pl_title ) );
+                                               "{$row->pl_from}|{$row->pl_namespace}|{$row->pl_title}" );
                                        break;
                                }
                                $vals = array();
@@ -166,8 +165,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                                $fit = $this->addPageSubItem( $row->pl_from, $vals );
                                if ( !$fit ) {
                                        $this->setContinueEnumParameter( 'continue',
-                                               "{$row->pl_from}|{$row->pl_namespace}|" .
-                                               $this->keyToTitle( $row->pl_title ) );
+                                               "{$row->pl_from}|{$row->pl_namespace}|{$row->pl_title}" );
                                        break;
                                }
                        }
@@ -179,8 +177,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                                        // We've reached the one extra which shows that
                                        // there are additional pages to be had. Stop here...
                                        $this->setContinueEnumParameter( 'continue',
-                                               "{$row->pl_from}|{$row->pl_namespace}|" .
-                                               $this->keyToTitle( $row->pl_title ) );
+                                               "{$row->pl_from}|{$row->pl_namespace}|{$row->pl_title}" );
                                        break;
                                }
                                $titles[] = Title::makeTitle( $row->pl_namespace, $row->pl_title );
@@ -227,6 +224,15 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return "Returns all {$this->description}s from the given page(s)";
        }