discard duplicate GC attributes in GPX; fixes #257
This commit is contained in:
@ -480,13 +480,22 @@
|
|||||||
FROM `caches_attributes`
|
FROM `caches_attributes`
|
||||||
INNER JOIN `cache_attrib` ON `cache_attrib`.`id`=`caches_attributes`.`attrib_id`
|
INNER JOIN `cache_attrib` ON `cache_attrib`.`id`=`caches_attributes`.`attrib_id`
|
||||||
WHERE `caches_attributes`.`cache_id`=&1", $r['cacheid']);
|
WHERE `caches_attributes`.`cache_id`=&1", $r['cacheid']);
|
||||||
|
$gc_ids = array();
|
||||||
while ($rAttrib = sql_fetch_array($rsAttributes))
|
while ($rAttrib = sql_fetch_array($rsAttributes))
|
||||||
{
|
{
|
||||||
$thisattribute = mb_ereg_replace('{attrib_id}', $rAttrib['gc_id'], $gpxAttributes);
|
// Multiple OC attributes can be mapped to one GC attribute, either with
|
||||||
$thisattribute = mb_ereg_replace('{attrib_inc}', $rAttrib['gc_inc'], $thisattribute);
|
// the same "inc"s or with different. Both may disturb applications, so we
|
||||||
$thisattribute = mb_ereg_replace('{attrib_name}', xmlentities($rAttrib['gc_name']), $thisattribute);
|
// output each GC ID only once.
|
||||||
$attribentries .= $thisattribute . "\n";
|
if (!isset($gc_ids[$rAttrib['gc_id']]))
|
||||||
|
{
|
||||||
|
$thisattribute = mb_ereg_replace('{attrib_id}', $rAttrib['gc_id'], $gpxAttributes);
|
||||||
|
$thisattribute = mb_ereg_replace('{attrib_inc}', $rAttrib['gc_inc'], $thisattribute);
|
||||||
|
$thisattribute = mb_ereg_replace('{attrib_name}', xmlentities($rAttrib['gc_name']), $thisattribute);
|
||||||
|
$attribentries .= $thisattribute . "\n";
|
||||||
|
$gc_ids[$rAttrib['gc_id']] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_free_result($rsAttributes);
|
mysql_free_result($rsAttributes);
|
||||||
$thisline = mb_ereg_replace('{attributes}', $attribentries, $thisline);
|
$thisline = mb_ereg_replace('{attributes}', $attribentries, $thisline);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user