Fix php syntax issues
--- a/include/common-session.inc.php
+++ b/include/common-session.inc.php
@@ -62,7 +62,7 @@
//debug(print_r($_SESSION, true) , "session");
function current_time($time = "") {
- if ($_REQUEST['time']) return $_REQUEST['time'];
+ if (isset($_REQUEST['time'])) return $_REQUEST['time'];
else if ($time != "") date("H:i:s",$time);
else return date("H:i:s");
}
--- a/include/db/trip-dao.inc.php
+++ b/include/db/trip-dao.inc.php
@@ -78,7 +78,7 @@
join trips on trips.trip_id = stop_times.trip_id
join routes on trips.route_id = routes.route_id
join stops on stops.stop_id = stop_times.stop_id
-WHERE trips.trip_id = :tripID $range ORDER BY stop_sequence";
+WHERE trips.trip_id = :tripID ORDER BY stop_sequence";
debug($query, "database");
$query = $conn->prepare($query);
$query->bindParam(":tripID", $tripID);
--- a/myway/myway_timeliness_calculate.php
+++ b/myway/myway_timeliness_calculate.php
@@ -95,7 +95,7 @@
}
$timeDeltas = Array();
foreach ($potentialRoutes as $potentialRoute) {
- echo "Matched route: {$potentialRoute['route_id']} {$potentialRoute['route_short_name']}{$potentialRoute['route_long_name']} {$timing_period}<br>";
+ echo "Matched route: {$potentialRoute['route_id']} {$potentialRoute['route_short_name']} {$timing_period}<br>";
foreach ($potentialStops as $potentialStop) {
$stopRoutes = getStopRoutes($potentialStop['stop_id'], $timing_period);
$foundRoute = Array();
--- a/stop.php
+++ b/stop.php
@@ -127,7 +127,7 @@
$earlierTime = strtotime($trips[$tripsKeys[0]]['arrival_time']) - (90 * 60);
$laterTime = strtotime($trips[$tripsKeys[sizeof($trips) - 1]]['arrival_time']) - 60;
}
-if (sizeof($stopids) > 0) {
+if (isset($stopids) && sizeof($stopids) > 0) {
$stopidurl = "stopids=" . implode(",", $stopids);
} else {
$stopidurl = "stopid=$stopid";
--- a/stopList.php
+++ b/stopList.php
@@ -94,9 +94,8 @@
//var_dump($stops);
$stopsGrouped = Array();
foreach ($stops as $key => $stop) {
- if (stopCompare($stops[$key]["stop_name"])
- != stopCompare($stops[$key + 1]["stop_name"])
- || $key + 1 >= sizeof($stops)) {
+ if ($key + 1 >= sizeof($stops) ||
+ stopCompare($stops[$key]["stop_name"]) != stopCompare($stops[$key + 1]["stop_name"])) {
if (sizeof($stopsGrouped) > 0) {
// print and empty grouped stops
// subsequent duplicates