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 \n" "Language-Team: following \n" "Language: German\n" @@ -19,11 +19,15 @@ msgstr "" "X-Poedit-SearchPath-1: D:\\PRIV\\Projekty\\EclipseWorkspace\\opencaching-api" "\\okapi\n" -#: 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 geocache description comes from the %sCache-Beschreibung stammt von %s." -#: 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 "" "© %s, %s, CC-BY-NC-ND, Stand: %s; " "alle Logeinträge © 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 "" "© %s, %s, get_parameter('trackables'); if (!$tmp) $tmp = 'none'; if (!in_array($tmp, array('none', 'desc:list', 'desc:count'))) @@ -131,7 +141,8 @@ class WebService # Which fields of the services/caches/geocaches method do we need? $fields = 'code|name|location|date_created|url|type|status|size|size2|oxsize'. - '|difficulty|terrain|description|hint2|rating|owner|url|internal_id'; + '|difficulty|terrain|description|hint2|rating|owner|url|internal_id'. + '|protection_areas'; if ($vars['images'] != 'none') $fields .= "|images"; if (count($vars['attrs']) > 0) diff --git a/htdocs/okapi/services/caches/formatters/gpx.xml b/htdocs/okapi/services/caches/formatters/gpx.xml index 66283b57..dd44f552 100644 --- a/htdocs/okapi/services/caches/formatters/gpx.xml +++ b/htdocs/okapi/services/caches/formatters/gpx.xml @@ -102,6 +102,21 @@ parameter to none. Using an empty string won't work this way - it will trigger the default (desc:text) to be selected, for backward-compatibility.

+ +

This argument controls wether protection area information is included and how + it is included.

+
    +
  • desc:text - 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.
  • +
  • desc:auto - protection area information may be included in the + cache description, depending on the installation.
  • +
  • none - no protection area information will be included in the + GPX data.
  • +
+

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> + + <p></p> + <ul> + + <li></li> + + </ul;> + diff --git a/htdocs/okapi/services/caches/geocache.xml b/htdocs/okapi/services/caches/geocache.xml index b77706e6..eaeeeed8 100644 --- a/htdocs/okapi/services/caches/geocache.xml +++ b/htdocs/okapi/services/caches/geocache.xml @@ -362,6 +362,21 @@ in (but it *may* start to vary on the value of your langpref parameter in the future).

+
  • +

    protection_areas - list of dictionaries, each representing a + protection area in which the cache probably is located; each dictionary + has the following structure:

    +
      +
    • type - the type of the protection area, e.g. + "National Nature Reserve",
    • +
    • name - the name of the protection area, e.g. + "East Dartmoor Woods and Heaths".
    • +
    +

    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]))