Код: Выделить всё
##############################################################
## MOD Title: [geo] bbCode
## MOD Author: chyduskam < chuduskam@debilarius.ru > (Egor Naklonyaeff) N/A
## MOD Description: [geo] bbCode
## MOD Version: 0.0.3
##
## Installation Level: Easy
## Installation Time: 2 Minutes
## Files To Edit: 1
## includes/bbcode.php
## Included Files: globe.gif
## geo2wpt.php
##############################################################
## For Security Purposes, Please Check: http://www.phpbbguru.net/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbbguru.net/mods/
##############################################################
## Author Notes: Usage [geo]xx:yy.zzz;xx:yy.zzz[/geo]
## Return point to map and wpt file
##############################################################
## MOD History:
## 2005-04-20 - Version 0.0.2
## - initial release
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------
#
globe.gif to images/globe.gif
geo2wpt.php to geo2wpt.php
#
#-----[ OPEN ]-------------------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]----------------------------------------
#
// Patterns and replacements for URL and email tags.
#
#-----[ BEFORE, ADD ]----------------------------------
#
// [geo] bbCode
$text = preg_replace("#\[geo:$uid\](.*?)\[/geo:$uid\]#sie", "geo_bbCode('\\1')", $text);
#
#-----[ FIND ]----------------------------------------
#
// [img]image_url_here[/img] code..
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)
#
#-----[ BEFORE, ADD ]----------------------------------
#
// [geo] bbCode
$text = preg_replace("#\[geo\]([\-0-9]+\:[\.0-9]+;[\-0-9]+\:[\.0-9]+)\[/geo\]#si", "[geo:$uid]\\1[/geo:$uid]", $text);
#
#-----[ FIND ]----------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]----------------------------------
#
function geo_bbCode($text)
{
global $board_config,$phpEx;
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
$index_url = $server_protocol . $server_name . $server_port . (( $script_name != '' )? $script_name . '/':'');
list($lat,$lon)=explode(';',$text,2);
list($lat1,$lat2)=explode(':',$lat,2);
list($lon1,$lon2)=explode(':',$lon,2);
$lat=number_format((intval($lat1)+floatval($lat2)/60.0),5,'.','');
$lon=number_format((intval($lon1)+floatval($lon2)/60.0),5,'.','');
$txt=abs($lat1).'°'.$lat2."'".(($lat1>0)?'N':'S').'; '.abs($lon1).'°'.$lon2."'".(($lon1>0)?'E':'W');
return '<a target=_blank href="http://www.multimap.com/map/browse.cgi?icon=X&lat='.$lat.'&lon='.$lon.'&scale=200000&scale2=320">
<img src="'.$index_url.'images/globe.gif" border="0" alt=""></a> <a target=_blank title="OziExplorer WPT" href="'.$index_url.'geo2wpt.php?geo='.$text.'">'.$txt.'</a>';
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
1. Картинка globe.gif -
2. Пример работы: http://naklon.info/talk/viewtopic.php?p=2976#2976
3. Файл geo2wpt.php
Код: Выделить всё
<?php
if(!isset($_GET['geo'])) die('Out of order');
list($lat,$lon)=explode(';',$_GET['geo'],2);
list($lat1,$lat2)=explode(':',$lat,2);
list($lon1,$lon2)=explode(':',$lon,2);
$lat=number_format((intval($lat1)+floatval($lat2)/60.0),6,'.','');
$lon=number_format((intval($lon1)+floatval($lon2)/60.0),6,'.','');
header ('Content-Type: text/plain');
header('Content-Disposition: inline; filename="pount.wpt"');
echo "OziExplorer Waypoint File Version 1.1\r\n";
echo "WGS 84\r\nReserved 2\r\ngarmin\r\n";
echo "1,1,$lat,$lon,".number_format((time()/86400.0+25570),5,'.','').",70,1,4,0,65535,AutoPoint,0,0,0,-777,6,0,17\r\n";
?>