Better walking directions wording, output url on curl http fetch errors
--- a/include/common-net.inc.php
+++ b/include/common-net.inc.php
@@ -7,7 +7,14 @@
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$page = curl_exec($ch);
- if (curl_errno($ch)) echo "<font color=red> Database temporarily unavailable: " . curl_errno($ch) . " " . curl_error($ch) . "</font><br>";
+ if (curl_errno($ch)) {
+ echo "<font color=red> Database temporarily unavailable: ";
+ echo curl_errno($ch) . " " . curl_error($ch);
+ if (isDebug()) {
+ echo $url;
+ }
+ echo "</font><br>";
+ }
curl_close($ch);
debug(print_r($page,true),"json");
return $page;
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -16,7 +16,7 @@
$googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q";
$otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/';
if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com") {
- 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/';
+ $otpAPIurl = 'http://bus-main.lambdacomplex.org:8080/opentripplanner-api-webapp/';
}
if (isDebug("phperror")) error_reporting(E_ALL ^ E_NOTICE);
include_once ("common-geo.inc.php");
--- a/tripPlanner.php
+++ b/tripPlanner.php
@@ -92,7 +92,17 @@
}
echo "" . staticmap($walkStepMarkers, 0, "icong", false) . "<br>\n";
foreach ($leg->steps->walkSteps as $stepNumber => $step) {
- echo "Walking step " . ($stepNumber + 1) . " $step->absoluteDirection / $step->relativeDirection on $step->streetName for " . floor($step->distance) . " meters<br>\n";
+ echo "Walking step " . ($stepNumber + 1) . ": ";
+ if ($step->relativeDirection == "CONTINUE") {
+ echo "Continue, ";
+ } else if ($step->relativeDirection) echo "Turn ".ucwords(strtolower(str_replace("_"," ",$step->relativeDirection))).", ";
+ echo "Go ".ucwords(strtolower($step->absoluteDirection))." on ";
+ if (strpos($step->streetName,"from") !== false && strpos($step->streetName,"way") !== false) {
+ echo "footpath";
+ } else {
+ echo $step->streetName;
+ }
+ echo " for " . floor($step->distance) . " meters<br>\n";
}
}
}
@@ -116,8 +126,9 @@
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$page = curl_exec($ch);
if (curl_errno($ch)) {
- tripPlanForm("Trip planner temporarily unavailable: " . curl_errno($ch) . " " . curl_error($ch));
- }
+ tripPlanForm("Trip planner temporarily unavailable: " . curl_errno($ch) . " " . curl_error($ch) .(isDebug() ? $url : ""));
+
+ }
else {
$tripplan = json_decode($page);
debug(print_r($triplan, true));