From: maxious Date: Wed, 16 Mar 2011 07:24:01 +0000 Subject: More lax geolocation X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=c6a81e7cb2be952cfca5805d5af6f8ce0bf70b6c --- More lax geolocation --- --- a/common-template.inc.php +++ b/common-template.inc.php @@ -65,7 +65,12 @@ } if (navigator.geolocation) { - navigator.geolocation.getCurrentPosition(success, error); +var options = { + enableHighAccuracy: false, + timeout: 60000, + maximumAge: 10000 +} + navigator.geolocation.getCurrentPosition(success, error, options); } "; --- a/common.inc.php +++ b/common.inc.php @@ -150,5 +150,33 @@ { return str_replace(")", "", str_replace("(", "
", $input)); } + +function sksort(&$array, $subkey="id", $sort_ascending=false) { + + if (count($array)) + $temp_array[key($array)] = array_shift($array); + + foreach($array as $key => $val){ + $offset = 0; + $found = false; + foreach($temp_array as $tmp_key => $tmp_val) + { + if(!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) + { + $temp_array = array_merge( (array)array_slice($temp_array,0,$offset), + array($key => $val), + array_slice($temp_array,$offset) + ); + $found = true; + } + $offset++; + } + if(!$found) $temp_array = array_merge($temp_array, array($key => $val)); + } + + if ($sort_ascending) $array = array_reverse($temp_array); + + else $array = $temp_array; +} ?> --- a/index.php +++ b/index.php @@ -19,6 +19,7 @@
  • Timetables - Routes
  • Routes By Final Destination
  • Routes By Number
  • +
  • Stops By Suburb
  • Nearby Routes
  • '; -echo '