Use AWS resources for debugging
Use AWS resources for debugging

file:a/about.php -> file:b/about.php
--- a/about.php
+++ b/about.php
@@ -4,9 +4,14 @@
 ?>
 <p>
 Busness Time - An ACT bus timetable webapp<br />
-Based on the maxious-canberra-transit-feed (<a href="cbrfeed.zip">download</a>, last updated <?php
+Based on the maxious-canberra-transit-feed (<a 
+href="http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip">download</a>, 
+last updated <?php
 echo date("F d Y.", @filemtime('cbrfeed.zip')); ?>)<br />
-Source code for the transit feed and this site @ <a href="http://maxious.lambdacomplex.org/git">http://maxious.lambdacomplex.org/git</a><br />
+Source code for the <a 
+href="https://github.com/maxious/ACTBus-data">transit 
+feed</a> and <a href="https://github.com/maxious/ACTBus-ui">this 
+site</a> available from github.<br />
 Uses jQuery Mobile, PHP, Ruby, Python, Google Transit Feed Specification tools, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service<br />
 <br />
 Feedback encouraged; contact maxious@lambdacomplex.org<br />

--- a/aws/awsStartup.sh
+++ b/aws/awsStartup.sh
@@ -4,7 +4,6 @@
 #screen php-cli php-gd tomcat6-webapps tomcat6-admin-webapps svn maven2
 #http://www.how2forge.org/installing-lighttpd-with-php5-and-mysql-support-on-fedora-12
 
-cp -rfv /tmp/busui/* /var/www
 cp /root/aws.php /tmp/
 chcon -h system_u:object_r:httpd_sys_content_t /var/www
 chcon -R -h root:object_r:httpd_sys_content_t /var/www/*
@@ -14,7 +13,8 @@
 -O /var/www/cbrfeed.zip
 easy_install transitfeed
 easy_install simplejson
-screen -d -m /var/www/view.sh
+screen -S viewsh -X quit
+screen -S viewsh -d -m /var/www/view.sh
 
 wget http://s3-ap-southeast-1.amazonaws.com/busresources/Graph.obj \
 -O /tmp/Graph.obj

file:b/aws/compress.conf (new)
--- /dev/null
+++ b/aws/compress.conf
@@ -1,1 +1,33 @@
+#######################################################################
+##
+##  Output Compression 
+## --------------------
+##
+## see http://www.lighttpd.net/documentation/compress.html
+##
+server.modules += ( "mod_compress" )
 
+##
+## where should the compressed files be cached?
+## see the base config for the declaration of the variable.
+##
+## This directory should be changed per vhost otherwise you can
+## run into trouble with overlapping filenames
+##
+compress.cache-dir         = cache_dir + "/compress"
+
+##
+## FileTypes to compress.
+## 
+#compress.filetype          = ("text/plain", "text/html")
+compress.filetype = ("text/plain", "text/html", "text/javascript", "text/css", "text/xml")
+
+##
+## Maximum filesize that will be compressed.
+## Default is 0, which means unlimited file size.
+## 
+#compress.max-filesize = 0
+
+##
+#######################################################################
+

file:b/aws/expire.conf (new)
--- /dev/null
+++ b/aws/expire.conf
@@ -1,1 +1,29 @@
+#######################################################################
+##
+##  Expire Module 
+## --------------- 
+##
+## See http://www.lighttpd.net/documentation/expire.html
+##
+server.modules += ( "mod_expire" )
 
+##
+##  assignes a expiration to all files below the specified path. The
+##  specification of the time is made up of:
+##
+##    <access|modification> <number> <years|months|days|hours|minutes|seconds>
+##    
+#expire.url = (
+#  "/buggy/"  => "access 2 hours",
+#  "/images/" => "access plus 1 seconds 2 minutes"
+#)
+etag.use-mtime = "enable"
+etag.use-inode = "disable"
+static-file.etags = "enable"
+$HTTP["url"] =~ "\.(css|js|png|jpg|ico|gif)$" {
+	expire.url = ( "" => "access 7 days" )
+}
+
+##
+#######################################################################
+

--- a/aws/modules.conf
+++ b/aws/modules.conf
@@ -76,7 +76,7 @@
 ##
 ## mod_compress
 ##
-#include "conf.d/compress.conf"
+include "conf.d/compress.conf"
 
 ##
 ## mod_userdir
@@ -106,7 +106,7 @@
 ##
 ## mod_expire
 ##
-#include "conf.d/expire.conf"
+include "conf.d/expire.conf"
 
 ##
 ## mod_secdownload

--- a/aws/php.ini
+++ b/aws/php.ini
@@ -1,4 +1,6 @@
 [PHP]
+
+date.timezone = "Australia/Sydney"
 
 ;;;;;;;;;;;;;;;;;;;
 ; About php.ini   ;
@@ -288,7 +290,7 @@
 ; Note: You need to use zlib.output_handler instead of the standard
 ;   output_handler, or otherwise the output will be corrupted.
 ; http://www.php.net/manual/en/zlib.configuration.php#ini.zlib.output-compression
-zlib.output_compression = Off
+zlib.output_compression = on
 
 ; http://www.php.net/manual/en/zlib.configuration.php#ini.zlib.output-compression-level
 ;zlib.output_compression_level = -1
@@ -1264,7 +1266,7 @@
 ; where MODE is the octal representation of the mode. Note that this
 ; does not overwrite the process's umask.
 ; http://www.php.net/manual/en/session.configuration.php#ini.session.save-path
-session.save_path = "/var/lib/php/session"
+session.save_path = "/tmp"
 
 ; Whether to use cookies.
 ; http://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies

--- a/common-template.inc.php
+++ b/common-template.inc.php
@@ -30,8 +30,9 @@
 <html lang="en">
 	<head>
         <meta charset="UTF-8">
-	<title>' . $pageTitle . '</title>';
-        <meta name="google-site-verification" content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" />
+	<title>' . $pageTitle . '</title>
+        <meta name="google-site-verification" 
+content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" />';
 	if ($datepicker) echo '<link rel="stylesheet"  href="css/jquery.ui.datepicker.mobile.css" />';
 	if (isDebugServer()) echo '<link rel="stylesheet"  href="css/jquery-mobile-1.0a3.css" />
          <script type="text/javascript" src="js/jquery-1.5.js"></script>
@@ -73,7 +74,13 @@
     #jqm-homeheader {
         text-align: center;
     }        
-    
+    .viaPoints {
+        display: none;
+        text-size: 0.2em;
+    }
+    .min-width-480px .viaPoints {
+        display: block;
+    }
     // source http://webaim.org/techniques/skipnav/
     #skip a, #skip a:hover, #skip a:visited 
 { 
@@ -122,7 +129,23 @@
 
 </script> ";
 	}
-	echo '</head>
+	echo '
+<script type="text/javascript">
+
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-22173039-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 
+'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 
+'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; 
+s.parentNode.insertBefore(ga, s);
+  })();
+
+</script></head>
 <body>
     <div id="skip">
     <a href="#maincontent">Skip to content</a>

--- a/common.inc.php
+++ b/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") {
+	'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) {

file:a/readme.txt -> file:b/readme.txt
--- a/readme.txt
+++ b/readme.txt
@@ -1,30 +1,15 @@
-# input location (via GPS or favourites or search) and destination (via searchable list, optional)
-# http://10.0.1.153:8765/json/boundboxstops?n=-35.27568499917103&e=149.1346514225006&s=-35.279495003493516
-&w=149.12622928619385&limit=50
-# http://10.0.1.153:8765/json/stoptrips?stop=43&time=64440 # recursively call to show all services nearby, sort by distance, need to filter by service period
-# Hey, can pick destination again from a list filtered to places these stops go if you're curious!
-# http://10.0.1.153:8765/json/tripstoptimes?trip=2139 # Can recursively call and parse based on intended destination to show ETA
-# http://10.0.1.153:8765/json/triprows?trip=2139 # For pretty maps
+Busness Time - An ACT bus timetable webapp
+Based on the maxious-canberra-transit-feed @ http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip
+Source code for the https://github.com/maxious/ACTBus-data transit 
+feed and https://github.com/maxious/ACTBus-ui this site available from github.
+Uses jQuery Mobile, PHP, Ruby, Python, Google Transit Feed Specification 
+tools, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder 
+and Tile Service
 
-have to do
+Must have view.sh running on port 8765 for this webapp to work
+
+For static maps, may have to do
 /usr/sbin/setsebool -P httpd_can_network_connect=1
 on fedora
 
-might need http://forum.jquery.com/topic/google-maps-inside-jquery-mobile
 
-some extras
-/json/routes = all routes
-/json/neareststops?lat/lng/number
-TODO
-Destinations
-Favourites
-OOP stops/routes
-Stop sorting/search-filter
-
-static maps
-https://code.google.com/apis/maps/documentation/staticmaps/
-http://www.multimap.com/openapidocs/1.2/web_service/staticmaps.htm
-http://dev.openstreetmap.de/staticmap/ (os @ http://sourceforge.net/projects/staticmaplite/)
-(php and open source @ http://trac.openstreetmap.org/browser/sites/other/StaticMap?rev=16348)
-http://pafciu17.dev.openstreetmap.org/
-

file:a/stop.php -> file:b/stop.php
--- a/stop.php
+++ b/stop.php
@@ -72,10 +72,8 @@
 foreach ($trips as $row) {
 	echo '<li>';
 	echo '<h3><a href="trip.php?stopid=' . $stopid . '&tripid=' . $row[1][0] . '">' . $row[1][1];
-	if (isFastDevice()) {
-		$viaPoints = viaPointNames($row[1][0], $stopid);
-		if ($viaPoints != "") echo '<br><small>Via: ' . $viaPoints . '</small>';
-	}
+        $viaPoints = viaPointNames($row[1][0], $stopid);
+        if ($viaPoints != "") echo '<div class="viaPoints">Via: ' . $viaPoints . '</div>';
 	if (sizeof($tripStopNumbers) > 0) {
             echo '<br><small>Boarding At: ';
             foreach ($tripStopNumbers[$row[1][0]] as $key) {