Bug 589: make random selection slightly more random. PHP's
[lhc/web/wiklou.git] / includes / SpecialGeo.php
1 <?php
2 # Copyright (C) 2004 Magnus Manske <magnus.manske@web.de>
3 # http://www.mediawiki.org/
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # http://www.gnu.org/copyleft/gpl.html
19
20 /**
21 *
22 * @package MediaWiki
23 * @subpackage SpecialPage
24 */
25
26 /**
27 *
28 */
29 function wfSpecialGeo( $page = '' ) {
30 global $wgOut, $wgLang, $wgRequest;
31 $coordinates = $wgRequest->getText( 'coordinates' ) ;
32 $coordinates = explode ( ":" , $coordinates ) ;
33 $ns = array_shift ( $coordinates ) ;
34 $ew = array_shift ( $coordinates ) ;
35 if ( 0 < count ( $coordinates ) ) $zoom = length ( array_shift ( $coordinates ) ) ;
36 else $zoom = 6 ;
37
38 $ns = explode ( "." , $ns ) ;
39 $ew = explode ( "." , $ew ) ;
40 while ( count ( $ns ) < 3 ) $ns[] = "0" ;
41 while ( count ( $ew ) < 3 ) $ew[] = "0" ;
42
43 $mapquest = "http://www.mapquest.com/maps/map.adp?latlongtype=decimal&latitude={$ns[0]}.{$ns[1]}&longitude={$ew[0]}.{$ew[1]}&zoom={$zoom}" ;
44 $mapquest = "<a href=\"{$mapquest}\">Mapquest</a>" ;
45
46
47 $wgOut->addHTML( "{$mapquest}" ) ;
48 /*
49 if( $wgRequest->getVal( 'action' ) == 'submit') {
50 $page = $wgRequest->getText( 'pages' );
51 $curonly = $wgRequest->getCheck( 'curonly' );
52 } else {
53 # Pre-check the 'current version only' box in the UI
54 $curonly = true;
55 }
56
57 if( $page != "" ) {
58 header( "Content-type: application/xml; charset=utf-8" );
59 $pages = explode( "\n", $page );
60 $xml = pages2xml( $pages, $curonly );
61 echo $xml;
62 wfAbruptExit();
63 }
64
65 $wgOut->addWikiText( wfMsg( "exporttext" ) );
66 $titleObj = Title::makeTitle( NS_SPECIAL, "Export" );
67 $action = $titleObj->escapeLocalURL();
68 $wgOut->addHTML( "
69 <form method='post' action=\"$action\">
70 <input type='hidden' name='action' value='submit' />
71 <textarea name='pages' cols='40' rows='10'></textarea><br />
72 <label><input type='checkbox' name='curonly' value='true' checked='checked' />
73 " . wfMsg( "exportcuronly" ) . "</label><br />
74 <input type='submit' />
75 </form>
76 " );
77 */
78 }
79
80 ?>