From: maxious Date: Wed, 16 Mar 2011 09:54:36 +0000 Subject: Misc formatting fixes like only show iOS stuff on those devices, don't show letters on nearby when have no nearby stuff X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=36df07e562251a2761a3c169162e4c0cef0fb632 --- Misc formatting fixes like only show iOS stuff on those devices, don't show letters on nearby when have no nearby stuff --- --- a/common-geo.inc.php +++ b/common-geo.inc.php @@ -51,7 +51,7 @@ if ($collapsible) $output.= ''; return $output; } -function distance($lat1, $lng1, $lat2, $lng2) +function distance($lat1, $lng1, $lat2, $lng2, $roundLargeValues = false) { $pi80 = M_PI / 180; $lat1*= $pi80; @@ -64,7 +64,10 @@ $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2); $c = 2 * atan2(sqrt($a) , sqrt(1 - $a)); $km = $r * $c; - return $km * 1000; + if ($roundLargeValues) { + if ($km < 1) return floor($km * 1000); + else return round($km,2)."k"; + } else return floor($km * 1000); } function decodePolylineToArray($encoded) { --- a/common-template.inc.php +++ b/common-template.inc.php @@ -20,7 +20,7 @@ }); '; -echo ' - +'; + if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod')) { + echo ' '; + } if ($geolocate) { echo "