Merge branch 'master' of https://github.com/maxious/ACTBus-ui
Merge branch 'master' of https://github.com/maxious/ACTBus-ui

Conflicts:
include/common-template.inc.php

file:a/about.php -> file:b/about.php
--- a/about.php
+++ b/about.php
@@ -25,7 +25,7 @@
 All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend, 
 change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site 
 without prior notice. </small>
-<?
+<?php
 include_footer();
 ?>
 

--- a/feedback.php
+++ b/feedback.php
@@ -26,7 +26,7 @@
 }
 if (isset($_REQUEST['feedback']) || isset($_REQUEST['newlocation'])){
 	sendEmail("bus.lambda feedback",print_r($_REQUEST,true));
-	echo "<center><h2>Thank you for your feedback!</h2></center>";
+	echo "<h2 style='text-align: center;'>Thank you for your feedback!</h2>";
 } else {
 $stopid = "";
 $stopcode = "";

--- a/include/common-geo.inc.php
+++ b/include/common-geo.inc.php
@@ -46,9 +46,9 @@
 		$center = $totalLat / sizeof($mapPoints) . "," . $totalLon / sizeof($mapPoints);
 	}
 	$output = "";
-	if ($collapsible) $output.= '<div data-role="collapsible" data-collapsed="true"><h3>Open Map...</h3>';
-	$output.= '<center><img src="' . curPageURL() . '/lib/staticmaplite/staticmap.php?center=' . $center . '&zoom=' . $zoom . '&size=' . $width . 'x' . $height . '&markers=' . 
-$markers . '" width=' . $width . ' height=' . $height . '></center>';
+	if ($collapsible) $output.= '<div class="map" data-role="collapsible" data-collapsed="true"><h3>Open Map...</h3>';
+	$output.= '<img class="map" src="' . curPageURL() . '/lib/staticmaplite/staticmap.php?center=' . $center . '&amp;zoom=' . $zoom . '&amp;size=' . $width . 'x' . $height . '&amp;markers=' . 
+$markers . '" width=' . $width . ' height=' . $height . '>';
 	if ($collapsible) $output.= '</div>';
 	return $output;
 }

--- a/include/common-template.inc.php
+++ b/include/common-template.inc.php
@@ -189,19 +189,21 @@
         <a name="maincontent" id="maincontent"></a>
         <div data-role="content"> ';
 		$overrides = getServiceOverride();
-		if ($overrides['service_id']){
-if  ($overrides['service_id'] == "noservice") {
-		echo '<div id="servicewarning">Buses are <strong>not running today</strong> due to industrial action/public holiday. See <a 
+		if ($overrides['service_id']) {
+				if ($overrides['service_id'] == "noservice") {
+					echo '<div id="servicewarning">Buses are <strong>not running today</strong> due to industrial action/public holiday. See <a 
 href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>';
-		} else {
-		echo '<div id="servicewarning">Buses are running on an altered timetable today due to industrial action/public holiday. See <a href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>';
+				}
+				else {
+					echo '<div id="servicewarning">Buses are running on an altered timetable today due to industrial action/public holiday. See <a href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>';
+				}
+			}
 		}
-		}
 	}
 }
 function include_footer()
 {
-	echo '<div id="footer"><a href="about.php">About/Contact Us</a>&nbsp;<a href="feedback.php">Feedback/Bug Report</a></a>';
+	echo '<div id="footer"><a href="about.php">About/Contact Us</a>&nbsp;<a href="feedback.php">Feedback/Bug Report</a>';
 	echo '</div>';
 	if (isAnalyticsOn()) {
 		echo "<script>  (function() {
@@ -214,7 +216,9 @@
   })();</script>";
 		$googleAnalyticsImageUrl = googleAnalyticsGetImageUrl();
 		echo '<noscript><img src="' . $googleAnalyticsImageUrl . '" /></noscript>';
-	}
+
+	}
+			echo "\n</div></div></body></html>";
 }
 function timePlaceSettings($geolocate = false)
 {
@@ -248,12 +252,12 @@
 		echo "<option value=\"$service_period\"" . (service_period() === $service_period ? " SELECTED" : "") . '>' . ucwords($service_period) . '</option>';
 	}
 	echo '</select>
-			<a href="#" style="display:none" name="currentPeriod" id="currentPeriod"/>Current Period?</a>
+			<a href="#" style="display:none" name="currentPeriod" id="currentPeriod">Current Period?</a>
 		</div>
 		
 		<input type="submit" value="Update"/>
-                </form>
-            </div></div>';
+                </div></form>
+            </div>';
 }
 function trackEvent($category, $action, $label = "", $value = - 1)
 {

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -25,7 +25,7 @@
             </ul>
 <?php
 echo timePlaceSettings();
-echo ' <a href="labs/index.php" data-role="button" data-icon="beaker">Busness R&D</a>';
+echo ' <a href="labs/index.php" data-role="button" data-icon="beaker">Busness R&amp;D</a>';
 include_footer(true)
 ?>
         

--- a/labs/index.php
+++ b/labs/index.php
@@ -1,6 +1,6 @@
 <?php
 include ('../include/common.inc.php');
-include_header("Busness R&D", "index")
+include_header("Busness R&amp;D", "index")
 ?>
 	    <ul data-role="listview" data-theme="e" data-groupingtheme="e">
 		<li data-role="list-divider" > Experimental Features </li>

--- a/routeList.php
+++ b/routeList.php
@@ -19,7 +19,7 @@
 	echo '  <ul data-role="listview" data-filter="true" data-inset="true" >';
 	if (!isset($_REQUEST['firstLetter'])) {
 		foreach (range('A', 'Z') as $letter) {
-			echo "<li><a href=\"routeList.php?firstLetter=$letter&bysuburb=yes\">$letter...</a></li>\n";
+			echo "<li><a href=\"routeList.php?firstLetter=$letter&amp;bysuburb=yes\">$letter...</a></li>\n";
 		}
 	}
 	else {
@@ -55,7 +55,7 @@
 	}
 
 	echo '  <ul data-role="listview" data-filter="true" data-inset="true" >';
-
+ if ($routes) {
 	foreach ($routes as $route) {
 		echo '<li><a href="trip.php?routeid=' . $route['route_id'] . '"><h3>' . $route['route_short_name'] . "</h3><p>" . $route['route_long_name'] . " (" . ucwords($route['service_id']) . ")</p>";
 		if ($_REQUEST['nearby']) {
@@ -64,6 +64,9 @@
 		}
 		echo "</a></li>\n";
 	}
+ } else {
+	echo "<li style='text-align: center;'> No routes nearby.</li>";
+ }
 }
 else if ($_REQUEST['bynumber'] || $_REQUEST['numberSeries']) {
 	include_header("Routes by Number", "routeList");

file:a/stop.php -> file:b/stop.php
--- a/stop.php
+++ b/stop.php
@@ -33,11 +33,11 @@
 		//	$stopNames[$key] = $sub_stop[1] . ' Stop #' . ($key + 1);
 		if (strpos($stop["stop_name"], "Station")) {
 			$stopNames[$key] = 'Platform ' . ($key + 1);
-			$stopLinks.= '<a href="stop.php?stopid=' . $sub_stop["stop_id"] . '&stopcode=' . $sub_stop["stop_code"] . '">' . $sub_stop["stop_name"] . '</a> ';
+			$stopLinks.= '<a href="stop.php?stopid=' . $sub_stop["stop_id"] . '&amp;stopcode=' . $sub_stop["stop_code"] . '">' . $sub_stop["stop_name"] . '</a> ';
 		}
 		else {
 			$stopNames[$key] = '#' . ($key + 1);
-			$stopLinks.= '<a href="stop.php?stopid=' . $sub_stop["stop_id"] . '&stopcode=' . $sub_stop["stop_code"] . '">' . $sub_stop["stop_name"] . ' Stop #' . ($key + 1) . '</a> ';
+			$stopLinks.= '<a href="stop.php?stopid=' . $sub_stop["stop_id"] . '&amp;stopcode=' . $sub_stop["stop_code"] . '">' . $sub_stop["stop_name"] . ' Stop #' . ($key + 1) . '</a> ';
 		}
 		$stopPositions[$key] = Array(
 			$sub_stop["stop_lat"],
@@ -64,20 +64,19 @@
 }
 include_header($stop['stop_name'], "stop");
 timePlaceSettings();
-echo '<div data-role="content" class="ui-content" role="main">        <a name="maincontent" id="maincontent"></a>';
 echo $stopLinks;
 if (sizeof($stops) > 0) {
 	trackEvent("View Stops", "View Combined Stops", $stop["stop_name"], $stop["stop_id"]);
-	echo '<p>' . staticmap($stopPositions) . '</p>';
+	echo staticmap($stopPositions);
 }
 else {
 	trackEvent("View Stops", "View Single Stop", $stop["stop_name"], $stop["stop_id"]);
-	echo '<p>' . staticmap(Array(
+	echo staticmap(Array(
 		0 => Array(
 			$stop["stop_lat"],
 			$stop["stop_lon"]
 		)
-	)) . '</p>';
+	)) ;
 }
 echo '  <ul data-role="listview"  data-inset="true">';
 if (sizeof($allStopsTrips) > 0) {
@@ -88,12 +87,12 @@
 	$trips = getStopTripsWithTimes($stopid);
 }
 if (sizeof($trips) == 0) {
-	echo "<li> <center>No trips in the near future.</center> </li>";
+	echo "<li style='text-align: center;'>No trips in the near future.</li>";
 }
 else {
 	foreach ($trips as $trip) {
 		echo '<li>';
-		echo '<a href="trip.php?stopid=' . $stopid . '&tripid=' . $trip['trip_id'] . '"><h3>' . $trip['route_short_name'] . " " . $trip['route_long_name'] . "</h3><p>";
+		echo '<a href="trip.php?stopid=' . $stopid . '&amp;tripid=' . $trip['trip_id'] . '"><h3>' . $trip['route_short_name'] . " " . $trip['route_long_name'] . "</h3><p>";
 		$viaPoints = viaPointNames($trip['trip_id'], $trip['stop_sequence']);
 		if ($viaPoints != "") echo '<br><span class="viaPoints">Via: ' . $viaPoints . '</span>';
 		if (sizeof($tripStopNumbers) > 0) {
@@ -110,7 +109,7 @@
 		@ob_flush();
 	}
 }
-echo '</ul></div>';
+echo '</ul>';
 include_footer();
 ?>
 

--- a/stopList.php
+++ b/stopList.php
@@ -25,7 +25,7 @@
 	echo '  <ul data-role="listview" data-filter="true" data-inset="true" >';
 	if (!isset($_REQUEST['firstLetter'])) {
 		foreach (range('A', 'Z') as $letter) {
-			echo "<li><a href=\"stopList.php?firstLetter=$letter&suburbs=yes\">$letter...</a></li>\n";
+			echo "<li><a href=\"stopList.php?firstLetter=$letter&amp;suburbs=yes\">$letter...</a></li>\n";
 		}
 	}
 	else {
@@ -75,7 +75,7 @@
 	echo '  <ul data-role="listview" data-filter="true" data-inset="true" >';
 	if (!isset($_REQUEST['firstLetter']) && !$_REQUEST['suburb'] && !$_REQUEST['nearby']) {
 		foreach (range('A', 'Z') as $letter) {
-			echo "<li><a href=\"stopList.php?firstLetter=$letter&$listType\">$letter...</a></li>\n";
+			echo "<li><a href=\"stopList.php?firstLetter=$letter&amp;$listType\">$letter...</a></li>\n";
 		}
 	}
 	else {
@@ -102,7 +102,7 @@
 					// just a normal stop
 					echo '<li>';
 					if (!startsWith($stop['stop_code'], "Wj")) echo '<img src="css/images/time.png" alt="Timing Point" class="ui-li-icon">';
-					echo '<a href="stop.php?stopid=' . $stop['stop_id'] . (startsWith($stop['stop_code'], "Wj") ? '&stopcode=' . $stop['stop_code'] : "") . '">';
+					echo '<a href="stop.php?stopid=' . $stop['stop_id'] . (startsWith($stop['stop_code'], "Wj") ? '&amp;stopcode=' . $stop['stop_code'] : "") . '">';
 					if (isset($_SESSION['lat']) && isset($_SESSION['lon'])) {
 						echo '<span class="ui-li-count">' . distance($stop['stop_lat'],$stop['stop_lon'], $_SESSION['lat'], $_SESSION['lon'], true) . 'm away</span>';
 					}

file:a/trip.php -> file:b/trip.php
--- a/trip.php
+++ b/trip.php
@@ -20,13 +20,13 @@
 trackEvent("Route/Trip View","View Route",  $trip['route_short_name'] . ' ' . $trip['route_long_name'], $routeid);
 
 
-echo '<p><h2>Via:</h2> ' . viaPointNames($tripid) . '</small></p>';
-echo '<p><h2>Other Trips:</h2> ';
+echo '<h2>Via:</h2> <small>' . viaPointNames($tripid) . '</small>';
+echo '<h2>Other Trips:</h2> ';
 foreach (getRouteTrips($routeid) as $othertrip) {
-	echo '<a href="trip.php?tripid=' . $othertrip['trip_id'] . "&routeid=" . $routeid . '">' . str_replace("  ",":00",str_replace(":00"," ",$othertrip['arrival_time'])). '</a> ';
+	echo '<a href="trip.php?tripid=' . $othertrip['trip_id'] . "&amp;routeid=" . $routeid . '">' . str_replace("  ",":00",str_replace(":00"," ",$othertrip['arrival_time'])). '</a> ';
 }
 flush(); @ob_flush();
-echo '</p><p><h2>Other directions/timing periods:</h2> ';
+echo '<h2>Other directions/timing periods:</h2> ';
 foreach (getRoutesByNumber($trip['route_short_name']) as $row) {
 	if ($row['route_id'] != $routeid) echo '<a href="trip.php?routeid=' . $row['route_id'] . '">' . $row['route_long_name'] . ' (' . ucwords($row['service_id']) . ')</a> ';
 }
@@ -58,7 +58,7 @@
 		}
 		else {
 			// just a normal stop
-			echo '<a href="stop.php?stopid=' . $tripStopTime['stop_id'] . (startsWith($tripStopTime['stop_code'], "Wj") ? '&stopcode=' . $tripStopTime['stop_code'] : "") . '">';
+			echo '<a href="stop.php?stopid=' . $tripStopTime['stop_id'] . (startsWith($tripStopTime['stop_code'], "Wj") ? '&amp;stopcode=' . $tripStopTime['stop_code'] : "") . '">';
 			echo '<p class="ui-li-aside">' . $tripStopTime['arrival_time'] . '</p>';
 			if (isset($_SESSION['lat']) && isset($_SESSION['lon'])) {
 						echo '<span class="ui-li-count">' . distance($stop['stop_lat'],$stop['stop_lon'], $_SESSION['lat'], $_SESSION['lon'], true) . 'm away</span>';