added NPA info to GPX and XML cache descrption; updates #258
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/****************************************************************************
|
||||
|
||||
For license information see doc/license.txt
|
||||
|
||||
Unicode Reminder メモ
|
||||
|
||||
Nature Protection Area functions
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
function get_npas($cache_id)
|
||||
{
|
||||
$rsNPA = sql(
|
||||
"SELECT `npa_areas`.`name` AS `npaName`, `npa_types`.`name` AS `npaTypeName`
|
||||
FROM `cache_npa_areas`
|
||||
INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id`
|
||||
INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id`
|
||||
WHERE `cache_npa_areas`.`cache_id`='&1'
|
||||
GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`
|
||||
ORDER BY `npa_types`.`ordinal` ASC",
|
||||
$cache_id);
|
||||
$npas = array();
|
||||
while ($rNPA = sql_fetch_array($rsNPA))
|
||||
$npas[] = $rNPA;
|
||||
sql_free_result($rsNPA);
|
||||
|
||||
return $npas;
|
||||
}
|
||||
|
||||
|
||||
function get_desc_npas($cache_id)
|
||||
{
|
||||
global $opt;
|
||||
|
||||
$npas = get_npas($cache_id);
|
||||
if ($npas)
|
||||
{
|
||||
$desc = "<p>" . str_replace('%1',$opt['cms']['npa'], t('This geocache is probably placed within the following nature protection areas (<a href="%1">Info</a>):')) . "</p>\n" .
|
||||
"<ul>\n";
|
||||
foreach ($npas as $npa)
|
||||
$desc .= "<li>" . $npa['npaTypeName'] . ": <a href='http://www.google.de/search?q=".urlencode($npa['npaName'])."' target='_blank'>" . $npa['npaName'] . "</a></li>\n";
|
||||
$desc .= "</ul>\n";
|
||||
}
|
||||
else
|
||||
$desc = "";
|
||||
|
||||
return $desc;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
require_once('lib/npas.inc.php');
|
||||
|
||||
global $content, $bUseZip, $sqldebug, $locale;
|
||||
|
||||
|
||||
$gpxHead =
|
||||
'<?xml version="1.0" encoding="utf-8"?>
|
||||
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="Opencaching.de - http://www.opencaching.de" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0/1 http://www.groundspeak.com/cache/1/0/1/cache.xsd" xmlns="http://www.topografix.com/GPX/1/0">
|
||||
@@ -362,7 +365,8 @@
|
||||
$license = getLicenseDisclaimer(
|
||||
$r['userid'], $r['username'], $r['data_license'], $r['cacheid'], $locale, true, true);
|
||||
if ($license != "")
|
||||
$desc .= "<p><em>$license</em></p>";
|
||||
$desc .= "<p><em>$license</em></p>\n";
|
||||
$desc .= get_desc_npas($r['cacheid']);
|
||||
$thisline = mb_ereg_replace('{desc}', xmlentities(decodeEntities($desc)), $thisline);
|
||||
|
||||
$thisline = mb_ereg_replace('{images}', xmlentities(getPictures($r['cacheid'])), $thisline);
|
||||
|
||||
@@ -179,4 +179,8 @@
|
||||
$opt['template']['locales']['PL']['show'] = false;
|
||||
$opt['template']['locales']['PT']['show'] = false;
|
||||
$opt['template']['locales']['RU']['show'] = false;
|
||||
|
||||
// info on nature protection areas
|
||||
$opt['cms']['npa'] = 'http://wiki.opencaching.de/index.php/Schutzgebiete';
|
||||
|
||||
?>
|
||||
@@ -216,6 +216,10 @@
|
||||
// you can use -1 to use the master (not recommended, because replicated to slaves)
|
||||
$opt['db']['slave']['primary'] = -1;
|
||||
|
||||
// info on nature protection areas
|
||||
$opt['cms']['npa'] = 'http://wiki.opencaching.de/index.php/Schutzgebiete';
|
||||
|
||||
|
||||
/* post_config() is invoked directly before the first HTML line of the main.tpl.php is sent to the client.
|
||||
*/
|
||||
function post_config()
|
||||
|
||||
@@ -16,10 +16,11 @@
|
||||
$ocxmlversion = 11;
|
||||
|
||||
$opt['rootpath'] = '../';
|
||||
require_once($opt['rootpath'] . 'lib/common.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib/charset.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib2/const.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib/data-license.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib/common.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib/charset.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib2/const.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib/data-license.inc.php');
|
||||
require_once($opt['rootpath'] . 'lib/npas.inc.php');
|
||||
|
||||
if ($error == true)
|
||||
{
|
||||
@@ -561,6 +562,8 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
|
||||
fwrite($f, $t2 . '<license>' . xmlcdata($disclaimer) . '</license>' . "\n");
|
||||
else if ($disclaimer != "")
|
||||
$desc .= "<p><em>" . $disclaimer . "</em></p>";
|
||||
|
||||
$desc .= get_desc_npas($r['cache_id']);
|
||||
|
||||
fwrite($f, $t2 . '<desc html="' . (($r['desc_html'] == 1) ? '1' : '0') . '">' . xmlcdata(($bAllowView ? $desc : '')) . '</desc>' . "\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user