Ensure all variables are initialised in nearby routes codepath
--- a/include/db/route-dao.inc.php
+++ b/include/db/route-dao.inc.php
@@ -266,12 +266,13 @@
}
function getRoutesNearby($lat, $lng, $limit = "", $distance = 500) {
- if ($service_period == "")
+ // if ($service_period == "")
$service_period = service_period();
$service_ids = service_ids($service_period);
$sidA = $service_ids[0];
$sidB = $service_ids[1];
- if ($limit != "")
+ $limitSQL = "";
+ if ($limit != "")
$limitSQL = " LIMIT :limit ";
global $conn;
$query = "SELECT service_id,trips.route_id,trips.direction_id,route_short_name,route_long_name,min(stops.stop_id) as stop_id,
@@ -300,3 +301,4 @@
}
?>
+
--- a/routeList.php
+++ b/routeList.php
@@ -92,7 +92,7 @@
} else if (isset($nearby)) {
$routes = Array();
include_header("Routes Nearby", "routeList", true, true);
- trackEvent("Route Lists", "Routes Nearby", $_SESSION['lat'] . "," . $_SESSION['lon']);
+ if (isset($_SESSION['lat'])) trackEvent("Route Lists", "Routes Nearby", $_SESSION['lat'] . "," . $_SESSION['lon']);
navbar();
placeSettings();
if (!isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == "") {