From c43de1d4249d466681737346a7c76ec6d0640406 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 18 Oct 2006 06:32:40 +0000 Subject: [PATCH] API * HTML is now valid HTML Transitional (thansk nickj) * Fixed watchlist ordering bug --- includes/api/ApiFeedWatchlist.php | 2 +- includes/api/ApiFormatBase.php | 57 ++++++++++++++++-------------- includes/api/ApiQueryWatchlist.php | 4 +-- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index 5a40bc2b7d..6dd5f9879f 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -53,7 +53,7 @@ class ApiFeedWatchlist extends ApiBase { 'wlstart' => wfTimestamp(TS_MW, time() - intval( 1 * 86400 )), // limit to 1 day 'wllimit' => 50 )); - + // Execute $module = new ApiMain($params); $module->execute(); diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 3075fbc708..da515d51e7 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -75,40 +75,41 @@ abstract class ApiFormatBase extends ApiBase { function initPrinter($isError) { $isHtml = $this->getIsHtml(); $mime = $isHtml ? 'text/html' : $this->getMimeType(); - + // Some printers (ex. Feed) do their own header settings, // in which case $mime will be set to null if (is_null($mime)) - return; // skip any initialization - + return; // skip any initialization + header("Content-Type: $mime; charset=utf-8;"); header("Cache-Control: private, s-maxage=0, max-age=0"); - + if ($isHtml) { ?> - - - MediaWiki API - - + + + + MediaWiki API + + -
- - You are looking at the HTML representation of the mFormat?> format.
- HTML is good for debugging, but probably not suitable for your application.
- Please see "format" parameter documentation at the API help - for more information.
-
+
+ +You are looking at the HTML representation of the mFormat?> format.
+HTML is good for debugging, but probably not suitable for your application.
+Please see "format" parameter documentation at the API help +for more information. +
-
+
 getIsHtml()) {
 ?>
-		
- + +
+ + ]+)\>', '<\1>', $text); + $text = ereg_replace('\<([^>]+)\>', '<\1>', $text); // identify URLs $text = ereg_replace("[a-zA-Z]+://[^ '\"()<\n]+", '\\0', $text); // identify requests to api.php @@ -182,7 +185,7 @@ class ApiFormatFeedWrapper extends ApiFormatBase { public static function setResult($result, $feed, $feedItems) { // Store output in the Result data. // This way we can check during execution if any error has occured - $data =& $result->getData(); + $data = & $result->getData(); $data['_feed'] = $feed; $data['_feeditems'] = $feedItems; } @@ -200,15 +203,15 @@ class ApiFormatFeedWrapper extends ApiFormatBase { public function getNeedsRawData() { return true; } - + public function execute() { - $data =& $this->getResultData(); - if (isset($data['_feed']) && isset($data['_feeditems'])) { - $feed =& $data['_feed']; - $items =& $data['_feeditems']; + $data = & $this->getResultData(); + if (isset ($data['_feed']) && isset ($data['_feeditems'])) { + $feed = & $data['_feed']; + $items = & $data['_feeditems']; $feed->outHeader(); - foreach($items as &$item) + foreach ($items as & $item) $feed->outItem($item); $feed->outFooter(); } else { diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 452478499c..65335db494 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -55,8 +55,8 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $db = $this->getDB(); $dirNewer = ($dir === 'newer'); - $before = ($dirNewer ? '<=' : '>='); - $after = ($dirNewer ? '>=' : '<='); + $after = ($dirNewer ? '<=' : '>='); + $before = ($dirNewer ? '>=' : '<='); $tables = array ( 'watchlist', -- 2.20.1