FIx unclosed script tags in analytics
FIx unclosed script tags in analytics

--- a/include/common-template.inc.php
+++ b/include/common-template.inc.php
@@ -43,6 +43,10 @@
         <script type="text/javascript" src="js/jquery-mobile-1.0a3.js"></script>';
 	else echo '<link rel="stylesheet"  href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
         <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script>
+	 <script>$(document).bind("mobileinit", function(){
+  $.mobile.ajaxEnabled = false;
+});
+</script>
         <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>';
 	if ($datepicker) echo '<script> 
 		//reset type=date inputs to text
@@ -118,7 +122,7 @@
 
 function success(position) {
 $('#geolocate').val(position.coords.latitude+','+position.coords.longitude);
-$.ajax({ url: \"common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude });
+$.ajax({ url: \"include/common.inc.php?geolocate=yes&lat=\"+position.coords.latitude+\"&lon=\"+position.coords.longitude });
 location.reload(true);
 }
 function error(msg) {
@@ -183,7 +187,7 @@
 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
     var s = document.getElementsByTagName('script')[0]; 
 s.parentNode.insertBefore(ga, s);
-  })();";
+  })();</script>";
          $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl();
   echo '<noscript><img src="' . $googleAnalyticsImageUrl . '" /></noscript>';
     }
@@ -229,7 +233,7 @@
 }
 function trackEvent($category, $action, $label = "", $value = -1) {
   if (isAnalyticsOn()) {
-    echo "<script> _gaq.push(['_trackEvent', $category, $action".($label != "" ? ", $label" : "").($value != -1 ? ", $value" : "")."]);";
+    echo "<script> _gaq.push(['_trackEvent', $category, $action".($label != "" ? ", $label" : "").($value != -1 ? ", $value" : "")."]);</script>";
   }
 }
 ?>

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -1,6 +1,6 @@
 <?php
 include ('include/common.inc.php');
-include_header("bus.lambdacomplex.org", "index", false, true)
+include_header("bus.lambdacomplex.org", "index", false)
 ?>
 <div data-role="page">
 	<div data-role="content">

--- a/routeList.php
+++ b/routeList.php
@@ -36,16 +36,16 @@
 		$suburb = filter_var($_REQUEST['suburb'], FILTER_SANITIZE_STRING);
 		$url = $APIurl . "/json/stopzonesearch?q=" . $suburb;
 		include_header("Routes by Suburb", "routeList");
-		timePlaceSettings(true);
 		trackEvent("Route Lists","Routes By Suburb", $suburb);
-		if (!isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == "") {
-			include_footer();
-			die();
-		}
 	}
 	if ($_REQUEST['nearby']) {
 		$url = $APIurl . "/json/neareststops?lat={$_SESSION['lat']}&lon={$_SESSION['lon']}&limit=15";
 		include_header("Routes Nearby", "routeList", true, true);
+               timePlaceSettings(true);
+                if (!isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == "") {
+                        include_footer();
+                        die();
+                }
 	}
 	$stops = json_decode(getPage($url));
 	$routes = Array();