Better walking directions wording, output url on curl http fetch errors
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
@@ -1,16 +1,23 @@
 <?php
 date_default_timezone_set('Australia/ACT');
 $APIurl = "http://localhost:8765";
-$cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6";
-$googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q";
-$otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/';
-//$debugOkay = Array("session","json","phperror","other");
 $debugOkay = Array(
 	"session",
 	"json",
 	"phperror",
+	"awsgtfs",
+	"awsotp",
 	"other"
 );
+if (isDebug("awsgtfs")) {
+	$APIurl = "http://bus-main.lambdacomplex.org:8765";
+}
+$cloudmadeAPIkey = "daa03470bb8740298d4b10e3f03d63e6";
+$googleMapsAPIkey = "ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q";
+$otpAPIurl = 'http://localhost:8080/opentripplanner-api-webapp/';
+if (isDebug("awsotp") || php_uname('n') == "maxious.xen.prgmr.com") {
+	$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");
 include_once ("common-net.inc.php");
@@ -69,28 +76,9 @@
 }
 function isJQueryMobileDevice()
 {
-   // http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897
-	$user_agent = $_SERVER['HTTP_USER_AGENT'];   
-	return preg_match('/iphone/i', $user_agent)
-	|| preg_match('/android/i', $user_agent)
-	|| preg_match('/webos/i', $user_agent)
-	|| preg_match('/ios/i', $user_agent)
-	|| preg_match('/bada/i', $user_agent)
-	|| preg_match('/maemo/i', $user_agent)
-	|| preg_match('/meego/i', $user_agent)
-	|| preg_match('/fennec/i', $user_agent)
-	|| (preg_match('/symbian/i', $user_agent)
-	    && preg_match('/s60/i', $user_agent)
-	    && $browser['majorver'] >= 5)
-	|| (preg_match('/symbian/i', $user_agent)
-	    && preg_match('/platform/i', $user_agent)
-	    && $browser['majorver'] >= 3)
-	|| (preg_match('/blackberry/i', $user_agent)
-	    && $browser['majorver'] >= 5)
-	|| (preg_match('/opera mobile/i', $user_agent)
-	    && $browser['majorver'] >= 10)
-	|| (preg_match('/opera mini/i', $user_agent)
-	    && $browser['majorver'] >= 5);
+	// http://forum.jquery.com/topic/what-is-the-best-way-to-detect-all-useragents-which-can-handle-jquery-mobile#14737000002087897
+	$user_agent = $_SERVER['HTTP_USER_AGENT'];
+	return preg_match('/iphone/i', $user_agent) || preg_match('/android/i', $user_agent) || preg_match('/webos/i', $user_agent) || preg_match('/ios/i', $user_agent) || preg_match('/bada/i', $user_agent) || preg_match('/maemo/i', $user_agent) || preg_match('/meego/i', $user_agent) || preg_match('/fennec/i', $user_agent) || (preg_match('/symbian/i', $user_agent) && preg_match('/s60/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/symbian/i', $user_agent) && preg_match('/platform/i', $user_agent) && $browser['majorver'] >= 3) || (preg_match('/blackberry/i', $user_agent) && $browser['majorver'] >= 5) || (preg_match('/opera mobile/i', $user_agent) && $browser['majorver'] >= 10) || (preg_match('/opera mini/i', $user_agent) && $browser['majorver'] >= 5);
 }
 function isFastDevice()
 {
@@ -143,6 +131,7 @@
 	}
 	return (strcasecmp(substr($haystack, 0, strlen($needle)) , $needle) === 0);
 }
+
 function endsWith($haystack, $needle, $case = true)
 {
 	if ($case) {

--- 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));