Skip to content
Browse files

added protection_areas field/option to geocaches and gpx methods

update issue 279
  • Loading branch information...
following09 committed Jul 10, 2013
1 parent de6ebb2 commit c47a421bdf91e1d468d477a76482b65767b688b4
Binary file not shown.
@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: OKAPI\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-05-03 00:54+0100\n"
"PO-Revision-Date: 2013-05-03 00:58+0100\n"
"POT-Creation-Date: 2013-07-10 12:30+0100\n"
"PO-Revision-Date: 2013-07-10 12:31+0100\n"
"Last-Translator: following <>\n"
"Language-Team: following <>\n"
"Language: German\n"
@@ -19,19 +19,23 @@ msgstr ""
"X-Poedit-SearchPath-1: D:\\PRIV\\Projekty\\EclipseWorkspace\\opencaching-api"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/geocaches.php:911
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/geocaches.php:956
msgid "Stage"
msgstr "Station"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/geocaches.php:1139
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/geocaches.php:1108
msgid "National Park / Landscape"
msgstr "Nationalpark / Landschaft"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/geocaches.php:1260
#, php-format
msgid ""
"This <a href='%s'>geocache</a> description comes from the <a href='%s'>%s</"
"a> site."
msgstr ""
"Diese <a href='%s'>Cache</a>-Beschreibung stammt von <a href='%s'>%s</a>."

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/geocaches.php:1151
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/geocaches.php:1272
#, php-format
msgid ""
"&copy; <a href='%s'>%s</a>, <a href='%s'>%s</a>, <a href='http://"
@@ -42,7 +46,7 @@ msgstr ""
"'>CC-BY-NC-ND</a>, Stand: %s; "
"alle Logeinträge &copy; jeweiliger Autor"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/geocaches.php:1162
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/geocaches.php:1283
#, php-format
msgid ""
"&copy; <a href='%s'>%s</a>, <a href='%s'>%s</a>, <a href='http://"
@@ -54,56 +58,61 @@ msgstr ""
"Logeinträge &copy; jeweiliger Autor"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:31
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:48
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:60
msgid "hidden by"
msgstr "versteckt von"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:50
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:62
#, php-format
msgid "%d recommendation"
msgid_plural "%d recommendations"
msgstr[0] "%d Empfehlung"
msgstr[1] "%d Empfehlungen"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:51
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:63
#, php-format
msgid "found %d time"
msgid_plural "found %d times"
msgstr[0] "%d mal gefunden"
msgstr[1] "%d mal gefunden"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:54
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:66
#, php-format
msgid "%d trackable"
msgid_plural "%d trackables"
msgstr[0] "%d Geokret"
msgstr[1] "%d Geokrets"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:58
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:70
msgid "Personal notes"
msgstr "Persönliche Notizen"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:62
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:74
msgid "Attributes"
msgstr "Attribute"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:66
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:78
msgid "Trackables"
msgstr "Geokrets"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:76
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:92
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:88
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:104
msgid "Images"
msgstr "Bilder"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:99
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:111
msgid "Spoilers"
msgstr "Spoiler"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:108
#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:120
msgid "Image descriptions"
msgstr "Bildbeschreibungen"

#: c:\source\oc\server-3.0\htdocs\okapi/services/caches/formatters/gpxfile.tpl.php:128
msgid "The cache probably is located in the following protection areas:"
msgstr ""
"Der Geocache befindet sich wahrscheinlich in den folgenden Schutzgebieten:"

#: c:\source\oc\server-3.0\htdocs\okapi/services/logs/submit.php:70
msgid ""
"You are trying to publish a log entry with a date in future. Cache log "
@@ -111,6 +111,16 @@ public static function call(OkapiRequest $request)
$protection_areas = $request->get_parameter('protection_areas');
if (!$protection_areas || $protection_areas == 'desc:auto')
if (Settings::get('OC_BRANCH') == '') $protection_areas = 'desc:text';
else $protection_areas = 'none';
if (!in_array($protection_areas, array('none', 'desc:text')))
throw new InvalidParam('protection_areas',"'$protection_areas'");
$vars['protection_areas'] = $protection_areas;
$tmp = $request->get_parameter('trackables');
if (!$tmp) $tmp = 'none';
if (!in_array($tmp, array('none', 'desc:list', 'desc:count')))
@@ -131,7 +141,8 @@ public static function call(OkapiRequest $request)
# Which fields of the services/caches/geocaches method do we need?
$fields = 'code|name|location|date_created|url|type|status|size|size2|oxsize'.
if ($vars['images'] != 'none')
$fields .= "|images";
if (count($vars['attrs']) > 0)
@@ -102,6 +102,21 @@
parameter to <b>none</b>. Using an empty string won't work this way - it will
trigger the default (<b>desc:text</b>) to be selected, for backward-compatibility.</p>
<opt name='protection_areas' default='desc:auto'>
<p>This argument controls wether protection area information is included and how
it is included.</p>
<li><b>desc:text</b> - if the cache is (probably) located within one or more
protection areas, e.g. a nature reserve, a list of the protection areas will
be included in the cache description.</li>
<li><b>desc:auto</b> - protection area information may be included in the
cache description, depending on the installation.</li>
<li><b>none</b> - no protection area information will be included in the
GPX data.</li>
<p>Note that information on protection areas may be incomplete or outdated
or completely missing on some installations.</p>
<opt name='trackables' default='none'>
<p>This argument controls wether information on trackables is included and how it is included.
One of the following values:</p>
@@ -124,6 +124,14 @@
<? } ?>
<? } ?>
<? if ($vars['protection_areas'] == 'desc:text' && count($c['protection_areas'])) { ?>
&lt;p&gt;<?= _("The cache probably is located in the following protection areas:") ?>&lt;/p&gt;
<? foreach($c['protection_areas'] as $protection_area) { ?>
&lt;li&gt;<?= Okapi::xmlescape($protection_area['type'])." - ".Okapi::xmlescape($protection_area['name']) ?>&lt;/li&gt;
<? } ?>
<? } ?>
<groundspeak:encoded_hints><?= Okapi::xmlescape($c['hint2']) ?></groundspeak:encoded_hints>
<? if ($vars['latest_logs']) { /* Does user want us to include latest log entries? */ ?>
@@ -362,6 +362,21 @@
in (but it *may* start to vary on the value of your <b>langpref</b>
parameter in the future).</p>
<p><b>protection_areas</b> - list of dictionaries, each representing a
protection area in which the cache probably is located; each dictionary
has the following structure:</p>
<li><b>type</b> - the type of the protection area, e.g.
"National Nature Reserve",</li>
<li><b>name</b> - the name of the protection area, e.g.
"East Dartmoor Woods and Heaths".</li>
<p>The types and names currently are in a local language of the OC site but
may be translated depending on the <b>langpref</b> parameter in the future.</p>
<p>Note that this information is not authoritative. It may be outdated
or incomplete, and it is completely missing on some OC installations.</p>
<p><b>last_found</b> - date and time (ISO 8601) when the
geocache was last found <b>or null</b> when it hasn't been yet found.</p>
@@ -34,7 +34,8 @@ public static function options()
'my_notes', 'trackables_count', 'trackables', 'alt_wpts', 'last_found',
'last_modified', 'date_created', 'date_hidden', 'internal_id', 'is_watched',
'is_ignored', 'willattends', 'country', 'state', 'preview_image',
'trip_time', 'trip_distance', 'attribution_note','gc_code', 'hint2', 'hints2');
'trip_time', 'trip_distance', 'attribution_note','gc_code', 'hint2', 'hints2',
public static function call(OkapiRequest $request)
@@ -338,6 +339,7 @@ public static function call(OkapiRequest $request)
case 'date_hidden': $entry['date_hidden'] = date('c', strtotime($row['date_hidden'])); break;
case 'internal_id': $entry['internal_id'] = $row['cache_id']; break;
case 'attribution_note': /* handled separately */ break;
case 'protection_areas': /* handled separately */ break;
default: throw new Exception("Missing field case: ".$field);
@@ -1073,6 +1075,85 @@ public static function call(OkapiRequest $request)
# Protection areas
if (in_array('protection_areas', $fields))
$cache_ids_escaped_and_imploded = "'".implode("','", array_map('mysql_real_escape_string', array_keys($cacheid2wptcode)))."'";
if (Settings::get('OC_BRANCH') == '')
$rs = Db::query("
c.wp_oc as cache_code, as type, as name
caches c
inner join cache_npa_areas on cache_npa_areas.cache_id=c.cache_id
inner join npa_areas on cache_npa_areas.npa_id =
inner join npa_types on npa_areas.type_id =
c.cache_id in (".$cache_ids_escaped_and_imploded.")
group by npa_areas.type_id,
order by npa_types.ordinal
else if (Settings::get('ORIGIN_URL') == '' ||
Settings::get('ORIGIN_URL') == '')
# Current OCPL table definitions use collation 'latin1' for parkipl
# and 'utf8' for np_areas. Union needs identical collations.
# To be sure, we convert both to utf8.
$rs = Db::query("
c.wp_oc as cache_code,
'"._('National Park / Landscape')."' as type,
_utf8'' as name
caches c
inner join cache_npa_areas on cache_npa_areas.cache_id=c.cache_id
inner join parkipl on
c.cache_id in (".$cache_ids_escaped_and_imploded.")
and cache_npa_areas.parki_id != 0
c.wp_oc as cache_code,
'Natura 2000' as type,
_utf8'npa_areas.sitename' as name
caches c
inner join cache_npa_areas on cache_npa_areas.cache_id=c.cache_id
inner join npa_areas on
c.cache_id in (".$cache_ids_escaped_and_imploded.")
and cache_npa_areas.npa_id != 0
# OC.US and .UK do not have a 'parkipl' table.
# OC.US has a 'us_parks' table instead.
# Natura 2000 is Europe-only.
$rs = null;
foreach ($results as &$result_ref)
$result_ref['protection_areas'] = array();
if ($rs)
while ($row = mysql_fetch_assoc($rs))
$results[$row['cache_code']]['protection_areas'][] = array(
'type' => $row['type'],
'name' => $row['name'],
# Check which cache codes were not found and mark them with null.
foreach ($cache_codes as $cache_code)
if (!isset($results[$cache_code]))

0 comments on commit c47a421

Please sign in to comment.
You can’t perform that action at this time.