use Database::timestamp() for cutoff
[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 function wfSpecialGeo( $page = "" ) {
21 global $wgOut, $wgLang, $wgRequest;
22 $coordinates = $wgRequest->getText( 'coordinates' ) ;
23 $coordinates = explode ( ":" , $coordinates ) ;
24 $ns = array_shift ( $coordinates ) ;
25 $ew = array_shift ( $coordinates ) ;
26 if ( 0 < count ( $coordinates ) ) $zoom = length ( array_shift ( $coordinates ) ) ;
27 else $zoom = 6 ;
28
29 $ns = explode ( "." , $ns ) ;
30 $ew = explode ( "." , $ew ) ;
31 while ( count ( $ns ) < 3 ) $ns[] = "0" ;
32 while ( count ( $ew ) < 3 ) $ew[] = "0" ;
33
34 $mapquest = "http://www.mapquest.com/maps/map.adp?latlongtype=decimal&latitude={$ns[0]}.{$ns[1]}&longitude={$ew[0]}.{$ew[1]}&zoom={$zoom}" ;
35 $mapquest = "<a href=\"{$mapquest}\">Mapquest</a>" ;
36
37
38 $wgOut->addHTML( "{$mapquest}" ) ;
39 /*
40 if( $wgRequest->getVal( 'action' ) == 'submit') {
41 $page = $wgRequest->getText( 'pages' );
42 $curonly = $wgRequest->getCheck( 'curonly' );
43 } else {
44 # Pre-check the 'current version only' box in the UI
45 $curonly = true;
46 }
47
48 if( $page != "" ) {
49 header( "Content-type: application/xml; charset=utf-8" );
50 $pages = explode( "\n", $page );
51 $xml = pages2xml( $pages, $curonly );
52 echo $xml;
53 wfAbruptExit();
54 }
55
56 $wgOut->addWikiText( wfMsg( "exporttext" ) );
57 $titleObj = Title::makeTitle( NS_SPECIAL, "Export" );
58 $action = $titleObj->escapeLocalURL();
59 $wgOut->addHTML( "
60 <form method='post' action=\"$action\">
61 <input type='hidden' name='action' value='submit' />
62 <textarea name='pages' cols='40' rows='10'></textarea><br />
63 <label><input type='checkbox' name='curonly' value='true' checked='checked' />
64 " . wfMsg( "exportcuronly" ) . "</label><br />
65 <input type='submit' />
66 </form>
67 " );
68 */
69 }
70
71 ?>