Skip to content
Permalink
Browse files

Special Characters in GPX-/TXT-Files ; update #121 ; update #222

  • Loading branch information...
christian-m authored and following5 committed Jun 25, 2013
1 parent c1a9efd commit 55a9a7a51f7eea7fddfc091a09366566e376ef53
Showing with 8 additions and 6 deletions.
  1. +6 −4 htdocs/lib/search.gpx.inc.php
  2. +2 −2 htdocs/lib/search.txt.inc.php
@@ -352,7 +352,8 @@
$thisline = mb_ereg_replace('{hints}', '', $thisline);
else
// Ocprop: <groundspeak:encoded_hints>(.*?)<\/groundspeak:encoded_hints>
$thisline = mb_ereg_replace('{hints}', ' <groundspeak:encoded_hints>' . xmlentities(decodeEntities(strip_tags($r['hint']))) . '</groundspeak:encoded_hints>
$hint = html_entity_decode(strip_tags($r['hint']), ENT_COMPAT, "UTF-8");
$thisline = mb_ereg_replace('{hints}', ' <groundspeak:encoded_hints>' . xmlentities($hint) . '</groundspeak:encoded_hints>
', $thisline);
$thisline = mb_ereg_replace('{shortdesc}', xmlentities($r['short_desc']), $thisline);
@@ -569,7 +570,7 @@
}
exit;
function decodeEntities($str)
{
$str = changePlaceholder($str);
@@ -582,7 +583,8 @@ function changePlaceholder($str, $inverse = false)
{
$placeholder[0] = '{oc-placeholder-lt}'; $entity[0] = '&lt;';
$placeholder[1] = '{oc-placeholder-gt}'; $entity[1] = '&gt;';
for ($i=0;$i<=1;$i++)
$placeholder[2] = '{oc-placeholder-amp}'; $entity[2] = '&amp;';
for ($i=0;$i<count($placeholder);$i++)
{
if (!$inverse)
{
@@ -601,7 +603,7 @@ function xmlentities($str)
$str = htmlspecialchars($str, ENT_NOQUOTES, "UTF-8");
return filterevilchars($str);
}
function filterevilchars($str)
{
return mb_ereg_replace('[\\x00-\\x09|\\x0B-\\x0C|\\x0E-\\x1F]', '', $str);
@@ -83,8 +83,8 @@
//TODO: load from the users-profile
$distance_unit = 'km';
$lon_rad = $record_coords['longitude'] * 3.14159 / 180;
$lat_rad = $record_coords['latitude'] * 3.14159 / 180;
$lon_rad = $record_coords['longitude'] * 3.14159 / 180;
$lat_rad = $record_coords['latitude'] * 3.14159 / 180;
$sql .= getSqlDistanceFormula($record_coords['longitude'], $record_coords['latitude'], 0, $multiplier[$distance_unit]) . ' `distance`, ';
}

0 comments on commit 55a9a7a

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