diff --git a/htdocs/okapi/core.php b/htdocs/okapi/core.php
index 0ec0d36d..bc1854f6 100644
--- a/htdocs/okapi/core.php
+++ b/htdocs/okapi/core.php
@@ -814,7 +814,7 @@ class Okapi
{
public static $data_store;
public static $server;
- public static $revision = 863; # This gets replaced in automatically deployed packages
+ public static $revision = 869; # This gets replaced in automatically deployed packages
private static $okapi_vars = null;
/** Get a variable stored in okapi_vars. If variable not found, return $default. */
diff --git a/htdocs/okapi/locale/de_DE/LC_MESSAGES/okapi_messages.mo b/htdocs/okapi/locale/de_DE/LC_MESSAGES/okapi_messages.mo
index ae9ca1e6..7262bf7d 100644
Binary files a/htdocs/okapi/locale/de_DE/LC_MESSAGES/okapi_messages.mo and b/htdocs/okapi/locale/de_DE/LC_MESSAGES/okapi_messages.mo differ
diff --git a/htdocs/okapi/locale/de_DE/LC_MESSAGES/okapi_messages.po b/htdocs/okapi/locale/de_DE/LC_MESSAGES/okapi_messages.po
index 69ad4e01..16a9dae0 100644
--- a/htdocs/okapi/locale/de_DE/LC_MESSAGES/okapi_messages.po
+++ b/htdocs/okapi/locale/de_DE/LC_MESSAGES/okapi_messages.po
@@ -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
This argument controls wether protection area information is included and how + it is included.
+Note that information on protection areas may be incomplete or outdated + or completely missing on some installations.
+This argument controls wether information on trackables is included and how it is included. One of the following values:
diff --git a/htdocs/okapi/services/caches/formatters/gpxfile.tpl.php b/htdocs/okapi/services/caches/formatters/gpxfile.tpl.php index c19a7ce1..f5f68b3a 100644 --- a/htdocs/okapi/services/caches/formatters/gpxfile.tpl.php +++ b/htdocs/okapi/services/caches/formatters/gpxfile.tpl.php @@ -124,6 +124,14 @@ http://www.gsak.net/xmlv1/5 http://www.gsak.net/xmlv1/5/gsak.xsd } ?> </ul> } ?> + if ($vars['protection_areas'] == 'desc:text' && count($c['protection_areas'])) { ?> + <p>= _("The cache probably is located in the following protection areas:") ?></p> + <ul> + foreach($c['protection_areas'] as $protection_area) { ?> + <li>= Okapi::xmlescape($protection_area['type'])." - ".Okapi::xmlescape($protection_area['name']) ?></li> + } ?> + </ul;> + } ?>protection_areas - list of dictionaries, each representing a + protection area in which the cache probably is located; each dictionary + has the following structure:
+The types and names currently are in a local language of the OC site but + may be translated depending on the langpref parameter in the future.
+Note that this information is not authoritative. It may be outdated + or incomplete, and it is completely missing on some OC installations.
+last_found - date and time (ISO 8601) when the geocache was last found or null when it hasn't been yet found.
diff --git a/htdocs/okapi/services/caches/geocaches.php b/htdocs/okapi/services/caches/geocaches.php index 9bd13afa..21bff677 100644 --- a/htdocs/okapi/services/caches/geocaches.php +++ b/htdocs/okapi/services/caches/geocaches.php @@ -34,7 +34,8 @@ class WebService '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', + 'protection_areas'); public static function call(OkapiRequest $request) { @@ -338,6 +339,7 @@ class WebService 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 @@ class WebService ); } + # 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') == 'oc.de') + { + $rs = Db::query(" + select + c.wp_oc as cache_code, + npa_types.name as type, + npa_areas.name as name + from + 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 = npa_areas.id + inner join npa_types on npa_areas.type_id = npa_types.id + where + c.cache_id in (".$cache_ids_escaped_and_imploded.") + group by npa_areas.type_id, npa_areas.name + order by npa_types.ordinal + "); + } + else if (Settings::get('ORIGIN_URL') == 'http://opencaching.pl/' || + Settings::get('ORIGIN_URL') == 'http://www.opencaching.nl/') + { + # 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(" + select + c.wp_oc as cache_code, + '"._('National Park / Landscape')."' as type, + CONVERT(parkipl.name USING utf8) as name + from + caches c + inner join cache_npa_areas on cache_npa_areas.cache_id=c.cache_id + inner join parkipl on cache_npa_areas.parki_id=parkipl.id + where + c.cache_id in (".$cache_ids_escaped_and_imploded.") + and cache_npa_areas.parki_id != 0 + union + select + c.wp_oc as cache_code, + 'Natura 2000' as type, + CONVERT(npa_areas.sitename USING utf8) as name + from + 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=npa_areas.id + where + c.cache_id in (".$cache_ids_escaped_and_imploded.") + and cache_npa_areas.npa_id != 0 + "); + } + else + { + # 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'], + ); + } + mysql_free_result($rs); + } + } + # Check which cache codes were not found and mark them with null. foreach ($cache_codes as $cache_code) if (!isset($results[$cache_code]))