@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | date_default_timezone_set('UTC'); |
43 | 43 | //waypoint plotting |
44 | 44 | $output .= '{"type": "Feature",'; |
45 | - $output .= '"properties": {'; |
|
45 | + $output .= '"properties": {'; |
|
46 | 46 | $output .= '"ref": "'.$spotter_item['ref'].'",'; |
47 | 47 | $output .= '"title": "'.$spotter_item['title'].'",'; |
48 | 48 | $output .= '"fir": "'.$spotter_item['fir'].'",'; |
@@ -61,28 +61,28 @@ discard block |
||
61 | 61 | // $output .= '"photo": "'.$spotter_item['image_thumbnail'].'",'; |
62 | 62 | // if ($spotter_item['radius'] > 30) $spotter_item['radius'] = 30; |
63 | 63 | if ($spotter_item['scope'] == 'Airport warning') { |
64 | - $output .= '"color": "#EACC04",'; |
|
64 | + $output .= '"color": "#EACC04",'; |
|
65 | 65 | } elseif ($spotter_item['scope'] == 'Airport/Enroute warning') { |
66 | - $output .= '"color": "#EA7D00",'; |
|
66 | + $output .= '"color": "#EA7D00",'; |
|
67 | 67 | } elseif ($spotter_item['scope'] == 'Airport/Navigation warning') { |
68 | - $output .= '"color": "#DBEA00",'; |
|
68 | + $output .= '"color": "#DBEA00",'; |
|
69 | 69 | } elseif ($spotter_item['scope'] == 'Navigation warning') { |
70 | - $output .= '"color": "#BBEA00",'; |
|
70 | + $output .= '"color": "#BBEA00",'; |
|
71 | 71 | } else { |
72 | - $output .= '"color": "#FF0000",'; |
|
72 | + $output .= '"color": "#FF0000",'; |
|
73 | 73 | } |
74 | 74 | $radius = $spotter_item['radius']*1852; |
75 | 75 | $output .= '"radiusm": "'.$radius.'",'; |
76 | 76 | $output .= '"radiusnm": "'.$spotter_item['radius'].'",'; |
77 | 77 | if ($radius > 25000) $radius = 25000; |
78 | 78 | $output .= '"radius": '.$radius.''; |
79 | - $output .= '},'; |
|
80 | - $output .= '"geometry": {'; |
|
79 | + $output .= '},'; |
|
80 | + $output .= '"geometry": {'; |
|
81 | 81 | $output .= '"type": "Point",'; |
82 | 82 | $output .= '"coordinates": ['; |
83 | - $output .= $spotter_item['center_longitude'].', '.$spotter_item['center_latitude']; |
|
83 | + $output .= $spotter_item['center_longitude'].', '.$spotter_item['center_latitude']; |
|
84 | 84 | $output .= ']'; |
85 | - $output .= '}'; |
|
85 | + $output .= '}'; |
|
86 | 86 | $output .= '},'; |
87 | 87 | } |
88 | 88 | $output = substr($output, 0, -1); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | date_default_timezone_set('UTC'); |
27 | 27 | //waypoint plotting |
28 | 28 | $output .= '{"type": "Feature",'; |
29 | - $output .= '"properties": {'; |
|
29 | + $output .= '"properties": {'; |
|
30 | 30 | $output .= '"segment_name": "'.$spotter_item['segment_name'].'",'; |
31 | 31 | $output .= '"base": "'.$spotter_item['base'].'",'; |
32 | 32 | $output .= '"top": "'.$spotter_item['top'].'",'; |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | $output .= '"stroke": "#f0f0f0",'; |
50 | 50 | $output .= '"stroke-width": 2'; |
51 | 51 | // } |
52 | - $output .= '},'; |
|
53 | - $output .= '"geometry": {'; |
|
52 | + $output .= '},'; |
|
53 | + $output .= '"geometry": {'; |
|
54 | 54 | $output .= '"type": "LineString",'; |
55 | 55 | $output .= '"coordinates": ['; |
56 | - //$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].'], ['.$spotter_item['longitude_end_seg2'].', '.$spotter_item['latitude_end_seg2'].']'; |
|
57 | - $output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].','.round($spotter_item['base']*100*0.3048).'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].','.round($spotter_item['base']*100*0.3048).']'; |
|
56 | + //$output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].'], ['.$spotter_item['longitude_end_seg2'].', '.$spotter_item['latitude_end_seg2'].']'; |
|
57 | + $output .= '['.$spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].','.round($spotter_item['base']*100*0.3048).'], ['.$spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].','.round($spotter_item['base']*100*0.3048).']'; |
|
58 | 58 | // $output .= '['.$spotter_item['latitude_begin'].', '.$spotter_item['longitude_begin'].'], ['.$spotter_item['latitude_end'].', '.$spotter_item['longitude_end'].']'; |
59 | 59 | $output .= ']'; |
60 | - $output .= '}'; |
|
60 | + $output .= '}'; |
|
61 | 61 | /* $output .= '"geometry": {'; |
62 | 62 | $output .= '"type": "Point",'; |
63 | 63 | $output .= '"coordinates": ['; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $output .= '},'; |
69 | 69 | //waypoint plotting |
70 | 70 | $output .= '{"type": "Feature",'; |
71 | - $output .= '"properties": {'; |
|
71 | + $output .= '"properties": {'; |
|
72 | 72 | $output .= '"ident": "'.$spotter_item['name_begin'].'",'; |
73 | 73 | $output .= '"high": "'.$spotter_item['high'].'",'; |
74 | 74 | $output .= '"alt": "'.$spotter_item['base'].'",'; |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | $output .= '"marker-size": "small",'; |
99 | 99 | $output .= '"marker-color": "#0000ff"'; |
100 | 100 | } |
101 | - $output .= '},'; |
|
102 | - $output .= '"geometry": {'; |
|
101 | + $output .= '},'; |
|
102 | + $output .= '"geometry": {'; |
|
103 | 103 | $output .= '"type": "Point",'; |
104 | 104 | $output .= '"coordinates": ['; |
105 | - $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);; |
|
105 | + $output .= $spotter_item['longitude_begin'].', '.$spotter_item['latitude_begin'].', '.round($spotter_item['base']*100*0.3048);; |
|
106 | 106 | $output .= ']'; |
107 | - $output .= '}'; |
|
107 | + $output .= '}'; |
|
108 | 108 | |
109 | 109 | $output .= '},'; |
110 | 110 | $output .= '{"type": "Feature",'; |
111 | - $output .= '"properties": {'; |
|
111 | + $output .= '"properties": {'; |
|
112 | 112 | $output .= '"ident": "'.$spotter_item['name_end'].'",'; |
113 | 113 | $output .= '"high": "'.$spotter_item['high'].'",'; |
114 | 114 | $output .= '"alt": "'.$spotter_item['top'].'",'; |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | $output .= '"marker-size": "small",'; |
146 | 146 | $output .= '"marker-color": "#0000ff"'; |
147 | 147 | } |
148 | - $output .= '},'; |
|
149 | - $output .= '"geometry": {'; |
|
148 | + $output .= '},'; |
|
149 | + $output .= '"geometry": {'; |
|
150 | 150 | $output .= '"type": "Point",'; |
151 | 151 | $output .= '"coordinates": ['; |
152 | - $output .= $spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].', '.round($spotter_item['base']*100*0.3048); |
|
152 | + $output .= $spotter_item['longitude_end'].', '.$spotter_item['latitude_end'].', '.round($spotter_item['base']*100*0.3048); |
|
153 | 153 | $output .= ']'; |
154 | - $output .= '}'; |
|
154 | + $output .= '}'; |
|
155 | 155 | |
156 | 156 | $output .= '},'; |
157 | 157 | } |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | } |
30 | 30 | fclose($handle); |
31 | 31 | } |
32 | - //Connection::$db->commit(); |
|
33 | - $Connection->db = null; |
|
34 | - return ''; |
|
32 | + //Connection::$db->commit(); |
|
33 | + $Connection->db = null; |
|
34 | + return ''; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public static function import_all_db($directory) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | //foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename) |
41 | 41 | while(false !== ($filename = readdir($dh))) |
42 | 42 | { |
43 | - if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename); |
|
43 | + if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename); |
|
44 | 44 | } |
45 | 45 | return $error; |
46 | 46 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $host = filter_var($host,FILTER_SANITIZE_STRING); |
56 | 56 | // Dirty hack |
57 | 57 | if ($host != 'localhost' && $host != '127.0.0.1') { |
58 | - $grantright = $_SERVER['SERVER_ADDR']; |
|
58 | + $grantright = $_SERVER['SERVER_ADDR']; |
|
59 | 59 | } else $grantright = 'localhost'; |
60 | 60 | try { |
61 | 61 | $dbh = new PDO($db_type.':host='.$host,$root,$root_pass); |
@@ -7,91 +7,91 @@ discard block |
||
7 | 7 | |
8 | 8 | |
9 | 9 | class Translation { |
10 | - public $db; |
|
11 | - public function __construct($dbc = null) { |
|
12 | - $Connection = new Connection($dbc); |
|
13 | - $this->db = $Connection->db(); |
|
14 | - } |
|
10 | + public $db; |
|
11 | + public function __construct($dbc = null) { |
|
12 | + $Connection = new Connection($dbc); |
|
13 | + $this->db = $Connection->db(); |
|
14 | + } |
|
15 | 15 | |
16 | - /** |
|
17 | - * Change IATA to ICAO value for ident |
|
18 | - * |
|
19 | - * @param String $ident ident |
|
20 | - * @return String the icao |
|
21 | - */ |
|
22 | - public function ident2icao($ident) { |
|
16 | + /** |
|
17 | + * Change IATA to ICAO value for ident |
|
18 | + * |
|
19 | + * @param String $ident ident |
|
20 | + * @return String the icao |
|
21 | + */ |
|
22 | + public function ident2icao($ident) { |
|
23 | 23 | $Spotter = new Spotter(); |
24 | 24 | if (!is_numeric(substr($ident, 0, 3))) |
25 | - { |
|
26 | - if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
|
27 | - $airline_icao = substr($ident, 0, 2); |
|
28 | - } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
|
29 | - //$airline_icao = substr($ident, 0, 3); |
|
30 | - return $ident; |
|
31 | - } else return $ident; |
|
32 | - } else return $ident; |
|
33 | - if ($airline_icao == 'AF') { |
|
34 | - if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
35 | - else $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
36 | - } else { |
|
37 | - $identicao = $Spotter->getAllAirlineInfo($airline_icao); |
|
38 | - if (isset($identicao[0])) { |
|
39 | - $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0'); |
|
40 | - } else $icao = $ident; |
|
41 | - } |
|
42 | - return $icao; |
|
43 | - } |
|
25 | + { |
|
26 | + if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
|
27 | + $airline_icao = substr($ident, 0, 2); |
|
28 | + } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
|
29 | + //$airline_icao = substr($ident, 0, 3); |
|
30 | + return $ident; |
|
31 | + } else return $ident; |
|
32 | + } else return $ident; |
|
33 | + if ($airline_icao == 'AF') { |
|
34 | + if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
35 | + else $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
36 | + } else { |
|
37 | + $identicao = $Spotter->getAllAirlineInfo($airline_icao); |
|
38 | + if (isset($identicao[0])) { |
|
39 | + $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0'); |
|
40 | + } else $icao = $ident; |
|
41 | + } |
|
42 | + return $icao; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - public function getOperator($ident) { |
|
47 | - $query = "SELECT * FROM translation WHERE Operator = :ident LIMIT 1"; |
|
48 | - $query_values = array(':ident' => $ident); |
|
49 | - try { |
|
50 | - $sth = $this->db->prepare($query); |
|
51 | - $sth->execute($query_values); |
|
52 | - } catch(PDOException $e) { |
|
53 | - return "error : ".$e->getMessage(); |
|
54 | - } |
|
55 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
56 | - $sth->closeCursor(); |
|
57 | - if (count($row) > 0) { |
|
58 | - return $row['operator_correct']; |
|
59 | - } else return $ident; |
|
60 | - } |
|
46 | + public function getOperator($ident) { |
|
47 | + $query = "SELECT * FROM translation WHERE Operator = :ident LIMIT 1"; |
|
48 | + $query_values = array(':ident' => $ident); |
|
49 | + try { |
|
50 | + $sth = $this->db->prepare($query); |
|
51 | + $sth->execute($query_values); |
|
52 | + } catch(PDOException $e) { |
|
53 | + return "error : ".$e->getMessage(); |
|
54 | + } |
|
55 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
56 | + $sth->closeCursor(); |
|
57 | + if (count($row) > 0) { |
|
58 | + return $row['operator_correct']; |
|
59 | + } else return $ident; |
|
60 | + } |
|
61 | 61 | |
62 | - public function addOperator($ident,$correct_ident,$source) { |
|
63 | - $query = "INSERT INTO translation (Operator,Operator_correct,Source) VALUES (:ident,:correct_ident,:source)"; |
|
64 | - $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source); |
|
65 | - try { |
|
66 | - $sth = $this->db->prepare($query); |
|
67 | - $sth->execute($query_values); |
|
68 | - } catch(PDOException $e) { |
|
69 | - return "error : ".$e->getMessage(); |
|
70 | - } |
|
71 | - } |
|
62 | + public function addOperator($ident,$correct_ident,$source) { |
|
63 | + $query = "INSERT INTO translation (Operator,Operator_correct,Source) VALUES (:ident,:correct_ident,:source)"; |
|
64 | + $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source); |
|
65 | + try { |
|
66 | + $sth = $this->db->prepare($query); |
|
67 | + $sth->execute($query_values); |
|
68 | + } catch(PDOException $e) { |
|
69 | + return "error : ".$e->getMessage(); |
|
70 | + } |
|
71 | + } |
|
72 | 72 | |
73 | - public function updateOperator($ident,$correct_ident,$source) { |
|
74 | - $query = "UPDATE translation SET Operator_correct = :correct_ident,Source = :source WHERE Operator = :ident"; |
|
75 | - $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source); |
|
76 | - try { |
|
77 | - $sth = $this->db->prepare($query); |
|
78 | - $sth->execute($query_values); |
|
79 | - } catch(PDOException $e) { |
|
80 | - return "error : ".$e->getMessage(); |
|
81 | - } |
|
82 | - } |
|
73 | + public function updateOperator($ident,$correct_ident,$source) { |
|
74 | + $query = "UPDATE translation SET Operator_correct = :correct_ident,Source = :source WHERE Operator = :ident"; |
|
75 | + $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source); |
|
76 | + try { |
|
77 | + $sth = $this->db->prepare($query); |
|
78 | + $sth->execute($query_values); |
|
79 | + } catch(PDOException $e) { |
|
80 | + return "error : ".$e->getMessage(); |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | - public function checkTranslation($ident,$web = false) { |
|
85 | - global $globalTranslationSources, $globalTranslationFetch; |
|
86 | - //if (!isset($globalTranslationSources)) $globalTranslationSources = array('planefinder'); |
|
87 | - $globalTranslationSources = array(); |
|
88 | - if (!isset($globalTranslationFetch)) $globalTranslationFetch = TRUE; |
|
89 | - //echo "Check Translation for ".$ident."..."; |
|
90 | - $correct = $this->getOperator($ident); |
|
91 | - if ($correct != '' && $correct != $ident) { |
|
92 | - //echo "Found in DB !\n"; |
|
93 | - return $correct; |
|
94 | - } /* |
|
84 | + public function checkTranslation($ident,$web = false) { |
|
85 | + global $globalTranslationSources, $globalTranslationFetch; |
|
86 | + //if (!isset($globalTranslationSources)) $globalTranslationSources = array('planefinder'); |
|
87 | + $globalTranslationSources = array(); |
|
88 | + if (!isset($globalTranslationFetch)) $globalTranslationFetch = TRUE; |
|
89 | + //echo "Check Translation for ".$ident."..."; |
|
90 | + $correct = $this->getOperator($ident); |
|
91 | + if ($correct != '' && $correct != $ident) { |
|
92 | + //echo "Found in DB !\n"; |
|
93 | + return $correct; |
|
94 | + } /* |
|
95 | 95 | elseif ($web && $globalTranslationFetch) { |
96 | 96 | if (! is_numeric(substr($ident,-4))) { |
97 | 97 | if (count($globalTranslationSources) > 0) { |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | } |
109 | 109 | } |
110 | 110 | */ |
111 | - return $this->ident2icao($ident); |
|
112 | - } |
|
111 | + return $this->ident2icao($ident); |
|
112 | + } |
|
113 | 113 | |
114 | 114 | /* |
115 | 115 | function fromPlanefinder($icao) { |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | print '<div class="select-item">'; |
22 | 22 | print '<form action="'.$globalURL.'/aircraft" method="post">'; |
23 | 23 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
24 | - print '<option></option>'; |
|
25 | - $Stats = new Stats(); |
|
26 | - $aircraft_types = $Stats->getAllAircraftTypes(); |
|
27 | - if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
28 | - foreach($aircraft_types as $aircrafttype) |
|
29 | - { |
|
30 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
31 | - { |
|
32 | - print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
33 | - } else { |
|
34 | - print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
35 | - } |
|
24 | + print '<option></option>'; |
|
25 | + $Stats = new Stats(); |
|
26 | + $aircraft_types = $Stats->getAllAircraftTypes(); |
|
27 | + if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
28 | + foreach($aircraft_types as $aircrafttype) |
|
29 | + { |
|
30 | + if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
31 | + { |
|
32 | + print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
33 | + } else { |
|
34 | + print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | print '</select>'; |
38 | 38 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | function drawChart() { |
65 | 65 | var data = google.visualization.arrayToDataTable([ |
66 | 66 | ["Country", "# of times"], '; |
67 | - $country_data = ''; |
|
67 | + $country_data = ''; |
|
68 | 68 | foreach($airline_array as $airline_item) |
69 | 69 | { |
70 | 70 | $country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],'; |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | print '<div class="select-item">'; |
43 | 43 | print '<form action="'.$globalURL.'/aircraft" method="post">'; |
44 | 44 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
45 | - print '<option></option>'; |
|
46 | - $Stats = new Stats(); |
|
45 | + print '<option></option>'; |
|
46 | + $Stats = new Stats(); |
|
47 | 47 | $aircraft_types = $Stats->getAllAircraftTypes(); |
48 | 48 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
49 | 49 | foreach($aircraft_types as $aircrafttype) |
@@ -54,20 +54,20 @@ discard block |
||
54 | 54 | } else { |
55 | 55 | print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
56 | 56 | } |
57 | - } |
|
58 | - print '</select>'; |
|
59 | - print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
|
57 | + } |
|
58 | + print '</select>'; |
|
59 | + print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
|
60 | 60 | print '</form>'; |
61 | 61 | print '</div>'; |
62 | 62 | |
63 | 63 | if ($aircraft_type != "NA") |
64 | 64 | { |
65 | - print '<div class="info column">'; |
|
66 | - print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>'; |
|
67 | - print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
|
68 | - print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
|
69 | - if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
|
70 | - print '</div>'; |
|
65 | + print '<div class="info column">'; |
|
66 | + print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>'; |
|
67 | + print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
|
68 | + print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
|
69 | + if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
|
70 | + print '</div>'; |
|
71 | 71 | } else { |
72 | 72 | print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>'; |
73 | 73 | } |
@@ -305,17 +305,17 @@ discard block |
||
305 | 305 | </tr> |
306 | 306 | <!-- |
307 | 307 | <?php |
308 | - require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
309 | - $Connection = new Connection(); |
|
308 | + require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
309 | + $Connection = new Connection(); |
|
310 | 310 | ?> |
311 | 311 | --> |
312 | 312 | <?php |
313 | - if ($Connection->db != NULL) { |
|
313 | + if ($Connection->db != NULL) { |
|
314 | 314 | if ($Connection->tableExists('source_location')) { |
315 | - require_once(dirname(__FILE__).'/../require/class.Source.php'); |
|
316 | - $Source = new Source(); |
|
317 | - $alllocations = $Source->getAllLocationInfo(); |
|
318 | - foreach ($alllocations as $location) { |
|
315 | + require_once(dirname(__FILE__).'/../require/class.Source.php'); |
|
316 | + $Source = new Source(); |
|
317 | + $alllocations = $Source->getAllLocationInfo(); |
|
318 | + foreach ($alllocations as $location) { |
|
319 | 319 | ?> |
320 | 320 | <tr> |
321 | 321 | <input type="hidden" name="source_id[]" value="<?php print $location['id']; ?>" /> |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | </tr> |
330 | 330 | |
331 | 331 | <?php |
332 | - } |
|
332 | + } |
|
333 | + } |
|
333 | 334 | } |
334 | - } |
|
335 | 335 | ?> |
336 | 336 | |
337 | 337 | <tr> |
@@ -424,12 +424,12 @@ discard block |
||
424 | 424 | ?> |
425 | 425 | <tr> |
426 | 426 | <?php |
427 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
427 | + if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
428 | 428 | ?> |
429 | 429 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
430 | 430 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
431 | 431 | <?php |
432 | - } else { |
|
432 | + } else { |
|
433 | 433 | $hostport = explode(':',$source['host']); |
434 | 434 | if (isset($hostport[1])) { |
435 | 435 | $host = $hostport[0]; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | <td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td> |
443 | 443 | <td><input type="number" name="port[]" id="port" value="<?php print $port; ?>" /></td> |
444 | 444 | <?php |
445 | - } |
|
445 | + } |
|
446 | 446 | ?> |
447 | 447 | <td> |
448 | 448 | <select name="format[]" id="format"> |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | <br /> |
759 | 759 | <p> |
760 | 760 | <?php |
761 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
761 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
762 | 762 | ?> |
763 | 763 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
764 | 764 | <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
@@ -768,11 +768,11 @@ discard block |
||
768 | 768 | <b>The directory cache is not writable, aircraft icon will not be cached</b> |
769 | 769 | <?php |
770 | 770 | } |
771 | - } else { |
|
771 | + } else { |
|
772 | 772 | ?> |
773 | 773 | <b>PHP GD is not installed, you can t change color of aircraft icon on map</b> |
774 | 774 | <?php |
775 | - } |
|
775 | + } |
|
776 | 776 | ?> |
777 | 777 | </p> |
778 | 778 | <br /> |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | </p> |
792 | 792 | <?php |
793 | 793 | require('../footer.php'); |
794 | - exit; |
|
794 | + exit; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | $settings = array(); |
@@ -881,8 +881,8 @@ discard block |
||
881 | 881 | |
882 | 882 | $sources = array(); |
883 | 883 | foreach ($source_name as $keys => $name) { |
884 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
885 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
884 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
885 | + else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
886 | 886 | } |
887 | 887 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
888 | 888 | |
@@ -1176,14 +1176,14 @@ discard block |
||
1176 | 1176 | |
1177 | 1177 | // Set some defaults values... |
1178 | 1178 | if (!isset($globalAircraftImageSources)) { |
1179 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1180 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1179 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1180 | + $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | if (!isset($globalSchedulesSources)) { |
1184 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1185 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1186 | - } |
|
1184 | + $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1185 | + $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1186 | + } |
|
1187 | 1187 | |
1188 | 1188 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1189 | 1189 | |
@@ -1235,21 +1235,21 @@ discard block |
||
1235 | 1235 | $popi = false; |
1236 | 1236 | $popw = false; |
1237 | 1237 | foreach ($_SESSION['done'] as $done) { |
1238 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1239 | - if ($done == 'Create database') $pop = true; |
|
1240 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1241 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1242 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1238 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1239 | + if ($done == 'Create database') $pop = true; |
|
1240 | + if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1241 | + if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1242 | + if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1243 | 1243 | } |
1244 | 1244 | if ($pop) { |
1245 | - sleep(5); |
|
1246 | - print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1245 | + sleep(5); |
|
1246 | + print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1247 | 1247 | } else if ($popi) { |
1248 | - sleep(5); |
|
1249 | - print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1248 | + sleep(5); |
|
1249 | + print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1250 | 1250 | } else if ($popw) { |
1251 | - sleep(5); |
|
1252 | - print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1251 | + sleep(5); |
|
1252 | + print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1253 | 1253 | } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
1254 | 1254 | print '</div></ul>'; |
1255 | 1255 | print '<div id="error"></div>'; |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | unset($_COOKIE['install']); |
1313 | 1313 | print '<div class="info column"><ul>'; |
1314 | 1314 | foreach ($_SESSION['done'] as $done) { |
1315 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1315 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1316 | 1316 | } |
1317 | 1317 | print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>'; |
1318 | 1318 | print '</ul></div>'; |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | $Common = new Common(); |
12 | 12 | |
13 | 13 | if (isset($_GET['download'])) { |
14 | - if ($_GET['download'] == "true") |
|
15 | - { |
|
14 | + if ($_GET['download'] == "true") |
|
15 | + { |
|
16 | 16 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
17 | - } |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | header('Content-Type: text/javascript'); |
20 | 20 | |
@@ -333,26 +333,26 @@ discard block |
||
333 | 333 | |
334 | 334 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
335 | 335 | || (!isset($_COOKIE['flightpath']) |
336 | - && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
|
337 | - || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
|
336 | + && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
|
337 | + || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
|
338 | 338 | || (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) { |
339 | - if ($from_archive) { |
|
340 | - $spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
|
341 | - } else { |
|
342 | - $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
|
343 | - } |
|
344 | - $d = false; |
|
339 | + if ($from_archive) { |
|
340 | + $spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
|
341 | + } else { |
|
342 | + $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
|
343 | + } |
|
344 | + $d = false; |
|
345 | 345 | foreach ($spotter_history_array as $key => $spotter_history) |
346 | 346 | { |
347 | 347 | $alt = round($spotter_history['altitude']/10)*10; |
348 | 348 | if (!isset($prev_alt) || $prev_alt != $alt) { |
349 | - if (isset($prev_alt)) { |
|
349 | + if (isset($prev_alt)) { |
|
350 | 350 | $output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].', '.$spotter_history['altitude'].']'; |
351 | 351 | $output_history .= ']}},'; |
352 | 352 | $output .= $output_history; |
353 | - } |
|
354 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
355 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
353 | + } |
|
354 | + if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
355 | + else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
356 | 356 | } |
357 | 357 | $output_history .= '['; |
358 | 358 | $output_history .= $spotter_history['longitude'].', '; |
@@ -360,38 +360,38 @@ discard block |
||
360 | 360 | $output_history .= $spotter_history['altitude']*30.48; |
361 | 361 | $output_history .= '],'; |
362 | 362 | $prev_alt = $alt; |
363 | - //} |
|
363 | + //} |
|
364 | 364 | } |
365 | 365 | if (isset($output_history)) { |
366 | - $output_history = substr($output_history, 0, -1); |
|
367 | - $output_history .= ']}},'; |
|
368 | - $output .= $output_history; |
|
369 | - unset($prev_alt); |
|
370 | - unset($output_history); |
|
366 | + $output_history = substr($output_history, 0, -1); |
|
367 | + $output_history .= ']}},'; |
|
368 | + $output .= $output_history; |
|
369 | + unset($prev_alt); |
|
370 | + unset($output_history); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | 374 | if (isset($history) && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
375 | - $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
376 | - if (isset($spotter_item['departure_airport_latitude'])) { |
|
375 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
376 | + if (isset($spotter_item['departure_airport_latitude'])) { |
|
377 | 377 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
378 | - } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
378 | + } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
379 | 379 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
380 | 380 | if (isset($dairport[0]['latitude'])) { |
381 | - $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
381 | + $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
382 | 382 | } |
383 | - } |
|
384 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
383 | + } |
|
384 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
385 | 385 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
386 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
386 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
387 | 387 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
388 | 388 | if (isset($aairport[0]['latitude'])) { |
389 | - $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
389 | + $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
390 | 390 | } |
391 | - } |
|
392 | - $output_air .= ']}},'; |
|
393 | - $output .= $output_air; |
|
394 | - unset($output_air); |
|
391 | + } |
|
392 | + $output_air .= ']}},'; |
|
393 | + $output .= $output_air; |
|
394 | + unset($output_air); |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | $output = substr($output, 0, -1); |
@@ -10,100 +10,100 @@ |
||
10 | 10 | } |
11 | 11 | |
12 | 12 | |
13 | - /** |
|
14 | - * Get SQL query part for filter used |
|
15 | - * @param Array $filter the filter |
|
16 | - * @return Array the SQL part |
|
17 | - */ |
|
18 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
13 | + /** |
|
14 | + * Get SQL query part for filter used |
|
15 | + * @param Array $filter the filter |
|
16 | + * @return Array the SQL part |
|
17 | + */ |
|
18 | + public function getFilter($filter = array(),$where = false,$and = false) { |
|
19 | 19 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | - if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
|
21 | + if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
|
22 | 22 | foreach($globalStatsFilters[$globalFilterName] as $source) { |
23 | 23 | if (isset($source['source'])) $filter['source'][] = $source['source']; |
24 | 24 | } |
25 | - } else { |
|
25 | + } else { |
|
26 | 26 | $filter = $globalStatsFilters[$globalFilterName]; |
27 | - } |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
30 | 30 | $filter_query_join = ''; |
31 | 31 | $filter_query_where = ''; |
32 | 32 | if (isset($filter['source']) && !empty($filter['source'])) { |
33 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
33 | + $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
34 | 34 | } |
35 | 35 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
36 | 36 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
37 | 37 | $filter_query = $filter_query_join.$filter_query_where; |
38 | 38 | return $filter_query; |
39 | - } |
|
39 | + } |
|
40 | 40 | |
41 | - public function getAll() { |
|
42 | - $filter_query = $this->getFilter(array()); |
|
43 | - $query = "SELECT * FROM atc".$filter_query; |
|
44 | - $query_values = array(); |
|
45 | - try { |
|
46 | - $sth = $this->db->prepare($query); |
|
47 | - $sth->execute($query_values); |
|
48 | - } catch(PDOException $e) { |
|
49 | - return "error : ".$e->getMessage(); |
|
50 | - } |
|
51 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
52 | - return $all; |
|
53 | - } |
|
41 | + public function getAll() { |
|
42 | + $filter_query = $this->getFilter(array()); |
|
43 | + $query = "SELECT * FROM atc".$filter_query; |
|
44 | + $query_values = array(); |
|
45 | + try { |
|
46 | + $sth = $this->db->prepare($query); |
|
47 | + $sth->execute($query_values); |
|
48 | + } catch(PDOException $e) { |
|
49 | + return "error : ".$e->getMessage(); |
|
50 | + } |
|
51 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
52 | + return $all; |
|
53 | + } |
|
54 | 54 | |
55 | - public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') { |
|
56 | - $info = preg_replace('/[^(\x20-\x7F)]*/','',$info); |
|
57 | - $info = str_replace('^','<br />',$info); |
|
58 | - $info = str_replace('&sect;','',$info); |
|
59 | - $info = str_replace('"','',$info); |
|
60 | - if ($type == '') $type = NULL; |
|
61 | - $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)"; |
|
62 | - $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
|
63 | - try { |
|
64 | - $sth = $this->db->prepare($query); |
|
65 | - $sth->execute($query_values); |
|
66 | - } catch(PDOException $e) { |
|
67 | - return "error : ".$e->getMessage(); |
|
68 | - } |
|
69 | - } |
|
55 | + public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') { |
|
56 | + $info = preg_replace('/[^(\x20-\x7F)]*/','',$info); |
|
57 | + $info = str_replace('^','<br />',$info); |
|
58 | + $info = str_replace('&sect;','',$info); |
|
59 | + $info = str_replace('"','',$info); |
|
60 | + if ($type == '') $type = NULL; |
|
61 | + $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)"; |
|
62 | + $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
|
63 | + try { |
|
64 | + $sth = $this->db->prepare($query); |
|
65 | + $sth->execute($query_values); |
|
66 | + } catch(PDOException $e) { |
|
67 | + return "error : ".$e->getMessage(); |
|
68 | + } |
|
69 | + } |
|
70 | 70 | |
71 | - public function deleteById($id) { |
|
72 | - $query = "DELETE FROM atc WHERE atc_id = :id"; |
|
73 | - $query_values = array(':id' => $id); |
|
74 | - try { |
|
75 | - $sth = $this->db->prepare($query); |
|
76 | - $sth->execute($query_values); |
|
77 | - } catch(PDOException $e) { |
|
78 | - return "error : ".$e->getMessage(); |
|
79 | - } |
|
80 | - } |
|
71 | + public function deleteById($id) { |
|
72 | + $query = "DELETE FROM atc WHERE atc_id = :id"; |
|
73 | + $query_values = array(':id' => $id); |
|
74 | + try { |
|
75 | + $sth = $this->db->prepare($query); |
|
76 | + $sth->execute($query_values); |
|
77 | + } catch(PDOException $e) { |
|
78 | + return "error : ".$e->getMessage(); |
|
79 | + } |
|
80 | + } |
|
81 | 81 | |
82 | - public function deleteAll() { |
|
83 | - $query = "DELETE FROM atc"; |
|
84 | - $query_values = array(); |
|
85 | - try { |
|
86 | - $sth = $this->db->prepare($query); |
|
87 | - $sth->execute($query_values); |
|
88 | - } catch(PDOException $e) { |
|
89 | - return "error : ".$e->getMessage(); |
|
90 | - } |
|
91 | - } |
|
82 | + public function deleteAll() { |
|
83 | + $query = "DELETE FROM atc"; |
|
84 | + $query_values = array(); |
|
85 | + try { |
|
86 | + $sth = $this->db->prepare($query); |
|
87 | + $sth->execute($query_values); |
|
88 | + } catch(PDOException $e) { |
|
89 | + return "error : ".$e->getMessage(); |
|
90 | + } |
|
91 | + } |
|
92 | 92 | |
93 | 93 | public function deleteOldATC() { |
94 | - global $globalDBdriver; |
|
95 | - if ($globalDBdriver == 'mysql') { |
|
96 | - $query = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen"; |
|
97 | - } else { |
|
98 | - $query = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen"; |
|
99 | - } |
|
100 | - try { |
|
101 | - $sth = $this->db->prepare($query); |
|
102 | - $sth->execute(); |
|
103 | - } catch(PDOException $e) { |
|
104 | - return "error"; |
|
105 | - } |
|
106 | - return "success"; |
|
107 | - } |
|
94 | + global $globalDBdriver; |
|
95 | + if ($globalDBdriver == 'mysql') { |
|
96 | + $query = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen"; |
|
97 | + } else { |
|
98 | + $query = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen"; |
|
99 | + } |
|
100 | + try { |
|
101 | + $sth = $this->db->prepare($query); |
|
102 | + $sth->execute(); |
|
103 | + } catch(PDOException $e) { |
|
104 | + return "error"; |
|
105 | + } |
|
106 | + return "success"; |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | ?> |
110 | 110 | \ No newline at end of file |