@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | <button type="button" class="close">×</button> |
| 10 | 10 | <?php |
| 11 | 11 | |
| 12 | -$sat = filter_input(INPUT_GET,'sat',FILTER_SANITIZE_STRING); |
|
| 12 | +$sat = filter_input(INPUT_GET, 'sat', FILTER_SANITIZE_STRING); |
|
| 13 | 13 | $sat = urldecode($sat); |
| 14 | 14 | //$info = $Satellite->get_info(str_replace(' ','-',$sat)); |
| 15 | 15 | //print_r($info); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $aircraft_name = 'INTEGRAL'; |
| 49 | 49 | // $ground_speed = 14970; |
| 50 | 50 | $launch_date = '17 October 2002'; |
| 51 | -} elseif (strpos($sat,'IRIDIUM') !== false) { |
|
| 51 | +} elseif (strpos($sat, 'IRIDIUM') !== false) { |
|
| 52 | 52 | $image = 'https://upload.wikimedia.org/wikipedia/commons/b/b6/Iridium_Satellite.jpg'; |
| 53 | 53 | $image_copyright = 'Cliff'; |
| 54 | 54 | $ident = 'Iridium satellite constellation'; |
@@ -56,23 +56,23 @@ discard block |
||
| 56 | 56 | $aircraft_name = $sat; |
| 57 | 57 | // $ground_speed = 14970; |
| 58 | 58 | // $launch_date = '29 september 2011'; |
| 59 | -} elseif (strpos($sat,'ORBCOMM') !== false) { |
|
| 59 | +} elseif (strpos($sat, 'ORBCOMM') !== false) { |
|
| 60 | 60 | $ident = 'Orbcomm'; |
| 61 | 61 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/Orbcomm_(satellite)'; |
| 62 | 62 | $aircraft_name = $sat; |
| 63 | -} elseif (strpos($sat,'GLOBALSTAR') !== false) { |
|
| 63 | +} elseif (strpos($sat, 'GLOBALSTAR') !== false) { |
|
| 64 | 64 | $ident = 'Globalstar'; |
| 65 | 65 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/Globalstar'; |
| 66 | 66 | $aircraft_name = $sat; |
| 67 | - $satname = str_replace(array('[+]','[-]'),'',$sat); |
|
| 68 | -} elseif (strpos($sat,'OSCAR 7') !== false) { |
|
| 67 | + $satname = str_replace(array('[+]', '[-]'), '', $sat); |
|
| 68 | +} elseif (strpos($sat, 'OSCAR 7') !== false) { |
|
| 69 | 69 | $image = 'https://upload.wikimedia.org/wikipedia/en/a/ad/AMSAT-OSCAR_7.jpg'; |
| 70 | 70 | $image_copyright = 'Amsat.org'; |
| 71 | 71 | $ident = 'AMSAT-OSCAR 7'; |
| 72 | 72 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/AMSAT-OSCAR_7'; |
| 73 | 73 | $aircraft_name = $sat; |
| 74 | 74 | $launch_date = '15 November 1974'; |
| 75 | -} elseif (strpos($sat,'santaclaus') !== false) { |
|
| 75 | +} elseif (strpos($sat, 'santaclaus') !== false) { |
|
| 76 | 76 | $image = 'https://upload.wikimedia.org/wikipedia/commons/4/49/Jonathan_G_Meath_portrays_Santa_Claus.jpg'; |
| 77 | 77 | $image_copyright = 'Jonathan G Meath'; |
| 78 | 78 | $ident = 'Santa Claus'; |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | // $launch_date = '15 November 1974'; |
| 82 | 82 | } else { |
| 83 | 83 | $ident = $sat; |
| 84 | - if (strpos($sat,'(')) $satname = $sat; |
|
| 85 | - else $satname = str_replace(array(' '),'-',$sat); |
|
| 84 | + if (strpos($sat, '(')) $satname = $sat; |
|
| 85 | + else $satname = str_replace(array(' '), '-', $sat); |
|
| 86 | 86 | } |
| 87 | 87 | if (!isset($satname)) $satname = $sat; |
| 88 | 88 | if ($satname != 'santaclaus') { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | print '<div><span>'._("Orbit").'</span>'.$info['orbit'].'</div>'; |
| 157 | 157 | } |
| 158 | 158 | if ($info['launch_date'] != '') { |
| 159 | - print '<div><span>'._("Launch Date").'</span>'.date('Y-m-d',strtotime($info['launch_date'])).'</div>'; |
|
| 159 | + print '<div><span>'._("Launch Date").'</span>'.date('Y-m-d', strtotime($info['launch_date'])).'</div>'; |
|
| 160 | 160 | } |
| 161 | 161 | if ($info['launch_site'] != '') { |
| 162 | 162 | print '<div><span>'._("Launch Site").'</span>'.$info['launch_site'].'</div>'; |
@@ -81,10 +81,15 @@ |
||
| 81 | 81 | // $launch_date = '15 November 1974'; |
| 82 | 82 | } else { |
| 83 | 83 | $ident = $sat; |
| 84 | - if (strpos($sat,'(')) $satname = $sat; |
|
| 85 | - else $satname = str_replace(array(' '),'-',$sat); |
|
| 84 | + if (strpos($sat,'(')) { |
|
| 85 | + $satname = $sat; |
|
| 86 | + } else { |
|
| 87 | + $satname = str_replace(array(' '),'-',$sat); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | +if (!isset($satname)) { |
|
| 91 | + $satname = $sat; |
|
| 86 | 92 | } |
| 87 | -if (!isset($satname)) $satname = $sat; |
|
| 88 | 93 | if ($satname != 'santaclaus') { |
| 89 | 94 | $info = $Satellite->get_info(strtolower(trim($satname))); |
| 90 | 95 | $position = $Satellite->position($sat); |
@@ -18,7 +18,9 @@ discard block |
||
| 18 | 18 | public function __construct($dbc = null) { |
| 19 | 19 | $Connection = new Connection($dbc); |
| 20 | 20 | $this->db = $Connection->db; |
| 21 | - if ($this->db === null) die('Error: No DB connection. (Source)'); |
|
| 21 | + if ($this->db === null) { |
|
| 22 | + die('Error: No DB connection. (Source)'); |
|
| 23 | + } |
|
| 22 | 24 | } |
| 23 | 25 | |
| 24 | 26 | public function getAllLocationInfo() { |
@@ -83,7 +85,9 @@ discard block |
||
| 83 | 85 | $query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0"; |
| 84 | 86 | } |
| 85 | 87 | $query .= " ORDER BY last_seen DESC"; |
| 86 | - if ($limit) $query .= " LIMIT 1000"; |
|
| 88 | + if ($limit) { |
|
| 89 | + $query .= " LIMIT 1000"; |
|
| 90 | + } |
|
| 87 | 91 | $query_values = array(':type' => $type); |
| 88 | 92 | try { |
| 89 | 93 | $sth = $this->db->prepare($query); |
@@ -122,7 +126,9 @@ discard block |
||
| 122 | 126 | } |
| 123 | 127 | |
| 124 | 128 | public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') { |
| 125 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
| 129 | + if ($last_seen == '') { |
|
| 130 | + $last_seen = date('Y-m-d H:i:s'); |
|
| 131 | + } |
|
| 126 | 132 | $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
| 127 | 133 | $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
| 128 | 134 | try { |
@@ -134,7 +140,9 @@ discard block |
||
| 134 | 140 | } |
| 135 | 141 | |
| 136 | 142 | public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') { |
| 137 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
| 143 | + if ($last_seen == '') { |
|
| 144 | + $last_seen = date('Y-m-d H:i:s'); |
|
| 145 | + } |
|
| 138 | 146 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source"; |
| 139 | 147 | $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
| 140 | 148 | try { |
@@ -157,7 +165,9 @@ discard block |
||
| 157 | 165 | } |
| 158 | 166 | |
| 159 | 167 | public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') { |
| 160 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
| 168 | + if ($last_seen == '') { |
|
| 169 | + $last_seen = date('Y-m-d H:i:s'); |
|
| 170 | + } |
|
| 161 | 171 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id"; |
| 162 | 172 | $query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
| 163 | 173 | try { |
@@ -60,11 +60,11 @@ |
||
| 60 | 60 | return $all; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @param $name |
|
| 65 | - * @return array |
|
| 66 | - */ |
|
| 67 | - public function getLocationInfobySourceName($name) { |
|
| 63 | + /** |
|
| 64 | + * @param $name |
|
| 65 | + * @return array |
|
| 66 | + */ |
|
| 67 | + public function getLocationInfobySourceName($name) { |
|
| 68 | 68 | $query = "SELECT * FROM source_location WHERE source = :name"; |
| 69 | 69 | $query_values = array(':name' => $name); |
| 70 | 70 | try { |
@@ -187,6 +187,9 @@ |
||
| 187 | 187 | return ''; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | + /** |
|
| 191 | + * @param string $type |
|
| 192 | + */ |
|
| 190 | 193 | public function deleteLocationByType($type) { |
| 191 | 194 | $query = "DELETE FROM source_location WHERE type = :type"; |
| 192 | 195 | $query_values = array(':type' => $type); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | try { |
| 28 | 28 | $sth = $this->db->prepare($query); |
| 29 | 29 | $sth->execute($query_values); |
| 30 | - } catch(PDOException $e) { |
|
| 30 | + } catch (PDOException $e) { |
|
| 31 | 31 | return "error : ".$e->getMessage(); |
| 32 | 32 | } |
| 33 | 33 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -40,20 +40,20 @@ discard block |
||
| 40 | 40 | try { |
| 41 | 41 | $sth = $this->db->prepare($query); |
| 42 | 42 | $sth->execute($query_values); |
| 43 | - } catch(PDOException $e) { |
|
| 43 | + } catch (PDOException $e) { |
|
| 44 | 44 | return "error : ".$e->getMessage(); |
| 45 | 45 | } |
| 46 | 46 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 47 | 47 | return $all; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function getLocationInfobyNameType($name,$type) { |
|
| 50 | + public function getLocationInfobyNameType($name, $type) { |
|
| 51 | 51 | $query = "SELECT * FROM source_location WHERE name = :name AND type = :type"; |
| 52 | - $query_values = array(':name' => $name,':type' => $type); |
|
| 52 | + $query_values = array(':name' => $name, ':type' => $type); |
|
| 53 | 53 | try { |
| 54 | 54 | $sth = $this->db->prepare($query); |
| 55 | 55 | $sth->execute($query_values); |
| 56 | - } catch(PDOException $e) { |
|
| 56 | + } catch (PDOException $e) { |
|
| 57 | 57 | return "error : ".$e->getMessage(); |
| 58 | 58 | } |
| 59 | 59 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | try { |
| 71 | 71 | $sth = $this->db->prepare($query); |
| 72 | 72 | $sth->execute($query_values); |
| 73 | - } catch(PDOException $e) { |
|
| 73 | + } catch (PDOException $e) { |
|
| 74 | 74 | echo "error : ".$e->getMessage(); |
| 75 | 75 | return array(); |
| 76 | 76 | } |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | public function getLocationInfoByType($type, $coord = array(), $limit = false) { |
| 82 | 82 | $query = "SELECT * FROM source_location WHERE type = :type"; |
| 83 | 83 | if (is_array($coord) && !empty($coord) && count($coord) == 4) { |
| 84 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 85 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 86 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 87 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 84 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 85 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 86 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 87 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 88 | 88 | $query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0"; |
| 89 | 89 | } |
| 90 | 90 | $query .= " ORDER BY last_seen DESC"; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | try { |
| 94 | 94 | $sth = $this->db->prepare($query); |
| 95 | 95 | $sth->execute($query_values); |
| 96 | - } catch(PDOException $e) { |
|
| 96 | + } catch (PDOException $e) { |
|
| 97 | 97 | return "error : ".$e->getMessage(); |
| 98 | 98 | } |
| 99 | 99 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | try { |
| 107 | 107 | $sth = $this->db->prepare($query); |
| 108 | 108 | $sth->execute($query_values); |
| 109 | - } catch(PDOException $e) { |
|
| 109 | + } catch (PDOException $e) { |
|
| 110 | 110 | return "error : ".$e->getMessage(); |
| 111 | 111 | } |
| 112 | 112 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -119,58 +119,58 @@ discard block |
||
| 119 | 119 | try { |
| 120 | 120 | $sth = $this->db->prepare($query); |
| 121 | 121 | $sth->execute($query_values); |
| 122 | - } catch(PDOException $e) { |
|
| 122 | + } catch (PDOException $e) { |
|
| 123 | 123 | return "error : ".$e->getMessage(); |
| 124 | 124 | } |
| 125 | 125 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 126 | 126 | return $all; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') { |
|
| 129 | + public function addLocation($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id = 0, $last_seen = '', $description = '') { |
|
| 130 | 130 | if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
| 131 | 131 | $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
| 132 | - $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
|
| 132 | + $query_values = array(':name' => $name, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':source_id' => $source_id, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description); |
|
| 133 | 133 | try { |
| 134 | 134 | $sth = $this->db->prepare($query); |
| 135 | 135 | $sth->execute($query_values); |
| 136 | - } catch(PDOException $e) { |
|
| 136 | + } catch (PDOException $e) { |
|
| 137 | 137 | echo "error : ".$e->getMessage(); |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') { |
|
| 141 | + public function updateLocation($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id = 0, $last_seen = '', $description = '') { |
|
| 142 | 142 | if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
| 143 | 143 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source"; |
| 144 | - $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
|
| 144 | + $query_values = array(':name' => $name, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':source_id' => $source_id, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description); |
|
| 145 | 145 | try { |
| 146 | 146 | $sth = $this->db->prepare($query); |
| 147 | 147 | $sth->execute($query_values); |
| 148 | - } catch(PDOException $e) { |
|
| 148 | + } catch (PDOException $e) { |
|
| 149 | 149 | return "error : ".$e->getMessage(); |
| 150 | 150 | } |
| 151 | 151 | return ''; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public function updateLocationDescByName($name,$source,$source_id = 0,$description = '') { |
|
| 154 | + public function updateLocationDescByName($name, $source, $source_id = 0, $description = '') { |
|
| 155 | 155 | $query = "UPDATE source_location SET description = :description WHERE source_id = :source_id AND name = :name AND source = :source"; |
| 156 | - $query_values = array(':name' => $name,':source' => $source,':source_id' => $source_id,':description' => $description); |
|
| 156 | + $query_values = array(':name' => $name, ':source' => $source, ':source_id' => $source_id, ':description' => $description); |
|
| 157 | 157 | try { |
| 158 | 158 | $sth = $this->db->prepare($query); |
| 159 | 159 | $sth->execute($query_values); |
| 160 | - } catch(PDOException $e) { |
|
| 160 | + } catch (PDOException $e) { |
|
| 161 | 161 | return "error : ".$e->getMessage(); |
| 162 | 162 | } |
| 163 | 163 | return ''; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') { |
|
| 166 | + public function updateLocationByLocationID($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id, $last_seen = '', $description = '') { |
|
| 167 | 167 | if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
| 168 | 168 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id"; |
| 169 | - $query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
|
| 169 | + $query_values = array(':source_id' => $source_id, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description); |
|
| 170 | 170 | try { |
| 171 | 171 | $sth = $this->db->prepare($query); |
| 172 | 172 | $sth->execute($query_values); |
| 173 | - } catch(PDOException $e) { |
|
| 173 | + } catch (PDOException $e) { |
|
| 174 | 174 | echo "error : ".$e->getMessage(); |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | try { |
| 182 | 182 | $sth = $this->db->prepare($query); |
| 183 | 183 | $sth->execute($query_values); |
| 184 | - } catch(PDOException $e) { |
|
| 184 | + } catch (PDOException $e) { |
|
| 185 | 185 | return "error : ".$e->getMessage(); |
| 186 | 186 | } |
| 187 | 187 | return ''; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | try { |
| 194 | 194 | $sth = $this->db->prepare($query); |
| 195 | 195 | $sth->execute($query_values); |
| 196 | - } catch(PDOException $e) { |
|
| 196 | + } catch (PDOException $e) { |
|
| 197 | 197 | return "error : ".$e->getMessage(); |
| 198 | 198 | } |
| 199 | 199 | return ''; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | try { |
| 206 | 206 | $sth = $this->db->prepare($query); |
| 207 | 207 | $sth->execute($query_values); |
| 208 | - } catch(PDOException $e) { |
|
| 208 | + } catch (PDOException $e) { |
|
| 209 | 209 | return "error : ".$e->getMessage(); |
| 210 | 210 | } |
| 211 | 211 | return ''; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | try { |
| 217 | 217 | $sth = $this->db->prepare($query); |
| 218 | 218 | $sth->execute(); |
| 219 | - } catch(PDOException $e) { |
|
| 219 | + } catch (PDOException $e) { |
|
| 220 | 220 | return "error : ".$e->getMessage(); |
| 221 | 221 | } |
| 222 | 222 | return ''; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | try { |
| 247 | 247 | $sth = $this->db->prepare($query); |
| 248 | 248 | $sth->execute(array(':type' => $type)); |
| 249 | - } catch(PDOException $e) { |
|
| 249 | + } catch (PDOException $e) { |
|
| 250 | 250 | return "error"; |
| 251 | 251 | } |
| 252 | 252 | return "success"; |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | } |
| 9 | 9 | header('Content-Type: text/javascript'); |
| 10 | 10 | |
| 11 | -$race_id = filter_input(INPUT_GET,'race_id',FILTER_SANITIZE_NUMBER_INT); |
|
| 11 | +$race_id = filter_input(INPUT_GET, 'race_id', FILTER_SANITIZE_NUMBER_INT); |
|
| 12 | 12 | if ($race_id != '') { |
| 13 | 13 | $race_array = $Marine->getRace($race_id); |
| 14 | 14 | } else { |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | $output = '{"type": "FeatureCollection","features": ['; |
| 19 | 19 | if (!empty($race_array)) |
| 20 | 20 | { |
| 21 | - $course = json_decode($race_array['race_markers'],true); |
|
| 21 | + $course = json_decode($race_array['race_markers'], true); |
|
| 22 | 22 | $i = 0; |
| 23 | 23 | $f = count($course); |
| 24 | - foreach($course as $marker) |
|
| 24 | + foreach ($course as $marker) |
|
| 25 | 25 | { |
| 26 | 26 | date_default_timezone_set('UTC'); |
| 27 | 27 | $output .= '{"type": "Feature",'; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $output .= '"type": "'.$marker['type'].'",'; |
| 34 | 34 | if ($i == 0 || $i == 1) { |
| 35 | 35 | $output .= '"icon": "images/tsk/tsk-start.png",'; |
| 36 | - } elseif ($i == $f-1 || $i == $f-2) { |
|
| 36 | + } elseif ($i == $f - 1 || $i == $f - 2) { |
|
| 37 | 37 | $output .= '"icon": "images/tsk/tsk-finish.png",'; |
| 38 | 38 | } elseif ($marker['type'] == 4) { |
| 39 | 39 | $output .= '"icon": "images/kardinalstonne.png",'; |
@@ -5,14 +5,14 @@ discard block |
||
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | 6 | if (isset($_GET['start_date'])) { |
| 7 | 7 | //for the date manipulation into the query |
| 8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 9 | 9 | $start_date = $_GET['start_date'].":00"; |
| 10 | 10 | $end_date = $_GET['end_date'].":00"; |
| 11 | 11 | $sql_date = $start_date.",".$end_date; |
| 12 | - } else if($_GET['start_date'] != ""){ |
|
| 12 | + } else if ($_GET['start_date'] != "") { |
|
| 13 | 13 | $start_date = $_GET['start_date'].":00"; |
| 14 | 14 | $sql_date = $start_date; |
| 15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | 18 | } else $sql_date = ''; |
@@ -20,21 +20,21 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | if (isset($_GET['highest_altitude'])) { |
| 22 | 22 | //for altitude manipulation |
| 23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 27 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 28 | - $end_altitude = filter_input(iNPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 27 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 28 | + $end_altitude = filter_input(iNPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 29 | 29 | $sql_altitude = $end_altitude; |
| 30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 32 | 32 | $sql_altitude = $start_altitude; |
| 33 | 33 | } else $sql_altitude = ''; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | |
| 36 | 36 | //calculuation for the pagination |
| 37 | -if(!isset($_GET['limit'])) |
|
| 37 | +if (!isset($_GET['limit'])) |
|
| 38 | 38 | { |
| 39 | 39 | if (!isset($_GET['number_results'])) |
| 40 | 40 | { |
@@ -42,17 +42,17 @@ discard block |
||
| 42 | 42 | $limit_end = 25; |
| 43 | 43 | $absolute_difference = 25; |
| 44 | 44 | } else { |
| 45 | - if ($_GET['number_results'] > 1000){ |
|
| 45 | + if ($_GET['number_results'] > 1000) { |
|
| 46 | 46 | $_GET['number_results'] = 1000; |
| 47 | 47 | } |
| 48 | 48 | $limit_start = 0; |
| 49 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 50 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 49 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 50 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 51 | 51 | } |
| 52 | -} else { |
|
| 52 | +} else { |
|
| 53 | 53 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -72,27 +72,27 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 74 | 74 | else $sort = ''; |
| 75 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 76 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING); |
|
| 77 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 78 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 79 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 80 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 81 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 82 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 83 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 84 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 85 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 86 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 87 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 88 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 89 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 90 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 91 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 75 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 76 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); |
|
| 77 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 78 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 79 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 80 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 81 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 82 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 83 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 84 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 85 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 86 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 87 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 88 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 89 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 90 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 91 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 92 | 92 | if ($id != '') { |
| 93 | 93 | $spotter_array = $Spotter->getSpotterDataByID($id); |
| 94 | 94 | } else { |
| 95 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 95 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | print '<?xml version="1.0" encoding="UTF-8" ?>'; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | print '</author>'; |
| 109 | 109 | print '<id>FlightAirMap</id>'; |
| 110 | 110 | if (!empty($spotter_array)) { |
| 111 | - foreach($spotter_array as $spotter_item) { |
|
| 111 | + foreach ($spotter_array as $spotter_item) { |
|
| 112 | 112 | print '<entry>'; |
| 113 | 113 | print '<title>'.$spotter_item['ident'].' '.$spotter_item['airline_name'].' | '.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].') | '.$spotter_item['departure_airport'].' - '.$spotter_item['arrival_airport'].'</title>'; |
| 114 | 114 | print '<link href="http://www.flightairmap.fr/flightid/'.$spotter_item['spotter_id'].'"/>'; |
@@ -15,8 +15,12 @@ discard block |
||
| 15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | - } else $sql_date = ''; |
|
| 19 | -} else $sql_date = ''; |
|
| 18 | + } else { |
|
| 19 | + $sql_date = ''; |
|
| 20 | + } |
|
| 21 | + } else { |
|
| 22 | + $sql_date = ''; |
|
| 23 | +} |
|
| 20 | 24 | |
| 21 | 25 | if (isset($_GET['highest_altitude'])) { |
| 22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
| 30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
| 32 | 36 | $sql_altitude = $start_altitude; |
| 33 | - } else $sql_altitude = ''; |
|
| 34 | -} else $sql_altitude = ''; |
|
| 37 | + } else { |
|
| 38 | + $sql_altitude = ''; |
|
| 39 | + } |
|
| 40 | + } else { |
|
| 41 | + $sql_altitude = ''; |
|
| 42 | +} |
|
| 35 | 43 | |
| 36 | 44 | //calculuation for the pagination |
| 37 | 45 | if(!isset($_GET['limit'])) |
@@ -49,7 +57,7 @@ discard block |
||
| 49 | 57 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 50 | 58 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 51 | 59 | } |
| 52 | -} else { |
|
| 60 | +} else { |
|
| 53 | 61 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | 62 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 55 | 63 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -70,8 +78,11 @@ discard block |
||
| 70 | 78 | |
| 71 | 79 | $date = date("c", time()); |
| 72 | 80 | |
| 73 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 74 | -else $sort = ''; |
|
| 81 | +if (isset($_GET['sort'])) { |
|
| 82 | + $sort = $_GET['sort']; |
|
| 83 | +} else { |
|
| 84 | + $sort = ''; |
|
| 85 | +} |
|
| 75 | 86 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 76 | 87 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING); |
| 77 | 88 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -5,14 +5,14 @@ discard block |
||
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | 6 | if (isset($_GET['start_date'])) { |
| 7 | 7 | //for the date manipulation into the query |
| 8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 9 | 9 | $start_date = $_GET['start_date'].":00"; |
| 10 | 10 | $end_date = $_GET['end_date'].":00"; |
| 11 | 11 | $sql_date = $start_date.",".$end_date; |
| 12 | - } else if($_GET['start_date'] != ""){ |
|
| 12 | + } else if ($_GET['start_date'] != "") { |
|
| 13 | 13 | $start_date = $_GET['start_date'].":00"; |
| 14 | 14 | $sql_date = $start_date; |
| 15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | 18 | } else $sql_date = ''; |
@@ -20,37 +20,37 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | if (isset($_GET['highest_altitude'])) { |
| 22 | 22 | //for altitude manipulation |
| 23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 27 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 27 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 29 | 29 | $sql_altitude = $end_altitude; |
| 30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 32 | 32 | $sql_altitude = $start_altitude; |
| 33 | 33 | } else $sql_altitude = ''; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | |
| 36 | 36 | //calculuation for the pagination |
| 37 | -if(!isset($_GET['limit'])) { |
|
| 37 | +if (!isset($_GET['limit'])) { |
|
| 38 | 38 | if (!isset($_GET['number_results'])) { |
| 39 | 39 | $limit_start = 0; |
| 40 | 40 | $limit_end = 25; |
| 41 | 41 | $absolute_difference = 25; |
| 42 | 42 | } else { |
| 43 | - if ($_GET['number_results'] > 1000){ |
|
| 43 | + if ($_GET['number_results'] > 1000) { |
|
| 44 | 44 | $_GET['number_results'] = 1000; |
| 45 | 45 | } |
| 46 | 46 | $limit_start = 0; |
| 47 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 48 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 47 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 48 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 49 | 49 | } |
| 50 | -} else { |
|
| 50 | +} else { |
|
| 51 | 51 | $limit_explode = explode(",", $_GET['limit']); |
| 52 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 53 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 52 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 53 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -68,27 +68,27 @@ discard block |
||
| 68 | 68 | $date = date("D, d M Y H:i:s T", time()); |
| 69 | 69 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 70 | 70 | else $sort = ''; |
| 71 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 72 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
|
| 73 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 74 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 75 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 76 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 77 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 78 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 79 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 80 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 81 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 82 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 83 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 84 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 85 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 86 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 87 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 71 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 72 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); |
|
| 73 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 74 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 75 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 76 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 77 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 78 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 79 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 80 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 81 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 82 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 83 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 84 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 85 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 86 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 87 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 88 | 88 | if ($id != '') { |
| 89 | 89 | $spotter_array = $Spotter->getSpotterDataByID($id); |
| 90 | 90 | } else { |
| 91 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 91 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 92 | 92 | } |
| 93 | 93 | print '<?xml version="1.0" encoding="UTF-8" ?>'; |
| 94 | 94 | print '<rss xmlns:flightairmap="http://'.$_SERVER['HTTP_HOST'].''.htmlentities($_SERVER['REQUEST_URI']).'" version="2.0">'; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | print '<lastBuildDate>'.$date.'</lastBuildDate>'; |
| 102 | 102 | |
| 103 | 103 | if (!empty($spotter_array)) { |
| 104 | - foreach($spotter_array as $spotter_item) { |
|
| 104 | + foreach ($spotter_array as $spotter_item) { |
|
| 105 | 105 | print '<item>'; |
| 106 | 106 | print '<title>'.$spotter_item['ident'].' '.$spotter_item['airline_name'].' | '.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].') | '.$spotter_item['departure_airport'].' - '.$spotter_item['arrival_airport'].'</title>'; |
| 107 | 107 | print '<link>http://www.flightairmap.fr/flightid/'.$spotter_item['spotter_id'].'</link>'; |
@@ -15,8 +15,12 @@ discard block |
||
| 15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | - } else $sql_date = ''; |
|
| 19 | -} else $sql_date = ''; |
|
| 18 | + } else { |
|
| 19 | + $sql_date = ''; |
|
| 20 | + } |
|
| 21 | + } else { |
|
| 22 | + $sql_date = ''; |
|
| 23 | +} |
|
| 20 | 24 | |
| 21 | 25 | if (isset($_GET['highest_altitude'])) { |
| 22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
| 30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
| 32 | 36 | $sql_altitude = $start_altitude; |
| 33 | - } else $sql_altitude = ''; |
|
| 34 | -} else $sql_altitude = ''; |
|
| 37 | + } else { |
|
| 38 | + $sql_altitude = ''; |
|
| 39 | + } |
|
| 40 | + } else { |
|
| 41 | + $sql_altitude = ''; |
|
| 42 | +} |
|
| 35 | 43 | |
| 36 | 44 | //calculuation for the pagination |
| 37 | 45 | if(!isset($_GET['limit'])) { |
@@ -47,7 +55,7 @@ discard block |
||
| 47 | 55 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 48 | 56 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 49 | 57 | } |
| 50 | -} else { |
|
| 58 | +} else { |
|
| 51 | 59 | $limit_explode = explode(",", $_GET['limit']); |
| 52 | 60 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 53 | 61 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -66,8 +74,11 @@ discard block |
||
| 66 | 74 | header('Content-Type: application/rss+xml; charset=utf-8'); |
| 67 | 75 | |
| 68 | 76 | $date = date("D, d M Y H:i:s T", time()); |
| 69 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 70 | -else $sort = ''; |
|
| 77 | +if (isset($_GET['sort'])) { |
|
| 78 | + $sort = $_GET['sort']; |
|
| 79 | +} else { |
|
| 80 | + $sort = ''; |
|
| 81 | +} |
|
| 71 | 82 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 72 | 83 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
| 73 | 84 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -6,14 +6,14 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | if (isset($_GET['start_date'])) { |
| 8 | 8 | //for the date manipulation into the query |
| 9 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 9 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 10 | 10 | $start_date = $_GET['start_date'].":00"; |
| 11 | 11 | $end_date = $_GET['end_date'].":00"; |
| 12 | 12 | $sql_date = $start_date.",".$end_date; |
| 13 | - } else if($_GET['start_date'] != ""){ |
|
| 13 | + } else if ($_GET['start_date'] != "") { |
|
| 14 | 14 | $start_date = $_GET['start_date'].":00"; |
| 15 | 15 | $sql_date = $start_date; |
| 16 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 16 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 17 | 17 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 18 | 18 | $sql_date = $end_date; |
| 19 | 19 | } else $sql_date = ''; |
@@ -21,38 +21,38 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | if (isset($_GET['highest_altitude'])) { |
| 23 | 23 | //for altitude manipulation |
| 24 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 24 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 25 | 25 | $end_altitude = $_GET['highest_altitude']; |
| 26 | 26 | $start_altitude = $_GET['lowest_altitude']; |
| 27 | 27 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 28 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 28 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 29 | 29 | $end_altitude = $_GET['highest_altitude']; |
| 30 | 30 | $sql_altitude = $end_altitude; |
| 31 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 31 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 32 | 32 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
| 33 | 33 | $sql_altitude = $start_altitude; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | } else $sql_altitude = ''; |
| 36 | 36 | |
| 37 | 37 | //calculuation for the pagination |
| 38 | -if(!isset($_GET['limit'])) |
|
| 38 | +if (!isset($_GET['limit'])) |
|
| 39 | 39 | { |
| 40 | 40 | if (!isset($_GET['number_results'])) { |
| 41 | 41 | $limit_start = 0; |
| 42 | 42 | $limit_end = 25; |
| 43 | 43 | $absolute_difference = 25; |
| 44 | 44 | } else { |
| 45 | - if ($_GET['number_results'] > 1000){ |
|
| 45 | + if ($_GET['number_results'] > 1000) { |
|
| 46 | 46 | $_GET['number_results'] = 1000; |
| 47 | 47 | } |
| 48 | 48 | $limit_start = 0; |
| 49 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 50 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 49 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 50 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 51 | 51 | } |
| 52 | -} else { |
|
| 52 | +} else { |
|
| 53 | 53 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | 56 | } |
| 57 | 57 | $absolute_difference = abs($limit_start - $limit_end); |
| 58 | 58 | $limit_next = $limit_end + $absolute_difference; |
@@ -69,33 +69,33 @@ discard block |
||
| 69 | 69 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 70 | 70 | else $sort = ''; |
| 71 | 71 | |
| 72 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 73 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
|
| 74 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 75 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 76 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 77 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 78 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 79 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 80 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 81 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 82 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 83 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 84 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 85 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 86 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 87 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 88 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 72 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 73 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); |
|
| 74 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 75 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 76 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 77 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 78 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 79 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 80 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 81 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 82 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 83 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 84 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 85 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 86 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 87 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 88 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 89 | 89 | if ($id != '') { |
| 90 | 90 | $spotter_array = $Spotter->getSpotterDataByID($id); |
| 91 | 91 | } else { |
| 92 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 92 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $output = "id,ident,registration,aircraft_icao,aircraft_name,aircraft_manufacturer,airline,airline_icao,airline_iata,airline_country,airline_callsign,airline_type,departure_airport_city,departure_airport_country,departure_airport_iata,departure_airport_icao,departure_airport_latitude,departure_airport_longitude,departure_airport_altitude,arrival_airport_city,arrival_airport_country,arrival_airport_iata,arrival_airport_icao,arrival_airport_latitude,arrival_airport_longitude,arrival_airport_altitude,latitude,longitude,altitude,ground_speed,heading,heading_name,waypoints,date\n"; |
| 96 | 96 | |
| 97 | 97 | if (!empty($spotter_array)) { |
| 98 | - foreach($spotter_array as $spotter_item) { |
|
| 98 | + foreach ($spotter_array as $spotter_item) { |
|
| 99 | 99 | $output .= $spotter_item['spotter_id'].','; |
| 100 | 100 | $output .= $spotter_item['ident'].','; |
| 101 | 101 | $output .= $spotter_item['registration'].','; |
@@ -16,8 +16,12 @@ discard block |
||
| 16 | 16 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 17 | 17 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 18 | 18 | $sql_date = $end_date; |
| 19 | - } else $sql_date = ''; |
|
| 20 | -} else $sql_date = ''; |
|
| 19 | + } else { |
|
| 20 | + $sql_date = ''; |
|
| 21 | + } |
|
| 22 | + } else { |
|
| 23 | + $sql_date = ''; |
|
| 24 | +} |
|
| 21 | 25 | |
| 22 | 26 | if (isset($_GET['highest_altitude'])) { |
| 23 | 27 | //for altitude manipulation |
@@ -31,8 +35,12 @@ discard block |
||
| 31 | 35 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 32 | 36 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
| 33 | 37 | $sql_altitude = $start_altitude; |
| 34 | - } else $sql_altitude = ''; |
|
| 35 | -} else $sql_altitude = ''; |
|
| 38 | + } else { |
|
| 39 | + $sql_altitude = ''; |
|
| 40 | + } |
|
| 41 | + } else { |
|
| 42 | + $sql_altitude = ''; |
|
| 43 | +} |
|
| 36 | 44 | |
| 37 | 45 | //calculuation for the pagination |
| 38 | 46 | if(!isset($_GET['limit'])) |
@@ -49,7 +57,7 @@ discard block |
||
| 49 | 57 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 50 | 58 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 51 | 59 | } |
| 52 | -} else { |
|
| 60 | +} else { |
|
| 53 | 61 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | 62 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 55 | 63 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -66,8 +74,11 @@ discard block |
||
| 66 | 74 | |
| 67 | 75 | header("Content-type: text/csv"); |
| 68 | 76 | |
| 69 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 70 | -else $sort = ''; |
|
| 77 | +if (isset($_GET['sort'])) { |
|
| 78 | + $sort = $_GET['sort']; |
|
| 79 | +} else { |
|
| 80 | + $sort = ''; |
|
| 81 | +} |
|
| 71 | 82 | |
| 72 | 83 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 73 | 84 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
@@ -15,8 +15,12 @@ discard block |
||
| 15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | - } else $sql_date = ''; |
|
| 19 | -} else $sql_date = ''; |
|
| 18 | + } else { |
|
| 19 | + $sql_date = ''; |
|
| 20 | + } |
|
| 21 | + } else { |
|
| 22 | + $sql_date = ''; |
|
| 23 | +} |
|
| 20 | 24 | |
| 21 | 25 | if (isset($_GET['highest_altitude'])) { |
| 22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
| 30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
| 32 | 36 | $sql_altitude = $start_altitude; |
| 33 | - } else $sql_altitude = ''; |
|
| 34 | -} else $sql_altitude = ''; |
|
| 37 | + } else { |
|
| 38 | + $sql_altitude = ''; |
|
| 39 | + } |
|
| 40 | + } else { |
|
| 41 | + $sql_altitude = ''; |
|
| 42 | +} |
|
| 35 | 43 | |
| 36 | 44 | //calculuation for the pagination |
| 37 | 45 | if(!isset($_GET['limit'])) |
@@ -49,7 +57,7 @@ discard block |
||
| 49 | 57 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 50 | 58 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 51 | 59 | } |
| 52 | -} else { |
|
| 60 | +} else { |
|
| 53 | 61 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | 62 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 55 | 63 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -67,8 +75,11 @@ discard block |
||
| 67 | 75 | |
| 68 | 76 | header('Content-Type: application/json'); |
| 69 | 77 | |
| 70 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 71 | -else $sort = ''; |
|
| 78 | +if (isset($_GET['sort'])) { |
|
| 79 | + $sort = $_GET['sort']; |
|
| 80 | +} else { |
|
| 81 | + $sort = ''; |
|
| 82 | +} |
|
| 72 | 83 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 73 | 84 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
| 74 | 85 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -3,17 +3,17 @@ discard block |
||
| 3 | 3 | require_once('require/class.Language.php'); |
| 4 | 4 | require_once('require/class.Spotter.php'); |
| 5 | 5 | require_once('require/class.SpotterArchive.php'); |
| 6 | -$Spotter=new Spotter(); |
|
| 6 | +$Spotter = new Spotter(); |
|
| 7 | 7 | if (isset($_GET['start_date'])) { |
| 8 | 8 | //for the date manipulation into the query |
| 9 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 9 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 10 | 10 | $start_date = $_GET['start_date'].":00"; |
| 11 | 11 | $end_date = $_GET['end_date'].":00"; |
| 12 | 12 | $sql_date = $start_date.",".$end_date; |
| 13 | - } else if($_GET['start_date'] != ""){ |
|
| 13 | + } else if ($_GET['start_date'] != "") { |
|
| 14 | 14 | $start_date = $_GET['start_date'].":00"; |
| 15 | 15 | $sql_date = $start_date; |
| 16 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 16 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 17 | 17 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 18 | 18 | $sql_date = $end_date; |
| 19 | 19 | } else $sql_date = ''; |
@@ -21,21 +21,21 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | if (isset($_GET['highest_altitude'])) { |
| 23 | 23 | //for altitude manipulation |
| 24 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 25 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 24 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 25 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 27 | 27 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 28 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 29 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 28 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 29 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 30 | 30 | $sql_altitude = $end_altitude; |
| 31 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 32 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 31 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 32 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 33 | 33 | $sql_altitude = $start_altitude; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | } else $sql_altitude = ''; |
| 36 | 36 | |
| 37 | 37 | //calculuation for the pagination |
| 38 | -if(!isset($_GET['limit'])) |
|
| 38 | +if (!isset($_GET['limit'])) |
|
| 39 | 39 | { |
| 40 | 40 | if (!isset($_GET['number_results'])) |
| 41 | 41 | { |
@@ -43,17 +43,17 @@ discard block |
||
| 43 | 43 | $limit_end = 25; |
| 44 | 44 | $absolute_difference = 25; |
| 45 | 45 | } else { |
| 46 | - if ($_GET['number_results'] > 1000){ |
|
| 46 | + if ($_GET['number_results'] > 1000) { |
|
| 47 | 47 | $_GET['number_results'] = 1000; |
| 48 | 48 | } |
| 49 | 49 | $limit_start = 0; |
| 50 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 51 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 50 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 51 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 52 | 52 | } |
| 53 | -} else { |
|
| 53 | +} else { |
|
| 54 | 54 | $limit_explode = explode(",", $_GET['limit']); |
| 55 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -70,34 +70,34 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 72 | 72 | else $sort = ''; |
| 73 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 74 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
|
| 75 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 76 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 77 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 78 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 79 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 80 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 81 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 82 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 83 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 84 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 85 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 86 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 87 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 88 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 89 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 73 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 74 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); |
|
| 75 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 76 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 77 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 78 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 79 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 80 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 81 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 82 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 83 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 84 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 85 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 86 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 87 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 88 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 89 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 90 | 90 | if ($id != '') { |
| 91 | 91 | $spotter_array = $Spotter->getSpotterDataByID($id); |
| 92 | 92 | } else { |
| 93 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 93 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $output = '{'; |
| 97 | 97 | $output .= '"type": "FeatureCollection",'; |
| 98 | 98 | $output .= '"features": ['; |
| 99 | 99 | if (!empty($spotter_array)) { |
| 100 | - foreach($spotter_array as $spotter_item) { |
|
| 100 | + foreach ($spotter_array as $spotter_item) { |
|
| 101 | 101 | //waypoint plotting |
| 102 | 102 | $output .= '{'; |
| 103 | 103 | $output .= '"type": "Feature",'; |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | $output .= '"coordinates": ['; |
| 165 | 165 | foreach ($archive_data as $coord_data) { |
| 166 | 166 | $output .= '['; |
| 167 | - $output .= $coord_data['longitude'].', '; |
|
| 168 | - $output .= $coord_data['latitude']; |
|
| 167 | + $output .= $coord_data['longitude'].', '; |
|
| 168 | + $output .= $coord_data['latitude']; |
|
| 169 | 169 | $output .= '],'; |
| 170 | 170 | } |
| 171 | 171 | $output = substr($output, 0, -1); |
@@ -5,14 +5,14 @@ discard block |
||
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | 6 | if (isset($_GET['start_date'])) { |
| 7 | 7 | //for the date manipulation into the query |
| 8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 9 | 9 | $start_date = $_GET['start_date'].":00"; |
| 10 | 10 | $end_date = $_GET['end_date'].":00"; |
| 11 | 11 | $sql_date = $start_date.",".$end_date; |
| 12 | - } else if($_GET['start_date'] != ""){ |
|
| 12 | + } else if ($_GET['start_date'] != "") { |
|
| 13 | 13 | $start_date = $_GET['start_date'].":00"; |
| 14 | 14 | $sql_date = $start_date; |
| 15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | 18 | } else $sql_date = ''; |
@@ -20,37 +20,37 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | if (isset($_GET['highest_altitude'])) { |
| 22 | 22 | //for altitude manipulation |
| 23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 27 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 27 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 29 | 29 | $sql_altitude = $end_altitude; |
| 30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 32 | 32 | $sql_altitude = $start_altitude; |
| 33 | 33 | } else $sql_altitude = ''; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | |
| 36 | 36 | //calculuation for the pagination |
| 37 | -if(!isset($_GET['limit'])) { |
|
| 37 | +if (!isset($_GET['limit'])) { |
|
| 38 | 38 | if (!isset($_GET['number_results'])) { |
| 39 | 39 | $limit_start = 0; |
| 40 | 40 | $limit_end = 25; |
| 41 | 41 | $absolute_difference = 25; |
| 42 | 42 | } else { |
| 43 | - if ($_GET['number_results'] > 1000){ |
|
| 43 | + if ($_GET['number_results'] > 1000) { |
|
| 44 | 44 | $_GET['number_results'] = 1000; |
| 45 | 45 | } |
| 46 | 46 | $limit_start = 0; |
| 47 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 48 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 47 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 48 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 49 | 49 | } |
| 50 | -} else { |
|
| 50 | +} else { |
|
| 51 | 51 | $limit_explode = explode(",", $_GET['limit']); |
| 52 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 53 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 52 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 53 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -67,34 +67,34 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 69 | 69 | else $sort = ''; |
| 70 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 71 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
|
| 72 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 73 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 74 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 75 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 76 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 77 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 78 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 79 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 80 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 81 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 82 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 83 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 84 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 85 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 86 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 70 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 71 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); |
|
| 72 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 73 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 74 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 75 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 76 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 77 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 78 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 79 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 80 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 81 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 82 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 83 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 84 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 85 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 86 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 87 | 87 | if ($id != '') { |
| 88 | 88 | $spotter_array = $Spotter->getSpotterDataByID($id); |
| 89 | 89 | } else { |
| 90 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 90 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 91 | 91 | } |
| 92 | 92 | $i = 1; |
| 93 | 93 | //$output .= "oid;Line\n"; |
| 94 | 94 | $output = ''; |
| 95 | 95 | if (!empty($spotter_array)) |
| 96 | 96 | { |
| 97 | - foreach($spotter_array as $spotter_item) |
|
| 97 | + foreach ($spotter_array as $spotter_item) |
|
| 98 | 98 | { |
| 99 | 99 | if ($spotter_item['waypoints'] != '') { |
| 100 | 100 | $waypoint_pieces = explode(' ', $spotter_item['waypoints']); |
@@ -15,8 +15,12 @@ discard block |
||
| 15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | - } else $sql_date = ''; |
|
| 19 | -} else $sql_date = ''; |
|
| 18 | + } else { |
|
| 19 | + $sql_date = ''; |
|
| 20 | + } |
|
| 21 | + } else { |
|
| 22 | + $sql_date = ''; |
|
| 23 | +} |
|
| 20 | 24 | |
| 21 | 25 | if (isset($_GET['highest_altitude'])) { |
| 22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
| 30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
| 32 | 36 | $sql_altitude = $start_altitude; |
| 33 | - } else $sql_altitude = ''; |
|
| 34 | -} else $sql_altitude = ''; |
|
| 37 | + } else { |
|
| 38 | + $sql_altitude = ''; |
|
| 39 | + } |
|
| 40 | + } else { |
|
| 41 | + $sql_altitude = ''; |
|
| 42 | +} |
|
| 35 | 43 | |
| 36 | 44 | //calculuation for the pagination |
| 37 | 45 | if(!isset($_GET['limit'])) { |
@@ -47,7 +55,7 @@ discard block |
||
| 47 | 55 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 48 | 56 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 49 | 57 | } |
| 50 | -} else { |
|
| 58 | +} else { |
|
| 51 | 59 | $limit_explode = explode(",", $_GET['limit']); |
| 52 | 60 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 53 | 61 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -65,8 +73,11 @@ discard block |
||
| 65 | 73 | |
| 66 | 74 | header("Content-type: text/csv"); |
| 67 | 75 | |
| 68 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 69 | -else $sort = ''; |
|
| 76 | +if (isset($_GET['sort'])) { |
|
| 77 | + $sort = $_GET['sort']; |
|
| 78 | +} else { |
|
| 79 | + $sort = ''; |
|
| 80 | +} |
|
| 70 | 81 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 71 | 82 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
| 72 | 83 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -5,14 +5,14 @@ discard block |
||
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | 6 | if (isset($_GET['start_date'])) { |
| 7 | 7 | //for the date manipulation into the query |
| 8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 9 | 9 | $start_date = $_GET['start_date'].":00"; |
| 10 | 10 | $end_date = $_GET['end_date'].":00"; |
| 11 | 11 | $sql_date = $start_date.",".$end_date; |
| 12 | - } else if($_GET['start_date'] != ""){ |
|
| 12 | + } else if ($_GET['start_date'] != "") { |
|
| 13 | 13 | $start_date = $_GET['start_date'].":00"; |
| 14 | 14 | $sql_date = $start_date; |
| 15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | 18 | } else $sql_date = ''; |
@@ -20,37 +20,37 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | if (isset($_GET['highest_altitude'])) { |
| 22 | 22 | //for altitude manipulation |
| 23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 27 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 27 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 29 | 29 | $sql_altitude = $end_altitude; |
| 30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 32 | 32 | $sql_altitude = $start_altitude; |
| 33 | 33 | } else $sql_altitude = ''; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | |
| 36 | 36 | //calculuation for the pagination |
| 37 | -if(!isset($_GET['limit'])) { |
|
| 37 | +if (!isset($_GET['limit'])) { |
|
| 38 | 38 | if (!isset($_GET['number_results'])) { |
| 39 | 39 | $limit_start = 0; |
| 40 | 40 | $limit_end = 25; |
| 41 | 41 | $absolute_difference = 25; |
| 42 | 42 | } else { |
| 43 | - if ($_GET['number_results'] > 1000){ |
|
| 43 | + if ($_GET['number_results'] > 1000) { |
|
| 44 | 44 | $_GET['number_results'] = 1000; |
| 45 | 45 | } |
| 46 | 46 | $limit_start = 0; |
| 47 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 48 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 47 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 48 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 49 | 49 | } |
| 50 | -} else { |
|
| 50 | +} else { |
|
| 51 | 51 | $limit_explode = explode(",", $_GET['limit']); |
| 52 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 53 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 52 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 53 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -67,31 +67,31 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 69 | 69 | else $sort = ''; |
| 70 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 71 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
|
| 72 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 73 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 74 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 75 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 76 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 77 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 78 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 79 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 80 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 81 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 82 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 83 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 84 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 85 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 86 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 70 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 71 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); |
|
| 72 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 73 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 74 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 75 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 76 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 77 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 78 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 79 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 80 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 81 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 82 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 83 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 84 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 85 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 86 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 87 | 87 | if ($id != '') { |
| 88 | 88 | $spotter_array = $Spotter->getSpotterDataByID($id); |
| 89 | 89 | } else { |
| 90 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 90 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 91 | 91 | } |
| 92 | 92 | $output = "-flights:\n"; |
| 93 | 93 | if (!empty($spotter_array)) { |
| 94 | - foreach($spotter_array as $spotter_item) { |
|
| 94 | + foreach ($spotter_array as $spotter_item) { |
|
| 95 | 95 | $output .= ' - id: '.$spotter_item['spotter_id']; |
| 96 | 96 | $output .= "\n"; |
| 97 | 97 | $output .= ' - ident: '.$spotter_item['ident']; |
@@ -15,8 +15,12 @@ discard block |
||
| 15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | - } else $sql_date = ''; |
|
| 19 | -} else $sql_date = ''; |
|
| 18 | + } else { |
|
| 19 | + $sql_date = ''; |
|
| 20 | + } |
|
| 21 | + } else { |
|
| 22 | + $sql_date = ''; |
|
| 23 | +} |
|
| 20 | 24 | |
| 21 | 25 | if (isset($_GET['highest_altitude'])) { |
| 22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
| 30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
| 32 | 36 | $sql_altitude = $start_altitude; |
| 33 | - } else $sql_altitude = ''; |
|
| 34 | -} else $sql_altitude = ''; |
|
| 37 | + } else { |
|
| 38 | + $sql_altitude = ''; |
|
| 39 | + } |
|
| 40 | + } else { |
|
| 41 | + $sql_altitude = ''; |
|
| 42 | +} |
|
| 35 | 43 | |
| 36 | 44 | //calculuation for the pagination |
| 37 | 45 | if(!isset($_GET['limit'])) { |
@@ -47,7 +55,7 @@ discard block |
||
| 47 | 55 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 48 | 56 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 49 | 57 | } |
| 50 | -} else { |
|
| 58 | +} else { |
|
| 51 | 59 | $limit_explode = explode(",", $_GET['limit']); |
| 52 | 60 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 53 | 61 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -65,8 +73,11 @@ discard block |
||
| 65 | 73 | |
| 66 | 74 | header("Content-type: text/yaml"); |
| 67 | 75 | |
| 68 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 69 | -else $sort = ''; |
|
| 76 | +if (isset($_GET['sort'])) { |
|
| 77 | + $sort = $_GET['sort']; |
|
| 78 | +} else { |
|
| 79 | + $sort = ''; |
|
| 80 | +} |
|
| 70 | 81 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 71 | 82 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
| 72 | 83 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |