X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryBacklinks.php;h=a9534512b88128cbe673c76f374f06e0a201cbe0;hb=da5805fd34ca0fe64aba67871c0f260f7c1d5610;hp=8081837fb13c55b735d46029d79c5cee839975f9;hpb=5b8213e9efc8807b9bf2c67ce86106a938cdf2be;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 8081837fb1..a9534512b8 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -29,12 +29,12 @@ if (!defined('MEDIAWIKI')) { } /** - * This is three-in-one module to query: + * This is a three-in-one module to query: * * backlinks - links pointing to the given page, * * embeddedin - what pages transclude the given page within themselves, * * imageusage - what pages use the given image * - * @addtogroup API + * @ingroup API */ class ApiQueryBacklinks extends ApiQueryGeneratorBase { @@ -141,7 +141,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $titleWhere = ''; foreach($this->redirTitles as $t) $titleWhere .= ($titleWhere != '' ? " OR " : '') . - "({$this->bl_title} = '{$t->getDBKey()}'" . + "({$this->bl_title} = ".$db->addQuotes($t->getDBKey()). ($this->hasNS ? " AND {$this->bl_ns} = '{$t->getNamespace()}'" : "") . ")"; $this->addWhere($titleWhere); @@ -229,7 +229,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $resultData = array(); foreach($this->data as $ns => $a) foreach($a as $title => $arr) - $resultData[$arr['pageid']] = $arr; + $resultData[] = $arr; $result = $this->getResult(); $result->setIndexedTagName($resultData, $this->bl_code); $result->addValue('query', $this->getModuleName(), $resultData); @@ -263,9 +263,13 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { if (!is_null($this->params['continue'])) $this->parseContinueParam(); else { - $title = $this->params['title']; - if (!is_null($title)) { - $this->rootTitle = Title :: newFromText($title); + if ( $this->params['title'] !== "" ) { + $title = Title::newFromText( $this->params['title'] ); + if ( !$title ) { + $this->dieUsageMsg(array('invalidtitle', $this->params['title'])); + } else { + $this->rootTitle = $title; + } } else { $this->dieUsageMsg(array('missingparam', 'title')); }