Example #1
0
 public static function findFromRouteNo($parish, $routeno)
 {
     $ROWs = array();
     $result = pg_query("SELECT *,ST_AsGeoJSON(the_geom) AS geojson " . "FROM hampshire WHERE parish='{$parish}' " . " AND routeno='{$routeno}'");
     while ($row = pg_fetch_array($result, null, PGSQL_ASSOC)) {
         $rightofway = new RightOfWay();
         $rightofway->loadFromRow($row);
         $ROWs[] = $rightofway;
     }
     return $ROWs;
 }
Example #2
0
         header("HTTP/1.1 400 Bad Request");
         echo "Required information missing or email in invalid format";
     }
     break;
 case "addMultiProblems":
     $valid = false;
     if (isset($cleaned["data"]) && $cleaned["data"] != "" && isset($cleaned["reporter_name"]) && $cleaned["reporter_name"] != "" && isset($cleaned["reporter_email"]) && filter_var($cleaned["reporter_email"], FILTER_VALIDATE_EMAIL)) {
         $data = @simplexml_load_string(stripslashes($_POST["data"]));
         if ($data) {
             foreach ($data->annotation as $annotation) {
                 $attrs = $annotation->attributes();
                 if (isset($attrs["x"]) && isset($attrs["y"]) && isset($annotation->description) && isset($annotation->extras) && isset($annotation->extras->row_id)) {
                     $desc = pg_escape_string($annotation->description);
                     $type = isset($annotation->type) ? pg_escape_string($annotation->type) : "unknown";
                     $id = pg_escape_string($annotation->extras->row_id);
                     $rightofway = new RightOfWay($id);
                     if ($rightofway->isValid()) {
                         // Note attributes need to be cast to float
                         // otherwise this will not work
                         $rightofway->addProblem($desc, $type, $cleaned["reporter_name"], $cleaned["reporter_email"], (double) $attrs["x"], (double) $attrs["y"]);
                     }
                 }
             }
         }
     } else {
         header("HTTP/1.1 400 Bad Request");
         echo "Unexpected format";
     }
     break;
 case "getProblems":
     if (isset($cleaned["id"])) {