Fix service alerts code standards
Fix service alerts code standards

--- a/aws/busuidb.sh
+++ b/aws/busuidb.sh
@@ -7,10 +7,10 @@
 psql -d transitdata -f /var/www/transitdata.cbrfeed.sql
 #createuser transitdata -SDRP
 #password transitdata
-#psql -d transitdata -c "GRANT SELECT ON TABLE agency,calendar,calendar_dates,routes,stop_times,stops,trips\
-#,servicealerts_alerts,servicealerts_informed TO transitdata;"
-#psql -d transitdata -c "GRANT SELECT,INSERT ON	TABLE myway_observations,myway_routes,myway_stops,myway_timingdeltas TO transitdata;"
-#psql -d transitdata -c	"GRANT SELECT,INSERT,UPDATE ON TABLE myway_routes,myway_stops TO transitdata;"
+#psql -d transitdata -c "GRANT SELECT ON TABLE agency,calendar,calendar_dates,routes,stop_times,stops,trips TO transitdata;"
+#psql -d transitdata -c "GRANT SELECT,INSERT ON TABLE myway_observations,myway_timingdeltas,myway_routes,myway_stops TO transitdata;"
+#psql -d transitdata -c	"GRANT SELECT,INSERT,UPDATE ON TABLE servicealerts_alerts,servicealerts_informed TO transitdata;"
+#psql -d transitdata -c	"GRANT USAGE,SELECT ON SEQUENCE servicealerts_alerts_id_seq TO transitdata;"
 ##psql -d transitdata -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO transitdata;"
 ## INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type")
 ##SELECT '', 'public', 'shapes', 'shape_pt', ST_CoordDim(shape_pt), ST_SRID(shape_pt), GeometryType(shape_pt)

--- a/rtpis/servicealert_editor.php
+++ b/rtpis/servicealert_editor.php
@@ -35,18 +35,18 @@
     echo "Saved " . $_REQUEST['saveedit'];
     die();
 }
-if ($_REQUEST['delete']) {
+if (isset($_REQUEST['delete'])) {
     $deleteParts = explode(";", $_REQUEST['delete']);
     deleteInformedAlert($deleteParts[0], $deleteParts[1], $deleteParts[2]);
     echo "Deleted network inform for {$deleteParts[0]} ({$deleteParts[1]},{$deleteParts[2]})<br>\n";
     die();
 }
-if ($_REQUEST['networkinform']) {
+if (isset($_REQUEST['networkinform'])) {
     addInformedAlert($_REQUEST['networkinform'], "agency", "0", "inform");
     echo "Added network inform for" . $_REQUEST['networkinform'];
     die();
 }
-if ($_REQUEST['stopsearch']) {
+if (isset($_REQUEST['stopsearch'])) {
     addInformedAlert($_REQUEST['stopsearch'], "stop", $_REQUEST['stopid'], "remove");
     echo "Added stop remove for" . $_REQUEST['stopsearch'] . ", stop" . $_REQUEST['stopid'] . "<br>\n";
 
@@ -59,7 +59,7 @@
     }
     die();
 }
-if ($_REQUEST['streetsearch']) {
+if (isset($_REQUEST['streetsearch'])) {
 
     echo "Informing stops of street<br>\n";
     foreach (getStopsByName($_REQUEST['street']) as $stop) {
@@ -87,7 +87,7 @@
     ?>
 </table>
 <?php
-$alert = getServiceAlert($_REQUEST['edit']);
+$alert = getServiceAlert((isset($_REQUEST['edit'])?$_REQUEST['edit']:""));
 ?>
 <form action="<?php echo basename(__FILE__);
 ?>" method="get">
@@ -95,19 +95,21 @@
     <div data-role="fieldcontain">
         <label for="startdate"> Start Date</label>
         <input type="text" name="startdate" id="startdate" value="<?php
-      if ($alert['start'])
+      if ($alert['start']) {
           echo date("c", $alert['start']);
-      else
+      } else {
           echo date("c", strtotime("0:00"));
+}
 ?>"  />
     </div>
     <div data-role="fieldcontain">
         <label for="enddate"> End Date </label>
         <input type="text" name="enddate" id="enddate" value="<?php
-               if ($alert['end'])
+               if ($alert['end']) {
                    echo date("c", $alert['end']);
-               else
+               } else {
                    echo date("c", strtotime("23:59"));
+}
 ?>"  />
     </div>
     <div data-role="fieldcontain">
@@ -141,12 +143,12 @@
             }
             ?>
         </select></div>
-    <input type="hidden" name="saveedit" value="<?php echo $_REQUEST['edit']; ?>"/>
+    <input type="hidden" name="saveedit" value="<?php if (isset($_REQUEST['edit']))echo $_REQUEST['edit']; ?>"/>
     <input type="submit" value="Save"/>
 </div></form>
 
 <?php
-if ($_REQUEST['edit']) {
+if (isset($_REQUEST['edit'])) {
     echo "Informed Entities for ID {$_REQUEST['edit']}:";
     echo '<table>';
     foreach (getInformedAlerts($_REQUEST['edit'], "", "") as $informed) {