--- a/betweenpoint.php
+++ b/betweenpoint.php
@@ -129,7 +129,9 @@
// Strip off individual platforms because it usually doesn't matter for routes
$timetable["time_points"] = preg_replace("/\(Platform.*/","",$timetable["time_points"]);
for ($i = 0; $i < sizeof($timetable["time_points"]) - 1; $i++) {
- @$paths[trim($timetable["time_points"][$i]) . "->" . trim($timetable["time_points"][$i + 1])] .= $timetable["short_name"] . ";";
+ $key = trim($timetable["time_points"][$i]) . "->" . trim($timetable["time_points"][$i + 1]);
+ if (strstr($paths[$key],";" . $timetable["short_name"] . ";") === false)
+ @$paths[$key] .= $timetable["short_name"] . ";";
}
}
}
@@ -139,9 +141,12 @@
$completedPaths = array();
$result_betweenstops = pg_query($conn, "Select * FROM between_stops");
while ($path = pg_fetch_assoc($result_betweenstops)) {
- $completedPaths[trim($path['fromlocation']) . "->" . trim($path['tolocation'])] .= trim($path['routes']);
+ $key = trim($path['fromlocation']) . "->" . trim($path['tolocation']);
+ $completedPaths[$key].= trim($path['routes']);
+
}
-
+
+
foreach ($paths as $path => $routes) {
if (!in_array($path, array_keys($completedPaths))) {
echo "\n";
@@ -150,12 +155,14 @@
$incompleteRoutes = "";
foreach (explode(";", $routes) as $route) {
- if (!in_array($route,$completedRoutes)) {
+ if (!in_array($route,$completedRoutes) && strstr($incompleteRoutes,';'.$route.';') === false) {
$incompleteRoutes .= $route.';';
}
}
- if ($incompleteRoutes != "") echo "\n";
+ if ($incompleteRoutes != "") {
+ echo "\n";
+ }
}
}