Make sure urls encode spaces, disable google analytics on localhost
Make sure urls encode spaces, disable google analytics on localhost

--- 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-template.inc.php
+++ b/include/common-template.inc.php
@@ -129,7 +129,7 @@
 
 </script> ";
 	}
-	echo '
+	if (!isDebugServer()) echo '
 <script type="text/javascript">'."
 
   var _gaq = _gaq || [];
@@ -145,7 +145,8 @@
 s.parentNode.insertBefore(ga, s);
   })();
 
-</script></head>".'
+</script>";
+echo '</head>
 <body>
     <div id="skip">
     <a href="#maincontent">Skip to content</a>
@@ -176,7 +177,7 @@
 	}
 	echo '<div id="footer"><a href="about.php">About/Contact Us</a>&nbsp;<a href="feedback.php">Feedback/Bug Report</a></a>';
 	echo '</div>';
-        if (!isDebug()) {
+        if (!isDebugServer()) {
          $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl();
   echo '<img src="' . $googleAnalyticsImageUrl . '" />';
     }

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

file:a/trip.php -> file:b/trip.php
--- a/trip.php
+++ b/trip.php
@@ -40,7 +40,7 @@
 	echo '<a href="trip.php?tripid=' . $othertrip[1] . "&routeid=" . $routeid . '">' . midnight_seconds_to_time($othertrip[0]) . '</a> ';
 }
 echo '</p><p><h2>Other directions/timing periods:</h2> ';
-$url = $APIurl . "/json/routesearch?routeshortname=" . $trips[1]->route_short_name;
+$url = $APIurl . "/json/routesearch?routeshortname=" . rawurlencode($trips[1]->route_short_name);
 $json = json_decode(getPage($url));
 foreach ($json as $row) {
 	if ($row[0] != $routeid) echo '<a href="trip.php?routeid=' . $row[0] . '">' . $row[2] . ' (' . ucwords($row[3]) . ')</a> ';

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