Escape keyword "end" for older versions of postgresql
Escape keyword "end" for older versions of postgresql

--- a/include/common-template.inc.php
+++ b/include/common-template.inc.php
@@ -60,9 +60,9 @@
         $jqjs = $basePath . "js/jquery-1.6.2.min.js";
         $jqmjs = $basePath . "js/jquery.mobile-$jqmVersion.js";
     } else {
-        $jqmcss = "//code.jquery.com/mobile/1.0b3/jquery.mobile-$jqmVersion.min.css";
+        $jqmcss = "//code.jquery.com/mobile/$jqmVersion/jquery.mobile-$jqmVersion.min.css";
         $jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js";
-        $jqmjs = "//code.jquery.com/mobile/1.0b3/jquery.mobile-$jqmVersion.min.js";
+        $jqmjs = "//code.jquery.com/mobile/$jqmVersion/jquery.mobile-$jqmVersion.min.js";
     }
     echo '<link rel="stylesheet"  href="' . $jqmcss . '" />
 	<script src="' . $jqjs . '"></script>

--- a/include/db/servicealert-dao.inc.php
+++ b/include/db/servicealert-dao.inc.php
@@ -32,7 +32,7 @@
 
 function getServiceAlert($alertID) {
     global $conn;
-    $query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from end) as end,cause,effect,header,description,url from servicealerts_alerts where id = :servicealert_id";
+    $query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from \"end\") as \"end\",cause,effect,header,description,url from servicealerts_alerts where id = :servicealert_id";
     debug($query, "database");
     $query = $conn->prepare($query);
     $query->bindParam(":servicealert_id", $alertID);
@@ -87,7 +87,7 @@
 
 function getCurrentAlerts() {
     global $conn;
-    $query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from end) as end,cause,effect,header,description,url from servicealerts_alerts where NOW() > start and NOW() < \"end\"";
+    $query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from \"end\") as \"end\",cause,effect,header,description,url from servicealerts_alerts where NOW() > start and NOW() < \"end\"";
     // debug($query, "database");
     $query = $conn->prepare($query);
     $query->execute();
@@ -100,7 +100,7 @@
 
 function getFutureAlerts() {
     global $conn;
-    $query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from end) as end,cause,effect,header,description,url from servicealerts_alerts where NOW() > start or NOW() < \"end\"";
+    $query = "SELECT id,extract('epoch' from start) as start, extract('epoch' from \"end\") as \"end\",cause,effect,header,description,url from servicealerts_alerts where NOW() > start or NOW() < \"end\"";
     // debug($query, "database");
     $query = $conn->prepare($query);
     $query->execute();