r7854 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r7853‎ | r7854 | r7855 >
Date:12:43, 24 March 2005
Author:egilk
Status:old
Tags:
Comment:
Version 0.2: Support action=raw for maparea page (needed when Wikimaps wamts to retrieve this data remotely, probably nice for others too to avoind wading though HTML)
Modified paths:
  • /trunk/extensions/gis/index.php (modified) (history)
  • /trunk/extensions/gis/maparea.php (modified) (history)

Diff [purge]

Index: trunk/extensions/gis/maparea.php
@@ -41,24 +41,34 @@
4242 $this->attr = $this->p->get_attr();
4343 }
4444
45 - function show()
 45+ function show($action)
4646 {
4747 global $wgOut, $wgUser, $wgContLang;
4848
49 - /* No reason for robots to follow map links */
50 - $wgOut->setRobotpolicy( 'noindex,nofollow' );
 49+ if ($action != 'raw') {
 50+ /* No reason for robots to follow map links */
 51+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
5152
52 - $wgOut->setPagetitle( "Maparea" );
 53+ $wgOut->setPagetitle( "Maparea" );
5354
54 - if (($e = $this->p->get_error()) != "") {
55 - $wgOut->addHTML(
56 - "<p>" . htmlspecialchars( $e ) . "</p>");
57 - $wgOut->output();
58 - wfErrorExit();
59 - return;
 55+ if (($e = $this->p->get_error()) != "") {
 56+ $wgOut->addHTML(
 57+ "<p>" . htmlspecialchars( $e ) . "</p>");
 58+ $wgOut->output();
 59+ wfErrorExit();
 60+ return;
 61+ }
 62+
 63+ $wgOut->addWikiText( $this->make_output() );
 64+ } else {
 65+ global $wgInputEncoding;
 66+ $ContentType = 'text/x-wiki';
 67+ header( "Content-type: ".$ContentType.'; charset='.$wgInputEncoding);
 68+
 69+ echo( $this->make_output() );
 70+
 71+ $wgOut->disable();
6072 }
61 -
62 - $wgOut->addWikiText( $this->make_output() );
6373 }
6474
6575 function make_output()
Index: trunk/extensions/gis/index.php
@@ -31,7 +31,7 @@
3232 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3333 */
3434
35 -$wgGisVersion = '0.1alpha';
 35+$wgGisVersion = '0.2alpha';
3636
3737 include_once ( "gissettings.php" ) ;
3838
@@ -63,8 +63,9 @@
6464 $bsl->show();
6565 } else if ( isset ( $_GET['maparea'] ) ) {
6666 $maparea = urldecode ( $_GET['maparea'] ) ;
 67+ $action = urldecode ( $_GET['action'] ) ;
6768 $bsl = new maparea( $maparea );
68 - $bsl->show();
 69+ $bsl->show( $action );
6970 } else if ( isset ( $_GET['version'] ) ) {
7071 $bsl = new gis_version( );
7172 $bsl->show();

Status & tagging log