@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | $Stats = new Stats(); |
44 | 44 | $airline_names = $Stats->getAllAirlineNames(); |
45 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
45 | + if (empty($airline_names)) { |
|
46 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
47 | + } |
|
46 | 48 | foreach($airline_names as $airline_name) |
47 | 49 | { |
48 | 50 | if($airline == $airline_name['airline_icao']) |
@@ -65,8 +67,7 @@ discard block |
||
65 | 67 | if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif')) |
66 | 68 | { |
67 | 69 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
68 | - } |
|
69 | - elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
70 | + } elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
70 | 71 | { |
71 | 72 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
72 | 73 | } |
@@ -7,21 +7,21 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airline'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $alliance = false; |
13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
14 | 14 | $alliance = true; |
15 | 15 | } else { |
16 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
16 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | if (!empty($spotter_array) || $alliance === true) |
20 | 20 | { |
21 | 21 | if ($alliance) { |
22 | - $title = sprintf(_("Most Common Routes from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
22 | + $title = sprintf(_("Most Common Routes from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
23 | 23 | } else { |
24 | - $title = sprintf(_("Most Common Routes from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
24 | + $title = sprintf(_("Most Common Routes from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
25 | 25 | } |
26 | 26 | require_once('header.php'); |
27 | 27 | print '<div class="select-item">'; |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | $alliances = $Spotter->getAllAllianceNames(); |
32 | 32 | if (!empty($alliances)) { |
33 | 33 | foreach ($alliances as $al) { |
34 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
35 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
34 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
35 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
36 | 36 | } else { |
37 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
37 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | print '<option disabled>───────────────────</option>'; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | $Stats = new Stats(); |
43 | 43 | $airline_names = $Stats->getAllAirlineNames(); |
44 | 44 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
45 | - foreach($airline_names as $airline_name) |
|
45 | + foreach ($airline_names as $airline_name) |
|
46 | 46 | { |
47 | - if($airline == $airline_name['airline_icao']) |
|
47 | + if ($airline == $airline_name['airline_icao']) |
|
48 | 48 | { |
49 | 49 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
50 | 50 | } else { |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | print '</div>'; |
79 | 79 | } else { |
80 | 80 | print '<div class="info column">'; |
81 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
82 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
81 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
82 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
83 | 83 | { |
84 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
84 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
85 | 85 | } |
86 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
86 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
87 | 87 | print '</div>'; |
88 | 88 | } |
89 | 89 | } else { |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | print '<div class="column">'; |
95 | 95 | print '<h2>'._("Most Common Routes").'</h2>'; |
96 | 96 | if ($alliance) { |
97 | - print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
97 | + print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
98 | 98 | } else { |
99 | - print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
99 | + print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
100 | 100 | } |
101 | 101 | if ($alliance) { |
102 | - $route_array = $Spotter->countAllRoutesByAirline('',array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline)))); |
|
102 | + $route_array = $Spotter->countAllRoutesByAirline('', array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $airline)))); |
|
103 | 103 | } else { |
104 | 104 | $route_array = $Spotter->countAllRoutesByAirline($airline); |
105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | print '</thead>'; |
118 | 118 | print '<tbody>'; |
119 | 119 | $i = 1; |
120 | - foreach($route_array as $route_item) |
|
120 | + foreach ($route_array as $route_item) |
|
121 | 121 | { |
122 | 122 | print '<tr>'; |
123 | 123 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | $Stats = new Stats(); |
44 | 44 | $airline_names = $Stats->getAllAirlineNames(); |
45 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
45 | + if (empty($airline_names)) { |
|
46 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
47 | + } |
|
46 | 48 | foreach($airline_names as $airline_name) |
47 | 49 | { |
48 | 50 | if($airline == $airline_name['airline_icao']) |
@@ -65,8 +67,7 @@ discard block |
||
65 | 67 | if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif')) |
66 | 68 | { |
67 | 69 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
68 | - } |
|
69 | - elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
70 | + } elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
70 | 71 | { |
71 | 72 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
72 | 73 | } |
@@ -7,21 +7,21 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airline'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $alliance = false; |
13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
14 | 14 | $alliance = true; |
15 | 15 | } else { |
16 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
16 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | if (!empty($spotter_array) || $alliance === true) |
20 | 20 | { |
21 | 21 | if ($alliance) { |
22 | - $title = sprintf(_("Most Common Aircraft Manufacturer from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
22 | + $title = sprintf(_("Most Common Aircraft Manufacturer from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
23 | 23 | } else { |
24 | - $title = sprintf(_("Most Common Aircraft Manufacturer from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
24 | + $title = sprintf(_("Most Common Aircraft Manufacturer from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
25 | 25 | } |
26 | 26 | require_once('header.php'); |
27 | 27 | print '<div class="select-item">'; |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | $alliances = $Spotter->getAllAllianceNames(); |
32 | 32 | if (!empty($alliances)) { |
33 | 33 | foreach ($alliances as $al) { |
34 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
35 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
34 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
35 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
36 | 36 | } else { |
37 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
37 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | print '<option disabled>───────────────────</option>'; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | $Stats = new Stats(); |
43 | 43 | $airline_names = $Stats->getAllAirlineNames(); |
44 | 44 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
45 | - foreach($airline_names as $airline_name) |
|
45 | + foreach ($airline_names as $airline_name) |
|
46 | 46 | { |
47 | - if($airline == $airline_name['airline_icao']) |
|
47 | + if ($airline == $airline_name['airline_icao']) |
|
48 | 48 | { |
49 | 49 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
50 | 50 | } else { |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | print '</div>'; |
79 | 79 | } else { |
80 | 80 | print '<div class="info column">'; |
81 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
82 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
81 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
82 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
83 | 83 | { |
84 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
84 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
85 | 85 | } |
86 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
86 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
87 | 87 | print '</div>'; |
88 | 88 | } |
89 | 89 | } else { |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | print '<div class="column">'; |
95 | 95 | print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>'; |
96 | 96 | if ($alliance) { |
97 | - print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
97 | + print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
98 | 98 | } else { |
99 | - print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
99 | + print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
100 | 100 | } |
101 | 101 | if ($alliance) { |
102 | - $manufacturers_array = $Spotter->countAllAircraftManufacturerByAirline('',array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline)))); |
|
102 | + $manufacturers_array = $Spotter->countAllAircraftManufacturerByAirline('', array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $airline)))); |
|
103 | 103 | } else { |
104 | 104 | $manufacturers_array = $Spotter->countAllAircraftManufacturerByAirline($airline); |
105 | 105 | } |
106 | - $manufacturers_array = $Stats->countAllAircraftManufacturers(true,$airline); |
|
106 | + $manufacturers_array = $Stats->countAllAircraftManufacturers(true, $airline); |
|
107 | 107 | if (!empty($manufacturers_array)) |
108 | 108 | { |
109 | 109 | print '<div class="table-responsive">'; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | print '</thead>'; |
117 | 117 | print '<tbody>'; |
118 | 118 | $i = 1; |
119 | - foreach($manufacturers_array as $manufacturer_item) |
|
119 | + foreach ($manufacturers_array as $manufacturer_item) |
|
120 | 120 | { |
121 | 121 | print '<tr>'; |
122 | 122 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $Spotter = new Spotter(); |
8 | 8 | $orderby = $Spotter->getOrderBy(); |
9 | 9 | |
10 | -$ask = filter_input(INPUT_GET,'ask',FILTER_SANITIZE_STRING); |
|
10 | +$ask = filter_input(INPUT_GET, 'ask', FILTER_SANITIZE_STRING); |
|
11 | 11 | if ($ask == 'aircraftsdetected') { |
12 | 12 | require_once('require/class.SpotterLive.php'); |
13 | 13 | $SpotterLive = new SpotterLive(); |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | $manufacturers = $Stats->getAllManufacturers(); |
28 | 28 | if (empty($manufacturers)) $manufacturers = $Spotter->getAllManufacturers(); |
29 | 29 | $all_manufacturers = array(); |
30 | - foreach($manufacturers as $manufacturer) |
|
30 | + foreach ($manufacturers as $manufacturer) |
|
31 | 31 | { |
32 | - $all_manufacturers[] = array('value' => $manufacturer['aircraft_manufacturer'], 'id' => strtolower(str_replace(' ','-',$manufacturer['aircraft_manufacturer']))); |
|
32 | + $all_manufacturers[] = array('value' => $manufacturer['aircraft_manufacturer'], 'id' => strtolower(str_replace(' ', '-', $manufacturer['aircraft_manufacturer']))); |
|
33 | 33 | } |
34 | 34 | echo json_encode($all_manufacturers); |
35 | 35 | } elseif ($ask == 'aircrafttypes') { |
36 | 36 | $aircraft_types = $Stats->getAllAircraftTypes(); |
37 | 37 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
38 | 38 | $all_aircraft_types = array(); |
39 | - foreach($aircraft_types as $aircraft_type) |
|
39 | + foreach ($aircraft_types as $aircraft_type) |
|
40 | 40 | { |
41 | 41 | $all_aircraft_types[] = array('id' => $aircraft_type['aircraft_icao'], 'value' => $aircraft_type['aircraft_name'].' ('.$aircraft_type['aircraft_icao'].')'); |
42 | 42 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } elseif ($ask == 'airlinenames') { |
45 | 45 | $airline_names = $Stats->getAllAirlineNames(); |
46 | 46 | $all_airline_names = array(); |
47 | - foreach($airline_names as $airline_name) |
|
47 | + foreach ($airline_names as $airline_name) |
|
48 | 48 | { |
49 | 49 | $all_airline_names[] = array('id' => $airline_name['airline_icao'], 'value' => $airline_name['airline_name'].' ('.$airline_name['airline_icao'].')'); |
50 | 50 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } elseif ($ask == 'airlinecountries') { |
53 | 53 | $airline_countries = $Spotter->getAllAirlineCountries(); |
54 | 54 | $all_airline_countries = array(); |
55 | - foreach($airline_countries as $airline_country) |
|
55 | + foreach ($airline_countries as $airline_country) |
|
56 | 56 | { |
57 | 57 | $all_airline_countries[] = array('id' => $airline_country['airline_country'], 'value' => $airline_country['airline_country']); |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
63 | 63 | ksort($airport_names); |
64 | 64 | $all_airport_names = array(); |
65 | - foreach($airport_names as $airport_name) |
|
65 | + foreach ($airport_names as $airport_name) |
|
66 | 66 | { |
67 | 67 | $all_airport_names[] = array('id' => $airport_name['airport_icao'], 'value' => $airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')'); |
68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } elseif ($ask == 'airportcountries') { |
71 | 71 | $airport_countries = $Spotter->getAllAirportCountries(); |
72 | 72 | $all_airport_countries = array(); |
73 | - foreach($airport_countries as $airport_country) |
|
73 | + foreach ($airport_countries as $airport_country) |
|
74 | 74 | { |
75 | 75 | $all_airport_countries[] = array('id' => $airport_country['airport_country'], 'value' => $airport_country['airport_country']); |
76 | 76 | } |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | echo json_encode($marinecnt); |
26 | 26 | } elseif ($ask == 'manufacturer') { |
27 | 27 | $manufacturers = $Stats->getAllManufacturers(); |
28 | - if (empty($manufacturers)) $manufacturers = $Spotter->getAllManufacturers(); |
|
28 | + if (empty($manufacturers)) { |
|
29 | + $manufacturers = $Spotter->getAllManufacturers(); |
|
30 | + } |
|
29 | 31 | $all_manufacturers = array(); |
30 | 32 | foreach($manufacturers as $manufacturer) |
31 | 33 | { |
@@ -34,7 +36,9 @@ discard block |
||
34 | 36 | echo json_encode($all_manufacturers); |
35 | 37 | } elseif ($ask == 'aircrafttypes') { |
36 | 38 | $aircraft_types = $Stats->getAllAircraftTypes(); |
37 | - if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
39 | + if (empty($aircraft_types)) { |
|
40 | + $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
41 | + } |
|
38 | 42 | $all_aircraft_types = array(); |
39 | 43 | foreach($aircraft_types as $aircraft_type) |
40 | 44 | { |
@@ -59,7 +63,9 @@ discard block |
||
59 | 63 | echo json_encode($all_airline_countries); |
60 | 64 | } elseif ($ask == 'airportnames' || $ask == 'departureairportnames' || $ask == 'arrivalairportnames') { |
61 | 65 | $airport_names = $Stats->getAllAirportNames(); |
62 | - if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
|
66 | + if (empty($airport_names)) { |
|
67 | + $airport_names = $Spotter->getAllAirportNames(); |
|
68 | + } |
|
63 | 69 | ksort($airport_names); |
64 | 70 | $all_airport_names = array(); |
65 | 71 | foreach($airport_names as $airport_name) |
@@ -16,24 +16,24 @@ discard block |
||
16 | 16 | $sql_date = ''; |
17 | 17 | if (isset($_GET['start_date'])) { |
18 | 18 | //for the date manipulation into the query |
19 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
19 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
20 | 20 | if (strtotime($_GET['start_date']) !== false && strtotime($_GET['end_date']) !== false) { |
21 | 21 | //$start_date = $_GET['start_date']." 00:00:00"; |
22 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
22 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
23 | 23 | //$end_date = $_GET['end_date']." 00:00:00"; |
24 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
24 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
25 | 25 | $sql_date = $start_date.",".$end_date; |
26 | 26 | } |
27 | - } else if($_GET['start_date'] != ""){ |
|
27 | + } else if ($_GET['start_date'] != "") { |
|
28 | 28 | if (strtotime($_GET['start_date']) !== false) { |
29 | 29 | //$start_date = $_GET['start_date']." 00:00:00"; |
30 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
30 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
31 | 31 | $sql_date = $start_date; |
32 | 32 | } |
33 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
33 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
34 | 34 | if (strtotime($_GET['end_date']) !== false) { |
35 | 35 | //$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00"; |
36 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
36 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
37 | 37 | $sql_date = $end_date; |
38 | 38 | } |
39 | 39 | } else $sql_date = ''; |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | |
42 | 42 | if (isset($_GET['highest_altitude'])) { |
43 | 43 | //for altitude manipulation |
44 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
45 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
46 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
44 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
45 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
46 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | $sql_altitude = $start_altitude.",".$end_altitude; |
48 | - } else if($_GET['highest_altitude'] != ""){ |
|
49 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
48 | + } else if ($_GET['highest_altitude'] != "") { |
|
49 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
50 | 50 | $sql_altitude = $end_altitude; |
51 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
52 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
51 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
52 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
53 | 53 | $sql_altitude = $start_altitude; |
54 | 54 | } else $sql_altitude = ''; |
55 | 55 | } else $sql_altitude = ''; |
56 | 56 | |
57 | 57 | //calculuation for the pagination |
58 | -if(!isset($_GET['limit'])) |
|
58 | +if (!isset($_GET['limit'])) |
|
59 | 59 | { |
60 | 60 | if (!isset($_GET['number_results'])) |
61 | 61 | { |
@@ -63,45 +63,45 @@ discard block |
||
63 | 63 | $limit_end = 25; |
64 | 64 | $absolute_difference = 25; |
65 | 65 | } else { |
66 | - if ($_GET['number_results'] > 1000){ |
|
66 | + if ($_GET['number_results'] > 1000) { |
|
67 | 67 | $_GET['number_results'] = 1000; |
68 | 68 | } |
69 | 69 | $limit_start = 0; |
70 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
71 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
70 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
71 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
72 | 72 | } |
73 | -} else { |
|
73 | +} else { |
|
74 | 74 | $limit_explode = explode(",", $_GET['limit']); |
75 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
76 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
75 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
76 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
77 | 77 | } |
78 | 78 | $absolute_difference = abs($limit_start - $limit_end); |
79 | 79 | $limit_next = $limit_end + $absolute_difference; |
80 | 80 | $limit_previous_1 = $limit_start - $absolute_difference; |
81 | 81 | $limit_previous_2 = $limit_end - $absolute_difference; |
82 | 82 | |
83 | -if (!empty($_GET)){ |
|
84 | - $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
|
85 | - $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
|
86 | - $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
|
87 | - $manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING); |
|
88 | - $highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING); |
|
89 | - $airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING); |
|
90 | - $airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING); |
|
91 | - $airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING); |
|
92 | - $airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING); |
|
93 | - $airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING); |
|
94 | - $callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING); |
|
95 | - $owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING); |
|
96 | - $pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING); |
|
97 | - $pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING); |
|
98 | - $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING); |
|
99 | - $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
100 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
101 | - $archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT); |
|
102 | - $origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_NUMBER_FLOAT); |
|
103 | - $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_NUMBER_FLOAT); |
|
104 | - $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
|
83 | +if (!empty($_GET)) { |
|
84 | + $q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
85 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
86 | + $aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
87 | + $manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
88 | + $highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
89 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
90 | + $airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
91 | + $airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
92 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
93 | + $airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
94 | + $callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
95 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
96 | + $pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
97 | + $pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
98 | + $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
99 | + $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
100 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
101 | + $archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT); |
|
102 | + $origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_NUMBER_FLOAT); |
|
103 | + $origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_NUMBER_FLOAT); |
|
104 | + $dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT); |
|
105 | 105 | if ($dist != '') { |
106 | 106 | if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
107 | 107 | elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | if (!isset($sql_date)) $sql_date = ''; |
110 | 110 | if ($archive == 1) { |
111 | 111 | $SpotterArchive = new SpotterArchive(); |
112 | - $spotter_array = $SpotterArchive->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,'',$origlat,$origlon,$dist); |
|
112 | + $spotter_array = $SpotterArchive->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, '', $origlat, $origlon, $dist); |
|
113 | 113 | } else { |
114 | - $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,'',$origlat,$origlon,$dist); |
|
114 | + $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, '', $origlat, $origlon, $dist); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | print '<span class="sub-menu-statistic column mobile">'; |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | //remove 3D=true parameter |
145 | 145 | $no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']); |
146 | 146 | $kmlURL = str_replace("http://", "kml://", $globalURL); |
147 | - if (!isset($_GET['3D'])){ |
|
147 | + if (!isset($_GET['3D'])) { |
|
148 | 148 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>'; |
149 | 149 | } else { |
150 | 150 | print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>'; |
151 | 151 | } |
152 | - if (isset($_GET['3D'])){ |
|
152 | + if (isset($_GET['3D'])) { |
|
153 | 153 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>'; |
154 | 154 | } else { |
155 | 155 | print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>'; |
@@ -170,30 +170,30 @@ discard block |
||
170 | 170 | print '<div class="column">'; |
171 | 171 | print '<div class="info">'; |
172 | 172 | print '<h1>'._("Search Results for").' '; |
173 | - if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$q.'</span> '; } |
|
174 | - if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
175 | - if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
176 | - if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
|
177 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
178 | - if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
|
179 | - if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
180 | - if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
181 | - if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$airport.'</span> '; } |
|
182 | - if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
183 | - if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
184 | - if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$owner.'</span> '; } |
|
185 | - if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
186 | - if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
187 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
188 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
189 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
190 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
191 | - if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
192 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
193 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
194 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
195 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
196 | - if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
173 | + if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$q.'</span> '; } |
|
174 | + if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
175 | + if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
176 | + if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$registration.'</span> '; } |
|
177 | + if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
178 | + if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$airline.'</span> '; } |
|
179 | + if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
180 | + if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
181 | + if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$airport.'</span> '; } |
|
182 | + if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
183 | + if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
184 | + if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$owner.'</span> '; } |
|
185 | + if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
186 | + if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
187 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
188 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
189 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
190 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
191 | + if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
192 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
193 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
194 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
195 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
196 | + if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
197 | 197 | print '</h1>'; |
198 | 198 | print '</div>'; |
199 | 199 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | </select> |
301 | 301 | </div> |
302 | 302 | </div> |
303 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
303 | + <script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
304 | 304 | <div class="form-group"> |
305 | 305 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
306 | 306 | <div class="col-sm-10"> |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | </select> |
310 | 310 | </div> |
311 | 311 | </div> |
312 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
312 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
313 | 313 | <div class="form-group"> |
314 | 314 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
315 | 315 | <div class="col-sm-10"> |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | </div> |
333 | 333 | </div> |
334 | 334 | <?php |
335 | -}else { |
|
335 | +} else { |
|
336 | 336 | ?> |
337 | 337 | <div class="form-group"> |
338 | 338 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | ?> |
346 | 346 | <div class="form-group"> |
347 | 347 | <div class="col-sm-offset-2 col-sm-10"> |
348 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
349 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
348 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
349 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
350 | 350 | </div> |
351 | 351 | </div> |
352 | 352 | </fieldset> |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | </select> |
361 | 361 | </div> |
362 | 362 | </div> |
363 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
363 | + <script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $airline; ?>');</script> |
|
364 | 364 | <div class="form-group"> |
365 | 365 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
366 | 366 | <div class="col-sm-10"> |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | </select> |
370 | 370 | </div> |
371 | 371 | </div> |
372 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
372 | + <script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
373 | 373 | <div class="form-group"> |
374 | 374 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
375 | 375 | <div class="col-sm-10"> |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | </div> |
379 | 379 | <div class="form-group"> |
380 | 380 | <div class="col-sm-offset-2 col-sm-10"> |
381 | - <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
382 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
383 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
384 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
381 | + <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
382 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
383 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
384 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
385 | 385 | </div> |
386 | 386 | </div> |
387 | 387 | </fieldset> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | </select> |
396 | 396 | </div> |
397 | 397 | </div> |
398 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
398 | + <script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
399 | 399 | <div class="form-group"> |
400 | 400 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
401 | 401 | <div class="col-sm-10"> |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | </select> |
405 | 405 | </div> |
406 | 406 | </div> |
407 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
407 | + <script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
408 | 408 | </fieldset> |
409 | 409 | <fieldset> |
410 | 410 | <legend><?php echo _("Route"); ?></legend> |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | </select> |
417 | 417 | </div> |
418 | 418 | </div> |
419 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
419 | + <script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
420 | 420 | <div class="form-group"> |
421 | 421 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
422 | 422 | <div class="col-sm-10"> |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | </select> |
426 | 426 | </div> |
427 | 427 | </div> |
428 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
428 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
429 | 429 | </fieldset> |
430 | 430 | <fieldset> |
431 | 431 | <legend><?php echo _("Date"); ?></legend> |
@@ -479,9 +479,9 @@ discard block |
||
479 | 479 | <option></option> |
480 | 480 | <?php |
481 | 481 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
482 | -foreach($altitude_array as $altitude) |
|
482 | +foreach ($altitude_array as $altitude) |
|
483 | 483 | { |
484 | - if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
484 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
485 | 485 | { |
486 | 486 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
487 | 487 | } else { |
@@ -499,9 +499,9 @@ discard block |
||
499 | 499 | <option></option> |
500 | 500 | <?php |
501 | 501 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
502 | -foreach($altitude_array as $altitude) |
|
502 | +foreach ($altitude_array as $altitude) |
|
503 | 503 | { |
504 | - if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
504 | + if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
505 | 505 | { |
506 | 506 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
507 | 507 | } else { |
@@ -540,10 +540,10 @@ discard block |
||
540 | 540 | <div class="col-sm-10"> |
541 | 541 | <select class="form-control" name="number_results"> |
542 | 542 | <?php |
543 | -$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
544 | -foreach($number_results_array as $number) |
|
543 | +$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
544 | +foreach ($number_results_array as $number) |
|
545 | 545 | { |
546 | - if(isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
546 | + if (isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
547 | 547 | { |
548 | 548 | print '<option value="'.$number.'" selected="selected">'.$number.'</option>'; |
549 | 549 | } else { |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | <fieldset> |
562 | 562 | <div class="form-group"> |
563 | 563 | <div class="col-sm-offset-2 col-sm-10"> |
564 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
564 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
565 | 565 | </div> |
566 | 566 | </div> |
567 | 567 | </fieldset> |
@@ -36,8 +36,10 @@ discard block |
||
36 | 36 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
37 | 37 | $sql_date = $end_date; |
38 | 38 | } |
39 | - } else $sql_date = ''; |
|
40 | -} |
|
39 | + } else { |
|
40 | + $sql_date = ''; |
|
41 | + } |
|
42 | + } |
|
41 | 43 | |
42 | 44 | if (isset($_GET['highest_altitude'])) { |
43 | 45 | //for altitude manipulation |
@@ -51,8 +53,12 @@ discard block |
||
51 | 53 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
52 | 54 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
53 | 55 | $sql_altitude = $start_altitude; |
54 | - } else $sql_altitude = ''; |
|
55 | -} else $sql_altitude = ''; |
|
56 | + } else { |
|
57 | + $sql_altitude = ''; |
|
58 | + } |
|
59 | + } else { |
|
60 | + $sql_altitude = ''; |
|
61 | +} |
|
56 | 62 | |
57 | 63 | //calculuation for the pagination |
58 | 64 | if(!isset($_GET['limit'])) |
@@ -70,7 +76,7 @@ discard block |
||
70 | 76 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
71 | 77 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
72 | 78 | } |
73 | -} else { |
|
79 | +} else { |
|
74 | 80 | $limit_explode = explode(",", $_GET['limit']); |
75 | 81 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
76 | 82 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -103,10 +109,15 @@ discard block |
||
103 | 109 | $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_NUMBER_FLOAT); |
104 | 110 | $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
105 | 111 | if ($dist != '') { |
106 | - if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
|
107 | - elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
|
112 | + if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') { |
|
113 | + $dist = $dist*1.60934; |
|
114 | + } elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') { |
|
115 | + $dist = $dist*1.852; |
|
116 | + } |
|
117 | + } |
|
118 | + if (!isset($sql_date)) { |
|
119 | + $sql_date = ''; |
|
108 | 120 | } |
109 | - if (!isset($sql_date)) $sql_date = ''; |
|
110 | 121 | if ($archive == 1) { |
111 | 122 | $SpotterArchive = new SpotterArchive(); |
112 | 123 | $spotter_array = $SpotterArchive->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,'',$origlat,$origlon,$dist); |
@@ -174,7 +185,10 @@ discard block |
||
174 | 185 | if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
175 | 186 | if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
176 | 187 | if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
177 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
188 | + if (isset($_GET['highlights'])) { |
|
189 | + if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; |
|
190 | + } |
|
191 | + } |
|
178 | 192 | if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
179 | 193 | if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
180 | 194 | if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
@@ -285,7 +299,10 @@ discard block |
||
285 | 299 | <div class="form-group"> |
286 | 300 | <label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label> |
287 | 301 | <div class="col-sm-10"> |
288 | - <input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" /> |
|
302 | + <input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) { |
|
303 | + print $q; |
|
304 | +} |
|
305 | +?>" size="10" placeholder="<?php echo _("Keywords"); ?>" /> |
|
289 | 306 | </div> |
290 | 307 | </div> |
291 | 308 | </fieldset> |
@@ -300,7 +317,10 @@ discard block |
||
300 | 317 | </select> |
301 | 318 | </div> |
302 | 319 | </div> |
303 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
320 | + <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) { |
|
321 | + print $manufacturer; |
|
322 | +} |
|
323 | +?>')</script> |
|
304 | 324 | <div class="form-group"> |
305 | 325 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
306 | 326 | <div class="col-sm-10"> |
@@ -309,11 +329,17 @@ discard block |
||
309 | 329 | </select> |
310 | 330 | </div> |
311 | 331 | </div> |
312 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
332 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) { |
|
333 | + print $aircraft_icao; |
|
334 | +} |
|
335 | +?>');</script> |
|
313 | 336 | <div class="form-group"> |
314 | 337 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
315 | 338 | <div class="col-sm-10"> |
316 | - <input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" /> |
|
339 | + <input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) { |
|
340 | + print $registration; |
|
341 | +} |
|
342 | +?>" size="8" placeholder="<?php echo _("Registration"); ?>" /> |
|
317 | 343 | </div> |
318 | 344 | </div> |
319 | 345 | <?php |
@@ -322,22 +348,31 @@ discard block |
||
322 | 348 | <div class="form-group"> |
323 | 349 | <label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> |
324 | 350 | <div class="col-sm-10"> |
325 | - <input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" /> |
|
351 | + <input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) { |
|
352 | + print $pilot_id; |
|
353 | +} |
|
354 | +?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" /> |
|
326 | 355 | </div> |
327 | 356 | </div> |
328 | 357 | <div class="form-group"> |
329 | 358 | <label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> |
330 | 359 | <div class="col-sm-10"> |
331 | - <input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" /> |
|
360 | + <input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) { |
|
361 | + print $pilot_name; |
|
362 | +} |
|
363 | +?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" /> |
|
332 | 364 | </div> |
333 | 365 | </div> |
334 | 366 | <?php |
335 | -}else { |
|
367 | +} else { |
|
336 | 368 | ?> |
337 | 369 | <div class="form-group"> |
338 | 370 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
339 | 371 | <div class="col-sm-10"> |
340 | - <input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" /> |
|
372 | + <input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) { |
|
373 | + print $owner; |
|
374 | +} |
|
375 | +?>" size="15" placeholder="<?php echo _("Owner name"); ?>" /> |
|
341 | 376 | </div> |
342 | 377 | </div> |
343 | 378 | <?php |
@@ -345,8 +380,14 @@ discard block |
||
345 | 380 | ?> |
346 | 381 | <div class="form-group"> |
347 | 382 | <div class="col-sm-offset-2 col-sm-10"> |
348 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
349 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
383 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) { |
|
384 | + if ($_GET['highlights'] == "true"){ print 'checked="checked"'; |
|
385 | +} |
|
386 | +} ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
387 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) { |
|
388 | + if ($_GET['highlights'] == "true"){ print 'checked="checked"'; |
|
389 | +} |
|
390 | +} ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
350 | 391 | </div> |
351 | 392 | </div> |
352 | 393 | </fieldset> |
@@ -360,7 +401,10 @@ discard block |
||
360 | 401 | </select> |
361 | 402 | </div> |
362 | 403 | </div> |
363 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
404 | + <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) { |
|
405 | + print $airline; |
|
406 | +} |
|
407 | +?>');</script> |
|
364 | 408 | <div class="form-group"> |
365 | 409 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
366 | 410 | <div class="col-sm-10"> |
@@ -369,19 +413,34 @@ discard block |
||
369 | 413 | </select> |
370 | 414 | </div> |
371 | 415 | </div> |
372 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
416 | + <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) { |
|
417 | + print $airline_country; |
|
418 | +} |
|
419 | +?>');</script> |
|
373 | 420 | <div class="form-group"> |
374 | 421 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
375 | 422 | <div class="col-sm-10"> |
376 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
423 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
424 | + print $callsign; |
|
425 | +} |
|
426 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
377 | 427 | </div> |
378 | 428 | </div> |
379 | 429 | <div class="form-group"> |
380 | 430 | <div class="col-sm-offset-2 col-sm-10"> |
381 | 431 | <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
382 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
383 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
384 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
432 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) { |
|
433 | + if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; |
|
434 | +} |
|
435 | +} ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
436 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) { |
|
437 | + if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; |
|
438 | +} |
|
439 | +} ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
440 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) { |
|
441 | + if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; |
|
442 | +} |
|
443 | +} ?>> <?php echo _("Only Military airlines"); ?></label> |
|
385 | 444 | </div> |
386 | 445 | </div> |
387 | 446 | </fieldset> |
@@ -395,7 +454,10 @@ discard block |
||
395 | 454 | </select> |
396 | 455 | </div> |
397 | 456 | </div> |
398 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
457 | + <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) { |
|
458 | + print $airport_icao; |
|
459 | +} |
|
460 | +?>');</script> |
|
399 | 461 | <div class="form-group"> |
400 | 462 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
401 | 463 | <div class="col-sm-10"> |
@@ -404,7 +466,10 @@ discard block |
||
404 | 466 | </select> |
405 | 467 | </div> |
406 | 468 | </div> |
407 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
469 | + <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) { |
|
470 | + print $airport_country; |
|
471 | +} |
|
472 | +?>');</script> |
|
408 | 473 | </fieldset> |
409 | 474 | <fieldset> |
410 | 475 | <legend><?php echo _("Route"); ?></legend> |
@@ -416,7 +481,10 @@ discard block |
||
416 | 481 | </select> |
417 | 482 | </div> |
418 | 483 | </div> |
419 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
484 | + <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) { |
|
485 | + print $departure_airport_route; |
|
486 | +} |
|
487 | +?>');</script> |
|
420 | 488 | <div class="form-group"> |
421 | 489 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
422 | 490 | <div class="col-sm-10"> |
@@ -425,7 +493,10 @@ discard block |
||
425 | 493 | </select> |
426 | 494 | </div> |
427 | 495 | </div> |
428 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
496 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) { |
|
497 | + print $arrival_airport_route; |
|
498 | +} |
|
499 | +?>');</script> |
|
429 | 500 | </fieldset> |
430 | 501 | <fieldset> |
431 | 502 | <legend><?php echo _("Date"); ?></legend> |
@@ -433,7 +504,10 @@ discard block |
||
433 | 504 | <label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label> |
434 | 505 | <div class="col-sm-10"> |
435 | 506 | <div class='input-group date' id='datetimepicker1'> |
436 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date'])) print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" /> |
|
507 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date'])) { |
|
508 | + print $start_date; |
|
509 | +} |
|
510 | +?>" placeholder="<?php echo _("Start Date/Time"); ?>" /> |
|
437 | 511 | <span class="input-group-addon"> |
438 | 512 | <span class="glyphicon glyphicon-calendar"></span> |
439 | 513 | </span> |
@@ -444,7 +518,10 @@ discard block |
||
444 | 518 | <label class="control-label col-sm-2"><?php echo _("End Date"); ?></label> |
445 | 519 | <div class="col-sm-10"> |
446 | 520 | <div class='input-group date' id='datetimepicker2'> |
447 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date'])) print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" /> |
|
521 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date'])) { |
|
522 | + print $end_date; |
|
523 | +} |
|
524 | +?>" placeholder="<?php echo _("End Date/Time"); ?>" /> |
|
448 | 525 | <span class="input-group-addon"> |
449 | 526 | <span class="glyphicon glyphicon-calendar"></span> |
450 | 527 | </span> |
@@ -517,19 +594,33 @@ discard block |
||
517 | 594 | <div class="form-group"> |
518 | 595 | <label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label> |
519 | 596 | <div class="col-sm-10"> |
520 | - <input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" /> |
|
597 | + <input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) { |
|
598 | + print $origlat; |
|
599 | +} |
|
600 | +?>" /> |
|
521 | 601 | </div> |
522 | 602 | </div> |
523 | 603 | <div class="form-group"> |
524 | 604 | <label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label> |
525 | 605 | <div class="col-sm-10"> |
526 | - <input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" /> |
|
606 | + <input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) { |
|
607 | + print $origlon; |
|
608 | +} |
|
609 | +?>" /> |
|
527 | 610 | </div> |
528 | 611 | </div> |
529 | 612 | <div class="form-group"> |
530 | - <label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label> |
|
613 | + <label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) { |
|
614 | + print $globalDistanceUnit; |
|
615 | +} else { |
|
616 | + print 'km'; |
|
617 | +} |
|
618 | +print ')'; ?></label> |
|
531 | 619 | <div class="col-sm-10"> |
532 | - <input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" /> |
|
620 | + <input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) { |
|
621 | + print $distance; |
|
622 | +} |
|
623 | +?>" /> |
|
533 | 624 | </div> |
534 | 625 | </div> |
535 | 626 | </fieldset> |
@@ -10,6 +10,9 @@ discard block |
||
10 | 10 | class update_db { |
11 | 11 | public static $db_sqlite; |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $file |
|
15 | + */ |
|
13 | 16 | public static function download($url, $file, $referer = '') { |
14 | 17 | //$file = str_replace('/',DIRECTORY_SEPARATOR,$file); |
15 | 18 | $fp = fopen($file, 'w+'); |
@@ -25,6 +28,9 @@ discard block |
||
25 | 28 | fclose($fp); |
26 | 29 | } |
27 | 30 | |
31 | + /** |
|
32 | + * @param string $in_file |
|
33 | + */ |
|
28 | 34 | public static function gunzip($in_file,$out_file_name = '') { |
29 | 35 | //echo $in_file.' -> '.$out_file_name."\n"; |
30 | 36 | $buffer_size = 4096; // read 4kb at a time |
@@ -46,6 +52,9 @@ discard block |
||
46 | 52 | } |
47 | 53 | } |
48 | 54 | |
55 | + /** |
|
56 | + * @param string $in_file |
|
57 | + */ |
|
49 | 58 | public static function unzip($in_file) { |
50 | 59 | if ($in_file != '' && file_exists($in_file)) { |
51 | 60 | $path = pathinfo(realpath($in_file), PATHINFO_DIRNAME); |
@@ -67,6 +76,9 @@ discard block |
||
67 | 76 | } |
68 | 77 | } |
69 | 78 | |
79 | + /** |
|
80 | + * @param string $database_file |
|
81 | + */ |
|
70 | 82 | public static function retrieve_route_sqlite_to_dest($database_file) { |
71 | 83 | global $globalDebug, $globalTransaction; |
72 | 84 | //$query = 'TRUNCATE TABLE routes'; |
@@ -109,6 +121,10 @@ discard block |
||
109 | 121 | } |
110 | 122 | return ''; |
111 | 123 | } |
124 | + |
|
125 | + /** |
|
126 | + * @param string $database_file |
|
127 | + */ |
|
112 | 128 | public static function retrieve_route_oneworld($database_file) { |
113 | 129 | global $globalDebug, $globalTransaction; |
114 | 130 | //$query = 'TRUNCATE TABLE routes'; |
@@ -150,6 +166,9 @@ discard block |
||
150 | 166 | return ''; |
151 | 167 | } |
152 | 168 | |
169 | + /** |
|
170 | + * @param string $database_file |
|
171 | + */ |
|
153 | 172 | public static function retrieve_route_skyteam($database_file) { |
154 | 173 | global $globalDebug, $globalTransaction; |
155 | 174 | //$query = 'TRUNCATE TABLE routes'; |
@@ -192,6 +211,10 @@ discard block |
||
192 | 211 | } |
193 | 212 | return ''; |
194 | 213 | } |
214 | + |
|
215 | + /** |
|
216 | + * @param string $database_file |
|
217 | + */ |
|
195 | 218 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
196 | 219 | global $globalTransaction; |
197 | 220 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -258,6 +281,9 @@ discard block |
||
258 | 281 | return ''; |
259 | 282 | } |
260 | 283 | |
284 | + /** |
|
285 | + * @param string $database_file |
|
286 | + */ |
|
261 | 287 | public static function retrieve_modes_flarmnet($database_file) { |
262 | 288 | global $globalTransaction; |
263 | 289 | $Common = new Common(); |
@@ -328,6 +354,9 @@ discard block |
||
328 | 354 | return ''; |
329 | 355 | } |
330 | 356 | |
357 | + /** |
|
358 | + * @param string $database_file |
|
359 | + */ |
|
331 | 360 | public static function retrieve_modes_ogn($database_file) { |
332 | 361 | global $globalTransaction; |
333 | 362 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -397,6 +426,9 @@ discard block |
||
397 | 426 | return ''; |
398 | 427 | } |
399 | 428 | |
429 | + /** |
|
430 | + * @param string $database_file |
|
431 | + */ |
|
400 | 432 | public static function retrieve_owner($database_file,$country = 'F') { |
401 | 433 | global $globalTransaction, $globalMasterSource; |
402 | 434 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -1332,6 +1364,10 @@ discard block |
||
1332 | 1364 | return ''; |
1333 | 1365 | } |
1334 | 1366 | |
1367 | + /** |
|
1368 | + * @param string $filename |
|
1369 | + * @param string $tletype |
|
1370 | + */ |
|
1335 | 1371 | public static function tle($filename,$tletype) { |
1336 | 1372 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1337 | 1373 | global $tmp_dir, $globalTransaction; |
@@ -1381,6 +1417,9 @@ discard block |
||
1381 | 1417 | return ''; |
1382 | 1418 | } |
1383 | 1419 | |
1420 | + /** |
|
1421 | + * @param string $filename |
|
1422 | + */ |
|
1384 | 1423 | public static function satellite_ucsdb($filename) { |
1385 | 1424 | global $tmp_dir, $globalTransaction; |
1386 | 1425 | $query = "DELETE FROM satellite"; |
@@ -1428,6 +1467,9 @@ discard block |
||
1428 | 1467 | return ''; |
1429 | 1468 | } |
1430 | 1469 | |
1470 | + /** |
|
1471 | + * @param string $filename |
|
1472 | + */ |
|
1431 | 1473 | public static function satellite_celestrak($filename) { |
1432 | 1474 | global $tmp_dir, $globalTransaction; |
1433 | 1475 | $satcat_sources = array( |
@@ -1743,6 +1785,9 @@ discard block |
||
1743 | 1785 | |
1744 | 1786 | } |
1745 | 1787 | */ |
1788 | + /** |
|
1789 | + * @param string $filename |
|
1790 | + */ |
|
1746 | 1791 | public static function waypoints($filename) { |
1747 | 1792 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1748 | 1793 | global $tmp_dir, $globalTransaction; |
@@ -1790,6 +1835,9 @@ discard block |
||
1790 | 1835 | return ''; |
1791 | 1836 | } |
1792 | 1837 | |
1838 | + /** |
|
1839 | + * @param string $filename |
|
1840 | + */ |
|
1793 | 1841 | public static function ivao_airlines($filename) { |
1794 | 1842 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1795 | 1843 | global $tmp_dir, $globalTransaction; |
@@ -76,38 +76,38 @@ discard block |
||
76 | 76 | try { |
77 | 77 | //$Connection = new Connection(); |
78 | 78 | $sth = $Connection->db->prepare($query); |
79 | - $sth->execute(array(':source' => $database_file)); |
|
80 | - } catch(PDOException $e) { |
|
81 | - return "error : ".$e->getMessage(); |
|
82 | - } |
|
79 | + $sth->execute(array(':source' => $database_file)); |
|
80 | + } catch(PDOException $e) { |
|
81 | + return "error : ".$e->getMessage(); |
|
82 | + } |
|
83 | 83 | |
84 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
85 | - update_db::connect_sqlite($database_file); |
|
84 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
85 | + update_db::connect_sqlite($database_file); |
|
86 | 86 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
87 | 87 | $query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID"; |
88 | 88 | try { |
89 | - $sth = update_db::$db_sqlite->prepare($query); |
|
90 | - $sth->execute(); |
|
91 | - } catch(PDOException $e) { |
|
92 | - return "error : ".$e->getMessage(); |
|
93 | - } |
|
89 | + $sth = update_db::$db_sqlite->prepare($query); |
|
90 | + $sth->execute(); |
|
91 | + } catch(PDOException $e) { |
|
92 | + return "error : ".$e->getMessage(); |
|
93 | + } |
|
94 | 94 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
95 | 95 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
96 | 96 | $Connection = new Connection(); |
97 | 97 | $sth_dest = $Connection->db->prepare($query_dest); |
98 | 98 | try { |
99 | 99 | if ($globalTransaction) $Connection->db->beginTransaction(); |
100 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
100 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
101 | 101 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
102 | 102 | $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
103 | 103 | $sth_dest->execute($query_dest_values); |
104 | - } |
|
104 | + } |
|
105 | 105 | if ($globalTransaction) $Connection->db->commit(); |
106 | 106 | } catch(PDOException $e) { |
107 | 107 | if ($globalTransaction) $Connection->db->rollBack(); |
108 | 108 | return "error : ".$e->getMessage(); |
109 | 109 | } |
110 | - return ''; |
|
110 | + return ''; |
|
111 | 111 | } |
112 | 112 | public static function retrieve_route_oneworld($database_file) { |
113 | 113 | global $globalDebug, $globalTransaction; |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | try { |
119 | 119 | //$Connection = new Connection(); |
120 | 120 | $sth = $Connection->db->prepare($query); |
121 | - $sth->execute(array(':source' => 'oneworld')); |
|
122 | - } catch(PDOException $e) { |
|
123 | - return "error : ".$e->getMessage(); |
|
124 | - } |
|
121 | + $sth->execute(array(':source' => 'oneworld')); |
|
122 | + } catch(PDOException $e) { |
|
123 | + return "error : ".$e->getMessage(); |
|
124 | + } |
|
125 | 125 | |
126 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
126 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
127 | 127 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
128 | 128 | $Spotter = new Spotter(); |
129 | 129 | if ($fh = fopen($database_file,"r")) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | if ($globalTransaction) $Connection->db->commit(); |
149 | 149 | } |
150 | - return ''; |
|
150 | + return ''; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | public static function retrieve_route_skyteam($database_file) { |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | try { |
160 | 160 | //$Connection = new Connection(); |
161 | 161 | $sth = $Connection->db->prepare($query); |
162 | - $sth->execute(array(':source' => 'skyteam')); |
|
163 | - } catch(PDOException $e) { |
|
164 | - return "error : ".$e->getMessage(); |
|
165 | - } |
|
162 | + $sth->execute(array(':source' => 'skyteam')); |
|
163 | + } catch(PDOException $e) { |
|
164 | + return "error : ".$e->getMessage(); |
|
165 | + } |
|
166 | 166 | |
167 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
167 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
168 | 168 | |
169 | 169 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
170 | 170 | $Spotter = new Spotter(); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return "error : ".$e->getMessage(); |
191 | 191 | } |
192 | 192 | } |
193 | - return ''; |
|
193 | + return ''; |
|
194 | 194 | } |
195 | 195 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
196 | 196 | global $globalTransaction; |
@@ -199,27 +199,27 @@ discard block |
||
199 | 199 | try { |
200 | 200 | $Connection = new Connection(); |
201 | 201 | $sth = $Connection->db->prepare($query); |
202 | - $sth->execute(array(':source' => $database_file)); |
|
203 | - } catch(PDOException $e) { |
|
204 | - return "error : ".$e->getMessage(); |
|
205 | - } |
|
202 | + $sth->execute(array(':source' => $database_file)); |
|
203 | + } catch(PDOException $e) { |
|
204 | + return "error : ".$e->getMessage(); |
|
205 | + } |
|
206 | 206 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
207 | 207 | try { |
208 | 208 | $Connection = new Connection(); |
209 | 209 | $sth = $Connection->db->prepare($query); |
210 | - $sth->execute(array(':source' => $database_file)); |
|
211 | - } catch(PDOException $e) { |
|
212 | - return "error : ".$e->getMessage(); |
|
213 | - } |
|
210 | + $sth->execute(array(':source' => $database_file)); |
|
211 | + } catch(PDOException $e) { |
|
212 | + return "error : ".$e->getMessage(); |
|
213 | + } |
|
214 | 214 | |
215 | - update_db::connect_sqlite($database_file); |
|
215 | + update_db::connect_sqlite($database_file); |
|
216 | 216 | $query = 'select * from Aircraft'; |
217 | 217 | try { |
218 | - $sth = update_db::$db_sqlite->prepare($query); |
|
219 | - $sth->execute(); |
|
220 | - } catch(PDOException $e) { |
|
221 | - return "error : ".$e->getMessage(); |
|
222 | - } |
|
218 | + $sth = update_db::$db_sqlite->prepare($query); |
|
219 | + $sth->execute(); |
|
220 | + } catch(PDOException $e) { |
|
221 | + return "error : ".$e->getMessage(); |
|
222 | + } |
|
223 | 223 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
224 | 224 | $query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)'; |
225 | 225 | |
@@ -230,17 +230,17 @@ discard block |
||
230 | 230 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
231 | 231 | try { |
232 | 232 | if ($globalTransaction) $Connection->db->beginTransaction(); |
233 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
233 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
234 | 234 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
235 | 235 | if ($values['UserString4'] == 'M') $type = 'military'; |
236 | 236 | else $type = null; |
237 | 237 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
238 | 238 | $sth_dest->execute($query_dest_values); |
239 | 239 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
240 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
241 | - $sth_dest_owner->execute($query_dest_owner_values); |
|
240 | + $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
241 | + $sth_dest_owner->execute($query_dest_owner_values); |
|
242 | 242 | } |
243 | - } |
|
243 | + } |
|
244 | 244 | if ($globalTransaction) $Connection->db->commit(); |
245 | 245 | } catch(PDOException $e) { |
246 | 246 | return "error : ".$e->getMessage(); |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | try { |
252 | 252 | $Connection = new Connection(); |
253 | 253 | $sth = $Connection->db->prepare($query); |
254 | - $sth->execute(array(':source' => $database_file)); |
|
255 | - } catch(PDOException $e) { |
|
256 | - return "error : ".$e->getMessage(); |
|
257 | - } |
|
254 | + $sth->execute(array(':source' => $database_file)); |
|
255 | + } catch(PDOException $e) { |
|
256 | + return "error : ".$e->getMessage(); |
|
257 | + } |
|
258 | 258 | return ''; |
259 | 259 | } |
260 | 260 | |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | try { |
267 | 267 | $Connection = new Connection(); |
268 | 268 | $sth = $Connection->db->prepare($query); |
269 | - $sth->execute(array(':source' => $database_file)); |
|
270 | - } catch(PDOException $e) { |
|
271 | - return "error : ".$e->getMessage(); |
|
272 | - } |
|
269 | + $sth->execute(array(':source' => $database_file)); |
|
270 | + } catch(PDOException $e) { |
|
271 | + return "error : ".$e->getMessage(); |
|
272 | + } |
|
273 | 273 | |
274 | 274 | if ($fh = fopen($database_file,"r")) { |
275 | 275 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -279,26 +279,26 @@ discard block |
||
279 | 279 | $sth_dest = $Connection->db->prepare($query_dest); |
280 | 280 | try { |
281 | 281 | if ($globalTransaction) $Connection->db->beginTransaction(); |
282 | - while (!feof($fh)) { |
|
283 | - $values = array(); |
|
284 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
282 | + while (!feof($fh)) { |
|
283 | + $values = array(); |
|
284 | + $line = $Common->hex2str(fgets($fh,9999)); |
|
285 | 285 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
286 | - $values['ModeS'] = substr($line,0,6); |
|
287 | - $values['Registration'] = trim(substr($line,69,6)); |
|
288 | - $aircraft_name = trim(substr($line,48,6)); |
|
289 | - // Check if we can find ICAO, else set it to GLID |
|
290 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
291 | - $search_more = ''; |
|
292 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
293 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
294 | - $sth_search = $Connection->db->prepare($query_search); |
|
286 | + $values['ModeS'] = substr($line,0,6); |
|
287 | + $values['Registration'] = trim(substr($line,69,6)); |
|
288 | + $aircraft_name = trim(substr($line,48,6)); |
|
289 | + // Check if we can find ICAO, else set it to GLID |
|
290 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
291 | + $search_more = ''; |
|
292 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
293 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
294 | + $sth_search = $Connection->db->prepare($query_search); |
|
295 | 295 | try { |
296 | - $sth_search->execute(); |
|
297 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
298 | - //if (count($result) > 0) { |
|
299 | - if (isset($result['icao']) && $result['icao'] != '') { |
|
300 | - $values['ICAOTypeCode'] = $result['icao']; |
|
301 | - } |
|
296 | + $sth_search->execute(); |
|
297 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
298 | + //if (count($result) > 0) { |
|
299 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
300 | + $values['ICAOTypeCode'] = $result['icao']; |
|
301 | + } |
|
302 | 302 | } catch(PDOException $e) { |
303 | 303 | return "error : ".$e->getMessage(); |
304 | 304 | } |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | try { |
322 | 322 | $Connection = new Connection(); |
323 | 323 | $sth = $Connection->db->prepare($query); |
324 | - $sth->execute(array(':source' => $database_file)); |
|
325 | - } catch(PDOException $e) { |
|
326 | - return "error : ".$e->getMessage(); |
|
327 | - } |
|
324 | + $sth->execute(array(':source' => $database_file)); |
|
325 | + } catch(PDOException $e) { |
|
326 | + return "error : ".$e->getMessage(); |
|
327 | + } |
|
328 | 328 | return ''; |
329 | 329 | } |
330 | 330 | |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | try { |
336 | 336 | $Connection = new Connection(); |
337 | 337 | $sth = $Connection->db->prepare($query); |
338 | - $sth->execute(array(':source' => $database_file)); |
|
339 | - } catch(PDOException $e) { |
|
340 | - return "error : ".$e->getMessage(); |
|
341 | - } |
|
338 | + $sth->execute(array(':source' => $database_file)); |
|
339 | + } catch(PDOException $e) { |
|
340 | + return "error : ".$e->getMessage(); |
|
341 | + } |
|
342 | 342 | |
343 | 343 | if ($fh = fopen($database_file,"r")) { |
344 | 344 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -349,25 +349,25 @@ discard block |
||
349 | 349 | try { |
350 | 350 | if ($globalTransaction) $Connection->db->beginTransaction(); |
351 | 351 | $tmp = fgetcsv($fh,9999,',',"'"); |
352 | - while (!feof($fh)) { |
|
353 | - $line = fgetcsv($fh,9999,',',"'"); |
|
352 | + while (!feof($fh)) { |
|
353 | + $line = fgetcsv($fh,9999,',',"'"); |
|
354 | 354 | |
355 | 355 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
356 | 356 | //print_r($line); |
357 | - $values['ModeS'] = $line[1]; |
|
358 | - $values['Registration'] = $line[3]; |
|
359 | - $values['ICAOTypeCode'] = ''; |
|
360 | - $aircraft_name = $line[2]; |
|
361 | - // Check if we can find ICAO, else set it to GLID |
|
362 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
363 | - $search_more = ''; |
|
364 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
365 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
366 | - $sth_search = $Connection->db->prepare($query_search); |
|
357 | + $values['ModeS'] = $line[1]; |
|
358 | + $values['Registration'] = $line[3]; |
|
359 | + $values['ICAOTypeCode'] = ''; |
|
360 | + $aircraft_name = $line[2]; |
|
361 | + // Check if we can find ICAO, else set it to GLID |
|
362 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
363 | + $search_more = ''; |
|
364 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
365 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
366 | + $sth_search = $Connection->db->prepare($query_search); |
|
367 | 367 | try { |
368 | - $sth_search->execute(); |
|
369 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
370 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
368 | + $sth_search->execute(); |
|
369 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
370 | + if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
371 | 371 | } catch(PDOException $e) { |
372 | 372 | return "error : ".$e->getMessage(); |
373 | 373 | } |
@@ -390,10 +390,10 @@ discard block |
||
390 | 390 | try { |
391 | 391 | $Connection = new Connection(); |
392 | 392 | $sth = $Connection->db->prepare($query); |
393 | - $sth->execute(array(':source' => $database_file)); |
|
394 | - } catch(PDOException $e) { |
|
395 | - return "error : ".$e->getMessage(); |
|
396 | - } |
|
393 | + $sth->execute(array(':source' => $database_file)); |
|
394 | + } catch(PDOException $e) { |
|
395 | + return "error : ".$e->getMessage(); |
|
396 | + } |
|
397 | 397 | return ''; |
398 | 398 | } |
399 | 399 | |
@@ -404,16 +404,16 @@ discard block |
||
404 | 404 | try { |
405 | 405 | $Connection = new Connection(); |
406 | 406 | $sth = $Connection->db->prepare($query); |
407 | - $sth->execute(array(':source' => $database_file)); |
|
408 | - } catch(PDOException $e) { |
|
409 | - return "error : ".$e->getMessage(); |
|
410 | - } |
|
407 | + $sth->execute(array(':source' => $database_file)); |
|
408 | + } catch(PDOException $e) { |
|
409 | + return "error : ".$e->getMessage(); |
|
410 | + } |
|
411 | 411 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
412 | 412 | $Spotter = new Spotter(); |
413 | 413 | if ($fh = fopen($database_file,"r")) { |
414 | 414 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
415 | 415 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
416 | - $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
416 | + $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
417 | 417 | |
418 | 418 | $Connection = new Connection(); |
419 | 419 | $sth_dest = $Connection->db->prepare($query_dest); |
@@ -421,126 +421,126 @@ discard block |
||
421 | 421 | try { |
422 | 422 | if ($globalTransaction) $Connection->db->beginTransaction(); |
423 | 423 | $tmp = fgetcsv($fh,9999,',','"'); |
424 | - while (!feof($fh)) { |
|
425 | - $line = fgetcsv($fh,9999,',','"'); |
|
426 | - $values = array(); |
|
427 | - //print_r($line); |
|
428 | - if ($country == 'F') { |
|
429 | - $values['registration'] = $line[0]; |
|
430 | - $values['base'] = $line[4]; |
|
431 | - $values['owner'] = $line[5]; |
|
432 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
433 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
434 | - $values['cancel'] = $line[7]; |
|
424 | + while (!feof($fh)) { |
|
425 | + $line = fgetcsv($fh,9999,',','"'); |
|
426 | + $values = array(); |
|
427 | + //print_r($line); |
|
428 | + if ($country == 'F') { |
|
429 | + $values['registration'] = $line[0]; |
|
430 | + $values['base'] = $line[4]; |
|
431 | + $values['owner'] = $line[5]; |
|
432 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
433 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
434 | + $values['cancel'] = $line[7]; |
|
435 | 435 | } elseif ($country == 'EI') { |
436 | - // TODO : add modeS & reg to aircraft_modes |
|
437 | - $values['registration'] = $line[0]; |
|
438 | - $values['base'] = $line[3]; |
|
439 | - $values['owner'] = $line[2]; |
|
440 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
441 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
442 | - $values['cancel'] = ''; |
|
443 | - $values['modes'] = $line[7]; |
|
444 | - $values['icao'] = $line[8]; |
|
436 | + // TODO : add modeS & reg to aircraft_modes |
|
437 | + $values['registration'] = $line[0]; |
|
438 | + $values['base'] = $line[3]; |
|
439 | + $values['owner'] = $line[2]; |
|
440 | + if ($line[1] == '') $values['date_first_reg'] = null; |
|
441 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
442 | + $values['cancel'] = ''; |
|
443 | + $values['modes'] = $line[7]; |
|
444 | + $values['icao'] = $line[8]; |
|
445 | 445 | |
446 | 446 | } elseif ($country == 'HB') { |
447 | - // TODO : add modeS & reg to aircraft_modes |
|
448 | - $values['registration'] = $line[0]; |
|
449 | - $values['base'] = null; |
|
450 | - $values['owner'] = $line[5]; |
|
451 | - $values['date_first_reg'] = null; |
|
452 | - $values['cancel'] = ''; |
|
453 | - $values['modes'] = $line[4]; |
|
454 | - $values['icao'] = $line[7]; |
|
447 | + // TODO : add modeS & reg to aircraft_modes |
|
448 | + $values['registration'] = $line[0]; |
|
449 | + $values['base'] = null; |
|
450 | + $values['owner'] = $line[5]; |
|
451 | + $values['date_first_reg'] = null; |
|
452 | + $values['cancel'] = ''; |
|
453 | + $values['modes'] = $line[4]; |
|
454 | + $values['icao'] = $line[7]; |
|
455 | 455 | } elseif ($country == 'OK') { |
456 | - // TODO : add modeS & reg to aircraft_modes |
|
457 | - $values['registration'] = $line[3]; |
|
458 | - $values['base'] = null; |
|
459 | - $values['owner'] = $line[5]; |
|
460 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
461 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
462 | - $values['cancel'] = ''; |
|
456 | + // TODO : add modeS & reg to aircraft_modes |
|
457 | + $values['registration'] = $line[3]; |
|
458 | + $values['base'] = null; |
|
459 | + $values['owner'] = $line[5]; |
|
460 | + if ($line[18] == '') $values['date_first_reg'] = null; |
|
461 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
462 | + $values['cancel'] = ''; |
|
463 | 463 | } elseif ($country == 'VH') { |
464 | - // TODO : add modeS & reg to aircraft_modes |
|
465 | - $values['registration'] = $line[0]; |
|
466 | - $values['base'] = null; |
|
467 | - $values['owner'] = $line[12]; |
|
468 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
469 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
470 | - |
|
471 | - $values['cancel'] = $line[39]; |
|
464 | + // TODO : add modeS & reg to aircraft_modes |
|
465 | + $values['registration'] = $line[0]; |
|
466 | + $values['base'] = null; |
|
467 | + $values['owner'] = $line[12]; |
|
468 | + if ($line[28] == '') $values['date_first_reg'] = null; |
|
469 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
470 | + |
|
471 | + $values['cancel'] = $line[39]; |
|
472 | 472 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
473 | - $values['registration'] = $line[0]; |
|
474 | - $values['base'] = null; |
|
475 | - $values['owner'] = $line[4]; |
|
476 | - $values['date_first_reg'] = null; |
|
477 | - $values['cancel'] = ''; |
|
473 | + $values['registration'] = $line[0]; |
|
474 | + $values['base'] = null; |
|
475 | + $values['owner'] = $line[4]; |
|
476 | + $values['date_first_reg'] = null; |
|
477 | + $values['cancel'] = ''; |
|
478 | 478 | } elseif ($country == 'CC') { |
479 | - $values['registration'] = $line[0]; |
|
480 | - $values['base'] = null; |
|
481 | - $values['owner'] = $line[6]; |
|
482 | - $values['date_first_reg'] = null; |
|
483 | - $values['cancel'] = ''; |
|
479 | + $values['registration'] = $line[0]; |
|
480 | + $values['base'] = null; |
|
481 | + $values['owner'] = $line[6]; |
|
482 | + $values['date_first_reg'] = null; |
|
483 | + $values['cancel'] = ''; |
|
484 | 484 | } elseif ($country == 'HJ') { |
485 | - $values['registration'] = $line[0]; |
|
486 | - $values['base'] = null; |
|
487 | - $values['owner'] = $line[8]; |
|
488 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
489 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
490 | - $values['cancel'] = ''; |
|
485 | + $values['registration'] = $line[0]; |
|
486 | + $values['base'] = null; |
|
487 | + $values['owner'] = $line[8]; |
|
488 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
489 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
490 | + $values['cancel'] = ''; |
|
491 | 491 | } elseif ($country == 'PP') { |
492 | - $values['registration'] = $line[0]; |
|
493 | - $values['base'] = null; |
|
494 | - $values['owner'] = $line[4]; |
|
495 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
496 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
497 | - $values['cancel'] = $line[7]; |
|
492 | + $values['registration'] = $line[0]; |
|
493 | + $values['base'] = null; |
|
494 | + $values['owner'] = $line[4]; |
|
495 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
496 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
497 | + $values['cancel'] = $line[7]; |
|
498 | 498 | } elseif ($country == 'E7') { |
499 | - $values['registration'] = $line[0]; |
|
500 | - $values['base'] = null; |
|
501 | - $values['owner'] = $line[4]; |
|
502 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
503 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
504 | - $values['cancel'] = ''; |
|
499 | + $values['registration'] = $line[0]; |
|
500 | + $values['base'] = null; |
|
501 | + $values['owner'] = $line[4]; |
|
502 | + if ($line[5] == '') $values['date_first_reg'] = null; |
|
503 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
504 | + $values['cancel'] = ''; |
|
505 | 505 | } elseif ($country == '8Q') { |
506 | - $values['registration'] = $line[0]; |
|
507 | - $values['base'] = null; |
|
508 | - $values['owner'] = $line[3]; |
|
509 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
510 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
511 | - $values['cancel'] = ''; |
|
506 | + $values['registration'] = $line[0]; |
|
507 | + $values['base'] = null; |
|
508 | + $values['owner'] = $line[3]; |
|
509 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
510 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
511 | + $values['cancel'] = ''; |
|
512 | 512 | } elseif ($country == 'ZK') { |
513 | - $values['registration'] = $line[0]; |
|
514 | - $values['base'] = null; |
|
515 | - $values['owner'] = $line[3]; |
|
516 | - $values['date_first_reg'] = null; |
|
517 | - $values['cancel'] = ''; |
|
518 | - $values['modes'] = $line[5]; |
|
519 | - $values['icao'] = $line[9]; |
|
513 | + $values['registration'] = $line[0]; |
|
514 | + $values['base'] = null; |
|
515 | + $values['owner'] = $line[3]; |
|
516 | + $values['date_first_reg'] = null; |
|
517 | + $values['cancel'] = ''; |
|
518 | + $values['modes'] = $line[5]; |
|
519 | + $values['icao'] = $line[9]; |
|
520 | 520 | } elseif ($country == 'M') { |
521 | - $values['registration'] = $line[0]; |
|
522 | - $values['base'] = null; |
|
523 | - $values['owner'] = $line[6]; |
|
524 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
525 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
526 | - $values['modes'] = $line[4]; |
|
527 | - $values['icao'] = $line[10]; |
|
521 | + $values['registration'] = $line[0]; |
|
522 | + $values['base'] = null; |
|
523 | + $values['owner'] = $line[6]; |
|
524 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
525 | + $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
526 | + $values['modes'] = $line[4]; |
|
527 | + $values['icao'] = $line[10]; |
|
528 | 528 | } elseif ($country == 'OY') { |
529 | - $values['registration'] = $line[0]; |
|
530 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
531 | - $values['modes'] = $line[5]; |
|
532 | - $values['icao'] = $line[6]; |
|
529 | + $values['registration'] = $line[0]; |
|
530 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
531 | + $values['modes'] = $line[5]; |
|
532 | + $values['icao'] = $line[6]; |
|
533 | 533 | } elseif ($country == 'PH') { |
534 | - $values['registration'] = $line[0]; |
|
535 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
536 | - $values['modes'] = $line[4]; |
|
537 | - $values['icao'] = $line[5]; |
|
534 | + $values['registration'] = $line[0]; |
|
535 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
536 | + $values['modes'] = $line[4]; |
|
537 | + $values['icao'] = $line[5]; |
|
538 | 538 | } elseif ($country == 'OM' || $country == 'TF') { |
539 | - $values['registration'] = $line[0]; |
|
540 | - $values['base'] = null; |
|
541 | - $values['owner'] = $line[3]; |
|
542 | - $values['date_first_reg'] = null; |
|
543 | - $values['cancel'] = ''; |
|
539 | + $values['registration'] = $line[0]; |
|
540 | + $values['base'] = null; |
|
541 | + $values['owner'] = $line[3]; |
|
542 | + $values['date_first_reg'] = null; |
|
543 | + $values['cancel'] = ''; |
|
544 | 544 | } |
545 | 545 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
546 | 546 | $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | return "error : ".$e->getMessage(); |
674 | 674 | } |
675 | 675 | */ |
676 | - /* |
|
676 | + /* |
|
677 | 677 | $query = 'ALTER TABLE airport DROP INDEX icaoidx'; |
678 | 678 | try { |
679 | 679 | $Connection = new Connection(); |
@@ -918,10 +918,10 @@ discard block |
||
918 | 918 | try { |
919 | 919 | $Connection = new Connection(); |
920 | 920 | $sth = $Connection->db->prepare($query); |
921 | - $sth->execute(array(':source' => 'translation.csv')); |
|
922 | - } catch(PDOException $e) { |
|
923 | - return "error : ".$e->getMessage(); |
|
924 | - } |
|
921 | + $sth->execute(array(':source' => 'translation.csv')); |
|
922 | + } catch(PDOException $e) { |
|
923 | + return "error : ".$e->getMessage(); |
|
924 | + } |
|
925 | 925 | |
926 | 926 | |
927 | 927 | //update_db::unzip($out_file); |
@@ -940,21 +940,21 @@ discard block |
||
940 | 940 | $data = $row; |
941 | 941 | $operator = $data[2]; |
942 | 942 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
943 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
944 | - //echo substr($operator, 0, 2)."\n";; |
|
945 | - if (count($airline_array) > 0) { |
|
943 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
944 | + //echo substr($operator, 0, 2)."\n";; |
|
945 | + if (count($airline_array) > 0) { |
|
946 | 946 | //print_r($airline_array); |
947 | 947 | $operator = $airline_array[0]['icao'].substr($operator,2); |
948 | - } |
|
949 | - } |
|
948 | + } |
|
949 | + } |
|
950 | 950 | |
951 | 951 | $operator_correct = $data[3]; |
952 | 952 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
953 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
954 | - if (count($airline_array) > 0) { |
|
955 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
956 | - } |
|
957 | - } |
|
953 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
954 | + if (count($airline_array) > 0) { |
|
955 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
956 | + } |
|
957 | + } |
|
958 | 958 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
959 | 959 | try { |
960 | 960 | $sth = $Connection->db->prepare($query); |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | //$Connection->db->commit(); |
969 | 969 | } |
970 | 970 | return ''; |
971 | - } |
|
971 | + } |
|
972 | 972 | |
973 | 973 | public static function translation_fam() { |
974 | 974 | global $tmp_dir, $globalTransaction; |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | //$Connection->db->commit(); |
1007 | 1007 | } |
1008 | 1008 | return ''; |
1009 | - } |
|
1009 | + } |
|
1010 | 1010 | |
1011 | 1011 | /* |
1012 | 1012 | * This function use FAA public data. |
@@ -1018,19 +1018,19 @@ discard block |
||
1018 | 1018 | try { |
1019 | 1019 | $Connection = new Connection(); |
1020 | 1020 | $sth = $Connection->db->prepare($query); |
1021 | - $sth->execute(array(':source' => 'website_faa')); |
|
1022 | - } catch(PDOException $e) { |
|
1023 | - return "error : ".$e->getMessage(); |
|
1024 | - } |
|
1021 | + $sth->execute(array(':source' => 'website_faa')); |
|
1022 | + } catch(PDOException $e) { |
|
1023 | + return "error : ".$e->getMessage(); |
|
1024 | + } |
|
1025 | 1025 | |
1026 | 1026 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source"; |
1027 | 1027 | try { |
1028 | 1028 | $Connection = new Connection(); |
1029 | 1029 | $sth = $Connection->db->prepare($query); |
1030 | - $sth->execute(array(':source' => 'website_faa')); |
|
1031 | - } catch(PDOException $e) { |
|
1032 | - return "error : ".$e->getMessage(); |
|
1033 | - } |
|
1030 | + $sth->execute(array(':source' => 'website_faa')); |
|
1031 | + } catch(PDOException $e) { |
|
1032 | + return "error : ".$e->getMessage(); |
|
1033 | + } |
|
1034 | 1034 | |
1035 | 1035 | $delimiter = ","; |
1036 | 1036 | $mfr = array(); |
@@ -1106,17 +1106,17 @@ discard block |
||
1106 | 1106 | } |
1107 | 1107 | //print_r($mfr); |
1108 | 1108 | return ''; |
1109 | - } |
|
1109 | + } |
|
1110 | 1110 | public static function modes_fam() { |
1111 | 1111 | global $tmp_dir, $globalTransaction; |
1112 | 1112 | $query = "DELETE FROM aircraft_modes WHERE Source = '' OR Source = :source"; |
1113 | 1113 | try { |
1114 | 1114 | $Connection = new Connection(); |
1115 | 1115 | $sth = $Connection->db->prepare($query); |
1116 | - $sth->execute(array(':source' => 'website_fam')); |
|
1117 | - } catch(PDOException $e) { |
|
1118 | - return "error : ".$e->getMessage(); |
|
1119 | - } |
|
1116 | + $sth->execute(array(':source' => 'website_fam')); |
|
1117 | + } catch(PDOException $e) { |
|
1118 | + return "error : ".$e->getMessage(); |
|
1119 | + } |
|
1120 | 1120 | |
1121 | 1121 | |
1122 | 1122 | //update_db::unzip($out_file); |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | if ($globalTransaction) $Connection->db->commit(); |
1147 | 1147 | } |
1148 | 1148 | return ''; |
1149 | - } |
|
1149 | + } |
|
1150 | 1150 | |
1151 | 1151 | public static function owner_fam() { |
1152 | 1152 | global $tmp_dir, $globalTransaction; |
@@ -1154,10 +1154,10 @@ discard block |
||
1154 | 1154 | try { |
1155 | 1155 | $Connection = new Connection(); |
1156 | 1156 | $sth = $Connection->db->prepare($query); |
1157 | - $sth->execute(array(':source' => 'website_fam')); |
|
1158 | - } catch(PDOException $e) { |
|
1159 | - return "error : ".$e->getMessage(); |
|
1160 | - } |
|
1157 | + $sth->execute(array(':source' => 'website_fam')); |
|
1158 | + } catch(PDOException $e) { |
|
1159 | + return "error : ".$e->getMessage(); |
|
1160 | + } |
|
1161 | 1161 | |
1162 | 1162 | $delimiter = "\t"; |
1163 | 1163 | $Connection = new Connection(); |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | if ($globalTransaction) $Connection->db->commit(); |
1184 | 1184 | } |
1185 | 1185 | return ''; |
1186 | - } |
|
1186 | + } |
|
1187 | 1187 | |
1188 | 1188 | public static function routes_fam() { |
1189 | 1189 | global $tmp_dir, $globalTransaction, $globalDebug; |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | if ($globalTransaction) $Connection->db->commit(); |
1219 | 1219 | } |
1220 | 1220 | return ''; |
1221 | - } |
|
1221 | + } |
|
1222 | 1222 | |
1223 | 1223 | public static function marine_identity_fam() { |
1224 | 1224 | global $tmp_dir, $globalTransaction; |
@@ -1226,10 +1226,10 @@ discard block |
||
1226 | 1226 | try { |
1227 | 1227 | $Connection = new Connection(); |
1228 | 1228 | $sth = $Connection->db->prepare($query); |
1229 | - $sth->execute(); |
|
1230 | - } catch(PDOException $e) { |
|
1231 | - return "error : ".$e->getMessage(); |
|
1232 | - } |
|
1229 | + $sth->execute(); |
|
1230 | + } catch(PDOException $e) { |
|
1231 | + return "error : ".$e->getMessage(); |
|
1232 | + } |
|
1233 | 1233 | |
1234 | 1234 | |
1235 | 1235 | //update_db::unzip($out_file); |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | if ($globalTransaction) $Connection->db->commit(); |
1260 | 1260 | } |
1261 | 1261 | return ''; |
1262 | - } |
|
1262 | + } |
|
1263 | 1263 | |
1264 | 1264 | public static function satellite_fam() { |
1265 | 1265 | global $tmp_dir, $globalTransaction; |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | if ($globalTransaction) $Connection->db->commit(); |
1331 | 1331 | } |
1332 | 1332 | return ''; |
1333 | - } |
|
1333 | + } |
|
1334 | 1334 | |
1335 | 1335 | public static function tle($filename,$tletype) { |
1336 | 1336 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1341,10 +1341,10 @@ discard block |
||
1341 | 1341 | try { |
1342 | 1342 | $Connection = new Connection(); |
1343 | 1343 | $sth = $Connection->db->prepare($query); |
1344 | - $sth->execute(array(':source' => $filename)); |
|
1345 | - } catch(PDOException $e) { |
|
1346 | - return "error : ".$e->getMessage(); |
|
1347 | - } |
|
1344 | + $sth->execute(array(':source' => $filename)); |
|
1345 | + } catch(PDOException $e) { |
|
1346 | + return "error : ".$e->getMessage(); |
|
1347 | + } |
|
1348 | 1348 | |
1349 | 1349 | $Connection = new Connection(); |
1350 | 1350 | if (($handle = fopen($filename, 'r')) !== FALSE) |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | //$Connection->db->commit(); |
1380 | 1380 | } |
1381 | 1381 | return ''; |
1382 | - } |
|
1382 | + } |
|
1383 | 1383 | |
1384 | 1384 | public static function satellite_ucsdb($filename) { |
1385 | 1385 | global $tmp_dir, $globalTransaction; |
@@ -1628,11 +1628,11 @@ discard block |
||
1628 | 1628 | try { |
1629 | 1629 | $sth = $Connection->db->prepare($query); |
1630 | 1630 | $sth->execute(array( |
1631 | - ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
|
1632 | - ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
|
1633 | - ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
|
1634 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1635 | - ) |
|
1631 | + ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
|
1632 | + ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
|
1633 | + ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
|
1634 | + ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1635 | + ) |
|
1636 | 1636 | ); |
1637 | 1637 | } catch(PDOException $e) { |
1638 | 1638 | return "error : ".$e->getMessage(); |
@@ -1656,13 +1656,13 @@ discard block |
||
1656 | 1656 | //$Connection->db->commit(); |
1657 | 1657 | } |
1658 | 1658 | return ''; |
1659 | - } |
|
1659 | + } |
|
1660 | 1660 | |
1661 | 1661 | /** |
1662 | - * Convert a HTML table to an array |
|
1663 | - * @param String $data HTML page |
|
1664 | - * @return Array array of the tables in HTML page |
|
1665 | - */ |
|
1662 | + * Convert a HTML table to an array |
|
1663 | + * @param String $data HTML page |
|
1664 | + * @return Array array of the tables in HTML page |
|
1665 | + */ |
|
1666 | 1666 | /* |
1667 | 1667 | private static function table2array($data) { |
1668 | 1668 | $html = str_get_html($data); |
@@ -1692,11 +1692,11 @@ discard block |
||
1692 | 1692 | return(array_filter($tabledata)); |
1693 | 1693 | } |
1694 | 1694 | */ |
1695 | - /** |
|
1696 | - * Get data from form result |
|
1697 | - * @param String $url form URL |
|
1698 | - * @return String the result |
|
1699 | - */ |
|
1695 | + /** |
|
1696 | + * Get data from form result |
|
1697 | + * @param String $url form URL |
|
1698 | + * @return String the result |
|
1699 | + */ |
|
1700 | 1700 | /* |
1701 | 1701 | private static function getData($url) { |
1702 | 1702 | $ch = curl_init(); |
@@ -1789,7 +1789,7 @@ discard block |
||
1789 | 1789 | if ($globalTransaction) $Connection->db->commit(); |
1790 | 1790 | } |
1791 | 1791 | return ''; |
1792 | - } |
|
1792 | + } |
|
1793 | 1793 | |
1794 | 1794 | public static function ivao_airlines($filename) { |
1795 | 1795 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1799,10 +1799,10 @@ discard block |
||
1799 | 1799 | try { |
1800 | 1800 | $Connection = new Connection(); |
1801 | 1801 | $sth = $Connection->db->prepare($query); |
1802 | - $sth->execute(); |
|
1803 | - } catch(PDOException $e) { |
|
1804 | - return "error : ".$e->getMessage(); |
|
1805 | - } |
|
1802 | + $sth->execute(); |
|
1803 | + } catch(PDOException $e) { |
|
1804 | + return "error : ".$e->getMessage(); |
|
1805 | + } |
|
1806 | 1806 | |
1807 | 1807 | $header = NULL; |
1808 | 1808 | $delimiter = ':'; |
@@ -1826,7 +1826,7 @@ discard block |
||
1826 | 1826 | if ($globalTransaction) $Connection->db->commit(); |
1827 | 1827 | } |
1828 | 1828 | return ''; |
1829 | - } |
|
1829 | + } |
|
1830 | 1830 | |
1831 | 1831 | public static function update_airspace() { |
1832 | 1832 | global $tmp_dir, $globalDBdriver; |
@@ -1836,11 +1836,11 @@ discard block |
||
1836 | 1836 | $query = 'DROP TABLE airspace'; |
1837 | 1837 | try { |
1838 | 1838 | $sth = $Connection->db->prepare($query); |
1839 | - $sth->execute(); |
|
1840 | - } catch(PDOException $e) { |
|
1839 | + $sth->execute(); |
|
1840 | + } catch(PDOException $e) { |
|
1841 | 1841 | return "error : ".$e->getMessage(); |
1842 | - } |
|
1843 | - } |
|
1842 | + } |
|
1843 | + } |
|
1844 | 1844 | |
1845 | 1845 | |
1846 | 1846 | if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
@@ -1895,10 +1895,10 @@ discard block |
||
1895 | 1895 | $query = 'DROP TABLE countries'; |
1896 | 1896 | try { |
1897 | 1897 | $sth = $Connection->db->prepare($query); |
1898 | - $sth->execute(); |
|
1899 | - } catch(PDOException $e) { |
|
1900 | - echo "error : ".$e->getMessage(); |
|
1901 | - } |
|
1898 | + $sth->execute(); |
|
1899 | + } catch(PDOException $e) { |
|
1900 | + echo "error : ".$e->getMessage(); |
|
1901 | + } |
|
1902 | 1902 | } |
1903 | 1903 | if ($globalDBdriver == 'mysql') { |
1904 | 1904 | update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
@@ -2453,11 +2453,11 @@ discard block |
||
2453 | 2453 | $query = 'DROP TABLE airspace'; |
2454 | 2454 | try { |
2455 | 2455 | $sth = $Connection->db->prepare($query); |
2456 | - $sth->execute(); |
|
2457 | - } catch(PDOException $e) { |
|
2456 | + $sth->execute(); |
|
2457 | + } catch(PDOException $e) { |
|
2458 | 2458 | return "error : ".$e->getMessage(); |
2459 | - } |
|
2460 | - } |
|
2459 | + } |
|
2460 | + } |
|
2461 | 2461 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2462 | 2462 | update_db::insert_airspace_version($airspace_md5); |
2463 | 2463 | } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
@@ -2667,12 +2667,12 @@ discard block |
||
2667 | 2667 | echo $data; |
2668 | 2668 | */ |
2669 | 2669 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2670 | - //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
2671 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2672 | - $result = fread($fh,100000000); |
|
2673 | - //echo $result; |
|
2674 | - //var_dump(str_get_html($result)); |
|
2675 | - //print_r(self::table2array($result)); |
|
2670 | + //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
2671 | + $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2672 | + $result = fread($fh,100000000); |
|
2673 | + //echo $result; |
|
2674 | + //var_dump(str_get_html($result)); |
|
2675 | + //print_r(self::table2array($result)); |
|
2676 | 2676 | } |
2677 | 2677 | |
2678 | 2678 | } |
@@ -2686,10 +2686,10 @@ discard block |
||
2686 | 2686 | try { |
2687 | 2687 | $Connection = new Connection(); |
2688 | 2688 | $sth = $Connection->db->prepare($query); |
2689 | - $sth->execute(); |
|
2690 | - } catch(PDOException $e) { |
|
2691 | - return "error : ".$e->getMessage(); |
|
2692 | - } |
|
2689 | + $sth->execute(); |
|
2690 | + } catch(PDOException $e) { |
|
2691 | + return "error : ".$e->getMessage(); |
|
2692 | + } |
|
2693 | 2693 | |
2694 | 2694 | $error = ''; |
2695 | 2695 | if ($globalDebug) echo "Notam : Download..."; |
@@ -2745,8 +2745,8 @@ discard block |
||
2745 | 2745 | $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
2746 | 2746 | $data['permanent'] = 0; |
2747 | 2747 | } else { |
2748 | - $data['date_end'] = NULL; |
|
2749 | - $data['permanent'] = 1; |
|
2748 | + $data['date_end'] = NULL; |
|
2749 | + $data['permanent'] = 1; |
|
2750 | 2750 | } |
2751 | 2751 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2752 | 2752 | $NOTAM = new NOTAM(); |
@@ -2820,13 +2820,13 @@ discard block |
||
2820 | 2820 | try { |
2821 | 2821 | $Connection = new Connection(); |
2822 | 2822 | $sth = $Connection->db->prepare($query); |
2823 | - $sth->execute(); |
|
2824 | - } catch(PDOException $e) { |
|
2825 | - return "error : ".$e->getMessage(); |
|
2826 | - } |
|
2827 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2828 | - if ($row['nb'] > 0) return false; |
|
2829 | - else return true; |
|
2823 | + $sth->execute(); |
|
2824 | + } catch(PDOException $e) { |
|
2825 | + return "error : ".$e->getMessage(); |
|
2826 | + } |
|
2827 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2828 | + if ($row['nb'] > 0) return false; |
|
2829 | + else return true; |
|
2830 | 2830 | } |
2831 | 2831 | |
2832 | 2832 | public static function insert_last_update() { |
@@ -2835,10 +2835,10 @@ discard block |
||
2835 | 2835 | try { |
2836 | 2836 | $Connection = new Connection(); |
2837 | 2837 | $sth = $Connection->db->prepare($query); |
2838 | - $sth->execute(); |
|
2839 | - } catch(PDOException $e) { |
|
2840 | - return "error : ".$e->getMessage(); |
|
2841 | - } |
|
2838 | + $sth->execute(); |
|
2839 | + } catch(PDOException $e) { |
|
2840 | + return "error : ".$e->getMessage(); |
|
2841 | + } |
|
2842 | 2842 | } |
2843 | 2843 | |
2844 | 2844 | public static function check_airspace_version($version) { |
@@ -2846,13 +2846,13 @@ discard block |
||
2846 | 2846 | try { |
2847 | 2847 | $Connection = new Connection(); |
2848 | 2848 | $sth = $Connection->db->prepare($query); |
2849 | - $sth->execute(array(':version' => $version)); |
|
2850 | - } catch(PDOException $e) { |
|
2851 | - return "error : ".$e->getMessage(); |
|
2852 | - } |
|
2853 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2854 | - if ($row['nb'] > 0) return true; |
|
2855 | - else return false; |
|
2849 | + $sth->execute(array(':version' => $version)); |
|
2850 | + } catch(PDOException $e) { |
|
2851 | + return "error : ".$e->getMessage(); |
|
2852 | + } |
|
2853 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2854 | + if ($row['nb'] > 0) return true; |
|
2855 | + else return false; |
|
2856 | 2856 | } |
2857 | 2857 | |
2858 | 2858 | public static function check_geoid_version($version) { |
@@ -2860,13 +2860,13 @@ discard block |
||
2860 | 2860 | try { |
2861 | 2861 | $Connection = new Connection(); |
2862 | 2862 | $sth = $Connection->db->prepare($query); |
2863 | - $sth->execute(array(':version' => $version)); |
|
2864 | - } catch(PDOException $e) { |
|
2865 | - return "error : ".$e->getMessage(); |
|
2866 | - } |
|
2867 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2868 | - if ($row['nb'] > 0) return true; |
|
2869 | - else return false; |
|
2863 | + $sth->execute(array(':version' => $version)); |
|
2864 | + } catch(PDOException $e) { |
|
2865 | + return "error : ".$e->getMessage(); |
|
2866 | + } |
|
2867 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2868 | + if ($row['nb'] > 0) return true; |
|
2869 | + else return false; |
|
2870 | 2870 | } |
2871 | 2871 | |
2872 | 2872 | public static function check_marine_identity_version($version) { |
@@ -2916,10 +2916,10 @@ discard block |
||
2916 | 2916 | try { |
2917 | 2917 | $Connection = new Connection(); |
2918 | 2918 | $sth = $Connection->db->prepare($query); |
2919 | - $sth->execute(array(':version' => $version)); |
|
2920 | - } catch(PDOException $e) { |
|
2921 | - return "error : ".$e->getMessage(); |
|
2922 | - } |
|
2919 | + $sth->execute(array(':version' => $version)); |
|
2920 | + } catch(PDOException $e) { |
|
2921 | + return "error : ".$e->getMessage(); |
|
2922 | + } |
|
2923 | 2923 | } |
2924 | 2924 | |
2925 | 2925 | public static function insert_marine_identity_version($version) { |
@@ -2956,13 +2956,13 @@ discard block |
||
2956 | 2956 | try { |
2957 | 2957 | $Connection = new Connection(); |
2958 | 2958 | $sth = $Connection->db->prepare($query); |
2959 | - $sth->execute(); |
|
2960 | - } catch(PDOException $e) { |
|
2961 | - return "error : ".$e->getMessage(); |
|
2962 | - } |
|
2963 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2964 | - if ($row['nb'] > 0) return false; |
|
2965 | - else return true; |
|
2959 | + $sth->execute(); |
|
2960 | + } catch(PDOException $e) { |
|
2961 | + return "error : ".$e->getMessage(); |
|
2962 | + } |
|
2963 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2964 | + if ($row['nb'] > 0) return false; |
|
2965 | + else return true; |
|
2966 | 2966 | } |
2967 | 2967 | |
2968 | 2968 | public static function insert_last_notam_update() { |
@@ -2971,10 +2971,10 @@ discard block |
||
2971 | 2971 | try { |
2972 | 2972 | $Connection = new Connection(); |
2973 | 2973 | $sth = $Connection->db->prepare($query); |
2974 | - $sth->execute(); |
|
2975 | - } catch(PDOException $e) { |
|
2976 | - return "error : ".$e->getMessage(); |
|
2977 | - } |
|
2974 | + $sth->execute(); |
|
2975 | + } catch(PDOException $e) { |
|
2976 | + return "error : ".$e->getMessage(); |
|
2977 | + } |
|
2978 | 2978 | } |
2979 | 2979 | |
2980 | 2980 | public static function check_last_airspace_update() { |
@@ -2987,13 +2987,13 @@ discard block |
||
2987 | 2987 | try { |
2988 | 2988 | $Connection = new Connection(); |
2989 | 2989 | $sth = $Connection->db->prepare($query); |
2990 | - $sth->execute(); |
|
2991 | - } catch(PDOException $e) { |
|
2992 | - return "error : ".$e->getMessage(); |
|
2993 | - } |
|
2994 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2995 | - if ($row['nb'] > 0) return false; |
|
2996 | - else return true; |
|
2990 | + $sth->execute(); |
|
2991 | + } catch(PDOException $e) { |
|
2992 | + return "error : ".$e->getMessage(); |
|
2993 | + } |
|
2994 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2995 | + if ($row['nb'] > 0) return false; |
|
2996 | + else return true; |
|
2997 | 2997 | } |
2998 | 2998 | |
2999 | 2999 | public static function insert_last_airspace_update() { |
@@ -3002,10 +3002,10 @@ discard block |
||
3002 | 3002 | try { |
3003 | 3003 | $Connection = new Connection(); |
3004 | 3004 | $sth = $Connection->db->prepare($query); |
3005 | - $sth->execute(); |
|
3006 | - } catch(PDOException $e) { |
|
3007 | - return "error : ".$e->getMessage(); |
|
3008 | - } |
|
3005 | + $sth->execute(); |
|
3006 | + } catch(PDOException $e) { |
|
3007 | + return "error : ".$e->getMessage(); |
|
3008 | + } |
|
3009 | 3009 | } |
3010 | 3010 | |
3011 | 3011 | public static function check_last_geoid_update() { |
@@ -3018,13 +3018,13 @@ discard block |
||
3018 | 3018 | try { |
3019 | 3019 | $Connection = new Connection(); |
3020 | 3020 | $sth = $Connection->db->prepare($query); |
3021 | - $sth->execute(); |
|
3022 | - } catch(PDOException $e) { |
|
3023 | - return "error : ".$e->getMessage(); |
|
3024 | - } |
|
3025 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3026 | - if ($row['nb'] > 0) return false; |
|
3027 | - else return true; |
|
3021 | + $sth->execute(); |
|
3022 | + } catch(PDOException $e) { |
|
3023 | + return "error : ".$e->getMessage(); |
|
3024 | + } |
|
3025 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3026 | + if ($row['nb'] > 0) return false; |
|
3027 | + else return true; |
|
3028 | 3028 | } |
3029 | 3029 | |
3030 | 3030 | public static function insert_last_geoid_update() { |
@@ -3033,10 +3033,10 @@ discard block |
||
3033 | 3033 | try { |
3034 | 3034 | $Connection = new Connection(); |
3035 | 3035 | $sth = $Connection->db->prepare($query); |
3036 | - $sth->execute(); |
|
3037 | - } catch(PDOException $e) { |
|
3038 | - return "error : ".$e->getMessage(); |
|
3039 | - } |
|
3036 | + $sth->execute(); |
|
3037 | + } catch(PDOException $e) { |
|
3038 | + return "error : ".$e->getMessage(); |
|
3039 | + } |
|
3040 | 3040 | } |
3041 | 3041 | |
3042 | 3042 | public static function check_last_owner_update() { |
@@ -3049,13 +3049,13 @@ discard block |
||
3049 | 3049 | try { |
3050 | 3050 | $Connection = new Connection(); |
3051 | 3051 | $sth = $Connection->db->prepare($query); |
3052 | - $sth->execute(); |
|
3053 | - } catch(PDOException $e) { |
|
3054 | - return "error : ".$e->getMessage(); |
|
3055 | - } |
|
3056 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3057 | - if ($row['nb'] > 0) return false; |
|
3058 | - else return true; |
|
3052 | + $sth->execute(); |
|
3053 | + } catch(PDOException $e) { |
|
3054 | + return "error : ".$e->getMessage(); |
|
3055 | + } |
|
3056 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3057 | + if ($row['nb'] > 0) return false; |
|
3058 | + else return true; |
|
3059 | 3059 | } |
3060 | 3060 | |
3061 | 3061 | public static function insert_last_owner_update() { |
@@ -3064,10 +3064,10 @@ discard block |
||
3064 | 3064 | try { |
3065 | 3065 | $Connection = new Connection(); |
3066 | 3066 | $sth = $Connection->db->prepare($query); |
3067 | - $sth->execute(); |
|
3068 | - } catch(PDOException $e) { |
|
3069 | - return "error : ".$e->getMessage(); |
|
3070 | - } |
|
3067 | + $sth->execute(); |
|
3068 | + } catch(PDOException $e) { |
|
3069 | + return "error : ".$e->getMessage(); |
|
3070 | + } |
|
3071 | 3071 | } |
3072 | 3072 | public static function check_last_schedules_update() { |
3073 | 3073 | global $globalDBdriver; |
@@ -3079,13 +3079,13 @@ discard block |
||
3079 | 3079 | try { |
3080 | 3080 | $Connection = new Connection(); |
3081 | 3081 | $sth = $Connection->db->prepare($query); |
3082 | - $sth->execute(); |
|
3083 | - } catch(PDOException $e) { |
|
3084 | - return "error : ".$e->getMessage(); |
|
3085 | - } |
|
3086 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3087 | - if ($row['nb'] > 0) return false; |
|
3088 | - else return true; |
|
3082 | + $sth->execute(); |
|
3083 | + } catch(PDOException $e) { |
|
3084 | + return "error : ".$e->getMessage(); |
|
3085 | + } |
|
3086 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3087 | + if ($row['nb'] > 0) return false; |
|
3088 | + else return true; |
|
3089 | 3089 | } |
3090 | 3090 | |
3091 | 3091 | public static function insert_last_schedules_update() { |
@@ -3265,10 +3265,10 @@ discard block |
||
3265 | 3265 | try { |
3266 | 3266 | $Connection = new Connection(); |
3267 | 3267 | $sth = $Connection->db->prepare($query); |
3268 | - $sth->execute(); |
|
3269 | - } catch(PDOException $e) { |
|
3270 | - return "error : ".$e->getMessage(); |
|
3271 | - } |
|
3268 | + $sth->execute(); |
|
3269 | + } catch(PDOException $e) { |
|
3270 | + return "error : ".$e->getMessage(); |
|
3271 | + } |
|
3272 | 3272 | } |
3273 | 3273 | public static function delete_duplicateowner() { |
3274 | 3274 | global $globalDBdriver; |
@@ -3280,10 +3280,10 @@ discard block |
||
3280 | 3280 | try { |
3281 | 3281 | $Connection = new Connection(); |
3282 | 3282 | $sth = $Connection->db->prepare($query); |
3283 | - $sth->execute(); |
|
3284 | - } catch(PDOException $e) { |
|
3285 | - return "error : ".$e->getMessage(); |
|
3286 | - } |
|
3283 | + $sth->execute(); |
|
3284 | + } catch(PDOException $e) { |
|
3285 | + return "error : ".$e->getMessage(); |
|
3286 | + } |
|
3287 | 3287 | } |
3288 | 3288 | |
3289 | 3289 | public static function update_all() { |
@@ -25,20 +25,20 @@ discard block |
||
25 | 25 | fclose($fp); |
26 | 26 | } |
27 | 27 | |
28 | - public static function gunzip($in_file,$out_file_name = '') { |
|
28 | + public static function gunzip($in_file, $out_file_name = '') { |
|
29 | 29 | //echo $in_file.' -> '.$out_file_name."\n"; |
30 | 30 | $buffer_size = 4096; // read 4kb at a time |
31 | 31 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
32 | 32 | if ($in_file != '' && file_exists($in_file)) { |
33 | 33 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
34 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
35 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
34 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
35 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
36 | 36 | else { |
37 | 37 | echo 'gzopen not available'; |
38 | 38 | die; |
39 | 39 | } |
40 | 40 | $out_file = fopen($out_file_name, 'wb'); |
41 | - while(!gzeof($file)) { |
|
41 | + while (!gzeof($file)) { |
|
42 | 42 | fwrite($out_file, gzread($file, $buffer_size)); |
43 | 43 | } |
44 | 44 | fclose($out_file); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | try { |
63 | 63 | self::$db_sqlite = new PDO('sqlite:'.$database); |
64 | 64 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
65 | - } catch(PDOException $e) { |
|
65 | + } catch (PDOException $e) { |
|
66 | 66 | return "error : ".$e->getMessage(); |
67 | 67 | } |
68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | //$Connection = new Connection(); |
78 | 78 | $sth = $Connection->db->prepare($query); |
79 | 79 | $sth->execute(array(':source' => $database_file)); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | return "error : ".$e->getMessage(); |
82 | 82 | } |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | try { |
89 | 89 | $sth = update_db::$db_sqlite->prepare($query); |
90 | 90 | $sth->execute(); |
91 | - } catch(PDOException $e) { |
|
91 | + } catch (PDOException $e) { |
|
92 | 92 | return "error : ".$e->getMessage(); |
93 | 93 | } |
94 | 94 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | if ($globalTransaction) $Connection->db->beginTransaction(); |
100 | 100 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
101 | 101 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
102 | - $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
102 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
103 | 103 | $sth_dest->execute($query_dest_values); |
104 | 104 | } |
105 | 105 | if ($globalTransaction) $Connection->db->commit(); |
106 | - } catch(PDOException $e) { |
|
106 | + } catch (PDOException $e) { |
|
107 | 107 | if ($globalTransaction) $Connection->db->rollBack(); |
108 | 108 | return "error : ".$e->getMessage(); |
109 | 109 | } |
@@ -119,26 +119,26 @@ discard block |
||
119 | 119 | //$Connection = new Connection(); |
120 | 120 | $sth = $Connection->db->prepare($query); |
121 | 121 | $sth->execute(array(':source' => 'oneworld')); |
122 | - } catch(PDOException $e) { |
|
122 | + } catch (PDOException $e) { |
|
123 | 123 | return "error : ".$e->getMessage(); |
124 | 124 | } |
125 | 125 | |
126 | 126 | if ($globalDebug) echo " - Add routes to DB -"; |
127 | 127 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
128 | 128 | $Spotter = new Spotter(); |
129 | - if ($fh = fopen($database_file,"r")) { |
|
129 | + if ($fh = fopen($database_file, "r")) { |
|
130 | 130 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
131 | 131 | $Connection = new Connection(); |
132 | 132 | $sth_dest = $Connection->db->prepare($query_dest); |
133 | 133 | if ($globalTransaction) $Connection->db->beginTransaction(); |
134 | 134 | while (!feof($fh)) { |
135 | - $line = fgetcsv($fh,9999,','); |
|
135 | + $line = fgetcsv($fh, 9999, ','); |
|
136 | 136 | if ($line[0] != '') { |
137 | 137 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
138 | 138 | try { |
139 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
139 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
140 | 140 | $sth_dest->execute($query_dest_values); |
141 | - } catch(PDOException $e) { |
|
141 | + } catch (PDOException $e) { |
|
142 | 142 | if ($globalTransaction) $Connection->db->rollBack(); |
143 | 143 | return "error : ".$e->getMessage(); |
144 | 144 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | //$Connection = new Connection(); |
161 | 161 | $sth = $Connection->db->prepare($query); |
162 | 162 | $sth->execute(array(':source' => 'skyteam')); |
163 | - } catch(PDOException $e) { |
|
163 | + } catch (PDOException $e) { |
|
164 | 164 | return "error : ".$e->getMessage(); |
165 | 165 | } |
166 | 166 | |
@@ -168,24 +168,24 @@ discard block |
||
168 | 168 | |
169 | 169 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
170 | 170 | $Spotter = new Spotter(); |
171 | - if ($fh = fopen($database_file,"r")) { |
|
171 | + if ($fh = fopen($database_file, "r")) { |
|
172 | 172 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
173 | 173 | $Connection = new Connection(); |
174 | 174 | $sth_dest = $Connection->db->prepare($query_dest); |
175 | 175 | try { |
176 | 176 | if ($globalTransaction) $Connection->db->beginTransaction(); |
177 | 177 | while (!feof($fh)) { |
178 | - $line = fgetcsv($fh,9999,','); |
|
178 | + $line = fgetcsv($fh, 9999, ','); |
|
179 | 179 | if ($line[0] != '') { |
180 | - $datebe = explode(' - ',$line[2]); |
|
180 | + $datebe = explode(' - ', $line[2]); |
|
181 | 181 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
182 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
182 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
183 | 183 | $sth_dest->execute($query_dest_values); |
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | 187 | if ($globalTransaction) $Connection->db->commit(); |
188 | - } catch(PDOException $e) { |
|
188 | + } catch (PDOException $e) { |
|
189 | 189 | if ($globalTransaction) $Connection->db->rollBack(); |
190 | 190 | return "error : ".$e->getMessage(); |
191 | 191 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $Connection = new Connection(); |
201 | 201 | $sth = $Connection->db->prepare($query); |
202 | 202 | $sth->execute(array(':source' => $database_file)); |
203 | - } catch(PDOException $e) { |
|
203 | + } catch (PDOException $e) { |
|
204 | 204 | return "error : ".$e->getMessage(); |
205 | 205 | } |
206 | 206 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $Connection = new Connection(); |
209 | 209 | $sth = $Connection->db->prepare($query); |
210 | 210 | $sth->execute(array(':source' => $database_file)); |
211 | - } catch(PDOException $e) { |
|
211 | + } catch (PDOException $e) { |
|
212 | 212 | return "error : ".$e->getMessage(); |
213 | 213 | } |
214 | 214 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | try { |
218 | 218 | $sth = update_db::$db_sqlite->prepare($query); |
219 | 219 | $sth->execute(); |
220 | - } catch(PDOException $e) { |
|
220 | + } catch (PDOException $e) { |
|
221 | 221 | return "error : ".$e->getMessage(); |
222 | 222 | } |
223 | 223 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -234,15 +234,15 @@ discard block |
||
234 | 234 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
235 | 235 | if ($values['UserString4'] == 'M') $type = 'military'; |
236 | 236 | else $type = null; |
237 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
237 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
238 | 238 | $sth_dest->execute($query_dest_values); |
239 | 239 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
240 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
240 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
241 | 241 | $sth_dest_owner->execute($query_dest_owner_values); |
242 | 242 | } |
243 | 243 | } |
244 | 244 | if ($globalTransaction) $Connection->db->commit(); |
245 | - } catch(PDOException $e) { |
|
245 | + } catch (PDOException $e) { |
|
246 | 246 | return "error : ".$e->getMessage(); |
247 | 247 | } |
248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $Connection = new Connection(); |
253 | 253 | $sth = $Connection->db->prepare($query); |
254 | 254 | $sth->execute(array(':source' => $database_file)); |
255 | - } catch(PDOException $e) { |
|
255 | + } catch (PDOException $e) { |
|
256 | 256 | return "error : ".$e->getMessage(); |
257 | 257 | } |
258 | 258 | return ''; |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | $Connection = new Connection(); |
268 | 268 | $sth = $Connection->db->prepare($query); |
269 | 269 | $sth->execute(array(':source' => $database_file)); |
270 | - } catch(PDOException $e) { |
|
270 | + } catch (PDOException $e) { |
|
271 | 271 | return "error : ".$e->getMessage(); |
272 | 272 | } |
273 | 273 | |
274 | - if ($fh = fopen($database_file,"r")) { |
|
274 | + if ($fh = fopen($database_file, "r")) { |
|
275 | 275 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
276 | 276 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
277 | 277 | |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | if ($globalTransaction) $Connection->db->beginTransaction(); |
282 | 282 | while (!feof($fh)) { |
283 | 283 | $values = array(); |
284 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
284 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
285 | 285 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
286 | - $values['ModeS'] = substr($line,0,6); |
|
287 | - $values['Registration'] = trim(substr($line,69,6)); |
|
288 | - $aircraft_name = trim(substr($line,48,6)); |
|
286 | + $values['ModeS'] = substr($line, 0, 6); |
|
287 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
288 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
289 | 289 | // Check if we can find ICAO, else set it to GLID |
290 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
290 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
291 | 291 | $search_more = ''; |
292 | 292 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
293 | 293 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -299,20 +299,20 @@ discard block |
||
299 | 299 | if (isset($result['icao']) && $result['icao'] != '') { |
300 | 300 | $values['ICAOTypeCode'] = $result['icao']; |
301 | 301 | } |
302 | - } catch(PDOException $e) { |
|
302 | + } catch (PDOException $e) { |
|
303 | 303 | return "error : ".$e->getMessage(); |
304 | 304 | } |
305 | 305 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
306 | 306 | // Add data to db |
307 | 307 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
308 | 308 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
309 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
309 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
310 | 310 | //print_r($query_dest_values); |
311 | 311 | $sth_dest->execute($query_dest_values); |
312 | 312 | } |
313 | 313 | } |
314 | 314 | if ($globalTransaction) $Connection->db->commit(); |
315 | - } catch(PDOException $e) { |
|
315 | + } catch (PDOException $e) { |
|
316 | 316 | return "error : ".$e->getMessage(); |
317 | 317 | } |
318 | 318 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $Connection = new Connection(); |
323 | 323 | $sth = $Connection->db->prepare($query); |
324 | 324 | $sth->execute(array(':source' => $database_file)); |
325 | - } catch(PDOException $e) { |
|
325 | + } catch (PDOException $e) { |
|
326 | 326 | return "error : ".$e->getMessage(); |
327 | 327 | } |
328 | 328 | return ''; |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | $Connection = new Connection(); |
337 | 337 | $sth = $Connection->db->prepare($query); |
338 | 338 | $sth->execute(array(':source' => $database_file)); |
339 | - } catch(PDOException $e) { |
|
339 | + } catch (PDOException $e) { |
|
340 | 340 | return "error : ".$e->getMessage(); |
341 | 341 | } |
342 | 342 | |
343 | - if ($fh = fopen($database_file,"r")) { |
|
343 | + if ($fh = fopen($database_file, "r")) { |
|
344 | 344 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
345 | 345 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
346 | 346 | |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | $sth_dest = $Connection->db->prepare($query_dest); |
349 | 349 | try { |
350 | 350 | if ($globalTransaction) $Connection->db->beginTransaction(); |
351 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
351 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
352 | 352 | while (!feof($fh)) { |
353 | - $line = fgetcsv($fh,9999,',',"'"); |
|
353 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
354 | 354 | |
355 | 355 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
356 | 356 | //print_r($line); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $values['ICAOTypeCode'] = ''; |
360 | 360 | $aircraft_name = $line[2]; |
361 | 361 | // Check if we can find ICAO, else set it to GLID |
362 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
362 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
363 | 363 | $search_more = ''; |
364 | 364 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
365 | 365 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -368,20 +368,20 @@ discard block |
||
368 | 368 | $sth_search->execute(); |
369 | 369 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
370 | 370 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
371 | - } catch(PDOException $e) { |
|
371 | + } catch (PDOException $e) { |
|
372 | 372 | return "error : ".$e->getMessage(); |
373 | 373 | } |
374 | 374 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
375 | 375 | // Add data to db |
376 | 376 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
377 | 377 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
378 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
378 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
379 | 379 | //print_r($query_dest_values); |
380 | 380 | $sth_dest->execute($query_dest_values); |
381 | 381 | } |
382 | 382 | } |
383 | 383 | if ($globalTransaction) $Connection->db->commit(); |
384 | - } catch(PDOException $e) { |
|
384 | + } catch (PDOException $e) { |
|
385 | 385 | return "error : ".$e->getMessage(); |
386 | 386 | } |
387 | 387 | } |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | $Connection = new Connection(); |
392 | 392 | $sth = $Connection->db->prepare($query); |
393 | 393 | $sth->execute(array(':source' => $database_file)); |
394 | - } catch(PDOException $e) { |
|
394 | + } catch (PDOException $e) { |
|
395 | 395 | return "error : ".$e->getMessage(); |
396 | 396 | } |
397 | 397 | return ''; |
398 | 398 | } |
399 | 399 | |
400 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
400 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
401 | 401 | global $globalTransaction, $globalMasterSource; |
402 | 402 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
403 | 403 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -405,12 +405,12 @@ discard block |
||
405 | 405 | $Connection = new Connection(); |
406 | 406 | $sth = $Connection->db->prepare($query); |
407 | 407 | $sth->execute(array(':source' => $database_file)); |
408 | - } catch(PDOException $e) { |
|
408 | + } catch (PDOException $e) { |
|
409 | 409 | return "error : ".$e->getMessage(); |
410 | 410 | } |
411 | 411 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
412 | 412 | $Spotter = new Spotter(); |
413 | - if ($fh = fopen($database_file,"r")) { |
|
413 | + if ($fh = fopen($database_file, "r")) { |
|
414 | 414 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
415 | 415 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
416 | 416 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | $sth_modes = $Connection->db->prepare($query_modes); |
421 | 421 | try { |
422 | 422 | if ($globalTransaction) $Connection->db->beginTransaction(); |
423 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
423 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
424 | 424 | while (!feof($fh)) { |
425 | - $line = fgetcsv($fh,9999,',','"'); |
|
425 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
426 | 426 | $values = array(); |
427 | 427 | //print_r($line); |
428 | 428 | if ($country == 'F') { |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $values['base'] = $line[4]; |
431 | 431 | $values['owner'] = $line[5]; |
432 | 432 | if ($line[6] == '') $values['date_first_reg'] = null; |
433 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
433 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
434 | 434 | $values['cancel'] = $line[7]; |
435 | 435 | } elseif ($country == 'EI') { |
436 | 436 | // TODO : add modeS & reg to aircraft_modes |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $values['base'] = $line[3]; |
439 | 439 | $values['owner'] = $line[2]; |
440 | 440 | if ($line[1] == '') $values['date_first_reg'] = null; |
441 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
441 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
442 | 442 | $values['cancel'] = ''; |
443 | 443 | $values['modes'] = $line[7]; |
444 | 444 | $values['icao'] = $line[8]; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $values['base'] = null; |
459 | 459 | $values['owner'] = $line[5]; |
460 | 460 | if ($line[18] == '') $values['date_first_reg'] = null; |
461 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
461 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
462 | 462 | $values['cancel'] = ''; |
463 | 463 | } elseif ($country == 'VH') { |
464 | 464 | // TODO : add modeS & reg to aircraft_modes |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $values['base'] = null; |
467 | 467 | $values['owner'] = $line[12]; |
468 | 468 | if ($line[28] == '') $values['date_first_reg'] = null; |
469 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
469 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
470 | 470 | |
471 | 471 | $values['cancel'] = $line[39]; |
472 | 472 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -486,28 +486,28 @@ discard block |
||
486 | 486 | $values['base'] = null; |
487 | 487 | $values['owner'] = $line[8]; |
488 | 488 | if ($line[7] == '') $values['date_first_reg'] = null; |
489 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
489 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
490 | 490 | $values['cancel'] = ''; |
491 | 491 | } elseif ($country == 'PP') { |
492 | 492 | $values['registration'] = $line[0]; |
493 | 493 | $values['base'] = null; |
494 | 494 | $values['owner'] = $line[4]; |
495 | 495 | if ($line[6] == '') $values['date_first_reg'] = null; |
496 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
496 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
497 | 497 | $values['cancel'] = $line[7]; |
498 | 498 | } elseif ($country == 'E7') { |
499 | 499 | $values['registration'] = $line[0]; |
500 | 500 | $values['base'] = null; |
501 | 501 | $values['owner'] = $line[4]; |
502 | 502 | if ($line[5] == '') $values['date_first_reg'] = null; |
503 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
503 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
504 | 504 | $values['cancel'] = ''; |
505 | 505 | } elseif ($country == '8Q') { |
506 | 506 | $values['registration'] = $line[0]; |
507 | 507 | $values['base'] = null; |
508 | 508 | $values['owner'] = $line[3]; |
509 | 509 | if ($line[7] == '') $values['date_first_reg'] = null; |
510 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
510 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
511 | 511 | $values['cancel'] = ''; |
512 | 512 | } elseif ($country == 'ZK') { |
513 | 513 | $values['registration'] = $line[0]; |
@@ -521,18 +521,18 @@ discard block |
||
521 | 521 | $values['registration'] = $line[0]; |
522 | 522 | $values['base'] = null; |
523 | 523 | $values['owner'] = $line[6]; |
524 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
525 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
524 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
525 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
526 | 526 | $values['modes'] = $line[4]; |
527 | 527 | $values['icao'] = $line[10]; |
528 | 528 | } elseif ($country == 'OY') { |
529 | 529 | $values['registration'] = $line[0]; |
530 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
530 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
531 | 531 | $values['modes'] = $line[5]; |
532 | 532 | $values['icao'] = $line[6]; |
533 | 533 | } elseif ($country == 'PH') { |
534 | 534 | $values['registration'] = $line[0]; |
535 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
535 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
536 | 536 | $values['modes'] = $line[4]; |
537 | 537 | $values['icao'] = $line[5]; |
538 | 538 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -543,17 +543,17 @@ discard block |
||
543 | 543 | $values['cancel'] = ''; |
544 | 544 | } |
545 | 545 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
546 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
546 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
547 | 547 | $sth_dest->execute($query_dest_values); |
548 | 548 | } |
549 | 549 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
550 | 550 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
551 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
551 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
552 | 552 | $sth_modes->execute($query_modes_values); |
553 | 553 | } |
554 | 554 | } |
555 | 555 | if ($globalTransaction) $Connection->db->commit(); |
556 | - } catch(PDOException $e) { |
|
556 | + } catch (PDOException $e) { |
|
557 | 557 | return "error : ".$e->getMessage(); |
558 | 558 | } |
559 | 559 | } |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | if ($globalTransaction) $Connection->db->beginTransaction(); |
692 | 692 | |
693 | 693 | $i = 0; |
694 | - while($row = sparql_fetch_array($result)) |
|
694 | + while ($row = sparql_fetch_array($result)) |
|
695 | 695 | { |
696 | 696 | if ($i >= 1) { |
697 | 697 | //print_r($row); |
@@ -711,33 +711,33 @@ discard block |
||
711 | 711 | $row['image'] = ''; |
712 | 712 | $row['image_thumb'] = ''; |
713 | 713 | } else { |
714 | - $image = str_replace(' ','_',$row['image']); |
|
714 | + $image = str_replace(' ', '_', $row['image']); |
|
715 | 715 | $digest = md5($image); |
716 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
717 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
718 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
719 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
716 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
717 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
718 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
719 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
720 | 720 | } |
721 | 721 | |
722 | - $country = explode('-',$row['country']); |
|
722 | + $country = explode('-', $row['country']); |
|
723 | 723 | $row['country'] = $country[0]; |
724 | 724 | |
725 | 725 | $row['type'] = trim($row['type']); |
726 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
726 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
727 | 727 | $row['type'] = 'military'; |
728 | 728 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
729 | 729 | $row['type'] = 'small_airport'; |
730 | 730 | } |
731 | 731 | |
732 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
733 | - $query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($row['altitude']),':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
732 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
733 | + $query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($row['altitude']), ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
734 | 734 | //print_r($query_dest_values); |
735 | 735 | |
736 | 736 | if ($row['icao'] != '') { |
737 | 737 | try { |
738 | 738 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
739 | 739 | $sth->execute(array(':icao' => $row['icao'])); |
740 | - } catch(PDOException $e) { |
|
740 | + } catch (PDOException $e) { |
|
741 | 741 | return "error : ".$e->getMessage(); |
742 | 742 | } |
743 | 743 | if ($sth->fetchColumn() > 0) { |
@@ -745,15 +745,15 @@ discard block |
||
745 | 745 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
746 | 746 | try { |
747 | 747 | $sth = $Connection->db->prepare($query); |
748 | - $sth->execute(array(':icao' => $row['icao'],':type' => $row['type'])); |
|
749 | - } catch(PDOException $e) { |
|
748 | + $sth->execute(array(':icao' => $row['icao'], ':type' => $row['type'])); |
|
749 | + } catch (PDOException $e) { |
|
750 | 750 | return "error : ".$e->getMessage(); |
751 | 751 | } |
752 | 752 | echo $row['icao'].' : '.$row['type']."\n"; |
753 | 753 | } else { |
754 | 754 | try { |
755 | 755 | $sth_dest->execute($query_dest_values); |
756 | - } catch(PDOException $e) { |
|
756 | + } catch (PDOException $e) { |
|
757 | 757 | return "error : ".$e->getMessage(); |
758 | 758 | } |
759 | 759 | } |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | echo "Download data from ourairports.com...\n"; |
805 | 805 | $delimiter = ','; |
806 | 806 | $out_file = $tmp_dir.'airports.csv'; |
807 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
807 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
808 | 808 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
809 | 809 | echo "Add data from ourairports.com...\n"; |
810 | 810 | |
@@ -815,33 +815,33 @@ discard block |
||
815 | 815 | //$Connection->db->beginTransaction(); |
816 | 816 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
817 | 817 | { |
818 | - if(!$header) $header = $row; |
|
818 | + if (!$header) $header = $row; |
|
819 | 819 | else { |
820 | 820 | $data = array(); |
821 | 821 | $data = array_combine($header, $row); |
822 | 822 | try { |
823 | 823 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
824 | 824 | $sth->execute(array(':icao' => $data['ident'])); |
825 | - } catch(PDOException $e) { |
|
825 | + } catch (PDOException $e) { |
|
826 | 826 | return "error : ".$e->getMessage(); |
827 | 827 | } |
828 | 828 | if ($sth->fetchColumn() > 0) { |
829 | 829 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
830 | 830 | try { |
831 | 831 | $sth = $Connection->db->prepare($query); |
832 | - $sth->execute(array(':icao' => $data['ident'],':type' => $data['type'])); |
|
833 | - } catch(PDOException $e) { |
|
832 | + $sth->execute(array(':icao' => $data['ident'], ':type' => $data['type'])); |
|
833 | + } catch (PDOException $e) { |
|
834 | 834 | return "error : ".$e->getMessage(); |
835 | 835 | } |
836 | 836 | } else { |
837 | 837 | if ($data['gps_code'] == $data['ident']) { |
838 | 838 | $query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link) |
839 | 839 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
840 | - $query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
840 | + $query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
841 | 841 | try { |
842 | 842 | $sth = $Connection->db->prepare($query); |
843 | 843 | $sth->execute($query_values); |
844 | - } catch(PDOException $e) { |
|
844 | + } catch (PDOException $e) { |
|
845 | 845 | return "error : ".$e->getMessage(); |
846 | 846 | } |
847 | 847 | $i++; |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | |
857 | 857 | echo "Download data from another free database...\n"; |
858 | 858 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
859 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
859 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
860 | 860 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
861 | 861 | update_db::unzip($out_file); |
862 | 862 | $header = NULL; |
@@ -868,15 +868,15 @@ discard block |
||
868 | 868 | //$Connection->db->beginTransaction(); |
869 | 869 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
870 | 870 | { |
871 | - if(!$header) $header = $row; |
|
871 | + if (!$header) $header = $row; |
|
872 | 872 | else { |
873 | 873 | $data = $row; |
874 | 874 | |
875 | 875 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
876 | 876 | try { |
877 | 877 | $sth = $Connection->db->prepare($query); |
878 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
879 | - } catch(PDOException $e) { |
|
878 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
879 | + } catch (PDOException $e) { |
|
880 | 880 | return "error : ".$e->getMessage(); |
881 | 881 | } |
882 | 882 | } |
@@ -890,15 +890,15 @@ discard block |
||
890 | 890 | try { |
891 | 891 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'"); |
892 | 892 | $sth->execute(); |
893 | - } catch(PDOException $e) { |
|
893 | + } catch (PDOException $e) { |
|
894 | 894 | return "error : ".$e->getMessage(); |
895 | 895 | } |
896 | 896 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
897 | 897 | $query2 = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
898 | 898 | try { |
899 | 899 | $sth2 = $Connection->db->prepare($query2); |
900 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
901 | - } catch(PDOException $e) { |
|
900 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
901 | + } catch (PDOException $e) { |
|
902 | 902 | return "error : ".$e->getMessage(); |
903 | 903 | } |
904 | 904 | } |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | $Connection = new Connection(); |
920 | 920 | $sth = $Connection->db->prepare($query); |
921 | 921 | $sth->execute(array(':source' => 'translation.csv')); |
922 | - } catch(PDOException $e) { |
|
922 | + } catch (PDOException $e) { |
|
923 | 923 | return "error : ".$e->getMessage(); |
924 | 924 | } |
925 | 925 | |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
937 | 937 | { |
938 | 938 | $i++; |
939 | - if($i > 12) { |
|
939 | + if ($i > 12) { |
|
940 | 940 | $data = $row; |
941 | 941 | $operator = $data[2]; |
942 | 942 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | //echo substr($operator, 0, 2)."\n";; |
945 | 945 | if (count($airline_array) > 0) { |
946 | 946 | //print_r($airline_array); |
947 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
947 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
@@ -952,14 +952,14 @@ discard block |
||
952 | 952 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
953 | 953 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
954 | 954 | if (count($airline_array) > 0) { |
955 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
955 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
956 | 956 | } |
957 | 957 | } |
958 | 958 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
959 | 959 | try { |
960 | 960 | $sth = $Connection->db->prepare($query); |
961 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
962 | - } catch(PDOException $e) { |
|
961 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
962 | + } catch (PDOException $e) { |
|
963 | 963 | return "error : ".$e->getMessage(); |
964 | 964 | } |
965 | 965 | } |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | $Connection = new Connection(); |
978 | 978 | $sth = $Connection->db->prepare($query); |
979 | 979 | $sth->execute(array(':source' => 'website_fam')); |
980 | - } catch(PDOException $e) { |
|
980 | + } catch (PDOException $e) { |
|
981 | 981 | return "error : ".$e->getMessage(); |
982 | 982 | } |
983 | 983 | //update_db::unzip($out_file); |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
996 | 996 | try { |
997 | 997 | $sth = $Connection->db->prepare($query); |
998 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
999 | - } catch(PDOException $e) { |
|
998 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
999 | + } catch (PDOException $e) { |
|
1000 | 1000 | return "error : ".$e->getMessage(); |
1001 | 1001 | } |
1002 | 1002 | } |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $Connection = new Connection(); |
1020 | 1020 | $sth = $Connection->db->prepare($query); |
1021 | 1021 | $sth->execute(array(':source' => 'website_faa')); |
1022 | - } catch(PDOException $e) { |
|
1022 | + } catch (PDOException $e) { |
|
1023 | 1023 | return "error : ".$e->getMessage(); |
1024 | 1024 | } |
1025 | 1025 | |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | $Connection = new Connection(); |
1029 | 1029 | $sth = $Connection->db->prepare($query); |
1030 | 1030 | $sth->execute(array(':source' => 'website_faa')); |
1031 | - } catch(PDOException $e) { |
|
1031 | + } catch (PDOException $e) { |
|
1032 | 1032 | return "error : ".$e->getMessage(); |
1033 | 1033 | } |
1034 | 1034 | |
@@ -1045,8 +1045,8 @@ discard block |
||
1045 | 1045 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
1046 | 1046 | try { |
1047 | 1047 | $sths = $Connection->db->prepare($query_search); |
1048 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
1049 | - } catch(PDOException $e) { |
|
1048 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
1049 | + } catch (PDOException $e) { |
|
1050 | 1050 | return "error s : ".$e->getMessage(); |
1051 | 1051 | } |
1052 | 1052 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1059,8 +1059,8 @@ discard block |
||
1059 | 1059 | //} |
1060 | 1060 | try { |
1061 | 1061 | $sthi = $Connection->db->prepare($queryi); |
1062 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1063 | - } catch(PDOException $e) { |
|
1062 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1063 | + } catch (PDOException $e) { |
|
1064 | 1064 | return "error u : ".$e->getMessage(); |
1065 | 1065 | } |
1066 | 1066 | } else { |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | try { |
1069 | 1069 | $sthsm = $Connection->db->prepare($query_search_mfr); |
1070 | 1070 | $sthsm->execute(array(':mfr' => $data[2])); |
1071 | - } catch(PDOException $e) { |
|
1071 | + } catch (PDOException $e) { |
|
1072 | 1072 | return "error mfr : ".$e->getMessage(); |
1073 | 1073 | } |
1074 | 1074 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1078,8 +1078,8 @@ discard block |
||
1078 | 1078 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1079 | 1079 | try { |
1080 | 1080 | $sthf = $Connection->db->prepare($queryf); |
1081 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
1082 | - } catch(PDOException $e) { |
|
1081 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
1082 | + } catch (PDOException $e) { |
|
1083 | 1083 | return "error f : ".$e->getMessage(); |
1084 | 1084 | } |
1085 | 1085 | } |
@@ -1089,13 +1089,13 @@ discard block |
||
1089 | 1089 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1090 | 1090 | try { |
1091 | 1091 | $sth = $Connection->db->prepare($query); |
1092 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
1093 | - } catch(PDOException $e) { |
|
1092 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
1093 | + } catch (PDOException $e) { |
|
1094 | 1094 | return "error i : ".$e->getMessage(); |
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | } |
1098 | - if ($i % 90 == 0) { |
|
1098 | + if ($i%90 == 0) { |
|
1099 | 1099 | if ($globalTransaction) $Connection->db->commit(); |
1100 | 1100 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1101 | 1101 | } |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | $Connection = new Connection(); |
1115 | 1115 | $sth = $Connection->db->prepare($query); |
1116 | 1116 | $sth->execute(array(':source' => 'website_fam')); |
1117 | - } catch(PDOException $e) { |
|
1117 | + } catch (PDOException $e) { |
|
1118 | 1118 | return "error : ".$e->getMessage(); |
1119 | 1119 | } |
1120 | 1120 | |
@@ -1135,8 +1135,8 @@ discard block |
||
1135 | 1135 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1136 | 1136 | try { |
1137 | 1137 | $sth = $Connection->db->prepare($query); |
1138 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
1139 | - } catch(PDOException $e) { |
|
1138 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
1139 | + } catch (PDOException $e) { |
|
1140 | 1140 | return "error : ".$e->getMessage(); |
1141 | 1141 | } |
1142 | 1142 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | $Connection = new Connection(); |
1156 | 1156 | $sth = $Connection->db->prepare($query); |
1157 | 1157 | $sth->execute(array(':source' => 'website_fam')); |
1158 | - } catch(PDOException $e) { |
|
1158 | + } catch (PDOException $e) { |
|
1159 | 1159 | return "error : ".$e->getMessage(); |
1160 | 1160 | } |
1161 | 1161 | |
@@ -1171,8 +1171,8 @@ discard block |
||
1171 | 1171 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1172 | 1172 | try { |
1173 | 1173 | $sth = $Connection->db->prepare($query); |
1174 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1175 | - } catch(PDOException $e) { |
|
1174 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1175 | + } catch (PDOException $e) { |
|
1176 | 1176 | //print_r($data); |
1177 | 1177 | return "error : ".$e->getMessage(); |
1178 | 1178 | } |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | $Connection = new Connection(); |
1193 | 1193 | $sth = $Connection->db->prepare($query); |
1194 | 1194 | $sth->execute(array(':source' => 'website_fam')); |
1195 | - } catch(PDOException $e) { |
|
1195 | + } catch (PDOException $e) { |
|
1196 | 1196 | return "error : ".$e->getMessage(); |
1197 | 1197 | } |
1198 | 1198 | $delimiter = "\t"; |
@@ -1207,9 +1207,9 @@ discard block |
||
1207 | 1207 | $query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
1208 | 1208 | try { |
1209 | 1209 | $sth = $Connection->db->prepare($query); |
1210 | - $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
1211 | - } catch(PDOException $e) { |
|
1212 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1210 | + $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
1211 | + } catch (PDOException $e) { |
|
1212 | + if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data); |
|
1213 | 1213 | } |
1214 | 1214 | } |
1215 | 1215 | $i++; |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | $Connection = new Connection(); |
1228 | 1228 | $sth = $Connection->db->prepare($query); |
1229 | 1229 | $sth->execute(); |
1230 | - } catch(PDOException $e) { |
|
1230 | + } catch (PDOException $e) { |
|
1231 | 1231 | return "error : ".$e->getMessage(); |
1232 | 1232 | } |
1233 | 1233 | |
@@ -1248,8 +1248,8 @@ discard block |
||
1248 | 1248 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
1249 | 1249 | try { |
1250 | 1250 | $sth = $Connection->db->prepare($query); |
1251 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
1252 | - } catch(PDOException $e) { |
|
1251 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
1252 | + } catch (PDOException $e) { |
|
1253 | 1253 | return "error : ".$e->getMessage(); |
1254 | 1254 | } |
1255 | 1255 | } |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | $Connection = new Connection(); |
1269 | 1269 | $sth = $Connection->db->prepare($query); |
1270 | 1270 | $sth->execute(); |
1271 | - } catch(PDOException $e) { |
|
1271 | + } catch (PDOException $e) { |
|
1272 | 1272 | return "error : ".$e->getMessage(); |
1273 | 1273 | } |
1274 | 1274 | $delimiter = "\t"; |
@@ -1285,8 +1285,8 @@ discard block |
||
1285 | 1285 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1286 | 1286 | try { |
1287 | 1287 | $sth = $Connection->db->prepare($query); |
1288 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1289 | - } catch(PDOException $e) { |
|
1288 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1289 | + } catch (PDOException $e) { |
|
1290 | 1290 | return "error : ".$e->getMessage(); |
1291 | 1291 | } |
1292 | 1292 | } |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | $Connection = new Connection(); |
1306 | 1306 | $sth = $Connection->db->prepare($query); |
1307 | 1307 | $sth->execute(); |
1308 | - } catch(PDOException $e) { |
|
1308 | + } catch (PDOException $e) { |
|
1309 | 1309 | return "error : ".$e->getMessage(); |
1310 | 1310 | } |
1311 | 1311 | |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | try { |
1322 | 1322 | $sth = $Connection->db->prepare($query); |
1323 | 1323 | $sth->execute(array(':icao' => $icao)); |
1324 | - } catch(PDOException $e) { |
|
1324 | + } catch (PDOException $e) { |
|
1325 | 1325 | return "error : ".$e->getMessage(); |
1326 | 1326 | } |
1327 | 1327 | } |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | return ''; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - public static function tle($filename,$tletype) { |
|
1335 | + public static function tle($filename, $tletype) { |
|
1336 | 1336 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1337 | 1337 | global $tmp_dir, $globalTransaction; |
1338 | 1338 | //$Spotter = new Spotter(); |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | $Connection = new Connection(); |
1343 | 1343 | $sth = $Connection->db->prepare($query); |
1344 | 1344 | $sth->execute(array(':source' => $filename)); |
1345 | - } catch(PDOException $e) { |
|
1345 | + } catch (PDOException $e) { |
|
1346 | 1346 | return "error : ".$e->getMessage(); |
1347 | 1347 | } |
1348 | 1348 | |
@@ -1367,8 +1367,8 @@ discard block |
||
1367 | 1367 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1368 | 1368 | try { |
1369 | 1369 | $sth = $Connection->db->prepare($query); |
1370 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1371 | - } catch(PDOException $e) { |
|
1370 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1371 | + } catch (PDOException $e) { |
|
1372 | 1372 | return "error : ".$e->getMessage(); |
1373 | 1373 | } |
1374 | 1374 | |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | $Connection = new Connection(); |
1389 | 1389 | $sth = $Connection->db->prepare($query); |
1390 | 1390 | $sth->execute(array(':source' => $filename)); |
1391 | - } catch(PDOException $e) { |
|
1391 | + } catch (PDOException $e) { |
|
1392 | 1392 | return "error : ".$e->getMessage(); |
1393 | 1393 | } |
1394 | 1394 | |
@@ -1398,13 +1398,13 @@ discard block |
||
1398 | 1398 | $i = 0; |
1399 | 1399 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1400 | 1400 | //$Connection->db->beginTransaction(); |
1401 | - while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE) |
|
1401 | + while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) |
|
1402 | 1402 | { |
1403 | 1403 | if ($i > 0 && $data[0] != '') { |
1404 | 1404 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1405 | - $period = str_replace(',','',$data[14]); |
|
1406 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1407 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1405 | + $period = str_replace(',', '', $data[14]); |
|
1406 | + if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60; |
|
1407 | + if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18])); |
|
1408 | 1408 | else $launch_date = NULL; |
1409 | 1409 | $data = array_map(function($value) { |
1410 | 1410 | return trim($value) === '' ? null : $value; |
@@ -1414,8 +1414,8 @@ discard block |
||
1414 | 1414 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1415 | 1415 | try { |
1416 | 1416 | $sth = $Connection->db->prepare($query); |
1417 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1418 | - } catch(PDOException $e) { |
|
1417 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1418 | + } catch (PDOException $e) { |
|
1419 | 1419 | return "error : ".$e->getMessage(); |
1420 | 1420 | } |
1421 | 1421 | } |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | 'EGYP' => array('country' => 'Egypt', 'owner' => ''), |
1456 | 1456 | 'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'), |
1457 | 1457 | 'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'), |
1458 | - 'EST' => array('country' => 'Estonia','owner' => ''), |
|
1458 | + 'EST' => array('country' => 'Estonia', 'owner' => ''), |
|
1459 | 1459 | 'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'), |
1460 | 1460 | 'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'), |
1461 | 1461 | 'FGER' => array('country' => 'France/Germany', 'owner' => ''), |
@@ -1578,10 +1578,10 @@ discard block |
||
1578 | 1578 | while (($data = fgets($handle, 1000)) !== FALSE) |
1579 | 1579 | { |
1580 | 1580 | $result = array(); |
1581 | - $result['cospar'] = trim(substr($data,0,11)); |
|
1582 | - $result['norad'] = trim(substr($data,13,6)); |
|
1583 | - $result['operational'] = trim(substr($data,21,1)); |
|
1584 | - $result['name'] = trim(substr($data,23,24)); |
|
1581 | + $result['cospar'] = trim(substr($data, 0, 11)); |
|
1582 | + $result['norad'] = trim(substr($data, 13, 6)); |
|
1583 | + $result['operational'] = trim(substr($data, 21, 1)); |
|
1584 | + $result['name'] = trim(substr($data, 23, 24)); |
|
1585 | 1585 | /* |
1586 | 1586 | * R/B(1) = Rocket body, first stage |
1587 | 1587 | * R/B(2) = Rocket body, second stage |
@@ -1593,20 +1593,20 @@ discard block |
||
1593 | 1593 | * An ampersand (&) indicates two or more objects are attached |
1594 | 1594 | */ |
1595 | 1595 | |
1596 | - $owner_code = trim(substr($data,49,5)); |
|
1596 | + $owner_code = trim(substr($data, 49, 5)); |
|
1597 | 1597 | if ($owner_code != 'TBD') { |
1598 | 1598 | $result['country_owner'] = $satcat_sources[$owner_code]['country']; |
1599 | 1599 | $result['owner'] = $satcat_sources[$owner_code]['owner']; |
1600 | - $result['launch_date'] = trim(substr($data,56,10)); |
|
1601 | - $launch_site_code = trim(substr($data,68,5)); |
|
1600 | + $result['launch_date'] = trim(substr($data, 56, 10)); |
|
1601 | + $launch_site_code = trim(substr($data, 68, 5)); |
|
1602 | 1602 | $result['launch_site'] = $satcat_launch_site[$launch_site_code]; |
1603 | - $result['lifetime'] = trim(substr($data,75,10)); |
|
1604 | - $result['period'] = trim(substr($data,87,7)); |
|
1605 | - $result['inclination'] = trim(substr($data,96,5)); |
|
1606 | - $result['apogee'] = trim(substr($data,103,6)); |
|
1607 | - $result['perigee'] = trim(substr($data,111,6)); |
|
1603 | + $result['lifetime'] = trim(substr($data, 75, 10)); |
|
1604 | + $result['period'] = trim(substr($data, 87, 7)); |
|
1605 | + $result['inclination'] = trim(substr($data, 96, 5)); |
|
1606 | + $result['apogee'] = trim(substr($data, 103, 6)); |
|
1607 | + $result['perigee'] = trim(substr($data, 111, 6)); |
|
1608 | 1608 | //$result['radarcross'] = trim(substr($data,119,8)); |
1609 | - $result['status'] = trim(substr($data,129,3)); |
|
1609 | + $result['status'] = trim(substr($data, 129, 3)); |
|
1610 | 1610 | //print_r($result); |
1611 | 1611 | $result = array_map(function($value) { |
1612 | 1612 | return trim($value) === '' ? null : $value; |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | $sth = $Connection->db->prepare($query); |
1620 | 1620 | $sth->execute(array(':cospar' => $result['cospar'])); |
1621 | 1621 | $exist = $sth->fetchAll(PDO::FETCH_ASSOC); |
1622 | - } catch(PDOException $e) { |
|
1622 | + } catch (PDOException $e) { |
|
1623 | 1623 | return "error : ".$e->getMessage(); |
1624 | 1624 | } |
1625 | 1625 | if (empty($exist)) { |
@@ -1631,10 +1631,10 @@ discard block |
||
1631 | 1631 | ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
1632 | 1632 | ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
1633 | 1633 | ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
1634 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1634 | + ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1635 | 1635 | ) |
1636 | 1636 | ); |
1637 | - } catch(PDOException $e) { |
|
1637 | + } catch (PDOException $e) { |
|
1638 | 1638 | return "error : ".$e->getMessage(); |
1639 | 1639 | } |
1640 | 1640 | } elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) { |
@@ -1642,8 +1642,8 @@ discard block |
||
1642 | 1642 | try { |
1643 | 1643 | $Connection = new Connection(); |
1644 | 1644 | $sth = $Connection->db->prepare($query); |
1645 | - $sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar'])); |
|
1646 | - } catch(PDOException $e) { |
|
1645 | + $sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar'])); |
|
1646 | + } catch (PDOException $e) { |
|
1647 | 1647 | return "error : ".$e->getMessage(); |
1648 | 1648 | } |
1649 | 1649 | } |
@@ -1762,13 +1762,13 @@ discard block |
||
1762 | 1762 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1763 | 1763 | { |
1764 | 1764 | $i++; |
1765 | - if($i > 3 && count($row) > 2) { |
|
1765 | + if ($i > 3 && count($row) > 2) { |
|
1766 | 1766 | $data = array_values(array_filter($row)); |
1767 | 1767 | $cntdata = count($data); |
1768 | 1768 | if ($cntdata > 10) { |
1769 | 1769 | $value = $data[9]; |
1770 | 1770 | |
1771 | - for ($i =10;$i < $cntdata;$i++) { |
|
1771 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1772 | 1772 | $value .= ' '.$data[$i]; |
1773 | 1773 | } |
1774 | 1774 | $data[9] = $value; |
@@ -1778,8 +1778,8 @@ discard block |
||
1778 | 1778 | $query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
1779 | 1779 | try { |
1780 | 1780 | $sth = $Connection->db->prepare($query); |
1781 | - $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1782 | - } catch(PDOException $e) { |
|
1781 | + $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1782 | + } catch (PDOException $e) { |
|
1783 | 1783 | return "error : ".$e->getMessage(); |
1784 | 1784 | } |
1785 | 1785 | } |
@@ -1800,7 +1800,7 @@ discard block |
||
1800 | 1800 | $Connection = new Connection(); |
1801 | 1801 | $sth = $Connection->db->prepare($query); |
1802 | 1802 | $sth->execute(); |
1803 | - } catch(PDOException $e) { |
|
1803 | + } catch (PDOException $e) { |
|
1804 | 1804 | return "error : ".$e->getMessage(); |
1805 | 1805 | } |
1806 | 1806 | |
@@ -1812,12 +1812,12 @@ discard block |
||
1812 | 1812 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1813 | 1813 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1814 | 1814 | { |
1815 | - if(count($row) > 1) { |
|
1815 | + if (count($row) > 1) { |
|
1816 | 1816 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1817 | 1817 | try { |
1818 | 1818 | $sth = $Connection->db->prepare($query); |
1819 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1820 | - } catch(PDOException $e) { |
|
1819 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1820 | + } catch (PDOException $e) { |
|
1821 | 1821 | return "error : ".$e->getMessage(); |
1822 | 1822 | } |
1823 | 1823 | } |
@@ -1837,21 +1837,21 @@ discard block |
||
1837 | 1837 | try { |
1838 | 1838 | $sth = $Connection->db->prepare($query); |
1839 | 1839 | $sth->execute(); |
1840 | - } catch(PDOException $e) { |
|
1840 | + } catch (PDOException $e) { |
|
1841 | 1841 | return "error : ".$e->getMessage(); |
1842 | 1842 | } |
1843 | 1843 | } |
1844 | 1844 | |
1845 | 1845 | |
1846 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1846 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1847 | 1847 | else { |
1848 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1848 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1849 | 1849 | $query = "CREATE EXTENSION postgis"; |
1850 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1850 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1851 | 1851 | try { |
1852 | 1852 | $sth = $Connection->db->prepare($query); |
1853 | 1853 | $sth->execute(); |
1854 | - } catch(PDOException $e) { |
|
1854 | + } catch (PDOException $e) { |
|
1855 | 1855 | return "error : ".$e->getMessage(); |
1856 | 1856 | } |
1857 | 1857 | } |
@@ -1864,7 +1864,7 @@ discard block |
||
1864 | 1864 | include_once('class.create_db.php'); |
1865 | 1865 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1866 | 1866 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
1867 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
1867 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1868 | 1868 | $error = ''; |
1869 | 1869 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1870 | 1870 | if ($globalDebug) echo "Gunzip..."; |
@@ -1896,14 +1896,14 @@ discard block |
||
1896 | 1896 | try { |
1897 | 1897 | $sth = $Connection->db->prepare($query); |
1898 | 1898 | $sth->execute(); |
1899 | - } catch(PDOException $e) { |
|
1899 | + } catch (PDOException $e) { |
|
1900 | 1900 | echo "error : ".$e->getMessage(); |
1901 | 1901 | } |
1902 | 1902 | } |
1903 | 1903 | if ($globalDBdriver == 'mysql') { |
1904 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1904 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1905 | 1905 | } else { |
1906 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1906 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1907 | 1907 | } |
1908 | 1908 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
1909 | 1909 | return $error; |
@@ -1916,7 +1916,7 @@ discard block |
||
1916 | 1916 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
1917 | 1917 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
1918 | 1918 | // update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
1919 | - update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
1919 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
1920 | 1920 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
1921 | 1921 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
1922 | 1922 | return $error; |
@@ -1936,7 +1936,7 @@ discard block |
||
1936 | 1936 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1937 | 1937 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
1938 | 1938 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1939 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1939 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1940 | 1940 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
1941 | 1941 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
1942 | 1942 | if ($error != '') { |
@@ -1949,7 +1949,7 @@ discard block |
||
1949 | 1949 | global $tmp_dir, $globalDebug; |
1950 | 1950 | $error = ''; |
1951 | 1951 | if ($globalDebug) echo "Routes : Download..."; |
1952 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
1952 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1953 | 1953 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1954 | 1954 | if ($globalDebug) echo "Gunzip..."; |
1955 | 1955 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1965,7 +1965,7 @@ discard block |
||
1965 | 1965 | global $tmp_dir, $globalDebug; |
1966 | 1966 | $error = ''; |
1967 | 1967 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
1968 | - update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
1968 | + update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1969 | 1969 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1970 | 1970 | if ($globalDebug) echo "Gunzip..."; |
1971 | 1971 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | global $tmp_dir, $globalDebug; |
1982 | 1982 | $error = ''; |
1983 | 1983 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
1984 | - update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
1984 | + update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1985 | 1985 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1986 | 1986 | if ($globalDebug) echo "Gunzip..."; |
1987 | 1987 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -2009,7 +2009,7 @@ discard block |
||
2009 | 2009 | */ |
2010 | 2010 | if ($globalDebug) echo "Modes : Download..."; |
2011 | 2011 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
2012 | - update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
2012 | + update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
2013 | 2013 | |
2014 | 2014 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2015 | 2015 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | public static function update_ModeS_faa() { |
2030 | 2030 | global $tmp_dir, $globalDebug; |
2031 | 2031 | if ($globalDebug) echo "Modes FAA: Download..."; |
2032 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
2032 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
2033 | 2033 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2034 | 2034 | if ($globalDebug) echo "Unzip..."; |
2035 | 2035 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -2045,7 +2045,7 @@ discard block |
||
2045 | 2045 | public static function update_ModeS_flarm() { |
2046 | 2046 | global $tmp_dir, $globalDebug; |
2047 | 2047 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
2048 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
2048 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
2049 | 2049 | if (file_exists($tmp_dir.'data.fln')) { |
2050 | 2050 | if ($globalDebug) echo "Add to DB..."; |
2051 | 2051 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -2059,7 +2059,7 @@ discard block |
||
2059 | 2059 | public static function update_ModeS_ogn() { |
2060 | 2060 | global $tmp_dir, $globalDebug; |
2061 | 2061 | if ($globalDebug) echo "Modes OGN: Download..."; |
2062 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
2062 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
2063 | 2063 | if (file_exists($tmp_dir.'ogn.csv')) { |
2064 | 2064 | if ($globalDebug) echo "Add to DB..."; |
2065 | 2065 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -2074,201 +2074,201 @@ discard block |
||
2074 | 2074 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2075 | 2075 | |
2076 | 2076 | if ($globalDebug) echo "Owner France: Download..."; |
2077 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
2077 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
2078 | 2078 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2079 | 2079 | if ($globalDebug) echo "Add to DB..."; |
2080 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
2080 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
2081 | 2081 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
2082 | 2082 | if ($error != '') { |
2083 | 2083 | return $error; |
2084 | 2084 | } elseif ($globalDebug) echo "Done\n"; |
2085 | 2085 | |
2086 | 2086 | if ($globalDebug) echo "Owner Ireland: Download..."; |
2087 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
2087 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
2088 | 2088 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2089 | 2089 | if ($globalDebug) echo "Add to DB..."; |
2090 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
2090 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
2091 | 2091 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
2092 | 2092 | if ($error != '') { |
2093 | 2093 | return $error; |
2094 | 2094 | } elseif ($globalDebug) echo "Done\n"; |
2095 | 2095 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
2096 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
2096 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
2097 | 2097 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2098 | 2098 | if ($globalDebug) echo "Add to DB..."; |
2099 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
2099 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
2100 | 2100 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
2101 | 2101 | if ($error != '') { |
2102 | 2102 | return $error; |
2103 | 2103 | } elseif ($globalDebug) echo "Done\n"; |
2104 | 2104 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
2105 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
2105 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
2106 | 2106 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2107 | 2107 | if ($globalDebug) echo "Add to DB..."; |
2108 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
2108 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
2109 | 2109 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
2110 | 2110 | if ($error != '') { |
2111 | 2111 | return $error; |
2112 | 2112 | } elseif ($globalDebug) echo "Done\n"; |
2113 | 2113 | if ($globalDebug) echo "Owner Australia: Download..."; |
2114 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
2114 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
2115 | 2115 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2116 | 2116 | if ($globalDebug) echo "Add to DB..."; |
2117 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
2117 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
2118 | 2118 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
2119 | 2119 | if ($error != '') { |
2120 | 2120 | return $error; |
2121 | 2121 | } elseif ($globalDebug) echo "Done\n"; |
2122 | 2122 | if ($globalDebug) echo "Owner Austria: Download..."; |
2123 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
2123 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
2124 | 2124 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2125 | 2125 | if ($globalDebug) echo "Add to DB..."; |
2126 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
2126 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
2127 | 2127 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
2128 | 2128 | if ($error != '') { |
2129 | 2129 | return $error; |
2130 | 2130 | } elseif ($globalDebug) echo "Done\n"; |
2131 | 2131 | if ($globalDebug) echo "Owner Chile: Download..."; |
2132 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
2132 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
2133 | 2133 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2134 | 2134 | if ($globalDebug) echo "Add to DB..."; |
2135 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
2135 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
2136 | 2136 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
2137 | 2137 | if ($error != '') { |
2138 | 2138 | return $error; |
2139 | 2139 | } elseif ($globalDebug) echo "Done\n"; |
2140 | 2140 | if ($globalDebug) echo "Owner Colombia: Download..."; |
2141 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
2141 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
2142 | 2142 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2143 | 2143 | if ($globalDebug) echo "Add to DB..."; |
2144 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
2144 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
2145 | 2145 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
2146 | 2146 | if ($error != '') { |
2147 | 2147 | return $error; |
2148 | 2148 | } elseif ($globalDebug) echo "Done\n"; |
2149 | 2149 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
2150 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
2150 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
2151 | 2151 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2152 | 2152 | if ($globalDebug) echo "Add to DB..."; |
2153 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
2153 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
2154 | 2154 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
2155 | 2155 | if ($error != '') { |
2156 | 2156 | return $error; |
2157 | 2157 | } elseif ($globalDebug) echo "Done\n"; |
2158 | 2158 | if ($globalDebug) echo "Owner Brazil: Download..."; |
2159 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
2159 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
2160 | 2160 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2161 | 2161 | if ($globalDebug) echo "Add to DB..."; |
2162 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
2162 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
2163 | 2163 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
2164 | 2164 | if ($error != '') { |
2165 | 2165 | return $error; |
2166 | 2166 | } elseif ($globalDebug) echo "Done\n"; |
2167 | 2167 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
2168 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
2168 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
2169 | 2169 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2170 | 2170 | if ($globalDebug) echo "Add to DB..."; |
2171 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
2171 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
2172 | 2172 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
2173 | 2173 | if ($error != '') { |
2174 | 2174 | return $error; |
2175 | 2175 | } elseif ($globalDebug) echo "Done\n"; |
2176 | 2176 | if ($globalDebug) echo "Owner Croatia: Download..."; |
2177 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
2177 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
2178 | 2178 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2179 | 2179 | if ($globalDebug) echo "Add to DB..."; |
2180 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
2180 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
2181 | 2181 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
2182 | 2182 | if ($error != '') { |
2183 | 2183 | return $error; |
2184 | 2184 | } elseif ($globalDebug) echo "Done\n"; |
2185 | 2185 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
2186 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
2186 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
2187 | 2187 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2188 | 2188 | if ($globalDebug) echo "Add to DB..."; |
2189 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
2189 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
2190 | 2190 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
2191 | 2191 | if ($error != '') { |
2192 | 2192 | return $error; |
2193 | 2193 | } elseif ($globalDebug) echo "Done\n"; |
2194 | 2194 | if ($globalDebug) echo "Owner Maldives: Download..."; |
2195 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
2195 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
2196 | 2196 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2197 | 2197 | if ($globalDebug) echo "Add to DB..."; |
2198 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
2198 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
2199 | 2199 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
2200 | 2200 | if ($error != '') { |
2201 | 2201 | return $error; |
2202 | 2202 | } elseif ($globalDebug) echo "Done\n"; |
2203 | 2203 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
2204 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
2204 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
2205 | 2205 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2206 | 2206 | if ($globalDebug) echo "Add to DB..."; |
2207 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
2207 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
2208 | 2208 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
2209 | 2209 | if ($error != '') { |
2210 | 2210 | return $error; |
2211 | 2211 | } elseif ($globalDebug) echo "Done\n"; |
2212 | 2212 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
2213 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
2213 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
2214 | 2214 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2215 | 2215 | if ($globalDebug) echo "Add to DB..."; |
2216 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
2216 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
2217 | 2217 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
2218 | 2218 | if ($error != '') { |
2219 | 2219 | return $error; |
2220 | 2220 | } elseif ($globalDebug) echo "Done\n"; |
2221 | 2221 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
2222 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
2222 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
2223 | 2223 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2224 | 2224 | if ($globalDebug) echo "Add to DB..."; |
2225 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
2225 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
2226 | 2226 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
2227 | 2227 | if ($error != '') { |
2228 | 2228 | return $error; |
2229 | 2229 | } elseif ($globalDebug) echo "Done\n"; |
2230 | 2230 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
2231 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
2231 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
2232 | 2232 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2233 | 2233 | if ($globalDebug) echo "Add to DB..."; |
2234 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
2234 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
2235 | 2235 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
2236 | 2236 | if ($error != '') { |
2237 | 2237 | return $error; |
2238 | 2238 | } elseif ($globalDebug) echo "Done\n"; |
2239 | 2239 | if ($globalDebug) echo "Owner Iceland: Download..."; |
2240 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
2240 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
2241 | 2241 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2242 | 2242 | if ($globalDebug) echo "Add to DB..."; |
2243 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
2243 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
2244 | 2244 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
2245 | 2245 | if ($error != '') { |
2246 | 2246 | return $error; |
2247 | 2247 | } elseif ($globalDebug) echo "Done\n"; |
2248 | 2248 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
2249 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
2249 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
2250 | 2250 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2251 | 2251 | if ($globalDebug) echo "Add to DB..."; |
2252 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
2252 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
2253 | 2253 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
2254 | 2254 | if ($error != '') { |
2255 | 2255 | return $error; |
2256 | 2256 | } elseif ($globalDebug) echo "Done\n"; |
2257 | 2257 | if ($globalMasterSource) { |
2258 | 2258 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
2259 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
2259 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
2260 | 2260 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2261 | 2261 | if ($globalDebug) echo "Add to DB..."; |
2262 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
2262 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
2263 | 2263 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
2264 | 2264 | if ($error != '') { |
2265 | 2265 | return $error; |
2266 | 2266 | } elseif ($globalDebug) echo "Done\n"; |
2267 | 2267 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
2268 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
2268 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
2269 | 2269 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2270 | 2270 | if ($globalDebug) echo "Add to DB..."; |
2271 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
2271 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
2272 | 2272 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
2273 | 2273 | if ($error != '') { |
2274 | 2274 | return $error; |
@@ -2281,7 +2281,7 @@ discard block |
||
2281 | 2281 | global $tmp_dir, $globalDebug; |
2282 | 2282 | $error = ''; |
2283 | 2283 | if ($globalDebug) echo "Translation : Download..."; |
2284 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
2284 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
2285 | 2285 | if (file_exists($tmp_dir.'translation.zip')) { |
2286 | 2286 | if ($globalDebug) echo "Unzip..."; |
2287 | 2287 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | public static function update_translation_fam() { |
2298 | 2298 | global $tmp_dir, $globalDebug; |
2299 | 2299 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
2300 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
2300 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
2301 | 2301 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
2302 | 2302 | if ($globalDebug) echo "Gunzip..."; |
2303 | 2303 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -2312,7 +2312,7 @@ discard block |
||
2312 | 2312 | public static function update_ModeS_fam() { |
2313 | 2313 | global $tmp_dir, $globalDebug; |
2314 | 2314 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
2315 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
2315 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
2316 | 2316 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
2317 | 2317 | if ($globalDebug) echo "Gunzip..."; |
2318 | 2318 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
@@ -2328,9 +2328,9 @@ discard block |
||
2328 | 2328 | global $tmp_dir, $globalDebug, $globalOwner; |
2329 | 2329 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
2330 | 2330 | if ($globalOwner === TRUE) { |
2331 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2331 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2332 | 2332 | } else { |
2333 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2333 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2334 | 2334 | } |
2335 | 2335 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
2336 | 2336 | if ($globalDebug) echo "Gunzip..."; |
@@ -2346,7 +2346,7 @@ discard block |
||
2346 | 2346 | public static function update_routes_fam() { |
2347 | 2347 | global $tmp_dir, $globalDebug; |
2348 | 2348 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2349 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
2349 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2350 | 2350 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2351 | 2351 | if ($globalDebug) echo "Gunzip..."; |
2352 | 2352 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
@@ -2360,13 +2360,13 @@ discard block |
||
2360 | 2360 | } |
2361 | 2361 | public static function update_marine_identity_fam() { |
2362 | 2362 | global $tmp_dir, $globalDebug; |
2363 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2363 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2364 | 2364 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2365 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2365 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2366 | 2366 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2367 | 2367 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2368 | 2368 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2369 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2369 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2370 | 2370 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2371 | 2371 | if ($globalDebug) echo "Gunzip..."; |
2372 | 2372 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
@@ -2386,13 +2386,13 @@ discard block |
||
2386 | 2386 | |
2387 | 2387 | public static function update_satellite_fam() { |
2388 | 2388 | global $tmp_dir, $globalDebug; |
2389 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5'); |
|
2389 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5'); |
|
2390 | 2390 | if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) { |
2391 | - $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2391 | + $satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2392 | 2392 | $satellite_md5 = $satellite_md5_file[0]; |
2393 | 2393 | if (!update_db::check_satellite_version($satellite_md5)) { |
2394 | 2394 | if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
2395 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
|
2395 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz'); |
|
2396 | 2396 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2397 | 2397 | if ($globalDebug) echo "Gunzip..."; |
2398 | 2398 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
@@ -2412,7 +2412,7 @@ discard block |
||
2412 | 2412 | public static function update_banned_fam() { |
2413 | 2413 | global $tmp_dir, $globalDebug; |
2414 | 2414 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2415 | - update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2415 | + update_db::download('http://data.flightairmap.com/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2416 | 2416 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2417 | 2417 | //if ($globalDebug) echo "Gunzip..."; |
2418 | 2418 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2431,18 +2431,18 @@ discard block |
||
2431 | 2431 | $error = ''; |
2432 | 2432 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2433 | 2433 | if ($globalDBdriver == 'mysql') { |
2434 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2434 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2435 | 2435 | } else { |
2436 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2436 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2437 | 2437 | } |
2438 | 2438 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2439 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2439 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2440 | 2440 | $airspace_md5 = $airspace_md5_file[0]; |
2441 | 2441 | if (!update_db::check_airspace_version($airspace_md5)) { |
2442 | 2442 | if ($globalDBdriver == 'mysql') { |
2443 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2443 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2444 | 2444 | } else { |
2445 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2445 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2446 | 2446 | } |
2447 | 2447 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2448 | 2448 | if ($globalDebug) echo "Gunzip..."; |
@@ -2454,7 +2454,7 @@ discard block |
||
2454 | 2454 | try { |
2455 | 2455 | $sth = $Connection->db->prepare($query); |
2456 | 2456 | $sth->execute(); |
2457 | - } catch(PDOException $e) { |
|
2457 | + } catch (PDOException $e) { |
|
2458 | 2458 | return "error : ".$e->getMessage(); |
2459 | 2459 | } |
2460 | 2460 | } |
@@ -2473,15 +2473,15 @@ discard block |
||
2473 | 2473 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2474 | 2474 | $error = ''; |
2475 | 2475 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
2476 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2476 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2477 | 2477 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2478 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2478 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2479 | 2479 | $geoid_md5 = $geoid_md5_file[0]; |
2480 | 2480 | if (!update_db::check_geoid_version($geoid_md5)) { |
2481 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2481 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2482 | 2482 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2483 | 2483 | if ($globalDebug) echo "Gunzip..."; |
2484 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2484 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2485 | 2485 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2486 | 2486 | update_db::insert_geoid_version($geoid_md5); |
2487 | 2487 | } |
@@ -2497,15 +2497,15 @@ discard block |
||
2497 | 2497 | public static function update_tle() { |
2498 | 2498 | global $tmp_dir, $globalDebug; |
2499 | 2499 | if ($globalDebug) echo "Download TLE : Download..."; |
2500 | - $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
|
2501 | - 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
|
2502 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
|
2500 | + $alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt', |
|
2501 | + 'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt', |
|
2502 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt', 'visual.txt', 'sarsat.txt', 'argos.txt', 'ses.txt', 'iridium-NEXT.txt', 'beidou.txt'); |
|
2503 | 2503 | foreach ($alltle as $filename) { |
2504 | 2504 | if ($globalDebug) echo "downloading ".$filename.'...'; |
2505 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2505 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2506 | 2506 | if (file_exists($tmp_dir.$filename)) { |
2507 | 2507 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
2508 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2508 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2509 | 2509 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2510 | 2510 | if ($error != '') { |
2511 | 2511 | echo $error."\n"; |
@@ -2517,7 +2517,7 @@ discard block |
||
2517 | 2517 | public static function update_ucsdb() { |
2518 | 2518 | global $tmp_dir, $globalDebug; |
2519 | 2519 | if ($globalDebug) echo "Download UCS DB : Download..."; |
2520 | - update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
2520 | + update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt', $tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
2521 | 2521 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2522 | 2522 | if ($globalDebug) echo "Add to DB..."; |
2523 | 2523 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
@@ -2531,7 +2531,7 @@ discard block |
||
2531 | 2531 | public static function update_celestrak() { |
2532 | 2532 | global $tmp_dir, $globalDebug; |
2533 | 2533 | if ($globalDebug) echo "Download Celestrak DB : Download..."; |
2534 | - update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
|
2534 | + update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt'); |
|
2535 | 2535 | if (file_exists($tmp_dir.'satcat.txt')) { |
2536 | 2536 | if ($globalDebug) echo "Add to DB..."; |
2537 | 2537 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
@@ -2546,32 +2546,32 @@ discard block |
||
2546 | 2546 | global $tmp_dir, $globalDebug; |
2547 | 2547 | $error = ''; |
2548 | 2548 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
2549 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2549 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2550 | 2550 | if (file_exists($tmp_dir.'models.md5sum')) { |
2551 | 2551 | if ($globalDebug) echo "Check files...\n"; |
2552 | 2552 | $newmodelsdb = array(); |
2553 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2554 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2553 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2554 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2555 | 2555 | $model = trim($row[2]); |
2556 | 2556 | $newmodelsdb[$model] = trim($row[0]); |
2557 | 2557 | } |
2558 | 2558 | } |
2559 | 2559 | $modelsdb = array(); |
2560 | 2560 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2561 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2562 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2561 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2562 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2563 | 2563 | $model = trim($row[2]); |
2564 | 2564 | $modelsdb[$model] = trim($row[0]); |
2565 | 2565 | } |
2566 | 2566 | } |
2567 | 2567 | } |
2568 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2568 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2569 | 2569 | foreach ($diff as $key => $value) { |
2570 | 2570 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2571 | - update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2571 | + update_db::download('http://data.flightairmap.com/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2572 | 2572 | |
2573 | 2573 | } |
2574 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2574 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2575 | 2575 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2576 | 2576 | if ($error != '') { |
2577 | 2577 | return $error; |
@@ -2583,32 +2583,32 @@ discard block |
||
2583 | 2583 | global $tmp_dir, $globalDebug; |
2584 | 2584 | $error = ''; |
2585 | 2585 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
2586 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
2586 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2587 | 2587 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2588 | 2588 | if ($globalDebug) echo "Check files...\n"; |
2589 | 2589 | $newmodelsdb = array(); |
2590 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2591 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2590 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
2591 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2592 | 2592 | $model = trim($row[2]); |
2593 | 2593 | $newmodelsdb[$model] = trim($row[0]); |
2594 | 2594 | } |
2595 | 2595 | } |
2596 | 2596 | $modelsdb = array(); |
2597 | 2597 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
2598 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2599 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2598 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2599 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2600 | 2600 | $model = trim($row[2]); |
2601 | 2601 | $modelsdb[$model] = trim($row[0]); |
2602 | 2602 | } |
2603 | 2603 | } |
2604 | 2604 | } |
2605 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2605 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2606 | 2606 | foreach ($diff as $key => $value) { |
2607 | 2607 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2608 | - update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2608 | + update_db::download('http://data.flightairmap.com/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2609 | 2609 | |
2610 | 2610 | } |
2611 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2611 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2612 | 2612 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2613 | 2613 | if ($error != '') { |
2614 | 2614 | return $error; |
@@ -2620,32 +2620,32 @@ discard block |
||
2620 | 2620 | global $tmp_dir, $globalDebug; |
2621 | 2621 | $error = ''; |
2622 | 2622 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
2623 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
2623 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2624 | 2624 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2625 | 2625 | if ($globalDebug) echo "Check files...\n"; |
2626 | 2626 | $newmodelsdb = array(); |
2627 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2628 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2627 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2628 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2629 | 2629 | $model = trim($row[2]); |
2630 | 2630 | $newmodelsdb[$model] = trim($row[0]); |
2631 | 2631 | } |
2632 | 2632 | } |
2633 | 2633 | $modelsdb = array(); |
2634 | 2634 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
2635 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2636 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2635 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2636 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2637 | 2637 | $model = trim($row[2]); |
2638 | 2638 | $modelsdb[$model] = trim($row[0]); |
2639 | 2639 | } |
2640 | 2640 | } |
2641 | 2641 | } |
2642 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2642 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2643 | 2643 | foreach ($diff as $key => $value) { |
2644 | 2644 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
2645 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2645 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2646 | 2646 | |
2647 | 2647 | } |
2648 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2648 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2649 | 2649 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2650 | 2650 | if ($error != '') { |
2651 | 2651 | return $error; |
@@ -2668,8 +2668,8 @@ discard block |
||
2668 | 2668 | */ |
2669 | 2669 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2670 | 2670 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
2671 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2672 | - $result = fread($fh,100000000); |
|
2671 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
2672 | + $result = fread($fh, 100000000); |
|
2673 | 2673 | //echo $result; |
2674 | 2674 | //var_dump(str_get_html($result)); |
2675 | 2675 | //print_r(self::table2array($result)); |
@@ -2687,23 +2687,23 @@ discard block |
||
2687 | 2687 | $Connection = new Connection(); |
2688 | 2688 | $sth = $Connection->db->prepare($query); |
2689 | 2689 | $sth->execute(); |
2690 | - } catch(PDOException $e) { |
|
2690 | + } catch (PDOException $e) { |
|
2691 | 2691 | return "error : ".$e->getMessage(); |
2692 | 2692 | } |
2693 | 2693 | |
2694 | 2694 | $error = ''; |
2695 | 2695 | if ($globalDebug) echo "Notam : Download..."; |
2696 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
2696 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2697 | 2697 | if (file_exists($tmp_dir.'notam.rss')) { |
2698 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
2698 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2699 | 2699 | foreach ($notams['channel']['item'] as $notam) { |
2700 | - $title = explode(':',$notam['title']); |
|
2700 | + $title = explode(':', $notam['title']); |
|
2701 | 2701 | $data['ref'] = trim($title[0]); |
2702 | 2702 | unset($title[0]); |
2703 | - $data['title'] = trim(implode(':',$title)); |
|
2704 | - $description = strip_tags($notam['description'],'<pre>'); |
|
2705 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
2706 | - $q = explode('/',$match[1]); |
|
2703 | + $data['title'] = trim(implode(':', $title)); |
|
2704 | + $description = strip_tags($notam['description'], '<pre>'); |
|
2705 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
2706 | + $q = explode('/', $match[1]); |
|
2707 | 2707 | $data['fir'] = $q[0]; |
2708 | 2708 | $data['code'] = $q[1]; |
2709 | 2709 | $ifrvfr = $q[2]; |
@@ -2719,30 +2719,30 @@ discard block |
||
2719 | 2719 | $data['lower_limit'] = $q[5]; |
2720 | 2720 | $data['upper_limit'] = $q[6]; |
2721 | 2721 | $latlonrad = $q[7]; |
2722 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2723 | - $latitude = $Common->convertDec($las,'latitude'); |
|
2724 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
2722 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
2723 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
2724 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
2725 | 2725 | if ($lac == 'S') $latitude = '-'.$latitude; |
2726 | 2726 | if ($lnc == 'W') $longitude = '-'.$longitude; |
2727 | 2727 | $data['center_latitude'] = $latitude; |
2728 | 2728 | $data['center_longitude'] = $longitude; |
2729 | 2729 | $data['radius'] = intval($radius); |
2730 | 2730 | |
2731 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
2731 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2732 | 2732 | $data['text'] = $match[1]; |
2733 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
2733 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
2734 | 2734 | $fromto = $match[1]; |
2735 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
2735 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2736 | 2736 | $fromall = trim($match[1]); |
2737 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
2737 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2738 | 2738 | $from = trim($match[1]); |
2739 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2740 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
2739 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
2740 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2741 | 2741 | $toall = trim($match[1]); |
2742 | - if (!preg_match(':Permanent:',$toall)) { |
|
2743 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
2742 | + if (!preg_match(':Permanent:', $toall)) { |
|
2743 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2744 | 2744 | $to = trim($match[1]); |
2745 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
2745 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2746 | 2746 | $data['permanent'] = 0; |
2747 | 2747 | } else { |
2748 | 2748 | $data['date_end'] = NULL; |
@@ -2750,7 +2750,7 @@ discard block |
||
2750 | 2750 | } |
2751 | 2751 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2752 | 2752 | $NOTAM = new NOTAM(); |
2753 | - $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
2753 | + $NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
2754 | 2754 | unset($data); |
2755 | 2755 | } |
2756 | 2756 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2773,16 +2773,16 @@ discard block |
||
2773 | 2773 | $Connection = new Connection(); |
2774 | 2774 | $sth = $Connection->db->prepare($query); |
2775 | 2775 | $sth->execute(); |
2776 | - } catch(PDOException $e) { |
|
2776 | + } catch (PDOException $e) { |
|
2777 | 2777 | return "error : ".$e->getMessage(); |
2778 | 2778 | } |
2779 | 2779 | } |
2780 | 2780 | $Common = new Common(); |
2781 | 2781 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2782 | - $airspace_json = json_decode($airspace_lst,true); |
|
2782 | + $airspace_json = json_decode($airspace_lst, true); |
|
2783 | 2783 | foreach ($airspace_json['records'] as $airspace) { |
2784 | 2784 | if ($globalDebug) echo $airspace['name']."...\n"; |
2785 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
2785 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2786 | 2786 | if (file_exists($tmp_dir.$airspace['name'])) { |
2787 | 2787 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
2788 | 2788 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2804,7 +2804,7 @@ discard block |
||
2804 | 2804 | $Connection = new Connection(); |
2805 | 2805 | $sth = $Connection->db->prepare($query); |
2806 | 2806 | $sth->execute(array(':new' => $new, ':old' => $old)); |
2807 | - } catch(PDOException $e) { |
|
2807 | + } catch (PDOException $e) { |
|
2808 | 2808 | return "error : ".$e->getMessage(); |
2809 | 2809 | } |
2810 | 2810 | } |
@@ -2821,7 +2821,7 @@ discard block |
||
2821 | 2821 | $Connection = new Connection(); |
2822 | 2822 | $sth = $Connection->db->prepare($query); |
2823 | 2823 | $sth->execute(); |
2824 | - } catch(PDOException $e) { |
|
2824 | + } catch (PDOException $e) { |
|
2825 | 2825 | return "error : ".$e->getMessage(); |
2826 | 2826 | } |
2827 | 2827 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2836,7 +2836,7 @@ discard block |
||
2836 | 2836 | $Connection = new Connection(); |
2837 | 2837 | $sth = $Connection->db->prepare($query); |
2838 | 2838 | $sth->execute(); |
2839 | - } catch(PDOException $e) { |
|
2839 | + } catch (PDOException $e) { |
|
2840 | 2840 | return "error : ".$e->getMessage(); |
2841 | 2841 | } |
2842 | 2842 | } |
@@ -2847,7 +2847,7 @@ discard block |
||
2847 | 2847 | $Connection = new Connection(); |
2848 | 2848 | $sth = $Connection->db->prepare($query); |
2849 | 2849 | $sth->execute(array(':version' => $version)); |
2850 | - } catch(PDOException $e) { |
|
2850 | + } catch (PDOException $e) { |
|
2851 | 2851 | return "error : ".$e->getMessage(); |
2852 | 2852 | } |
2853 | 2853 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2861,7 +2861,7 @@ discard block |
||
2861 | 2861 | $Connection = new Connection(); |
2862 | 2862 | $sth = $Connection->db->prepare($query); |
2863 | 2863 | $sth->execute(array(':version' => $version)); |
2864 | - } catch(PDOException $e) { |
|
2864 | + } catch (PDOException $e) { |
|
2865 | 2865 | return "error : ".$e->getMessage(); |
2866 | 2866 | } |
2867 | 2867 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2875,7 +2875,7 @@ discard block |
||
2875 | 2875 | $Connection = new Connection(); |
2876 | 2876 | $sth = $Connection->db->prepare($query); |
2877 | 2877 | $sth->execute(array(':version' => $version)); |
2878 | - } catch(PDOException $e) { |
|
2878 | + } catch (PDOException $e) { |
|
2879 | 2879 | return "error : ".$e->getMessage(); |
2880 | 2880 | } |
2881 | 2881 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2889,7 +2889,7 @@ discard block |
||
2889 | 2889 | $Connection = new Connection(); |
2890 | 2890 | $sth = $Connection->db->prepare($query); |
2891 | 2891 | $sth->execute(array(':version' => $version)); |
2892 | - } catch(PDOException $e) { |
|
2892 | + } catch (PDOException $e) { |
|
2893 | 2893 | return "error : ".$e->getMessage(); |
2894 | 2894 | } |
2895 | 2895 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2905,7 +2905,7 @@ discard block |
||
2905 | 2905 | $Connection = new Connection(); |
2906 | 2906 | $sth = $Connection->db->prepare($query); |
2907 | 2907 | $sth->execute(array(':version' => $version)); |
2908 | - } catch(PDOException $e) { |
|
2908 | + } catch (PDOException $e) { |
|
2909 | 2909 | return "error : ".$e->getMessage(); |
2910 | 2910 | } |
2911 | 2911 | } |
@@ -2917,7 +2917,7 @@ discard block |
||
2917 | 2917 | $Connection = new Connection(); |
2918 | 2918 | $sth = $Connection->db->prepare($query); |
2919 | 2919 | $sth->execute(array(':version' => $version)); |
2920 | - } catch(PDOException $e) { |
|
2920 | + } catch (PDOException $e) { |
|
2921 | 2921 | return "error : ".$e->getMessage(); |
2922 | 2922 | } |
2923 | 2923 | } |
@@ -2929,7 +2929,7 @@ discard block |
||
2929 | 2929 | $Connection = new Connection(); |
2930 | 2930 | $sth = $Connection->db->prepare($query); |
2931 | 2931 | $sth->execute(array(':version' => $version)); |
2932 | - } catch(PDOException $e) { |
|
2932 | + } catch (PDOException $e) { |
|
2933 | 2933 | return "error : ".$e->getMessage(); |
2934 | 2934 | } |
2935 | 2935 | } |
@@ -2941,7 +2941,7 @@ discard block |
||
2941 | 2941 | $Connection = new Connection(); |
2942 | 2942 | $sth = $Connection->db->prepare($query); |
2943 | 2943 | $sth->execute(array(':version' => $version)); |
2944 | - } catch(PDOException $e) { |
|
2944 | + } catch (PDOException $e) { |
|
2945 | 2945 | return "error : ".$e->getMessage(); |
2946 | 2946 | } |
2947 | 2947 | } |
@@ -2957,7 +2957,7 @@ discard block |
||
2957 | 2957 | $Connection = new Connection(); |
2958 | 2958 | $sth = $Connection->db->prepare($query); |
2959 | 2959 | $sth->execute(); |
2960 | - } catch(PDOException $e) { |
|
2960 | + } catch (PDOException $e) { |
|
2961 | 2961 | return "error : ".$e->getMessage(); |
2962 | 2962 | } |
2963 | 2963 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2972,7 +2972,7 @@ discard block |
||
2972 | 2972 | $Connection = new Connection(); |
2973 | 2973 | $sth = $Connection->db->prepare($query); |
2974 | 2974 | $sth->execute(); |
2975 | - } catch(PDOException $e) { |
|
2975 | + } catch (PDOException $e) { |
|
2976 | 2976 | return "error : ".$e->getMessage(); |
2977 | 2977 | } |
2978 | 2978 | } |
@@ -2988,7 +2988,7 @@ discard block |
||
2988 | 2988 | $Connection = new Connection(); |
2989 | 2989 | $sth = $Connection->db->prepare($query); |
2990 | 2990 | $sth->execute(); |
2991 | - } catch(PDOException $e) { |
|
2991 | + } catch (PDOException $e) { |
|
2992 | 2992 | return "error : ".$e->getMessage(); |
2993 | 2993 | } |
2994 | 2994 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3003,7 +3003,7 @@ discard block |
||
3003 | 3003 | $Connection = new Connection(); |
3004 | 3004 | $sth = $Connection->db->prepare($query); |
3005 | 3005 | $sth->execute(); |
3006 | - } catch(PDOException $e) { |
|
3006 | + } catch (PDOException $e) { |
|
3007 | 3007 | return "error : ".$e->getMessage(); |
3008 | 3008 | } |
3009 | 3009 | } |
@@ -3019,7 +3019,7 @@ discard block |
||
3019 | 3019 | $Connection = new Connection(); |
3020 | 3020 | $sth = $Connection->db->prepare($query); |
3021 | 3021 | $sth->execute(); |
3022 | - } catch(PDOException $e) { |
|
3022 | + } catch (PDOException $e) { |
|
3023 | 3023 | return "error : ".$e->getMessage(); |
3024 | 3024 | } |
3025 | 3025 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3034,7 +3034,7 @@ discard block |
||
3034 | 3034 | $Connection = new Connection(); |
3035 | 3035 | $sth = $Connection->db->prepare($query); |
3036 | 3036 | $sth->execute(); |
3037 | - } catch(PDOException $e) { |
|
3037 | + } catch (PDOException $e) { |
|
3038 | 3038 | return "error : ".$e->getMessage(); |
3039 | 3039 | } |
3040 | 3040 | } |
@@ -3050,7 +3050,7 @@ discard block |
||
3050 | 3050 | $Connection = new Connection(); |
3051 | 3051 | $sth = $Connection->db->prepare($query); |
3052 | 3052 | $sth->execute(); |
3053 | - } catch(PDOException $e) { |
|
3053 | + } catch (PDOException $e) { |
|
3054 | 3054 | return "error : ".$e->getMessage(); |
3055 | 3055 | } |
3056 | 3056 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3065,7 +3065,7 @@ discard block |
||
3065 | 3065 | $Connection = new Connection(); |
3066 | 3066 | $sth = $Connection->db->prepare($query); |
3067 | 3067 | $sth->execute(); |
3068 | - } catch(PDOException $e) { |
|
3068 | + } catch (PDOException $e) { |
|
3069 | 3069 | return "error : ".$e->getMessage(); |
3070 | 3070 | } |
3071 | 3071 | } |
@@ -3080,7 +3080,7 @@ discard block |
||
3080 | 3080 | $Connection = new Connection(); |
3081 | 3081 | $sth = $Connection->db->prepare($query); |
3082 | 3082 | $sth->execute(); |
3083 | - } catch(PDOException $e) { |
|
3083 | + } catch (PDOException $e) { |
|
3084 | 3084 | return "error : ".$e->getMessage(); |
3085 | 3085 | } |
3086 | 3086 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3095,7 +3095,7 @@ discard block |
||
3095 | 3095 | $Connection = new Connection(); |
3096 | 3096 | $sth = $Connection->db->prepare($query); |
3097 | 3097 | $sth->execute(); |
3098 | - } catch(PDOException $e) { |
|
3098 | + } catch (PDOException $e) { |
|
3099 | 3099 | return "error : ".$e->getMessage(); |
3100 | 3100 | } |
3101 | 3101 | } |
@@ -3111,7 +3111,7 @@ discard block |
||
3111 | 3111 | $Connection = new Connection(); |
3112 | 3112 | $sth = $Connection->db->prepare($query); |
3113 | 3113 | $sth->execute(); |
3114 | - } catch(PDOException $e) { |
|
3114 | + } catch (PDOException $e) { |
|
3115 | 3115 | return "error : ".$e->getMessage(); |
3116 | 3116 | } |
3117 | 3117 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3126,7 +3126,7 @@ discard block |
||
3126 | 3126 | $Connection = new Connection(); |
3127 | 3127 | $sth = $Connection->db->prepare($query); |
3128 | 3128 | $sth->execute(); |
3129 | - } catch(PDOException $e) { |
|
3129 | + } catch (PDOException $e) { |
|
3130 | 3130 | return "error : ".$e->getMessage(); |
3131 | 3131 | } |
3132 | 3132 | } |
@@ -3142,7 +3142,7 @@ discard block |
||
3142 | 3142 | $Connection = new Connection(); |
3143 | 3143 | $sth = $Connection->db->prepare($query); |
3144 | 3144 | $sth->execute(); |
3145 | - } catch(PDOException $e) { |
|
3145 | + } catch (PDOException $e) { |
|
3146 | 3146 | return "error : ".$e->getMessage(); |
3147 | 3147 | } |
3148 | 3148 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3157,7 +3157,7 @@ discard block |
||
3157 | 3157 | $Connection = new Connection(); |
3158 | 3158 | $sth = $Connection->db->prepare($query); |
3159 | 3159 | $sth->execute(); |
3160 | - } catch(PDOException $e) { |
|
3160 | + } catch (PDOException $e) { |
|
3161 | 3161 | return "error : ".$e->getMessage(); |
3162 | 3162 | } |
3163 | 3163 | } |
@@ -3173,7 +3173,7 @@ discard block |
||
3173 | 3173 | $Connection = new Connection(); |
3174 | 3174 | $sth = $Connection->db->prepare($query); |
3175 | 3175 | $sth->execute(); |
3176 | - } catch(PDOException $e) { |
|
3176 | + } catch (PDOException $e) { |
|
3177 | 3177 | return "error : ".$e->getMessage(); |
3178 | 3178 | } |
3179 | 3179 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3188,7 +3188,7 @@ discard block |
||
3188 | 3188 | $Connection = new Connection(); |
3189 | 3189 | $sth = $Connection->db->prepare($query); |
3190 | 3190 | $sth->execute(); |
3191 | - } catch(PDOException $e) { |
|
3191 | + } catch (PDOException $e) { |
|
3192 | 3192 | return "error : ".$e->getMessage(); |
3193 | 3193 | } |
3194 | 3194 | } |
@@ -3204,7 +3204,7 @@ discard block |
||
3204 | 3204 | $Connection = new Connection(); |
3205 | 3205 | $sth = $Connection->db->prepare($query); |
3206 | 3206 | $sth->execute(); |
3207 | - } catch(PDOException $e) { |
|
3207 | + } catch (PDOException $e) { |
|
3208 | 3208 | return "error : ".$e->getMessage(); |
3209 | 3209 | } |
3210 | 3210 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3223,7 +3223,7 @@ discard block |
||
3223 | 3223 | $Connection = new Connection(); |
3224 | 3224 | $sth = $Connection->db->prepare($query); |
3225 | 3225 | $sth->execute(); |
3226 | - } catch(PDOException $e) { |
|
3226 | + } catch (PDOException $e) { |
|
3227 | 3227 | return "error : ".$e->getMessage(); |
3228 | 3228 | } |
3229 | 3229 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3238,7 +3238,7 @@ discard block |
||
3238 | 3238 | $Connection = new Connection(); |
3239 | 3239 | $sth = $Connection->db->prepare($query); |
3240 | 3240 | $sth->execute(); |
3241 | - } catch(PDOException $e) { |
|
3241 | + } catch (PDOException $e) { |
|
3242 | 3242 | return "error : ".$e->getMessage(); |
3243 | 3243 | } |
3244 | 3244 | } |
@@ -3250,7 +3250,7 @@ discard block |
||
3250 | 3250 | $Connection = new Connection(); |
3251 | 3251 | $sth = $Connection->db->prepare($query); |
3252 | 3252 | $sth->execute(); |
3253 | - } catch(PDOException $e) { |
|
3253 | + } catch (PDOException $e) { |
|
3254 | 3254 | return "error : ".$e->getMessage(); |
3255 | 3255 | } |
3256 | 3256 | } |
@@ -3266,7 +3266,7 @@ discard block |
||
3266 | 3266 | $Connection = new Connection(); |
3267 | 3267 | $sth = $Connection->db->prepare($query); |
3268 | 3268 | $sth->execute(); |
3269 | - } catch(PDOException $e) { |
|
3269 | + } catch (PDOException $e) { |
|
3270 | 3270 | return "error : ".$e->getMessage(); |
3271 | 3271 | } |
3272 | 3272 | } |
@@ -3281,7 +3281,7 @@ discard block |
||
3281 | 3281 | $Connection = new Connection(); |
3282 | 3282 | $sth = $Connection->db->prepare($query); |
3283 | 3283 | $sth->execute(); |
3284 | - } catch(PDOException $e) { |
|
3284 | + } catch (PDOException $e) { |
|
3285 | 3285 | return "error : ".$e->getMessage(); |
3286 | 3286 | } |
3287 | 3287 | } |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | curl_setopt($ch, CURLOPT_URL, $url); |
18 | 18 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
19 | 19 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
20 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
20 | + if ($referer != '') { |
|
21 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
22 | + } |
|
21 | 23 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
22 | 24 | curl_setopt($ch, CURLOPT_FILE, $fp); |
23 | 25 | curl_exec($ch); |
@@ -28,12 +30,16 @@ discard block |
||
28 | 30 | public static function gunzip($in_file,$out_file_name = '') { |
29 | 31 | //echo $in_file.' -> '.$out_file_name."\n"; |
30 | 32 | $buffer_size = 4096; // read 4kb at a time |
31 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
33 | + if ($out_file_name == '') { |
|
34 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
35 | + } |
|
32 | 36 | if ($in_file != '' && file_exists($in_file)) { |
33 | 37 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
34 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
35 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
36 | - else { |
|
38 | + if (function_exists('gzopen')) { |
|
39 | + $file = gzopen($in_file,'rb'); |
|
40 | + } elseif (function_exists('gzopen64')) { |
|
41 | + $file = gzopen64($in_file,'rb'); |
|
42 | + } else { |
|
37 | 43 | echo 'gzopen not available'; |
38 | 44 | die; |
39 | 45 | } |
@@ -54,8 +60,12 @@ discard block |
||
54 | 60 | if ($res === TRUE) { |
55 | 61 | $zip->extractTo($path); |
56 | 62 | $zip->close(); |
57 | - } else return false; |
|
58 | - } else return false; |
|
63 | + } else { |
|
64 | + return false; |
|
65 | + } |
|
66 | + } else { |
|
67 | + return false; |
|
68 | + } |
|
59 | 69 | } |
60 | 70 | |
61 | 71 | public static function connect_sqlite($database) { |
@@ -70,7 +80,9 @@ discard block |
||
70 | 80 | public static function retrieve_route_sqlite_to_dest($database_file) { |
71 | 81 | global $globalDebug, $globalTransaction; |
72 | 82 | //$query = 'TRUNCATE TABLE routes'; |
73 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
83 | + if ($globalDebug) { |
|
84 | + echo " - Delete previous routes from DB -"; |
|
85 | + } |
|
74 | 86 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
75 | 87 | $Connection = new Connection(); |
76 | 88 | try { |
@@ -81,7 +93,9 @@ discard block |
||
81 | 93 | return "error : ".$e->getMessage(); |
82 | 94 | } |
83 | 95 | |
84 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
96 | + if ($globalDebug) { |
|
97 | + echo " - Add routes to DB -"; |
|
98 | + } |
|
85 | 99 | update_db::connect_sqlite($database_file); |
86 | 100 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
87 | 101 | $query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID"; |
@@ -96,15 +110,21 @@ discard block |
||
96 | 110 | $Connection = new Connection(); |
97 | 111 | $sth_dest = $Connection->db->prepare($query_dest); |
98 | 112 | try { |
99 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
113 | + if ($globalTransaction) { |
|
114 | + $Connection->db->beginTransaction(); |
|
115 | + } |
|
100 | 116 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
101 | 117 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
102 | 118 | $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
103 | 119 | $sth_dest->execute($query_dest_values); |
104 | 120 | } |
105 | - if ($globalTransaction) $Connection->db->commit(); |
|
121 | + if ($globalTransaction) { |
|
122 | + $Connection->db->commit(); |
|
123 | + } |
|
106 | 124 | } catch(PDOException $e) { |
107 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
125 | + if ($globalTransaction) { |
|
126 | + $Connection->db->rollBack(); |
|
127 | + } |
|
108 | 128 | return "error : ".$e->getMessage(); |
109 | 129 | } |
110 | 130 | return ''; |
@@ -112,7 +132,9 @@ discard block |
||
112 | 132 | public static function retrieve_route_oneworld($database_file) { |
113 | 133 | global $globalDebug, $globalTransaction; |
114 | 134 | //$query = 'TRUNCATE TABLE routes'; |
115 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
135 | + if ($globalDebug) { |
|
136 | + echo " - Delete previous routes from DB -"; |
|
137 | + } |
|
116 | 138 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
117 | 139 | $Connection = new Connection(); |
118 | 140 | try { |
@@ -123,14 +145,18 @@ discard block |
||
123 | 145 | return "error : ".$e->getMessage(); |
124 | 146 | } |
125 | 147 | |
126 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
148 | + if ($globalDebug) { |
|
149 | + echo " - Add routes to DB -"; |
|
150 | + } |
|
127 | 151 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
128 | 152 | $Spotter = new Spotter(); |
129 | 153 | if ($fh = fopen($database_file,"r")) { |
130 | 154 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
131 | 155 | $Connection = new Connection(); |
132 | 156 | $sth_dest = $Connection->db->prepare($query_dest); |
133 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
157 | + if ($globalTransaction) { |
|
158 | + $Connection->db->beginTransaction(); |
|
159 | + } |
|
134 | 160 | while (!feof($fh)) { |
135 | 161 | $line = fgetcsv($fh,9999,','); |
136 | 162 | if ($line[0] != '') { |
@@ -139,13 +165,17 @@ discard block |
||
139 | 165 | $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
140 | 166 | $sth_dest->execute($query_dest_values); |
141 | 167 | } catch(PDOException $e) { |
142 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
168 | + if ($globalTransaction) { |
|
169 | + $Connection->db->rollBack(); |
|
170 | + } |
|
143 | 171 | return "error : ".$e->getMessage(); |
144 | 172 | } |
145 | 173 | } |
146 | 174 | } |
147 | 175 | } |
148 | - if ($globalTransaction) $Connection->db->commit(); |
|
176 | + if ($globalTransaction) { |
|
177 | + $Connection->db->commit(); |
|
178 | + } |
|
149 | 179 | } |
150 | 180 | return ''; |
151 | 181 | } |
@@ -153,7 +183,9 @@ discard block |
||
153 | 183 | public static function retrieve_route_skyteam($database_file) { |
154 | 184 | global $globalDebug, $globalTransaction; |
155 | 185 | //$query = 'TRUNCATE TABLE routes'; |
156 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
186 | + if ($globalDebug) { |
|
187 | + echo " - Delete previous routes from DB -"; |
|
188 | + } |
|
157 | 189 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
158 | 190 | $Connection = new Connection(); |
159 | 191 | try { |
@@ -164,7 +196,9 @@ discard block |
||
164 | 196 | return "error : ".$e->getMessage(); |
165 | 197 | } |
166 | 198 | |
167 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
199 | + if ($globalDebug) { |
|
200 | + echo " - Add routes to DB -"; |
|
201 | + } |
|
168 | 202 | |
169 | 203 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
170 | 204 | $Spotter = new Spotter(); |
@@ -173,7 +207,9 @@ discard block |
||
173 | 207 | $Connection = new Connection(); |
174 | 208 | $sth_dest = $Connection->db->prepare($query_dest); |
175 | 209 | try { |
176 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
210 | + if ($globalTransaction) { |
|
211 | + $Connection->db->beginTransaction(); |
|
212 | + } |
|
177 | 213 | while (!feof($fh)) { |
178 | 214 | $line = fgetcsv($fh,9999,','); |
179 | 215 | if ($line[0] != '') { |
@@ -184,9 +220,13 @@ discard block |
||
184 | 220 | } |
185 | 221 | } |
186 | 222 | } |
187 | - if ($globalTransaction) $Connection->db->commit(); |
|
223 | + if ($globalTransaction) { |
|
224 | + $Connection->db->commit(); |
|
225 | + } |
|
188 | 226 | } catch(PDOException $e) { |
189 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
227 | + if ($globalTransaction) { |
|
228 | + $Connection->db->rollBack(); |
|
229 | + } |
|
190 | 230 | return "error : ".$e->getMessage(); |
191 | 231 | } |
192 | 232 | } |
@@ -229,11 +269,16 @@ discard block |
||
229 | 269 | $sth_dest = $Connection->db->prepare($query_dest); |
230 | 270 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
231 | 271 | try { |
232 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
272 | + if ($globalTransaction) { |
|
273 | + $Connection->db->beginTransaction(); |
|
274 | + } |
|
233 | 275 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
234 | 276 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
235 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
236 | - else $type = null; |
|
277 | + if ($values['UserString4'] == 'M') { |
|
278 | + $type = 'military'; |
|
279 | + } else { |
|
280 | + $type = null; |
|
281 | + } |
|
237 | 282 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
238 | 283 | $sth_dest->execute($query_dest_values); |
239 | 284 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -241,7 +286,9 @@ discard block |
||
241 | 286 | $sth_dest_owner->execute($query_dest_owner_values); |
242 | 287 | } |
243 | 288 | } |
244 | - if ($globalTransaction) $Connection->db->commit(); |
|
289 | + if ($globalTransaction) { |
|
290 | + $Connection->db->commit(); |
|
291 | + } |
|
245 | 292 | } catch(PDOException $e) { |
246 | 293 | return "error : ".$e->getMessage(); |
247 | 294 | } |
@@ -278,7 +325,9 @@ discard block |
||
278 | 325 | $Connection = new Connection(); |
279 | 326 | $sth_dest = $Connection->db->prepare($query_dest); |
280 | 327 | try { |
281 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
328 | + if ($globalTransaction) { |
|
329 | + $Connection->db->beginTransaction(); |
|
330 | + } |
|
282 | 331 | while (!feof($fh)) { |
283 | 332 | $values = array(); |
284 | 333 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -289,7 +338,9 @@ discard block |
||
289 | 338 | // Check if we can find ICAO, else set it to GLID |
290 | 339 | $aircraft_name_split = explode(' ',$aircraft_name); |
291 | 340 | $search_more = ''; |
292 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
341 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
342 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
343 | + } |
|
293 | 344 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
294 | 345 | $sth_search = $Connection->db->prepare($query_search); |
295 | 346 | try { |
@@ -302,7 +353,9 @@ discard block |
||
302 | 353 | } catch(PDOException $e) { |
303 | 354 | return "error : ".$e->getMessage(); |
304 | 355 | } |
305 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
356 | + if (!isset($values['ICAOTypeCode'])) { |
|
357 | + $values['ICAOTypeCode'] = 'GLID'; |
|
358 | + } |
|
306 | 359 | // Add data to db |
307 | 360 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
308 | 361 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
@@ -311,7 +364,9 @@ discard block |
||
311 | 364 | $sth_dest->execute($query_dest_values); |
312 | 365 | } |
313 | 366 | } |
314 | - if ($globalTransaction) $Connection->db->commit(); |
|
367 | + if ($globalTransaction) { |
|
368 | + $Connection->db->commit(); |
|
369 | + } |
|
315 | 370 | } catch(PDOException $e) { |
316 | 371 | return "error : ".$e->getMessage(); |
317 | 372 | } |
@@ -347,7 +402,9 @@ discard block |
||
347 | 402 | $Connection = new Connection(); |
348 | 403 | $sth_dest = $Connection->db->prepare($query_dest); |
349 | 404 | try { |
350 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
405 | + if ($globalTransaction) { |
|
406 | + $Connection->db->beginTransaction(); |
|
407 | + } |
|
351 | 408 | $tmp = fgetcsv($fh,9999,',',"'"); |
352 | 409 | while (!feof($fh)) { |
353 | 410 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -361,13 +418,17 @@ discard block |
||
361 | 418 | // Check if we can find ICAO, else set it to GLID |
362 | 419 | $aircraft_name_split = explode(' ',$aircraft_name); |
363 | 420 | $search_more = ''; |
364 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
421 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
422 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
423 | + } |
|
365 | 424 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
366 | 425 | $sth_search = $Connection->db->prepare($query_search); |
367 | 426 | try { |
368 | 427 | $sth_search->execute(); |
369 | 428 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
370 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
429 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
430 | + $values['ICAOTypeCode'] = $result['icao']; |
|
431 | + } |
|
371 | 432 | } catch(PDOException $e) { |
372 | 433 | return "error : ".$e->getMessage(); |
373 | 434 | } |
@@ -380,7 +441,9 @@ discard block |
||
380 | 441 | $sth_dest->execute($query_dest_values); |
381 | 442 | } |
382 | 443 | } |
383 | - if ($globalTransaction) $Connection->db->commit(); |
|
444 | + if ($globalTransaction) { |
|
445 | + $Connection->db->commit(); |
|
446 | + } |
|
384 | 447 | } catch(PDOException $e) { |
385 | 448 | return "error : ".$e->getMessage(); |
386 | 449 | } |
@@ -419,7 +482,9 @@ discard block |
||
419 | 482 | $sth_dest = $Connection->db->prepare($query_dest); |
420 | 483 | $sth_modes = $Connection->db->prepare($query_modes); |
421 | 484 | try { |
422 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
485 | + if ($globalTransaction) { |
|
486 | + $Connection->db->beginTransaction(); |
|
487 | + } |
|
423 | 488 | $tmp = fgetcsv($fh,9999,',','"'); |
424 | 489 | while (!feof($fh)) { |
425 | 490 | $line = fgetcsv($fh,9999,',','"'); |
@@ -429,16 +494,22 @@ discard block |
||
429 | 494 | $values['registration'] = $line[0]; |
430 | 495 | $values['base'] = $line[4]; |
431 | 496 | $values['owner'] = $line[5]; |
432 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
433 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
497 | + if ($line[6] == '') { |
|
498 | + $values['date_first_reg'] = null; |
|
499 | + } else { |
|
500 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
501 | + } |
|
434 | 502 | $values['cancel'] = $line[7]; |
435 | 503 | } elseif ($country == 'EI') { |
436 | 504 | // TODO : add modeS & reg to aircraft_modes |
437 | 505 | $values['registration'] = $line[0]; |
438 | 506 | $values['base'] = $line[3]; |
439 | 507 | $values['owner'] = $line[2]; |
440 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
441 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
508 | + if ($line[1] == '') { |
|
509 | + $values['date_first_reg'] = null; |
|
510 | + } else { |
|
511 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
512 | + } |
|
442 | 513 | $values['cancel'] = ''; |
443 | 514 | $values['modes'] = $line[7]; |
444 | 515 | $values['icao'] = $line[8]; |
@@ -457,16 +528,22 @@ discard block |
||
457 | 528 | $values['registration'] = $line[3]; |
458 | 529 | $values['base'] = null; |
459 | 530 | $values['owner'] = $line[5]; |
460 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
461 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
531 | + if ($line[18] == '') { |
|
532 | + $values['date_first_reg'] = null; |
|
533 | + } else { |
|
534 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
535 | + } |
|
462 | 536 | $values['cancel'] = ''; |
463 | 537 | } elseif ($country == 'VH') { |
464 | 538 | // TODO : add modeS & reg to aircraft_modes |
465 | 539 | $values['registration'] = $line[0]; |
466 | 540 | $values['base'] = null; |
467 | 541 | $values['owner'] = $line[12]; |
468 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
469 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
542 | + if ($line[28] == '') { |
|
543 | + $values['date_first_reg'] = null; |
|
544 | + } else { |
|
545 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
546 | + } |
|
470 | 547 | |
471 | 548 | $values['cancel'] = $line[39]; |
472 | 549 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -485,29 +562,41 @@ discard block |
||
485 | 562 | $values['registration'] = $line[0]; |
486 | 563 | $values['base'] = null; |
487 | 564 | $values['owner'] = $line[8]; |
488 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
489 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
565 | + if ($line[7] == '') { |
|
566 | + $values['date_first_reg'] = null; |
|
567 | + } else { |
|
568 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
569 | + } |
|
490 | 570 | $values['cancel'] = ''; |
491 | 571 | } elseif ($country == 'PP') { |
492 | 572 | $values['registration'] = $line[0]; |
493 | 573 | $values['base'] = null; |
494 | 574 | $values['owner'] = $line[4]; |
495 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
496 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
575 | + if ($line[6] == '') { |
|
576 | + $values['date_first_reg'] = null; |
|
577 | + } else { |
|
578 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
579 | + } |
|
497 | 580 | $values['cancel'] = $line[7]; |
498 | 581 | } elseif ($country == 'E7') { |
499 | 582 | $values['registration'] = $line[0]; |
500 | 583 | $values['base'] = null; |
501 | 584 | $values['owner'] = $line[4]; |
502 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
503 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
585 | + if ($line[5] == '') { |
|
586 | + $values['date_first_reg'] = null; |
|
587 | + } else { |
|
588 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
589 | + } |
|
504 | 590 | $values['cancel'] = ''; |
505 | 591 | } elseif ($country == '8Q') { |
506 | 592 | $values['registration'] = $line[0]; |
507 | 593 | $values['base'] = null; |
508 | 594 | $values['owner'] = $line[3]; |
509 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
510 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
595 | + if ($line[7] == '') { |
|
596 | + $values['date_first_reg'] = null; |
|
597 | + } else { |
|
598 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
599 | + } |
|
511 | 600 | $values['cancel'] = ''; |
512 | 601 | } elseif ($country == 'ZK') { |
513 | 602 | $values['registration'] = $line[0]; |
@@ -552,7 +641,9 @@ discard block |
||
552 | 641 | $sth_modes->execute($query_modes_values); |
553 | 642 | } |
554 | 643 | } |
555 | - if ($globalTransaction) $Connection->db->commit(); |
|
644 | + if ($globalTransaction) { |
|
645 | + $Connection->db->commit(); |
|
646 | + } |
|
556 | 647 | } catch(PDOException $e) { |
557 | 648 | return "error : ".$e->getMessage(); |
558 | 649 | } |
@@ -688,25 +779,45 @@ discard block |
||
688 | 779 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
689 | 780 | $Connection = new Connection(); |
690 | 781 | $sth_dest = $Connection->db->prepare($query_dest); |
691 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
782 | + if ($globalTransaction) { |
|
783 | + $Connection->db->beginTransaction(); |
|
784 | + } |
|
692 | 785 | |
693 | 786 | $i = 0; |
694 | 787 | while($row = sparql_fetch_array($result)) |
695 | 788 | { |
696 | 789 | if ($i >= 1) { |
697 | 790 | //print_r($row); |
698 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
699 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
700 | - if (!isset($row['type'])) $row['type'] = ''; |
|
701 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
791 | + if (!isset($row['iata'])) { |
|
792 | + $row['iata'] = ''; |
|
793 | + } |
|
794 | + if (!isset($row['icao'])) { |
|
795 | + $row['icao'] = ''; |
|
796 | + } |
|
797 | + if (!isset($row['type'])) { |
|
798 | + $row['type'] = ''; |
|
799 | + } |
|
800 | + if (!isset($row['altitude'])) { |
|
801 | + $row['altitude'] = ''; |
|
802 | + } |
|
702 | 803 | if (isset($row['city_bis'])) { |
703 | 804 | $row['city'] = $row['city_bis']; |
704 | 805 | } |
705 | - if (!isset($row['city'])) $row['city'] = ''; |
|
706 | - if (!isset($row['country'])) $row['country'] = ''; |
|
707 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
708 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
709 | - if (!isset($row['name'])) continue; |
|
806 | + if (!isset($row['city'])) { |
|
807 | + $row['city'] = ''; |
|
808 | + } |
|
809 | + if (!isset($row['country'])) { |
|
810 | + $row['country'] = ''; |
|
811 | + } |
|
812 | + if (!isset($row['homepage'])) { |
|
813 | + $row['homepage'] = ''; |
|
814 | + } |
|
815 | + if (!isset($row['wikipedia_page'])) { |
|
816 | + $row['wikipedia_page'] = ''; |
|
817 | + } |
|
818 | + if (!isset($row['name'])) { |
|
819 | + continue; |
|
820 | + } |
|
710 | 821 | if (!isset($row['image'])) { |
711 | 822 | $row['image'] = ''; |
712 | 823 | $row['image_thumb'] = ''; |
@@ -762,7 +873,9 @@ discard block |
||
762 | 873 | |
763 | 874 | $i++; |
764 | 875 | } |
765 | - if ($globalTransaction) $Connection->db->commit(); |
|
876 | + if ($globalTransaction) { |
|
877 | + $Connection->db->commit(); |
|
878 | + } |
|
766 | 879 | /* |
767 | 880 | echo "Delete duplicate rows...\n"; |
768 | 881 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
@@ -805,7 +918,9 @@ discard block |
||
805 | 918 | $delimiter = ','; |
806 | 919 | $out_file = $tmp_dir.'airports.csv'; |
807 | 920 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
808 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
921 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
922 | + return FALSE; |
|
923 | + } |
|
809 | 924 | echo "Add data from ourairports.com...\n"; |
810 | 925 | |
811 | 926 | $header = NULL; |
@@ -815,8 +930,9 @@ discard block |
||
815 | 930 | //$Connection->db->beginTransaction(); |
816 | 931 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
817 | 932 | { |
818 | - if(!$header) $header = $row; |
|
819 | - else { |
|
933 | + if(!$header) { |
|
934 | + $header = $row; |
|
935 | + } else { |
|
820 | 936 | $data = array(); |
821 | 937 | $data = array_combine($header, $row); |
822 | 938 | try { |
@@ -857,7 +973,9 @@ discard block |
||
857 | 973 | echo "Download data from another free database...\n"; |
858 | 974 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
859 | 975 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
860 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
976 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
977 | + return FALSE; |
|
978 | + } |
|
861 | 979 | update_db::unzip($out_file); |
862 | 980 | $header = NULL; |
863 | 981 | echo "Add data from another free database...\n"; |
@@ -868,8 +986,9 @@ discard block |
||
868 | 986 | //$Connection->db->beginTransaction(); |
869 | 987 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
870 | 988 | { |
871 | - if(!$header) $header = $row; |
|
872 | - else { |
|
989 | + if(!$header) { |
|
990 | + $header = $row; |
|
991 | + } else { |
|
873 | 992 | $data = $row; |
874 | 993 | |
875 | 994 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
@@ -1038,7 +1157,9 @@ discard block |
||
1038 | 1157 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
1039 | 1158 | { |
1040 | 1159 | $i = 0; |
1041 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1160 | + if ($globalTransaction) { |
|
1161 | + $Connection->db->beginTransaction(); |
|
1162 | + } |
|
1042 | 1163 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1043 | 1164 | { |
1044 | 1165 | if ($i > 0) { |
@@ -1051,7 +1172,9 @@ discard block |
||
1051 | 1172 | } |
1052 | 1173 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
1053 | 1174 | if (!empty($result_search)) { |
1054 | - if ($globalDebug) echo '.'; |
|
1175 | + if ($globalDebug) { |
|
1176 | + echo '.'; |
|
1177 | + } |
|
1055 | 1178 | //if ($globalDBdriver == 'mysql') { |
1056 | 1179 | // $queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao'; |
1057 | 1180 | //} else { |
@@ -1073,8 +1196,12 @@ discard block |
||
1073 | 1196 | } |
1074 | 1197 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
1075 | 1198 | if (!empty($result_search_mfr)) { |
1076 | - if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23]; |
|
1077 | - if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15]; |
|
1199 | + if (trim($data[16]) == '' && trim($data[23]) != '') { |
|
1200 | + $data[16] = $data[23]; |
|
1201 | + } |
|
1202 | + if (trim($data[16]) == '' && trim($data[15]) != '') { |
|
1203 | + $data[16] = $data[15]; |
|
1204 | + } |
|
1078 | 1205 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1079 | 1206 | try { |
1080 | 1207 | $sthf = $Connection->db->prepare($queryf); |
@@ -1085,7 +1212,9 @@ discard block |
||
1085 | 1212 | } |
1086 | 1213 | } |
1087 | 1214 | if (strtotime($data[29]) > time()) { |
1088 | - if ($globalDebug) echo 'i'; |
|
1215 | + if ($globalDebug) { |
|
1216 | + echo 'i'; |
|
1217 | + } |
|
1089 | 1218 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1090 | 1219 | try { |
1091 | 1220 | $sth = $Connection->db->prepare($query); |
@@ -1096,13 +1225,19 @@ discard block |
||
1096 | 1225 | } |
1097 | 1226 | } |
1098 | 1227 | if ($i % 90 == 0) { |
1099 | - if ($globalTransaction) $Connection->db->commit(); |
|
1100 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1228 | + if ($globalTransaction) { |
|
1229 | + $Connection->db->commit(); |
|
1230 | + } |
|
1231 | + if ($globalTransaction) { |
|
1232 | + $Connection->db->beginTransaction(); |
|
1233 | + } |
|
1101 | 1234 | } |
1102 | 1235 | $i++; |
1103 | 1236 | } |
1104 | 1237 | fclose($handle); |
1105 | - if ($globalTransaction) $Connection->db->commit(); |
|
1238 | + if ($globalTransaction) { |
|
1239 | + $Connection->db->commit(); |
|
1240 | + } |
|
1106 | 1241 | } |
1107 | 1242 | //print_r($mfr); |
1108 | 1243 | return ''; |
@@ -1127,11 +1262,15 @@ discard block |
||
1127 | 1262 | $i = 0; |
1128 | 1263 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1129 | 1264 | //$Connection->db->beginTransaction(); |
1130 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1265 | + if ($globalTransaction) { |
|
1266 | + $Connection->db->beginTransaction(); |
|
1267 | + } |
|
1131 | 1268 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1132 | 1269 | { |
1133 | 1270 | if ($i > 0) { |
1134 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
1271 | + if ($data[1] == 'NULL') { |
|
1272 | + $data[1] = $data[0]; |
|
1273 | + } |
|
1135 | 1274 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1136 | 1275 | try { |
1137 | 1276 | $sth = $Connection->db->prepare($query); |
@@ -1143,7 +1282,9 @@ discard block |
||
1143 | 1282 | $i++; |
1144 | 1283 | } |
1145 | 1284 | fclose($handle); |
1146 | - if ($globalTransaction) $Connection->db->commit(); |
|
1285 | + if ($globalTransaction) { |
|
1286 | + $Connection->db->commit(); |
|
1287 | + } |
|
1147 | 1288 | } |
1148 | 1289 | return ''; |
1149 | 1290 | } |
@@ -1164,7 +1305,9 @@ discard block |
||
1164 | 1305 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
1165 | 1306 | { |
1166 | 1307 | $i = 0; |
1167 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1308 | + if ($globalTransaction) { |
|
1309 | + $Connection->db->beginTransaction(); |
|
1310 | + } |
|
1168 | 1311 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1169 | 1312 | { |
1170 | 1313 | if ($i > 0) { |
@@ -1180,7 +1323,9 @@ discard block |
||
1180 | 1323 | $i++; |
1181 | 1324 | } |
1182 | 1325 | fclose($handle); |
1183 | - if ($globalTransaction) $Connection->db->commit(); |
|
1326 | + if ($globalTransaction) { |
|
1327 | + $Connection->db->commit(); |
|
1328 | + } |
|
1184 | 1329 | } |
1185 | 1330 | return ''; |
1186 | 1331 | } |
@@ -1200,7 +1345,9 @@ discard block |
||
1200 | 1345 | if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE) |
1201 | 1346 | { |
1202 | 1347 | $i = 0; |
1203 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1348 | + if ($globalTransaction) { |
|
1349 | + $Connection->db->beginTransaction(); |
|
1350 | + } |
|
1204 | 1351 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1205 | 1352 | { |
1206 | 1353 | if ($i > 0) { |
@@ -1209,13 +1356,17 @@ discard block |
||
1209 | 1356 | $sth = $Connection->db->prepare($query); |
1210 | 1357 | $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
1211 | 1358 | } catch(PDOException $e) { |
1212 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1359 | + if ($globalDebug) { |
|
1360 | + echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1361 | + } |
|
1213 | 1362 | } |
1214 | 1363 | } |
1215 | 1364 | $i++; |
1216 | 1365 | } |
1217 | 1366 | fclose($handle); |
1218 | - if ($globalTransaction) $Connection->db->commit(); |
|
1367 | + if ($globalTransaction) { |
|
1368 | + $Connection->db->commit(); |
|
1369 | + } |
|
1219 | 1370 | } |
1220 | 1371 | return ''; |
1221 | 1372 | } |
@@ -1240,7 +1391,9 @@ discard block |
||
1240 | 1391 | $i = 0; |
1241 | 1392 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1242 | 1393 | //$Connection->db->beginTransaction(); |
1243 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1394 | + if ($globalTransaction) { |
|
1395 | + $Connection->db->beginTransaction(); |
|
1396 | + } |
|
1244 | 1397 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1245 | 1398 | { |
1246 | 1399 | if ($i > 0) { |
@@ -1256,7 +1409,9 @@ discard block |
||
1256 | 1409 | $i++; |
1257 | 1410 | } |
1258 | 1411 | fclose($handle); |
1259 | - if ($globalTransaction) $Connection->db->commit(); |
|
1412 | + if ($globalTransaction) { |
|
1413 | + $Connection->db->commit(); |
|
1414 | + } |
|
1260 | 1415 | } |
1261 | 1416 | return ''; |
1262 | 1417 | } |
@@ -1276,7 +1431,9 @@ discard block |
||
1276 | 1431 | if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE) |
1277 | 1432 | { |
1278 | 1433 | $i = 0; |
1279 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1434 | + if ($globalTransaction) { |
|
1435 | + $Connection->db->beginTransaction(); |
|
1436 | + } |
|
1280 | 1437 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1281 | 1438 | { |
1282 | 1439 | if ($i > 0) { |
@@ -1293,7 +1450,9 @@ discard block |
||
1293 | 1450 | $i++; |
1294 | 1451 | } |
1295 | 1452 | fclose($handle); |
1296 | - if ($globalTransaction) $Connection->db->commit(); |
|
1453 | + if ($globalTransaction) { |
|
1454 | + $Connection->db->commit(); |
|
1455 | + } |
|
1297 | 1456 | } |
1298 | 1457 | return ''; |
1299 | 1458 | } |
@@ -1312,7 +1471,9 @@ discard block |
||
1312 | 1471 | $Connection = new Connection(); |
1313 | 1472 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
1314 | 1473 | { |
1315 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1474 | + if ($globalTransaction) { |
|
1475 | + $Connection->db->beginTransaction(); |
|
1476 | + } |
|
1316 | 1477 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
1317 | 1478 | { |
1318 | 1479 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1327,7 +1488,9 @@ discard block |
||
1327 | 1488 | } |
1328 | 1489 | } |
1329 | 1490 | fclose($handle); |
1330 | - if ($globalTransaction) $Connection->db->commit(); |
|
1491 | + if ($globalTransaction) { |
|
1492 | + $Connection->db->commit(); |
|
1493 | + } |
|
1331 | 1494 | } |
1332 | 1495 | return ''; |
1333 | 1496 | } |
@@ -1403,9 +1566,14 @@ discard block |
||
1403 | 1566 | if ($i > 0 && $data[0] != '') { |
1404 | 1567 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1405 | 1568 | $period = str_replace(',','',$data[14]); |
1406 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1407 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1408 | - else $launch_date = NULL; |
|
1569 | + if (!empty($period) && strpos($period,'days')) { |
|
1570 | + $period = str_replace(' days','',$period)*24*60; |
|
1571 | + } |
|
1572 | + if ($data[18] != '') { |
|
1573 | + $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1574 | + } else { |
|
1575 | + $launch_date = NULL; |
|
1576 | + } |
|
1409 | 1577 | $data = array_map(function($value) { |
1410 | 1578 | return trim($value) === '' ? null : $value; |
1411 | 1579 | }, $data); |
@@ -1758,7 +1926,9 @@ discard block |
||
1758 | 1926 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1759 | 1927 | { |
1760 | 1928 | $i = 0; |
1761 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1929 | + if ($globalTransaction) { |
|
1930 | + $Connection->db->beginTransaction(); |
|
1931 | + } |
|
1762 | 1932 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1763 | 1933 | { |
1764 | 1934 | $i++; |
@@ -1786,7 +1956,9 @@ discard block |
||
1786 | 1956 | } |
1787 | 1957 | } |
1788 | 1958 | fclose($handle); |
1789 | - if ($globalTransaction) $Connection->db->commit(); |
|
1959 | + if ($globalTransaction) { |
|
1960 | + $Connection->db->commit(); |
|
1961 | + } |
|
1790 | 1962 | } |
1791 | 1963 | return ''; |
1792 | 1964 | } |
@@ -1809,7 +1981,9 @@ discard block |
||
1809 | 1981 | $Connection = new Connection(); |
1810 | 1982 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1811 | 1983 | { |
1812 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1984 | + if ($globalTransaction) { |
|
1985 | + $Connection->db->beginTransaction(); |
|
1986 | + } |
|
1813 | 1987 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1814 | 1988 | { |
1815 | 1989 | if(count($row) > 1) { |
@@ -1823,7 +1997,9 @@ discard block |
||
1823 | 1997 | } |
1824 | 1998 | } |
1825 | 1999 | fclose($handle); |
1826 | - if ($globalTransaction) $Connection->db->commit(); |
|
2000 | + if ($globalTransaction) { |
|
2001 | + $Connection->db->commit(); |
|
2002 | + } |
|
1827 | 2003 | } |
1828 | 2004 | return ''; |
1829 | 2005 | } |
@@ -1843,8 +2019,9 @@ discard block |
||
1843 | 2019 | } |
1844 | 2020 | |
1845 | 2021 | |
1846 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1847 | - else { |
|
2022 | + if ($globalDBdriver == 'mysql') { |
|
2023 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
2024 | + } else { |
|
1848 | 2025 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
1849 | 2026 | $query = "CREATE EXTENSION postgis"; |
1850 | 2027 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -1863,20 +2040,30 @@ discard block |
||
1863 | 2040 | global $tmp_dir, $globalDebug; |
1864 | 2041 | include_once('class.create_db.php'); |
1865 | 2042 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1866 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
2043 | + if ($globalDebug) { |
|
2044 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
2045 | + } |
|
1867 | 2046 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
1868 | 2047 | $error = ''; |
1869 | 2048 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1870 | - if ($globalDebug) echo "Gunzip..."; |
|
2049 | + if ($globalDebug) { |
|
2050 | + echo "Gunzip..."; |
|
2051 | + } |
|
1871 | 2052 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
1872 | - if ($globalDebug) echo "Add to DB..."; |
|
2053 | + if ($globalDebug) { |
|
2054 | + echo "Add to DB..."; |
|
2055 | + } |
|
1873 | 2056 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
1874 | 2057 | $NOTAM = new NOTAM(); |
1875 | 2058 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
1876 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2059 | + } else { |
|
2060 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2061 | + } |
|
1877 | 2062 | if ($error != '') { |
1878 | 2063 | return $error; |
1879 | - } elseif ($globalDebug) echo "Done\n"; |
|
2064 | + } elseif ($globalDebug) { |
|
2065 | + echo "Done\n"; |
|
2066 | + } |
|
1880 | 2067 | return ''; |
1881 | 2068 | } |
1882 | 2069 | |
@@ -1930,67 +2117,111 @@ discard block |
||
1930 | 2117 | //if ($globalDebug) echo "IVAO : Download..."; |
1931 | 2118 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
1932 | 2119 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
1933 | - if ($globalDebug) echo "Unzip..."; |
|
2120 | + if ($globalDebug) { |
|
2121 | + echo "Unzip..."; |
|
2122 | + } |
|
1934 | 2123 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
1935 | - if ($globalDebug) echo "Add to DB..."; |
|
2124 | + if ($globalDebug) { |
|
2125 | + echo "Add to DB..."; |
|
2126 | + } |
|
1936 | 2127 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1937 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
2128 | + if ($globalDebug) { |
|
2129 | + echo "Copy airlines logos to airlines images directory..."; |
|
2130 | + } |
|
1938 | 2131 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1939 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1940 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
1941 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2132 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
2133 | + $error = "Failed to copy airlines logo."; |
|
2134 | + } |
|
2135 | + } else { |
|
2136 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
2137 | + } |
|
2138 | + } else { |
|
2139 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2140 | + } |
|
1942 | 2141 | if ($error != '') { |
1943 | 2142 | return $error; |
1944 | - } elseif ($globalDebug) echo "Done\n"; |
|
2143 | + } elseif ($globalDebug) { |
|
2144 | + echo "Done\n"; |
|
2145 | + } |
|
1945 | 2146 | return ''; |
1946 | 2147 | } |
1947 | 2148 | |
1948 | 2149 | public static function update_routes() { |
1949 | 2150 | global $tmp_dir, $globalDebug; |
1950 | 2151 | $error = ''; |
1951 | - if ($globalDebug) echo "Routes : Download..."; |
|
2152 | + if ($globalDebug) { |
|
2153 | + echo "Routes : Download..."; |
|
2154 | + } |
|
1952 | 2155 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
1953 | 2156 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1954 | - if ($globalDebug) echo "Gunzip..."; |
|
2157 | + if ($globalDebug) { |
|
2158 | + echo "Gunzip..."; |
|
2159 | + } |
|
1955 | 2160 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
1956 | - if ($globalDebug) echo "Add to DB..."; |
|
2161 | + if ($globalDebug) { |
|
2162 | + echo "Add to DB..."; |
|
2163 | + } |
|
1957 | 2164 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
1958 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2165 | + } else { |
|
2166 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2167 | + } |
|
1959 | 2168 | if ($error != '') { |
1960 | 2169 | return $error; |
1961 | - } elseif ($globalDebug) echo "Done\n"; |
|
2170 | + } elseif ($globalDebug) { |
|
2171 | + echo "Done\n"; |
|
2172 | + } |
|
1962 | 2173 | return ''; |
1963 | 2174 | } |
1964 | 2175 | public static function update_oneworld() { |
1965 | 2176 | global $tmp_dir, $globalDebug; |
1966 | 2177 | $error = ''; |
1967 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
2178 | + if ($globalDebug) { |
|
2179 | + echo "Schedules Oneworld : Download..."; |
|
2180 | + } |
|
1968 | 2181 | update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
1969 | 2182 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1970 | - if ($globalDebug) echo "Gunzip..."; |
|
2183 | + if ($globalDebug) { |
|
2184 | + echo "Gunzip..."; |
|
2185 | + } |
|
1971 | 2186 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
1972 | - if ($globalDebug) echo "Add to DB..."; |
|
2187 | + if ($globalDebug) { |
|
2188 | + echo "Add to DB..."; |
|
2189 | + } |
|
1973 | 2190 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
1974 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2191 | + } else { |
|
2192 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2193 | + } |
|
1975 | 2194 | if ($error != '') { |
1976 | 2195 | return $error; |
1977 | - } elseif ($globalDebug) echo "Done\n"; |
|
2196 | + } elseif ($globalDebug) { |
|
2197 | + echo "Done\n"; |
|
2198 | + } |
|
1978 | 2199 | return ''; |
1979 | 2200 | } |
1980 | 2201 | public static function update_skyteam() { |
1981 | 2202 | global $tmp_dir, $globalDebug; |
1982 | 2203 | $error = ''; |
1983 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
2204 | + if ($globalDebug) { |
|
2205 | + echo "Schedules Skyteam : Download..."; |
|
2206 | + } |
|
1984 | 2207 | update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
1985 | 2208 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1986 | - if ($globalDebug) echo "Gunzip..."; |
|
2209 | + if ($globalDebug) { |
|
2210 | + echo "Gunzip..."; |
|
2211 | + } |
|
1987 | 2212 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
1988 | - if ($globalDebug) echo "Add to DB..."; |
|
2213 | + if ($globalDebug) { |
|
2214 | + echo "Add to DB..."; |
|
2215 | + } |
|
1989 | 2216 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
1990 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2217 | + } else { |
|
2218 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2219 | + } |
|
1991 | 2220 | if ($error != '') { |
1992 | 2221 | return $error; |
1993 | - } elseif ($globalDebug) echo "Done\n"; |
|
2222 | + } elseif ($globalDebug) { |
|
2223 | + echo "Done\n"; |
|
2224 | + } |
|
1994 | 2225 | return ''; |
1995 | 2226 | } |
1996 | 2227 | public static function update_ModeS() { |
@@ -2007,355 +2238,619 @@ discard block |
||
2007 | 2238 | exit; |
2008 | 2239 | } elseif ($globalDebug) echo "Done\n"; |
2009 | 2240 | */ |
2010 | - if ($globalDebug) echo "Modes : Download..."; |
|
2011 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2241 | + if ($globalDebug) { |
|
2242 | + echo "Modes : Download..."; |
|
2243 | + } |
|
2244 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2012 | 2245 | update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
2013 | 2246 | |
2014 | 2247 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2015 | 2248 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
2016 | - if ($globalDebug) echo "Unzip..."; |
|
2017 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2249 | + if ($globalDebug) { |
|
2250 | + echo "Unzip..."; |
|
2251 | + } |
|
2252 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2018 | 2253 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
2019 | - if ($globalDebug) echo "Add to DB..."; |
|
2254 | + if ($globalDebug) { |
|
2255 | + echo "Add to DB..."; |
|
2256 | + } |
|
2020 | 2257 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
2021 | 2258 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
2022 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2259 | + } else { |
|
2260 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2261 | + } |
|
2023 | 2262 | if ($error != '') { |
2024 | 2263 | return $error; |
2025 | - } elseif ($globalDebug) echo "Done\n"; |
|
2264 | + } elseif ($globalDebug) { |
|
2265 | + echo "Done\n"; |
|
2266 | + } |
|
2026 | 2267 | return ''; |
2027 | 2268 | } |
2028 | 2269 | |
2029 | 2270 | public static function update_ModeS_faa() { |
2030 | 2271 | global $tmp_dir, $globalDebug; |
2031 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
2272 | + if ($globalDebug) { |
|
2273 | + echo "Modes FAA: Download..."; |
|
2274 | + } |
|
2032 | 2275 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
2033 | 2276 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2034 | - if ($globalDebug) echo "Unzip..."; |
|
2277 | + if ($globalDebug) { |
|
2278 | + echo "Unzip..."; |
|
2279 | + } |
|
2035 | 2280 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
2036 | - if ($globalDebug) echo "Add to DB..."; |
|
2281 | + if ($globalDebug) { |
|
2282 | + echo "Add to DB..."; |
|
2283 | + } |
|
2037 | 2284 | $error = update_db::modes_faa(); |
2038 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2285 | + } else { |
|
2286 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2287 | + } |
|
2039 | 2288 | if ($error != '') { |
2040 | 2289 | return $error; |
2041 | - } elseif ($globalDebug) echo "Done\n"; |
|
2290 | + } elseif ($globalDebug) { |
|
2291 | + echo "Done\n"; |
|
2292 | + } |
|
2042 | 2293 | return ''; |
2043 | 2294 | } |
2044 | 2295 | |
2045 | 2296 | public static function update_ModeS_flarm() { |
2046 | 2297 | global $tmp_dir, $globalDebug; |
2047 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
2298 | + if ($globalDebug) { |
|
2299 | + echo "Modes Flarmnet: Download..."; |
|
2300 | + } |
|
2048 | 2301 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
2049 | 2302 | if (file_exists($tmp_dir.'data.fln')) { |
2050 | - if ($globalDebug) echo "Add to DB..."; |
|
2303 | + if ($globalDebug) { |
|
2304 | + echo "Add to DB..."; |
|
2305 | + } |
|
2051 | 2306 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
2052 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2307 | + } else { |
|
2308 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2309 | + } |
|
2053 | 2310 | if ($error != '') { |
2054 | 2311 | return $error; |
2055 | - } elseif ($globalDebug) echo "Done\n"; |
|
2312 | + } elseif ($globalDebug) { |
|
2313 | + echo "Done\n"; |
|
2314 | + } |
|
2056 | 2315 | return ''; |
2057 | 2316 | } |
2058 | 2317 | |
2059 | 2318 | public static function update_ModeS_ogn() { |
2060 | 2319 | global $tmp_dir, $globalDebug; |
2061 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
2320 | + if ($globalDebug) { |
|
2321 | + echo "Modes OGN: Download..."; |
|
2322 | + } |
|
2062 | 2323 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
2063 | 2324 | if (file_exists($tmp_dir.'ogn.csv')) { |
2064 | - if ($globalDebug) echo "Add to DB..."; |
|
2325 | + if ($globalDebug) { |
|
2326 | + echo "Add to DB..."; |
|
2327 | + } |
|
2065 | 2328 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
2066 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2329 | + } else { |
|
2330 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2331 | + } |
|
2067 | 2332 | if ($error != '') { |
2068 | 2333 | return $error; |
2069 | - } elseif ($globalDebug) echo "Done\n"; |
|
2334 | + } elseif ($globalDebug) { |
|
2335 | + echo "Done\n"; |
|
2336 | + } |
|
2070 | 2337 | return ''; |
2071 | 2338 | } |
2072 | 2339 | |
2073 | 2340 | public static function update_owner() { |
2074 | 2341 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2075 | 2342 | |
2076 | - if ($globalDebug) echo "Owner France: Download..."; |
|
2343 | + if ($globalDebug) { |
|
2344 | + echo "Owner France: Download..."; |
|
2345 | + } |
|
2077 | 2346 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
2078 | 2347 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2079 | - if ($globalDebug) echo "Add to DB..."; |
|
2348 | + if ($globalDebug) { |
|
2349 | + echo "Add to DB..."; |
|
2350 | + } |
|
2080 | 2351 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
2081 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2352 | + } else { |
|
2353 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2354 | + } |
|
2082 | 2355 | if ($error != '') { |
2083 | 2356 | return $error; |
2084 | - } elseif ($globalDebug) echo "Done\n"; |
|
2357 | + } elseif ($globalDebug) { |
|
2358 | + echo "Done\n"; |
|
2359 | + } |
|
2085 | 2360 | |
2086 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
2361 | + if ($globalDebug) { |
|
2362 | + echo "Owner Ireland: Download..."; |
|
2363 | + } |
|
2087 | 2364 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
2088 | 2365 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2089 | - if ($globalDebug) echo "Add to DB..."; |
|
2366 | + if ($globalDebug) { |
|
2367 | + echo "Add to DB..."; |
|
2368 | + } |
|
2090 | 2369 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
2091 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2370 | + } else { |
|
2371 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2372 | + } |
|
2092 | 2373 | if ($error != '') { |
2093 | 2374 | return $error; |
2094 | - } elseif ($globalDebug) echo "Done\n"; |
|
2095 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
2375 | + } elseif ($globalDebug) { |
|
2376 | + echo "Done\n"; |
|
2377 | + } |
|
2378 | + if ($globalDebug) { |
|
2379 | + echo "Owner Switzerland: Download..."; |
|
2380 | + } |
|
2096 | 2381 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
2097 | 2382 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2098 | - if ($globalDebug) echo "Add to DB..."; |
|
2383 | + if ($globalDebug) { |
|
2384 | + echo "Add to DB..."; |
|
2385 | + } |
|
2099 | 2386 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
2100 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2387 | + } else { |
|
2388 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2389 | + } |
|
2101 | 2390 | if ($error != '') { |
2102 | 2391 | return $error; |
2103 | - } elseif ($globalDebug) echo "Done\n"; |
|
2104 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
2392 | + } elseif ($globalDebug) { |
|
2393 | + echo "Done\n"; |
|
2394 | + } |
|
2395 | + if ($globalDebug) { |
|
2396 | + echo "Owner Czech Republic: Download..."; |
|
2397 | + } |
|
2105 | 2398 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
2106 | 2399 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2107 | - if ($globalDebug) echo "Add to DB..."; |
|
2400 | + if ($globalDebug) { |
|
2401 | + echo "Add to DB..."; |
|
2402 | + } |
|
2108 | 2403 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
2109 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2404 | + } else { |
|
2405 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2406 | + } |
|
2110 | 2407 | if ($error != '') { |
2111 | 2408 | return $error; |
2112 | - } elseif ($globalDebug) echo "Done\n"; |
|
2113 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
2409 | + } elseif ($globalDebug) { |
|
2410 | + echo "Done\n"; |
|
2411 | + } |
|
2412 | + if ($globalDebug) { |
|
2413 | + echo "Owner Australia: Download..."; |
|
2414 | + } |
|
2114 | 2415 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
2115 | 2416 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2116 | - if ($globalDebug) echo "Add to DB..."; |
|
2417 | + if ($globalDebug) { |
|
2418 | + echo "Add to DB..."; |
|
2419 | + } |
|
2117 | 2420 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
2118 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2421 | + } else { |
|
2422 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2423 | + } |
|
2119 | 2424 | if ($error != '') { |
2120 | 2425 | return $error; |
2121 | - } elseif ($globalDebug) echo "Done\n"; |
|
2122 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
2426 | + } elseif ($globalDebug) { |
|
2427 | + echo "Done\n"; |
|
2428 | + } |
|
2429 | + if ($globalDebug) { |
|
2430 | + echo "Owner Austria: Download..."; |
|
2431 | + } |
|
2123 | 2432 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
2124 | 2433 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2125 | - if ($globalDebug) echo "Add to DB..."; |
|
2434 | + if ($globalDebug) { |
|
2435 | + echo "Add to DB..."; |
|
2436 | + } |
|
2126 | 2437 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
2127 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2438 | + } else { |
|
2439 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2440 | + } |
|
2128 | 2441 | if ($error != '') { |
2129 | 2442 | return $error; |
2130 | - } elseif ($globalDebug) echo "Done\n"; |
|
2131 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
2443 | + } elseif ($globalDebug) { |
|
2444 | + echo "Done\n"; |
|
2445 | + } |
|
2446 | + if ($globalDebug) { |
|
2447 | + echo "Owner Chile: Download..."; |
|
2448 | + } |
|
2132 | 2449 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
2133 | 2450 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2134 | - if ($globalDebug) echo "Add to DB..."; |
|
2451 | + if ($globalDebug) { |
|
2452 | + echo "Add to DB..."; |
|
2453 | + } |
|
2135 | 2454 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
2136 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2455 | + } else { |
|
2456 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2457 | + } |
|
2137 | 2458 | if ($error != '') { |
2138 | 2459 | return $error; |
2139 | - } elseif ($globalDebug) echo "Done\n"; |
|
2140 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
2460 | + } elseif ($globalDebug) { |
|
2461 | + echo "Done\n"; |
|
2462 | + } |
|
2463 | + if ($globalDebug) { |
|
2464 | + echo "Owner Colombia: Download..."; |
|
2465 | + } |
|
2141 | 2466 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
2142 | 2467 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2143 | - if ($globalDebug) echo "Add to DB..."; |
|
2468 | + if ($globalDebug) { |
|
2469 | + echo "Add to DB..."; |
|
2470 | + } |
|
2144 | 2471 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
2145 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2472 | + } else { |
|
2473 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2474 | + } |
|
2146 | 2475 | if ($error != '') { |
2147 | 2476 | return $error; |
2148 | - } elseif ($globalDebug) echo "Done\n"; |
|
2149 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
2477 | + } elseif ($globalDebug) { |
|
2478 | + echo "Done\n"; |
|
2479 | + } |
|
2480 | + if ($globalDebug) { |
|
2481 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
2482 | + } |
|
2150 | 2483 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
2151 | 2484 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2152 | - if ($globalDebug) echo "Add to DB..."; |
|
2485 | + if ($globalDebug) { |
|
2486 | + echo "Add to DB..."; |
|
2487 | + } |
|
2153 | 2488 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
2154 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2489 | + } else { |
|
2490 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2491 | + } |
|
2155 | 2492 | if ($error != '') { |
2156 | 2493 | return $error; |
2157 | - } elseif ($globalDebug) echo "Done\n"; |
|
2158 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
2494 | + } elseif ($globalDebug) { |
|
2495 | + echo "Done\n"; |
|
2496 | + } |
|
2497 | + if ($globalDebug) { |
|
2498 | + echo "Owner Brazil: Download..."; |
|
2499 | + } |
|
2159 | 2500 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
2160 | 2501 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2161 | - if ($globalDebug) echo "Add to DB..."; |
|
2502 | + if ($globalDebug) { |
|
2503 | + echo "Add to DB..."; |
|
2504 | + } |
|
2162 | 2505 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
2163 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2506 | + } else { |
|
2507 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2508 | + } |
|
2164 | 2509 | if ($error != '') { |
2165 | 2510 | return $error; |
2166 | - } elseif ($globalDebug) echo "Done\n"; |
|
2167 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
2511 | + } elseif ($globalDebug) { |
|
2512 | + echo "Done\n"; |
|
2513 | + } |
|
2514 | + if ($globalDebug) { |
|
2515 | + echo "Owner Cayman Islands: Download..."; |
|
2516 | + } |
|
2168 | 2517 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
2169 | 2518 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2170 | - if ($globalDebug) echo "Add to DB..."; |
|
2519 | + if ($globalDebug) { |
|
2520 | + echo "Add to DB..."; |
|
2521 | + } |
|
2171 | 2522 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
2172 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2523 | + } else { |
|
2524 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2525 | + } |
|
2173 | 2526 | if ($error != '') { |
2174 | 2527 | return $error; |
2175 | - } elseif ($globalDebug) echo "Done\n"; |
|
2176 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
2528 | + } elseif ($globalDebug) { |
|
2529 | + echo "Done\n"; |
|
2530 | + } |
|
2531 | + if ($globalDebug) { |
|
2532 | + echo "Owner Croatia: Download..."; |
|
2533 | + } |
|
2177 | 2534 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
2178 | 2535 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2179 | - if ($globalDebug) echo "Add to DB..."; |
|
2536 | + if ($globalDebug) { |
|
2537 | + echo "Add to DB..."; |
|
2538 | + } |
|
2180 | 2539 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
2181 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2540 | + } else { |
|
2541 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2542 | + } |
|
2182 | 2543 | if ($error != '') { |
2183 | 2544 | return $error; |
2184 | - } elseif ($globalDebug) echo "Done\n"; |
|
2185 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
2545 | + } elseif ($globalDebug) { |
|
2546 | + echo "Done\n"; |
|
2547 | + } |
|
2548 | + if ($globalDebug) { |
|
2549 | + echo "Owner Luxembourg: Download..."; |
|
2550 | + } |
|
2186 | 2551 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
2187 | 2552 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2188 | - if ($globalDebug) echo "Add to DB..."; |
|
2553 | + if ($globalDebug) { |
|
2554 | + echo "Add to DB..."; |
|
2555 | + } |
|
2189 | 2556 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
2190 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2557 | + } else { |
|
2558 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2559 | + } |
|
2191 | 2560 | if ($error != '') { |
2192 | 2561 | return $error; |
2193 | - } elseif ($globalDebug) echo "Done\n"; |
|
2194 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
2562 | + } elseif ($globalDebug) { |
|
2563 | + echo "Done\n"; |
|
2564 | + } |
|
2565 | + if ($globalDebug) { |
|
2566 | + echo "Owner Maldives: Download..."; |
|
2567 | + } |
|
2195 | 2568 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
2196 | 2569 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2197 | - if ($globalDebug) echo "Add to DB..."; |
|
2570 | + if ($globalDebug) { |
|
2571 | + echo "Add to DB..."; |
|
2572 | + } |
|
2198 | 2573 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
2199 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2574 | + } else { |
|
2575 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2576 | + } |
|
2200 | 2577 | if ($error != '') { |
2201 | 2578 | return $error; |
2202 | - } elseif ($globalDebug) echo "Done\n"; |
|
2203 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
2579 | + } elseif ($globalDebug) { |
|
2580 | + echo "Done\n"; |
|
2581 | + } |
|
2582 | + if ($globalDebug) { |
|
2583 | + echo "Owner New Zealand: Download..."; |
|
2584 | + } |
|
2204 | 2585 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
2205 | 2586 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2206 | - if ($globalDebug) echo "Add to DB..."; |
|
2587 | + if ($globalDebug) { |
|
2588 | + echo "Add to DB..."; |
|
2589 | + } |
|
2207 | 2590 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
2208 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2591 | + } else { |
|
2592 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2593 | + } |
|
2209 | 2594 | if ($error != '') { |
2210 | 2595 | return $error; |
2211 | - } elseif ($globalDebug) echo "Done\n"; |
|
2212 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
2596 | + } elseif ($globalDebug) { |
|
2597 | + echo "Done\n"; |
|
2598 | + } |
|
2599 | + if ($globalDebug) { |
|
2600 | + echo "Owner Papua New Guinea: Download..."; |
|
2601 | + } |
|
2213 | 2602 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
2214 | 2603 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2215 | - if ($globalDebug) echo "Add to DB..."; |
|
2604 | + if ($globalDebug) { |
|
2605 | + echo "Add to DB..."; |
|
2606 | + } |
|
2216 | 2607 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
2217 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2608 | + } else { |
|
2609 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2610 | + } |
|
2218 | 2611 | if ($error != '') { |
2219 | 2612 | return $error; |
2220 | - } elseif ($globalDebug) echo "Done\n"; |
|
2221 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
2613 | + } elseif ($globalDebug) { |
|
2614 | + echo "Done\n"; |
|
2615 | + } |
|
2616 | + if ($globalDebug) { |
|
2617 | + echo "Owner Slovakia: Download..."; |
|
2618 | + } |
|
2222 | 2619 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
2223 | 2620 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2224 | - if ($globalDebug) echo "Add to DB..."; |
|
2621 | + if ($globalDebug) { |
|
2622 | + echo "Add to DB..."; |
|
2623 | + } |
|
2225 | 2624 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
2226 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2625 | + } else { |
|
2626 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2627 | + } |
|
2227 | 2628 | if ($error != '') { |
2228 | 2629 | return $error; |
2229 | - } elseif ($globalDebug) echo "Done\n"; |
|
2230 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
2630 | + } elseif ($globalDebug) { |
|
2631 | + echo "Done\n"; |
|
2632 | + } |
|
2633 | + if ($globalDebug) { |
|
2634 | + echo "Owner Ecuador: Download..."; |
|
2635 | + } |
|
2231 | 2636 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
2232 | 2637 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2233 | - if ($globalDebug) echo "Add to DB..."; |
|
2638 | + if ($globalDebug) { |
|
2639 | + echo "Add to DB..."; |
|
2640 | + } |
|
2234 | 2641 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
2235 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2642 | + } else { |
|
2643 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2644 | + } |
|
2236 | 2645 | if ($error != '') { |
2237 | 2646 | return $error; |
2238 | - } elseif ($globalDebug) echo "Done\n"; |
|
2239 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
2647 | + } elseif ($globalDebug) { |
|
2648 | + echo "Done\n"; |
|
2649 | + } |
|
2650 | + if ($globalDebug) { |
|
2651 | + echo "Owner Iceland: Download..."; |
|
2652 | + } |
|
2240 | 2653 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
2241 | 2654 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2242 | - if ($globalDebug) echo "Add to DB..."; |
|
2655 | + if ($globalDebug) { |
|
2656 | + echo "Add to DB..."; |
|
2657 | + } |
|
2243 | 2658 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
2244 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2659 | + } else { |
|
2660 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2661 | + } |
|
2245 | 2662 | if ($error != '') { |
2246 | 2663 | return $error; |
2247 | - } elseif ($globalDebug) echo "Done\n"; |
|
2248 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
2664 | + } elseif ($globalDebug) { |
|
2665 | + echo "Done\n"; |
|
2666 | + } |
|
2667 | + if ($globalDebug) { |
|
2668 | + echo "Owner Isle of Man: Download..."; |
|
2669 | + } |
|
2249 | 2670 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
2250 | 2671 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2251 | - if ($globalDebug) echo "Add to DB..."; |
|
2672 | + if ($globalDebug) { |
|
2673 | + echo "Add to DB..."; |
|
2674 | + } |
|
2252 | 2675 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
2253 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2676 | + } else { |
|
2677 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2678 | + } |
|
2254 | 2679 | if ($error != '') { |
2255 | 2680 | return $error; |
2256 | - } elseif ($globalDebug) echo "Done\n"; |
|
2681 | + } elseif ($globalDebug) { |
|
2682 | + echo "Done\n"; |
|
2683 | + } |
|
2257 | 2684 | if ($globalMasterSource) { |
2258 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
2685 | + if ($globalDebug) { |
|
2686 | + echo "ModeS Netherlands: Download..."; |
|
2687 | + } |
|
2259 | 2688 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
2260 | 2689 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2261 | - if ($globalDebug) echo "Add to DB..."; |
|
2690 | + if ($globalDebug) { |
|
2691 | + echo "Add to DB..."; |
|
2692 | + } |
|
2262 | 2693 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
2263 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2694 | + } else { |
|
2695 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2696 | + } |
|
2264 | 2697 | if ($error != '') { |
2265 | 2698 | return $error; |
2266 | - } elseif ($globalDebug) echo "Done\n"; |
|
2267 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
2699 | + } elseif ($globalDebug) { |
|
2700 | + echo "Done\n"; |
|
2701 | + } |
|
2702 | + if ($globalDebug) { |
|
2703 | + echo "ModeS Denmark: Download..."; |
|
2704 | + } |
|
2268 | 2705 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
2269 | 2706 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2270 | - if ($globalDebug) echo "Add to DB..."; |
|
2707 | + if ($globalDebug) { |
|
2708 | + echo "Add to DB..."; |
|
2709 | + } |
|
2271 | 2710 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
2272 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2711 | + } else { |
|
2712 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2713 | + } |
|
2273 | 2714 | if ($error != '') { |
2274 | 2715 | return $error; |
2275 | - } elseif ($globalDebug) echo "Done\n"; |
|
2276 | - } elseif ($globalDebug) echo "Done\n"; |
|
2716 | + } elseif ($globalDebug) { |
|
2717 | + echo "Done\n"; |
|
2718 | + } |
|
2719 | + } elseif ($globalDebug) { |
|
2720 | + echo "Done\n"; |
|
2721 | + } |
|
2277 | 2722 | return ''; |
2278 | 2723 | } |
2279 | 2724 | |
2280 | 2725 | public static function update_translation() { |
2281 | 2726 | global $tmp_dir, $globalDebug; |
2282 | 2727 | $error = ''; |
2283 | - if ($globalDebug) echo "Translation : Download..."; |
|
2728 | + if ($globalDebug) { |
|
2729 | + echo "Translation : Download..."; |
|
2730 | + } |
|
2284 | 2731 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
2285 | 2732 | if (file_exists($tmp_dir.'translation.zip')) { |
2286 | - if ($globalDebug) echo "Unzip..."; |
|
2733 | + if ($globalDebug) { |
|
2734 | + echo "Unzip..."; |
|
2735 | + } |
|
2287 | 2736 | update_db::unzip($tmp_dir.'translation.zip'); |
2288 | - if ($globalDebug) echo "Add to DB..."; |
|
2737 | + if ($globalDebug) { |
|
2738 | + echo "Add to DB..."; |
|
2739 | + } |
|
2289 | 2740 | $error = update_db::translation(); |
2290 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2741 | + } else { |
|
2742 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2743 | + } |
|
2291 | 2744 | if ($error != '') { |
2292 | 2745 | return $error; |
2293 | - } elseif ($globalDebug) echo "Done\n"; |
|
2746 | + } elseif ($globalDebug) { |
|
2747 | + echo "Done\n"; |
|
2748 | + } |
|
2294 | 2749 | return ''; |
2295 | 2750 | } |
2296 | 2751 | |
2297 | 2752 | public static function update_translation_fam() { |
2298 | 2753 | global $tmp_dir, $globalDebug; |
2299 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
2754 | + if ($globalDebug) { |
|
2755 | + echo "Translation from FlightAirMap website : Download..."; |
|
2756 | + } |
|
2300 | 2757 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
2301 | 2758 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
2302 | - if ($globalDebug) echo "Gunzip..."; |
|
2759 | + if ($globalDebug) { |
|
2760 | + echo "Gunzip..."; |
|
2761 | + } |
|
2303 | 2762 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
2304 | - if ($globalDebug) echo "Add to DB..."; |
|
2763 | + if ($globalDebug) { |
|
2764 | + echo "Add to DB..."; |
|
2765 | + } |
|
2305 | 2766 | $error = update_db::translation_fam(); |
2306 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2767 | + } else { |
|
2768 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2769 | + } |
|
2307 | 2770 | if ($error != '') { |
2308 | 2771 | return $error; |
2309 | - } elseif ($globalDebug) echo "Done\n"; |
|
2772 | + } elseif ($globalDebug) { |
|
2773 | + echo "Done\n"; |
|
2774 | + } |
|
2310 | 2775 | return ''; |
2311 | 2776 | } |
2312 | 2777 | public static function update_ModeS_fam() { |
2313 | 2778 | global $tmp_dir, $globalDebug; |
2314 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
2779 | + if ($globalDebug) { |
|
2780 | + echo "ModeS from FlightAirMap website : Download..."; |
|
2781 | + } |
|
2315 | 2782 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
2316 | 2783 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
2317 | - if ($globalDebug) echo "Gunzip..."; |
|
2784 | + if ($globalDebug) { |
|
2785 | + echo "Gunzip..."; |
|
2786 | + } |
|
2318 | 2787 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
2319 | - if ($globalDebug) echo "Add to DB..."; |
|
2788 | + if ($globalDebug) { |
|
2789 | + echo "Add to DB..."; |
|
2790 | + } |
|
2320 | 2791 | $error = update_db::modes_fam(); |
2321 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2792 | + } else { |
|
2793 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2794 | + } |
|
2322 | 2795 | if ($error != '') { |
2323 | 2796 | return $error; |
2324 | - } elseif ($globalDebug) echo "Done\n"; |
|
2797 | + } elseif ($globalDebug) { |
|
2798 | + echo "Done\n"; |
|
2799 | + } |
|
2325 | 2800 | return ''; |
2326 | 2801 | } |
2327 | 2802 | public static function update_owner_fam() { |
2328 | 2803 | global $tmp_dir, $globalDebug, $globalOwner; |
2329 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
2804 | + if ($globalDebug) { |
|
2805 | + echo "owner from FlightAirMap website : Download..."; |
|
2806 | + } |
|
2330 | 2807 | if ($globalOwner === TRUE) { |
2331 | 2808 | update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
2332 | 2809 | } else { |
2333 | 2810 | update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
2334 | 2811 | } |
2335 | 2812 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
2336 | - if ($globalDebug) echo "Gunzip..."; |
|
2813 | + if ($globalDebug) { |
|
2814 | + echo "Gunzip..."; |
|
2815 | + } |
|
2337 | 2816 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
2338 | - if ($globalDebug) echo "Add to DB..."; |
|
2817 | + if ($globalDebug) { |
|
2818 | + echo "Add to DB..."; |
|
2819 | + } |
|
2339 | 2820 | $error = update_db::owner_fam(); |
2340 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
2821 | + } else { |
|
2822 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
2823 | + } |
|
2341 | 2824 | if ($error != '') { |
2342 | 2825 | return $error; |
2343 | - } elseif ($globalDebug) echo "Done\n"; |
|
2826 | + } elseif ($globalDebug) { |
|
2827 | + echo "Done\n"; |
|
2828 | + } |
|
2344 | 2829 | return ''; |
2345 | 2830 | } |
2346 | 2831 | public static function update_routes_fam() { |
2347 | 2832 | global $tmp_dir, $globalDebug; |
2348 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
2833 | + if ($globalDebug) { |
|
2834 | + echo "Routes from FlightAirMap website : Download..."; |
|
2835 | + } |
|
2349 | 2836 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
2350 | 2837 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2351 | - if ($globalDebug) echo "Gunzip..."; |
|
2838 | + if ($globalDebug) { |
|
2839 | + echo "Gunzip..."; |
|
2840 | + } |
|
2352 | 2841 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
2353 | - if ($globalDebug) echo "Add to DB..."; |
|
2842 | + if ($globalDebug) { |
|
2843 | + echo "Add to DB..."; |
|
2844 | + } |
|
2354 | 2845 | $error = update_db::routes_fam(); |
2355 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
2846 | + } else { |
|
2847 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
2848 | + } |
|
2356 | 2849 | if ($error != '') { |
2357 | 2850 | return $error; |
2358 | - } elseif ($globalDebug) echo "Done\n"; |
|
2851 | + } elseif ($globalDebug) { |
|
2852 | + echo "Done\n"; |
|
2853 | + } |
|
2359 | 2854 | return ''; |
2360 | 2855 | } |
2361 | 2856 | public static function update_marine_identity_fam() { |
@@ -2365,14 +2860,22 @@ discard block |
||
2365 | 2860 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
2366 | 2861 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2367 | 2862 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2368 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
2863 | + if ($globalDebug) { |
|
2864 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
2865 | + } |
|
2369 | 2866 | update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
2370 | 2867 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2371 | - if ($globalDebug) echo "Gunzip..."; |
|
2868 | + if ($globalDebug) { |
|
2869 | + echo "Gunzip..."; |
|
2870 | + } |
|
2372 | 2871 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
2373 | - if ($globalDebug) echo "Add to DB..."; |
|
2872 | + if ($globalDebug) { |
|
2873 | + echo "Add to DB..."; |
|
2874 | + } |
|
2374 | 2875 | $error = update_db::marine_identity_fam(); |
2375 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
2876 | + } else { |
|
2877 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
2878 | + } |
|
2376 | 2879 | if ($error != '') { |
2377 | 2880 | return $error; |
2378 | 2881 | } elseif ($globalDebug) { |
@@ -2391,14 +2894,22 @@ discard block |
||
2391 | 2894 | $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
2392 | 2895 | $satellite_md5 = $satellite_md5_file[0]; |
2393 | 2896 | if (!update_db::check_satellite_version($satellite_md5)) { |
2394 | - if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
|
2897 | + if ($globalDebug) { |
|
2898 | + echo "Satellite from FlightAirMap website : Download..."; |
|
2899 | + } |
|
2395 | 2900 | update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
2396 | 2901 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2397 | - if ($globalDebug) echo "Gunzip..."; |
|
2902 | + if ($globalDebug) { |
|
2903 | + echo "Gunzip..."; |
|
2904 | + } |
|
2398 | 2905 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
2399 | - if ($globalDebug) echo "Add to DB..."; |
|
2906 | + if ($globalDebug) { |
|
2907 | + echo "Add to DB..."; |
|
2908 | + } |
|
2400 | 2909 | $error = update_db::satellite_fam(); |
2401 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
2910 | + } else { |
|
2911 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
2912 | + } |
|
2402 | 2913 | if ($error != '') { |
2403 | 2914 | return $error; |
2404 | 2915 | } elseif ($globalDebug) { |
@@ -2411,17 +2922,25 @@ discard block |
||
2411 | 2922 | } |
2412 | 2923 | public static function update_banned_fam() { |
2413 | 2924 | global $tmp_dir, $globalDebug; |
2414 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2925 | + if ($globalDebug) { |
|
2926 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2927 | + } |
|
2415 | 2928 | update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
2416 | 2929 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2417 | 2930 | //if ($globalDebug) echo "Gunzip..."; |
2418 | 2931 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
2419 | - if ($globalDebug) echo "Add to DB..."; |
|
2932 | + if ($globalDebug) { |
|
2933 | + echo "Add to DB..."; |
|
2934 | + } |
|
2420 | 2935 | $error = update_db::banned_fam(); |
2421 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
2936 | + } else { |
|
2937 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
2938 | + } |
|
2422 | 2939 | if ($error != '') { |
2423 | 2940 | return $error; |
2424 | - } elseif ($globalDebug) echo "Done\n"; |
|
2941 | + } elseif ($globalDebug) { |
|
2942 | + echo "Done\n"; |
|
2943 | + } |
|
2425 | 2944 | return ''; |
2426 | 2945 | } |
2427 | 2946 | |
@@ -2429,7 +2948,9 @@ discard block |
||
2429 | 2948 | global $tmp_dir, $globalDebug, $globalDBdriver; |
2430 | 2949 | include_once('class.create_db.php'); |
2431 | 2950 | $error = ''; |
2432 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
2951 | + if ($globalDebug) { |
|
2952 | + echo "Airspace from FlightAirMap website : Download..."; |
|
2953 | + } |
|
2433 | 2954 | if ($globalDBdriver == 'mysql') { |
2434 | 2955 | update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
2435 | 2956 | } else { |
@@ -2445,9 +2966,13 @@ discard block |
||
2445 | 2966 | update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
2446 | 2967 | } |
2447 | 2968 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2448 | - if ($globalDebug) echo "Gunzip..."; |
|
2969 | + if ($globalDebug) { |
|
2970 | + echo "Gunzip..."; |
|
2971 | + } |
|
2449 | 2972 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
2450 | - if ($globalDebug) echo "Add to DB..."; |
|
2973 | + if ($globalDebug) { |
|
2974 | + echo "Add to DB..."; |
|
2975 | + } |
|
2451 | 2976 | $Connection = new Connection(); |
2452 | 2977 | if ($Connection->tableExists('airspace')) { |
2453 | 2978 | $query = 'DROP TABLE airspace'; |
@@ -2460,19 +2985,27 @@ discard block |
||
2460 | 2985 | } |
2461 | 2986 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2462 | 2987 | update_db::insert_airspace_version($airspace_md5); |
2463 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
2988 | + } else { |
|
2989 | + $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
2990 | + } |
|
2464 | 2991 | } |
2465 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
2992 | + } else { |
|
2993 | + $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
2994 | + } |
|
2466 | 2995 | if ($error != '') { |
2467 | 2996 | return $error; |
2468 | - } elseif ($globalDebug) echo "Done\n"; |
|
2997 | + } elseif ($globalDebug) { |
|
2998 | + echo "Done\n"; |
|
2999 | + } |
|
2469 | 3000 | return ''; |
2470 | 3001 | } |
2471 | 3002 | |
2472 | 3003 | public static function update_geoid_fam() { |
2473 | 3004 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2474 | 3005 | $error = ''; |
2475 | - if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
3006 | + if ($globalDebug) { |
|
3007 | + echo "Geoid from FlightAirMap website : Download..."; |
|
3008 | + } |
|
2476 | 3009 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
2477 | 3010 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2478 | 3011 | $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
@@ -2480,75 +3013,113 @@ discard block |
||
2480 | 3013 | if (!update_db::check_geoid_version($geoid_md5)) { |
2481 | 3014 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
2482 | 3015 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2483 | - if ($globalDebug) echo "Gunzip..."; |
|
3016 | + if ($globalDebug) { |
|
3017 | + echo "Gunzip..."; |
|
3018 | + } |
|
2484 | 3019 | update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
2485 | 3020 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2486 | 3021 | update_db::insert_geoid_version($geoid_md5); |
2487 | 3022 | } |
2488 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
3023 | + } else { |
|
3024 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
3025 | + } |
|
2489 | 3026 | } |
2490 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3027 | + } else { |
|
3028 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3029 | + } |
|
2491 | 3030 | if ($error != '') { |
2492 | 3031 | return $error; |
2493 | - } elseif ($globalDebug) echo "Done\n"; |
|
3032 | + } elseif ($globalDebug) { |
|
3033 | + echo "Done\n"; |
|
3034 | + } |
|
2494 | 3035 | return ''; |
2495 | 3036 | } |
2496 | 3037 | |
2497 | 3038 | public static function update_tle() { |
2498 | 3039 | global $tmp_dir, $globalDebug; |
2499 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
3040 | + if ($globalDebug) { |
|
3041 | + echo "Download TLE : Download..."; |
|
3042 | + } |
|
2500 | 3043 | $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
2501 | 3044 | 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
2502 | 3045 | 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
2503 | 3046 | foreach ($alltle as $filename) { |
2504 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
3047 | + if ($globalDebug) { |
|
3048 | + echo "downloading ".$filename.'...'; |
|
3049 | + } |
|
2505 | 3050 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
2506 | 3051 | if (file_exists($tmp_dir.$filename)) { |
2507 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
3052 | + if ($globalDebug) { |
|
3053 | + echo "Add to DB ".$filename."..."; |
|
3054 | + } |
|
2508 | 3055 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
2509 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3056 | + } else { |
|
3057 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3058 | + } |
|
2510 | 3059 | if ($error != '') { |
2511 | 3060 | echo $error."\n"; |
2512 | - } elseif ($globalDebug) echo "Done\n"; |
|
3061 | + } elseif ($globalDebug) { |
|
3062 | + echo "Done\n"; |
|
3063 | + } |
|
2513 | 3064 | } |
2514 | 3065 | return ''; |
2515 | 3066 | } |
2516 | 3067 | |
2517 | 3068 | public static function update_ucsdb() { |
2518 | 3069 | global $tmp_dir, $globalDebug; |
2519 | - if ($globalDebug) echo "Download UCS DB : Download..."; |
|
3070 | + if ($globalDebug) { |
|
3071 | + echo "Download UCS DB : Download..."; |
|
3072 | + } |
|
2520 | 3073 | update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
2521 | 3074 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2522 | - if ($globalDebug) echo "Add to DB..."; |
|
3075 | + if ($globalDebug) { |
|
3076 | + echo "Add to DB..."; |
|
3077 | + } |
|
2523 | 3078 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
2524 | - } else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
3079 | + } else { |
|
3080 | + $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
3081 | + } |
|
2525 | 3082 | if ($error != '') { |
2526 | 3083 | echo $error."\n"; |
2527 | - } elseif ($globalDebug) echo "Done\n"; |
|
3084 | + } elseif ($globalDebug) { |
|
3085 | + echo "Done\n"; |
|
3086 | + } |
|
2528 | 3087 | return ''; |
2529 | 3088 | } |
2530 | 3089 | |
2531 | 3090 | public static function update_celestrak() { |
2532 | 3091 | global $tmp_dir, $globalDebug; |
2533 | - if ($globalDebug) echo "Download Celestrak DB : Download..."; |
|
3092 | + if ($globalDebug) { |
|
3093 | + echo "Download Celestrak DB : Download..."; |
|
3094 | + } |
|
2534 | 3095 | update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
2535 | 3096 | if (file_exists($tmp_dir.'satcat.txt')) { |
2536 | - if ($globalDebug) echo "Add to DB..."; |
|
3097 | + if ($globalDebug) { |
|
3098 | + echo "Add to DB..."; |
|
3099 | + } |
|
2537 | 3100 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
2538 | - } else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3101 | + } else { |
|
3102 | + $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3103 | + } |
|
2539 | 3104 | if ($error != '') { |
2540 | 3105 | echo $error."\n"; |
2541 | - } elseif ($globalDebug) echo "Done\n"; |
|
3106 | + } elseif ($globalDebug) { |
|
3107 | + echo "Done\n"; |
|
3108 | + } |
|
2542 | 3109 | return ''; |
2543 | 3110 | } |
2544 | 3111 | |
2545 | 3112 | public static function update_models() { |
2546 | 3113 | global $tmp_dir, $globalDebug; |
2547 | 3114 | $error = ''; |
2548 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
3115 | + if ($globalDebug) { |
|
3116 | + echo "Models from FlightAirMap website : Download..."; |
|
3117 | + } |
|
2549 | 3118 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
2550 | 3119 | if (file_exists($tmp_dir.'models.md5sum')) { |
2551 | - if ($globalDebug) echo "Check files...\n"; |
|
3120 | + if ($globalDebug) { |
|
3121 | + echo "Check files...\n"; |
|
3122 | + } |
|
2552 | 3123 | $newmodelsdb = array(); |
2553 | 3124 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
2554 | 3125 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2567,25 +3138,35 @@ discard block |
||
2567 | 3138 | } |
2568 | 3139 | $diff = array_diff($newmodelsdb,$modelsdb); |
2569 | 3140 | foreach ($diff as $key => $value) { |
2570 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3141 | + if ($globalDebug) { |
|
3142 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3143 | + } |
|
2571 | 3144 | update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
2572 | 3145 | |
2573 | 3146 | } |
2574 | 3147 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
2575 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3148 | + } else { |
|
3149 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3150 | + } |
|
2576 | 3151 | if ($error != '') { |
2577 | 3152 | return $error; |
2578 | - } elseif ($globalDebug) echo "Done\n"; |
|
3153 | + } elseif ($globalDebug) { |
|
3154 | + echo "Done\n"; |
|
3155 | + } |
|
2579 | 3156 | return ''; |
2580 | 3157 | } |
2581 | 3158 | |
2582 | 3159 | public static function update_space_models() { |
2583 | 3160 | global $tmp_dir, $globalDebug; |
2584 | 3161 | $error = ''; |
2585 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
3162 | + if ($globalDebug) { |
|
3163 | + echo "Space models from FlightAirMap website : Download..."; |
|
3164 | + } |
|
2586 | 3165 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
2587 | 3166 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2588 | - if ($globalDebug) echo "Check files...\n"; |
|
3167 | + if ($globalDebug) { |
|
3168 | + echo "Check files...\n"; |
|
3169 | + } |
|
2589 | 3170 | $newmodelsdb = array(); |
2590 | 3171 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
2591 | 3172 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2604,25 +3185,35 @@ discard block |
||
2604 | 3185 | } |
2605 | 3186 | $diff = array_diff($newmodelsdb,$modelsdb); |
2606 | 3187 | foreach ($diff as $key => $value) { |
2607 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
3188 | + if ($globalDebug) { |
|
3189 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
3190 | + } |
|
2608 | 3191 | update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
2609 | 3192 | |
2610 | 3193 | } |
2611 | 3194 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
2612 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3195 | + } else { |
|
3196 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3197 | + } |
|
2613 | 3198 | if ($error != '') { |
2614 | 3199 | return $error; |
2615 | - } elseif ($globalDebug) echo "Done\n"; |
|
3200 | + } elseif ($globalDebug) { |
|
3201 | + echo "Done\n"; |
|
3202 | + } |
|
2616 | 3203 | return ''; |
2617 | 3204 | } |
2618 | 3205 | |
2619 | 3206 | public static function update_vehicules_models() { |
2620 | 3207 | global $tmp_dir, $globalDebug; |
2621 | 3208 | $error = ''; |
2622 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
3209 | + if ($globalDebug) { |
|
3210 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
3211 | + } |
|
2623 | 3212 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
2624 | 3213 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2625 | - if ($globalDebug) echo "Check files...\n"; |
|
3214 | + if ($globalDebug) { |
|
3215 | + echo "Check files...\n"; |
|
3216 | + } |
|
2626 | 3217 | $newmodelsdb = array(); |
2627 | 3218 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
2628 | 3219 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2641,15 +3232,21 @@ discard block |
||
2641 | 3232 | } |
2642 | 3233 | $diff = array_diff($newmodelsdb,$modelsdb); |
2643 | 3234 | foreach ($diff as $key => $value) { |
2644 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3235 | + if ($globalDebug) { |
|
3236 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3237 | + } |
|
2645 | 3238 | update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
2646 | 3239 | |
2647 | 3240 | } |
2648 | 3241 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
2649 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3242 | + } else { |
|
3243 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3244 | + } |
|
2650 | 3245 | if ($error != '') { |
2651 | 3246 | return $error; |
2652 | - } elseif ($globalDebug) echo "Done\n"; |
|
3247 | + } elseif ($globalDebug) { |
|
3248 | + echo "Done\n"; |
|
3249 | + } |
|
2653 | 3250 | return ''; |
2654 | 3251 | } |
2655 | 3252 | |
@@ -2692,7 +3289,9 @@ discard block |
||
2692 | 3289 | } |
2693 | 3290 | |
2694 | 3291 | $error = ''; |
2695 | - if ($globalDebug) echo "Notam : Download..."; |
|
3292 | + if ($globalDebug) { |
|
3293 | + echo "Notam : Download..."; |
|
3294 | + } |
|
2696 | 3295 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
2697 | 3296 | if (file_exists($tmp_dir.'notam.rss')) { |
2698 | 3297 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -2707,14 +3306,30 @@ discard block |
||
2707 | 3306 | $data['fir'] = $q[0]; |
2708 | 3307 | $data['code'] = $q[1]; |
2709 | 3308 | $ifrvfr = $q[2]; |
2710 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
2711 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
2712 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
2713 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
2714 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
2715 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
2716 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
2717 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
3309 | + if ($ifrvfr == 'IV') { |
|
3310 | + $data['rules'] = 'IFR/VFR'; |
|
3311 | + } |
|
3312 | + if ($ifrvfr == 'I') { |
|
3313 | + $data['rules'] = 'IFR'; |
|
3314 | + } |
|
3315 | + if ($ifrvfr == 'V') { |
|
3316 | + $data['rules'] = 'VFR'; |
|
3317 | + } |
|
3318 | + if ($q[4] == 'A') { |
|
3319 | + $data['scope'] = 'Airport warning'; |
|
3320 | + } |
|
3321 | + if ($q[4] == 'E') { |
|
3322 | + $data['scope'] = 'Enroute warning'; |
|
3323 | + } |
|
3324 | + if ($q[4] == 'W') { |
|
3325 | + $data['scope'] = 'Navigation warning'; |
|
3326 | + } |
|
3327 | + if ($q[4] == 'AE') { |
|
3328 | + $data['scope'] = 'Airport/Enroute warning'; |
|
3329 | + } |
|
3330 | + if ($q[4] == 'AW') { |
|
3331 | + $data['scope'] = 'Airport/Navigation warning'; |
|
3332 | + } |
|
2718 | 3333 | //$data['scope'] = $q[4]; |
2719 | 3334 | $data['lower_limit'] = $q[5]; |
2720 | 3335 | $data['upper_limit'] = $q[6]; |
@@ -2722,8 +3337,12 @@ discard block |
||
2722 | 3337 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
2723 | 3338 | $latitude = $Common->convertDec($las,'latitude'); |
2724 | 3339 | $longitude = $Common->convertDec($lns,'longitude'); |
2725 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
2726 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
3340 | + if ($lac == 'S') { |
|
3341 | + $latitude = '-'.$latitude; |
|
3342 | + } |
|
3343 | + if ($lnc == 'W') { |
|
3344 | + $longitude = '-'.$longitude; |
|
3345 | + } |
|
2727 | 3346 | $data['center_latitude'] = $latitude; |
2728 | 3347 | $data['center_longitude'] = $longitude; |
2729 | 3348 | $data['radius'] = intval($radius); |
@@ -2753,10 +3372,14 @@ discard block |
||
2753 | 3372 | $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
2754 | 3373 | unset($data); |
2755 | 3374 | } |
2756 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3375 | + } else { |
|
3376 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3377 | + } |
|
2757 | 3378 | if ($error != '') { |
2758 | 3379 | return $error; |
2759 | - } elseif ($globalDebug) echo "Done\n"; |
|
3380 | + } elseif ($globalDebug) { |
|
3381 | + echo "Done\n"; |
|
3382 | + } |
|
2760 | 3383 | return ''; |
2761 | 3384 | } |
2762 | 3385 | |
@@ -2781,7 +3404,9 @@ discard block |
||
2781 | 3404 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2782 | 3405 | $airspace_json = json_decode($airspace_lst,true); |
2783 | 3406 | foreach ($airspace_json['records'] as $airspace) { |
2784 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
3407 | + if ($globalDebug) { |
|
3408 | + echo $airspace['name']."...\n"; |
|
3409 | + } |
|
2785 | 3410 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
2786 | 3411 | if (file_exists($tmp_dir.$airspace['name'])) { |
2787 | 3412 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -2825,8 +3450,11 @@ discard block |
||
2825 | 3450 | return "error : ".$e->getMessage(); |
2826 | 3451 | } |
2827 | 3452 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2828 | - if ($row['nb'] > 0) return false; |
|
2829 | - else return true; |
|
3453 | + if ($row['nb'] > 0) { |
|
3454 | + return false; |
|
3455 | + } else { |
|
3456 | + return true; |
|
3457 | + } |
|
2830 | 3458 | } |
2831 | 3459 | |
2832 | 3460 | public static function insert_last_update() { |
@@ -2851,8 +3479,11 @@ discard block |
||
2851 | 3479 | return "error : ".$e->getMessage(); |
2852 | 3480 | } |
2853 | 3481 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2854 | - if ($row['nb'] > 0) return true; |
|
2855 | - else return false; |
|
3482 | + if ($row['nb'] > 0) { |
|
3483 | + return true; |
|
3484 | + } else { |
|
3485 | + return false; |
|
3486 | + } |
|
2856 | 3487 | } |
2857 | 3488 | |
2858 | 3489 | public static function check_geoid_version($version) { |
@@ -2865,8 +3496,11 @@ discard block |
||
2865 | 3496 | return "error : ".$e->getMessage(); |
2866 | 3497 | } |
2867 | 3498 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2868 | - if ($row['nb'] > 0) return true; |
|
2869 | - else return false; |
|
3499 | + if ($row['nb'] > 0) { |
|
3500 | + return true; |
|
3501 | + } else { |
|
3502 | + return false; |
|
3503 | + } |
|
2870 | 3504 | } |
2871 | 3505 | |
2872 | 3506 | public static function check_marine_identity_version($version) { |
@@ -2879,8 +3513,11 @@ discard block |
||
2879 | 3513 | return "error : ".$e->getMessage(); |
2880 | 3514 | } |
2881 | 3515 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2882 | - if ($row['nb'] > 0) return true; |
|
2883 | - else return false; |
|
3516 | + if ($row['nb'] > 0) { |
|
3517 | + return true; |
|
3518 | + } else { |
|
3519 | + return false; |
|
3520 | + } |
|
2884 | 3521 | } |
2885 | 3522 | |
2886 | 3523 | public static function check_satellite_version($version) { |
@@ -2893,8 +3530,11 @@ discard block |
||
2893 | 3530 | return "error : ".$e->getMessage(); |
2894 | 3531 | } |
2895 | 3532 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2896 | - if ($row['nb'] > 0) return true; |
|
2897 | - else return false; |
|
3533 | + if ($row['nb'] > 0) { |
|
3534 | + return true; |
|
3535 | + } else { |
|
3536 | + return false; |
|
3537 | + } |
|
2898 | 3538 | } |
2899 | 3539 | |
2900 | 3540 | |
@@ -2961,8 +3601,11 @@ discard block |
||
2961 | 3601 | return "error : ".$e->getMessage(); |
2962 | 3602 | } |
2963 | 3603 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2964 | - if ($row['nb'] > 0) return false; |
|
2965 | - else return true; |
|
3604 | + if ($row['nb'] > 0) { |
|
3605 | + return false; |
|
3606 | + } else { |
|
3607 | + return true; |
|
3608 | + } |
|
2966 | 3609 | } |
2967 | 3610 | |
2968 | 3611 | public static function insert_last_notam_update() { |
@@ -2992,8 +3635,11 @@ discard block |
||
2992 | 3635 | return "error : ".$e->getMessage(); |
2993 | 3636 | } |
2994 | 3637 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2995 | - if ($row['nb'] > 0) return false; |
|
2996 | - else return true; |
|
3638 | + if ($row['nb'] > 0) { |
|
3639 | + return false; |
|
3640 | + } else { |
|
3641 | + return true; |
|
3642 | + } |
|
2997 | 3643 | } |
2998 | 3644 | |
2999 | 3645 | public static function insert_last_airspace_update() { |
@@ -3023,8 +3669,11 @@ discard block |
||
3023 | 3669 | return "error : ".$e->getMessage(); |
3024 | 3670 | } |
3025 | 3671 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3026 | - if ($row['nb'] > 0) return false; |
|
3027 | - else return true; |
|
3672 | + if ($row['nb'] > 0) { |
|
3673 | + return false; |
|
3674 | + } else { |
|
3675 | + return true; |
|
3676 | + } |
|
3028 | 3677 | } |
3029 | 3678 | |
3030 | 3679 | public static function insert_last_geoid_update() { |
@@ -3054,8 +3703,11 @@ discard block |
||
3054 | 3703 | return "error : ".$e->getMessage(); |
3055 | 3704 | } |
3056 | 3705 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3057 | - if ($row['nb'] > 0) return false; |
|
3058 | - else return true; |
|
3706 | + if ($row['nb'] > 0) { |
|
3707 | + return false; |
|
3708 | + } else { |
|
3709 | + return true; |
|
3710 | + } |
|
3059 | 3711 | } |
3060 | 3712 | |
3061 | 3713 | public static function insert_last_owner_update() { |
@@ -3084,8 +3736,11 @@ discard block |
||
3084 | 3736 | return "error : ".$e->getMessage(); |
3085 | 3737 | } |
3086 | 3738 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3087 | - if ($row['nb'] > 0) return false; |
|
3088 | - else return true; |
|
3739 | + if ($row['nb'] > 0) { |
|
3740 | + return false; |
|
3741 | + } else { |
|
3742 | + return true; |
|
3743 | + } |
|
3089 | 3744 | } |
3090 | 3745 | |
3091 | 3746 | public static function insert_last_schedules_update() { |
@@ -3115,8 +3770,11 @@ discard block |
||
3115 | 3770 | return "error : ".$e->getMessage(); |
3116 | 3771 | } |
3117 | 3772 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3118 | - if ($row['nb'] > 0) return false; |
|
3119 | - else return true; |
|
3773 | + if ($row['nb'] > 0) { |
|
3774 | + return false; |
|
3775 | + } else { |
|
3776 | + return true; |
|
3777 | + } |
|
3120 | 3778 | } |
3121 | 3779 | |
3122 | 3780 | public static function insert_last_tle_update() { |
@@ -3146,8 +3804,11 @@ discard block |
||
3146 | 3804 | return "error : ".$e->getMessage(); |
3147 | 3805 | } |
3148 | 3806 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3149 | - if ($row['nb'] > 0) return false; |
|
3150 | - else return true; |
|
3807 | + if ($row['nb'] > 0) { |
|
3808 | + return false; |
|
3809 | + } else { |
|
3810 | + return true; |
|
3811 | + } |
|
3151 | 3812 | } |
3152 | 3813 | |
3153 | 3814 | public static function insert_last_ucsdb_update() { |
@@ -3177,8 +3838,11 @@ discard block |
||
3177 | 3838 | return "error : ".$e->getMessage(); |
3178 | 3839 | } |
3179 | 3840 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3180 | - if ($row['nb'] > 0) return false; |
|
3181 | - else return true; |
|
3841 | + if ($row['nb'] > 0) { |
|
3842 | + return false; |
|
3843 | + } else { |
|
3844 | + return true; |
|
3845 | + } |
|
3182 | 3846 | } |
3183 | 3847 | |
3184 | 3848 | public static function insert_last_celestrak_update() { |
@@ -3208,8 +3872,11 @@ discard block |
||
3208 | 3872 | return "error : ".$e->getMessage(); |
3209 | 3873 | } |
3210 | 3874 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3211 | - if ($row['nb'] > 0) return false; |
|
3212 | - else return true; |
|
3875 | + if ($row['nb'] > 0) { |
|
3876 | + return false; |
|
3877 | + } else { |
|
3878 | + return true; |
|
3879 | + } |
|
3213 | 3880 | } |
3214 | 3881 | |
3215 | 3882 | public static function check_last_satellite_update() { |
@@ -3227,8 +3894,11 @@ discard block |
||
3227 | 3894 | return "error : ".$e->getMessage(); |
3228 | 3895 | } |
3229 | 3896 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3230 | - if ($row['nb'] > 0) return false; |
|
3231 | - else return true; |
|
3897 | + if ($row['nb'] > 0) { |
|
3898 | + return false; |
|
3899 | + } else { |
|
3900 | + return true; |
|
3901 | + } |
|
3232 | 3902 | } |
3233 | 3903 | |
3234 | 3904 | public static function insert_last_marine_identity_update() { |
@@ -7,35 +7,35 @@ discard block |
||
7 | 7 | public $latest_schema = 46; |
8 | 8 | |
9 | 9 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
10 | - global $globalNoDB; |
|
11 | - if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
10 | + global $globalNoDB; |
|
11 | + if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
12 | 12 | $this->db = null; |
13 | - } else { |
|
13 | + } else { |
|
14 | 14 | if ($dbc === null) { |
15 | - if ($this->db === null && $dbname === null) { |
|
15 | + if ($this->db === null && $dbname === null) { |
|
16 | 16 | if ($user === null && $pass === null) { |
17 | - $this->createDBConnection(); |
|
17 | + $this->createDBConnection(); |
|
18 | 18 | } else { |
19 | - $this->createDBConnection(null,$user,$pass); |
|
19 | + $this->createDBConnection(null,$user,$pass); |
|
20 | 20 | } |
21 | - } else { |
|
21 | + } else { |
|
22 | 22 | $this->createDBConnection($dbname); |
23 | - } |
|
23 | + } |
|
24 | 24 | } elseif ($dbname === null || $dbname === 'default') { |
25 | - $this->db = $dbc; |
|
26 | - if ($this->connectionExists() === false) { |
|
25 | + $this->db = $dbc; |
|
26 | + if ($this->connectionExists() === false) { |
|
27 | 27 | /* |
28 | 28 | echo 'Restart Connection !!!'."\n"; |
29 | 29 | $e = new \Exception; |
30 | 30 | var_dump($e->getTraceAsString()); |
31 | 31 | */ |
32 | 32 | $this->createDBConnection(); |
33 | - } |
|
33 | + } |
|
34 | 34 | } else { |
35 | - //$this->connectionExists(); |
|
36 | - $this->dbs[$dbname] = $dbc; |
|
35 | + //$this->connectionExists(); |
|
36 | + $this->dbs[$dbname] = $dbc; |
|
37 | + } |
|
37 | 38 | } |
38 | - } |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function db() { |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | - * Creates the database connection |
|
60 | - * |
|
61 | - * @return Boolean of the database connection |
|
62 | - * |
|
63 | - */ |
|
59 | + * Creates the database connection |
|
60 | + * |
|
61 | + * @return Boolean of the database connection |
|
62 | + * |
|
63 | + */ |
|
64 | 64 | |
65 | 65 | public function createDBConnection($DBname = null, $user = null, $pass = null) |
66 | 66 | { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | if($results->rowCount()>0) { |
161 | - return true; |
|
161 | + return true; |
|
162 | 162 | } |
163 | 163 | else return false; |
164 | 164 | } |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | $sum = $sum->fetchColumn(0); |
177 | 177 | } else $sum = 0; |
178 | 178 | if (intval($sum) !== 2) { |
179 | - return false; |
|
179 | + return false; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | } catch(PDOException $e) { |
183 | 183 | if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
184 | - throw $e; |
|
185 | - } |
|
186 | - //echo 'error ! '.$e->getMessage(); |
|
184 | + throw $e; |
|
185 | + } |
|
186 | + //echo 'error ! '.$e->getMessage(); |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | return true; |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | $version = 0; |
288 | 288 | if ($this->tableExists('aircraft')) { |
289 | 289 | if (!$this->tableExists('config')) { |
290 | - $version = '1'; |
|
291 | - return $version; |
|
290 | + $version = '1'; |
|
291 | + return $version; |
|
292 | 292 | } else { |
293 | 293 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
294 | 294 | try { |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | * @return Boolean if latest version or not |
310 | 310 | */ |
311 | 311 | public function latest() { |
312 | - global $globalNoDB; |
|
313 | - if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
314 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
315 | - else return false; |
|
312 | + global $globalNoDB; |
|
313 | + if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
314 | + if ($this->check_schema_version() == $this->latest_schema) return true; |
|
315 | + else return false; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once(dirname(__FILE__).'/settings.php'); |
3 | 3 | |
4 | -class Connection{ |
|
4 | +class Connection { |
|
5 | 5 | public $db = null; |
6 | 6 | public $dbs = array(); |
7 | 7 | public $latest_schema = 46; |
8 | 8 | |
9 | - public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
|
9 | + public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) { |
|
10 | 10 | global $globalNoDB; |
11 | 11 | if (isset($globalNoDB) && $globalNoDB === TRUE) { |
12 | 12 | $this->db = null; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | if ($user === null && $pass === null) { |
17 | 17 | $this->createDBConnection(); |
18 | 18 | } else { |
19 | - $this->createDBConnection(null,$user,$pass); |
|
19 | + $this->createDBConnection(null, $user, $pass); |
|
20 | 20 | } |
21 | 21 | } else { |
22 | 22 | $this->createDBConnection($dbname); |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | while (true) { |
101 | 101 | try { |
102 | 102 | if ($globalDBSdriver == 'mysql') { |
103 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
103 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
104 | 104 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
105 | 105 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
106 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
107 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
108 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
109 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
110 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
106 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
107 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500); |
|
108 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
109 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
110 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
111 | 111 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
112 | 112 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
113 | 113 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -117,19 +117,19 @@ discard block |
||
117 | 117 | $this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"'); |
118 | 118 | //$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"'); |
119 | 119 | } else { |
120 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
120 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
121 | 121 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
122 | 122 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
123 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
124 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
125 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
126 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
127 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
123 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
124 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200); |
|
125 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
126 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
127 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
128 | 128 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
129 | 129 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
130 | 130 | } |
131 | 131 | break; |
132 | - } catch(PDOException $e) { |
|
132 | + } catch (PDOException $e) { |
|
133 | 133 | $i++; |
134 | 134 | if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
135 | 135 | //exit; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | try { |
155 | 155 | //$Connection = new Connection(); |
156 | 156 | $results = $this->db->query($query); |
157 | - } catch(PDOException $e) { |
|
157 | + } catch (PDOException $e) { |
|
158 | 158 | return false; |
159 | 159 | } |
160 | - if($results->rowCount()>0) { |
|
160 | + if ($results->rowCount() > 0) { |
|
161 | 161 | return true; |
162 | 162 | } |
163 | 163 | else return false; |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | |
182 | - } catch(PDOException $e) { |
|
183 | - if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
182 | + } catch (PDOException $e) { |
|
183 | + if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
184 | 184 | throw $e; |
185 | 185 | } |
186 | 186 | //echo 'error ! '.$e->getMessage(); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | /* |
193 | 193 | * Check if index exist |
194 | 194 | */ |
195 | - public function indexExists($table,$index) |
|
195 | + public function indexExists($table, $index) |
|
196 | 196 | { |
197 | 197 | global $globalDBdriver, $globalDBname; |
198 | 198 | if ($globalDBdriver == 'mysql') { |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | try { |
204 | 204 | //$Connection = new Connection(); |
205 | 205 | $results = $this->db->query($query); |
206 | - } catch(PDOException $e) { |
|
206 | + } catch (PDOException $e) { |
|
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
210 | - if($nb[0]['nb'] > 0) { |
|
210 | + if ($nb[0]['nb'] > 0) { |
|
211 | 211 | return true; |
212 | 212 | } |
213 | 213 | else return false; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
223 | 223 | try { |
224 | 224 | $results = $this->db->query($query); |
225 | - } catch(PDOException $e) { |
|
225 | + } catch (PDOException $e) { |
|
226 | 226 | return "error : ".$e->getMessage()."\n"; |
227 | 227 | } |
228 | 228 | $columns = array(); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | return $columns; |
235 | 235 | } |
236 | 236 | |
237 | - public function getColumnType($table,$column) { |
|
237 | + public function getColumnType($table, $column) { |
|
238 | 238 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
239 | 239 | $tomet = $select->getColumnMeta(0); |
240 | 240 | return $tomet['native_type']; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * Check if a column name exist in a table |
245 | 245 | * @return Boolean column exist or not |
246 | 246 | */ |
247 | - public function checkColumnName($table,$name) |
|
247 | + public function checkColumnName($table, $name) |
|
248 | 248 | { |
249 | 249 | global $globalDBdriver, $globalDBname; |
250 | 250 | if ($globalDBdriver == 'mysql') { |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | } |
255 | 255 | try { |
256 | 256 | $sth = $this->db()->prepare($query); |
257 | - $sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name)); |
|
258 | - } catch(PDOException $e) { |
|
257 | + $sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name)); |
|
258 | + } catch (PDOException $e) { |
|
259 | 259 | echo "error : ".$e->getMessage()."\n"; |
260 | 260 | } |
261 | 261 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | try { |
295 | 295 | $sth = $this->db->prepare($query); |
296 | 296 | $sth->execute(); |
297 | - } catch(PDOException $e) { |
|
297 | + } catch (PDOException $e) { |
|
298 | 298 | return "error : ".$e->getMessage()."\n"; |
299 | 299 | } |
300 | 300 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -6,6 +6,9 @@ discard block |
||
6 | 6 | public $dbs = array(); |
7 | 7 | public $latest_schema = 46; |
8 | 8 | |
9 | + /** |
|
10 | + * @param string $dbname |
|
11 | + */ |
|
9 | 12 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
10 | 13 | global $globalNoDB; |
11 | 14 | if (isset($globalNoDB) && $globalNoDB === TRUE) { |
@@ -142,6 +145,9 @@ discard block |
||
142 | 145 | return true; |
143 | 146 | } |
144 | 147 | |
148 | + /** |
|
149 | + * @param string $table |
|
150 | + */ |
|
145 | 151 | public function tableExists($table) |
146 | 152 | { |
147 | 153 | global $globalDBdriver, $globalDBname; |
@@ -192,6 +198,11 @@ discard block |
||
192 | 198 | /* |
193 | 199 | * Check if index exist |
194 | 200 | */ |
201 | + |
|
202 | + /** |
|
203 | + * @param string $table |
|
204 | + * @param string $index |
|
205 | + */ |
|
195 | 206 | public function indexExists($table,$index) |
196 | 207 | { |
197 | 208 | global $globalDBdriver, $globalDBname; |
@@ -234,6 +245,10 @@ discard block |
||
234 | 245 | return $columns; |
235 | 246 | } |
236 | 247 | |
248 | + /** |
|
249 | + * @param string $table |
|
250 | + * @param string $column |
|
251 | + */ |
|
237 | 252 | public function getColumnType($table,$column) { |
238 | 253 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
239 | 254 | $tomet = $select->getColumnMeta(0); |
@@ -244,6 +259,11 @@ discard block |
||
244 | 259 | * Check if a column name exist in a table |
245 | 260 | * @return Boolean column exist or not |
246 | 261 | */ |
262 | + |
|
263 | + /** |
|
264 | + * @param string $table |
|
265 | + * @param string $name |
|
266 | + */ |
|
247 | 267 | public function checkColumnName($table,$name) |
248 | 268 | { |
249 | 269 | global $globalDBdriver, $globalDBname; |
@@ -73,8 +73,11 @@ discard block |
||
73 | 73 | $globalDBSname = $globalDBname; |
74 | 74 | $globalDBSuser = $globalDBuser; |
75 | 75 | $globalDBSpass = $globalDBpass; |
76 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
77 | - else $globalDBSport = $globalDBport; |
|
76 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
77 | + $globalDBSport = 3306; |
|
78 | + } else { |
|
79 | + $globalDBSport = $globalDBport; |
|
80 | + } |
|
78 | 81 | } else { |
79 | 82 | $DBname = 'default'; |
80 | 83 | $globalDBSdriver = $globalDBdriver; |
@@ -82,8 +85,11 @@ discard block |
||
82 | 85 | $globalDBSname = $globalDBname; |
83 | 86 | $globalDBSuser = $user; |
84 | 87 | $globalDBSpass = $pass; |
85 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
86 | - else $globalDBSport = $globalDBport; |
|
88 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
89 | + $globalDBSport = 3306; |
|
90 | + } else { |
|
91 | + $globalDBSport = $globalDBport; |
|
92 | + } |
|
87 | 93 | } |
88 | 94 | } else { |
89 | 95 | $globalDBSdriver = $globalDB[$DBname]['driver']; |
@@ -91,12 +97,19 @@ discard block |
||
91 | 97 | $globalDBSname = $globalDB[$DBname]['name']; |
92 | 98 | $globalDBSuser = $globalDB[$DBname]['user']; |
93 | 99 | $globalDBSpass = $globalDB[$DBname]['pass']; |
94 | - if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port']; |
|
95 | - else $globalDBSport = 3306; |
|
100 | + if (isset($globalDB[$DBname]['port'])) { |
|
101 | + $globalDBSport = $globalDB[$DBname]['port']; |
|
102 | + } else { |
|
103 | + $globalDBSport = 3306; |
|
104 | + } |
|
105 | + } |
|
106 | + if ($globalDBSname == '' || $globalDBSuser == '') { |
|
107 | + return false; |
|
96 | 108 | } |
97 | - if ($globalDBSname == '' || $globalDBSuser == '') return false; |
|
98 | 109 | // Set number of try to connect to DB |
99 | - if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5; |
|
110 | + if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) { |
|
111 | + $globalDBretry = 5; |
|
112 | + } |
|
100 | 113 | $i = 0; |
101 | 114 | while (true) { |
102 | 115 | try { |
@@ -105,10 +118,16 @@ discard block |
||
105 | 118 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
106 | 119 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
107 | 120 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
108 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
109 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
110 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
111 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
121 | + if (!isset($globalDBTimeOut)) { |
|
122 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
123 | + } else { |
|
124 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
125 | + } |
|
126 | + if (!isset($globalDBPersistent)) { |
|
127 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
128 | + } else { |
|
129 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
130 | + } |
|
112 | 131 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
113 | 132 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
114 | 133 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -122,24 +141,36 @@ discard block |
||
122 | 141 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
123 | 142 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
124 | 143 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
125 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
126 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
127 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
128 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
144 | + if (!isset($globalDBTimeOut)) { |
|
145 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
146 | + } else { |
|
147 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
148 | + } |
|
149 | + if (!isset($globalDBPersistent)) { |
|
150 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
151 | + } else { |
|
152 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
153 | + } |
|
129 | 154 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
130 | 155 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
131 | 156 | } |
132 | 157 | break; |
133 | 158 | } catch(PDOException $e) { |
134 | 159 | $i++; |
135 | - if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
|
160 | + if (isset($globalDebug) && $globalDebug) { |
|
161 | + echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
|
162 | + } |
|
136 | 163 | //exit; |
137 | - if ($i > $globalDBretry) return false; |
|
164 | + if ($i > $globalDBretry) { |
|
165 | + return false; |
|
166 | + } |
|
138 | 167 | //return false; |
139 | 168 | } |
140 | 169 | sleep(2); |
141 | 170 | } |
142 | - if ($DBname === 'default') $this->db = $this->dbs['default']; |
|
171 | + if ($DBname === 'default') { |
|
172 | + $this->db = $this->dbs['default']; |
|
173 | + } |
|
143 | 174 | return true; |
144 | 175 | } |
145 | 176 | |
@@ -151,7 +182,9 @@ discard block |
||
151 | 182 | } else { |
152 | 183 | $query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'"; |
153 | 184 | } |
154 | - if ($this->db == NULL) return false; |
|
185 | + if ($this->db == NULL) { |
|
186 | + return false; |
|
187 | + } |
|
155 | 188 | try { |
156 | 189 | //$Connection = new Connection(); |
157 | 190 | $results = $this->db->query($query); |
@@ -160,22 +193,31 @@ discard block |
||
160 | 193 | } |
161 | 194 | if($results->rowCount()>0) { |
162 | 195 | return true; |
196 | + } else { |
|
197 | + return false; |
|
163 | 198 | } |
164 | - else return false; |
|
165 | 199 | } |
166 | 200 | |
167 | 201 | public function connectionExists() |
168 | 202 | { |
169 | 203 | global $globalDBdriver, $globalDBCheckConnection, $globalNoDB; |
170 | - if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true; |
|
171 | - if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
204 | + if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) { |
|
205 | + return true; |
|
206 | + } |
|
207 | + if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
208 | + return true; |
|
209 | + } |
|
172 | 210 | $query = "SELECT 1 + 1"; |
173 | - if ($this->db === null) return false; |
|
211 | + if ($this->db === null) { |
|
212 | + return false; |
|
213 | + } |
|
174 | 214 | try { |
175 | 215 | $sum = @$this->db->query($query); |
176 | 216 | if ($sum instanceof \PDOStatement) { |
177 | 217 | $sum = $sum->fetchColumn(0); |
178 | - } else $sum = 0; |
|
218 | + } else { |
|
219 | + $sum = 0; |
|
220 | + } |
|
179 | 221 | if (intval($sum) !== 2) { |
180 | 222 | return false; |
181 | 223 | } |
@@ -210,8 +252,9 @@ discard block |
||
210 | 252 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
211 | 253 | if($nb[0]['nb'] > 0) { |
212 | 254 | return true; |
255 | + } else { |
|
256 | + return false; |
|
213 | 257 | } |
214 | - else return false; |
|
215 | 258 | } |
216 | 259 | |
217 | 260 | /* |
@@ -261,9 +304,12 @@ discard block |
||
261 | 304 | } |
262 | 305 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
263 | 306 | $sth->closeCursor(); |
264 | - if ($result['nb'] > 0) return true; |
|
265 | - else return false; |
|
266 | -/* } else { |
|
307 | + if ($result['nb'] > 0) { |
|
308 | + return true; |
|
309 | + } else { |
|
310 | + return false; |
|
311 | + } |
|
312 | + /* } else { |
|
267 | 313 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
268 | 314 | try { |
269 | 315 | $results = $this->db->query($query); |
@@ -302,7 +348,9 @@ discard block |
||
302 | 348 | $sth->closeCursor(); |
303 | 349 | return $result['value']; |
304 | 350 | } |
305 | - } else return $version; |
|
351 | + } else { |
|
352 | + return $version; |
|
353 | + } |
|
306 | 354 | } |
307 | 355 | |
308 | 356 | /* |
@@ -311,9 +359,14 @@ discard block |
||
311 | 359 | */ |
312 | 360 | public function latest() { |
313 | 361 | global $globalNoDB; |
314 | - if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
315 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
316 | - else return false; |
|
362 | + if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
363 | + return true; |
|
364 | + } |
|
365 | + if ($this->check_schema_version() == $this->latest_schema) { |
|
366 | + return true; |
|
367 | + } else { |
|
368 | + return false; |
|
369 | + } |
|
317 | 370 | } |
318 | 371 | |
319 | 372 | } |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | - * Gets all launch site |
|
128 | - * |
|
129 | - * @return Array the launch site list |
|
130 | - * |
|
131 | - */ |
|
127 | + * Gets all launch site |
|
128 | + * |
|
129 | + * @return Array the launch site list |
|
130 | + * |
|
131 | + */ |
|
132 | 132 | public function countAllLaunchSite($limit = true, $filters = array()) |
133 | 133 | { |
134 | 134 | global $globalDBdriver; |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
156 | - * Gets all owners |
|
157 | - * |
|
158 | - * @return Array the owners list |
|
159 | - * |
|
160 | - */ |
|
156 | + * Gets all owners |
|
157 | + * |
|
158 | + * @return Array the owners list |
|
159 | + * |
|
160 | + */ |
|
161 | 161 | public function countAllOwners($limit = true, $filters = array()) |
162 | 162 | { |
163 | 163 | global $globalDBdriver; |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | - * Gets all countries owners |
|
186 | - * |
|
187 | - * @return Array the countries list |
|
188 | - * |
|
189 | - */ |
|
185 | + * Gets all countries owners |
|
186 | + * |
|
187 | + * @return Array the countries list |
|
188 | + * |
|
189 | + */ |
|
190 | 190 | public function countAllCountriesOwners($limit = true, $filters = array()) |
191 | 191 | { |
192 | 192 | global $globalDBdriver; |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
214 | - * Counts all launch dates during the last year |
|
215 | - * |
|
216 | - * @return Array the launch date list |
|
217 | - * |
|
218 | - */ |
|
214 | + * Counts all launch dates during the last year |
|
215 | + * |
|
216 | + * @return Array the launch date list |
|
217 | + * |
|
218 | + */ |
|
219 | 219 | public function countAllMonthsLastYear($filters = array(), $sincedate = '') |
220 | 220 | { |
221 | 221 | global $globalTimezone, $globalDBdriver; |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
259 | - * Counts all dates during the last 10 years |
|
260 | - * |
|
261 | - * @return Array the date list |
|
262 | - * |
|
263 | - */ |
|
259 | + * Counts all dates during the last 10 years |
|
260 | + * |
|
261 | + * @return Array the date list |
|
262 | + * |
|
263 | + */ |
|
264 | 264 | public function countAllYears($filters = array(), $sincedate = '') |
265 | 265 | { |
266 | 266 | global $globalTimezone, $globalDBdriver; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | try { |
20 | 20 | $sth = $this->db->prepare($query); |
21 | 21 | $sth->execute(array(':name' => $name)); |
22 | - } catch(PDOException $e) { |
|
22 | + } catch (PDOException $e) { |
|
23 | 23 | echo $e->getMessage(); |
24 | 24 | } |
25 | 25 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | try { |
32 | 32 | $sth = $this->db->prepare($query); |
33 | 33 | $sth->execute(); |
34 | - } catch(PDOException $e) { |
|
34 | + } catch (PDOException $e) { |
|
35 | 35 | echo $e->getMessage(); |
36 | 36 | } |
37 | 37 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | try { |
44 | 44 | $sth = $this->db->prepare($query); |
45 | 45 | $sth->execute(); |
46 | - } catch(PDOException $e) { |
|
46 | + } catch (PDOException $e) { |
|
47 | 47 | echo $e->getMessage(); |
48 | 48 | } |
49 | 49 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | try { |
56 | 56 | $sth = $this->db->prepare($query); |
57 | 57 | $sth->execute(array(':type' => $type)); |
58 | - } catch(PDOException $e) { |
|
58 | + } catch (PDOException $e) { |
|
59 | 59 | echo $e->getMessage(); |
60 | 60 | } |
61 | 61 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -63,48 +63,48 @@ discard block |
||
63 | 63 | else return array(); |
64 | 64 | } |
65 | 65 | |
66 | - public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
66 | + public function position_all($timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
67 | 67 | $all_sat = $this->get_tle_names(); |
68 | 68 | $result = array(); |
69 | 69 | foreach ($all_sat as $sat) { |
70 | - $position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second); |
|
71 | - $result = array_merge($position,$result); |
|
70 | + $position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second); |
|
71 | + $result = array_merge($position, $result); |
|
72 | 72 | } |
73 | 73 | return $result; |
74 | 74 | } |
75 | 75 | |
76 | - public function position_all_type($type,$timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
76 | + public function position_all_type($type, $timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
77 | 77 | $all_sat = $this->get_tle_names_type($type); |
78 | 78 | $result = array(); |
79 | 79 | foreach ($all_sat as $sat) { |
80 | - $position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second); |
|
81 | - $result = array_merge($position,$result); |
|
80 | + $position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second); |
|
81 | + $result = array_merge($position, $result); |
|
82 | 82 | } |
83 | 83 | return $result; |
84 | 84 | } |
85 | 85 | |
86 | - public function position($name,$timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
86 | + public function position($name, $timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
87 | 87 | $qth = new Predict_QTH(); |
88 | 88 | $qth->lat = floatval(37.790252); |
89 | 89 | $qth->lon = floatval(-122.419968); |
90 | 90 | |
91 | 91 | $tle_file = $this->get_tle($name); |
92 | 92 | $type = $tle_file['tle_type']; |
93 | - $tle = new Predict_TLE($tle_file['tle_name'],$tle_file['tle_tle1'],$tle_file['tle_tle2']); |
|
93 | + $tle = new Predict_TLE($tle_file['tle_name'], $tle_file['tle_tle1'], $tle_file['tle_tle2']); |
|
94 | 94 | $sat = new Predict_Sat($tle); |
95 | 95 | $predict = new Predict(); |
96 | 96 | //if ($timestamp == '') $now = Predict_Time::get_current_daynum(); |
97 | 97 | if ($timestamp_begin == '') $timestamp_begin = time(); |
98 | 98 | if ($timestamp_end == '') { |
99 | 99 | $now = Predict_Time::unix2daynum($timestamp_begin); |
100 | - $predict->predict_calc($sat,$qth,$now); |
|
101 | - return array('name' => $name, 'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp_begin,'type' => $type); |
|
100 | + $predict->predict_calc($sat, $qth, $now); |
|
101 | + return array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp_begin, 'type' => $type); |
|
102 | 102 | } else { |
103 | 103 | $result = array(); |
104 | - for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp=$timestamp+$second) { |
|
104 | + for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp = $timestamp + $second) { |
|
105 | 105 | $now = Predict_Time::unix2daynum($timestamp); |
106 | - $predict->predict_calc($sat,$qth,$now); |
|
107 | - $result[] = array('name' => $name,'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp,'type' => $type); |
|
106 | + $predict->predict_calc($sat, $qth, $now); |
|
107 | + $result[] = array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp, 'type' => $type); |
|
108 | 108 | } |
109 | 109 | return $result; |
110 | 110 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | try { |
116 | 116 | $sth = $this->db->prepare($query); |
117 | 117 | $sth->execute(array(':name' => $name.'%')); |
118 | - } catch(PDOException $e) { |
|
118 | + } catch (PDOException $e) { |
|
119 | 119 | echo $e->getMessage(); |
120 | 120 | } |
121 | 121 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $sth->execute($query_values); |
144 | 144 | $launch_site_array = array(); |
145 | 145 | $temp_array = array(); |
146 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
146 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
147 | 147 | { |
148 | 148 | $temp_array['launch_site'] = $row['launch_site']; |
149 | 149 | $temp_array['launch_site_count'] = $row['launch_site_count']; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $sth->execute($query_values); |
173 | 173 | $owner_array = array(); |
174 | 174 | $temp_array = array(); |
175 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
175 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
176 | 176 | { |
177 | 177 | $temp_array['owner_name'] = $row['owner_name']; |
178 | 178 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $sth->execute($query_values); |
202 | 202 | $owner_array = array(); |
203 | 203 | $temp_array = array(); |
204 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
204 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
205 | 205 | { |
206 | 206 | $temp_array['country_name'] = $row['country_name']; |
207 | 207 | $temp_array['country_count'] = $row['country_count']; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $sth->execute($query_data); |
246 | 246 | $date_array = array(); |
247 | 247 | $temp_array = array(); |
248 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
248 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
249 | 249 | { |
250 | 250 | $temp_array['year_name'] = $row['year_name']; |
251 | 251 | $temp_array['month_name'] = $row['month_name']; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $sth->execute($query_data); |
291 | 291 | $date_array = array(); |
292 | 292 | $temp_array = array(); |
293 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
293 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
294 | 294 | { |
295 | 295 | $temp_array['year_name'] = $row['year_name']; |
296 | 296 | $temp_array['date_count'] = $row['date_count']; |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | public function __construct($dbc = null) { |
13 | 13 | $Connection = new Connection($dbc); |
14 | 14 | $this->db = $Connection->db(); |
15 | - if ($this->db === null) die('Error: No DB connection.'); |
|
15 | + if ($this->db === null) { |
|
16 | + die('Error: No DB connection.'); |
|
17 | + } |
|
16 | 18 | } |
17 | 19 | |
18 | 20 | public function get_tle($name) { |
@@ -24,8 +26,11 @@ discard block |
||
24 | 26 | echo $e->getMessage(); |
25 | 27 | } |
26 | 28 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
27 | - if (isset($result[0])) return $result[0]; |
|
28 | - else return array(); |
|
29 | + if (isset($result[0])) { |
|
30 | + return $result[0]; |
|
31 | + } else { |
|
32 | + return array(); |
|
33 | + } |
|
29 | 34 | } |
30 | 35 | public function get_tle_types() { |
31 | 36 | $query = 'SELECT DISTINCT tle_type FROM tle ORDER BY tle_type'; |
@@ -36,8 +41,11 @@ discard block |
||
36 | 41 | echo $e->getMessage(); |
37 | 42 | } |
38 | 43 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
39 | - if (isset($result[0])) return $result; |
|
40 | - else return array(); |
|
44 | + if (isset($result[0])) { |
|
45 | + return $result; |
|
46 | + } else { |
|
47 | + return array(); |
|
48 | + } |
|
41 | 49 | } |
42 | 50 | public function get_tle_names() { |
43 | 51 | $query = 'SELECT DISTINCT tle_name, tle_type FROM tle'; |
@@ -48,8 +56,11 @@ discard block |
||
48 | 56 | echo $e->getMessage(); |
49 | 57 | } |
50 | 58 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
51 | - if (isset($result[0])) return $result; |
|
52 | - else return array(); |
|
59 | + if (isset($result[0])) { |
|
60 | + return $result; |
|
61 | + } else { |
|
62 | + return array(); |
|
63 | + } |
|
53 | 64 | } |
54 | 65 | public function get_tle_names_type($type) { |
55 | 66 | $query = 'SELECT tle_name, tle_type FROM tle WHERE tle_type = :type ORDER BY tle_name'; |
@@ -60,8 +71,11 @@ discard block |
||
60 | 71 | echo $e->getMessage(); |
61 | 72 | } |
62 | 73 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
63 | - if (isset($result[0])) return $result; |
|
64 | - else return array(); |
|
74 | + if (isset($result[0])) { |
|
75 | + return $result; |
|
76 | + } else { |
|
77 | + return array(); |
|
78 | + } |
|
65 | 79 | } |
66 | 80 | |
67 | 81 | public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) { |
@@ -95,7 +109,9 @@ discard block |
||
95 | 109 | $sat = new Predict_Sat($tle); |
96 | 110 | $predict = new Predict(); |
97 | 111 | //if ($timestamp == '') $now = Predict_Time::get_current_daynum(); |
98 | - if ($timestamp_begin == '') $timestamp_begin = time(); |
|
112 | + if ($timestamp_begin == '') { |
|
113 | + $timestamp_begin = time(); |
|
114 | + } |
|
99 | 115 | if ($timestamp_end == '') { |
100 | 116 | $now = Predict_Time::unix2daynum($timestamp_begin); |
101 | 117 | $predict->predict_calc($sat,$qth,$now); |
@@ -120,8 +136,11 @@ discard block |
||
120 | 136 | echo $e->getMessage(); |
121 | 137 | } |
122 | 138 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
123 | - if (isset($result[0])) return $result[0]; |
|
124 | - else return array(); |
|
139 | + if (isset($result[0])) { |
|
140 | + return $result[0]; |
|
141 | + } else { |
|
142 | + return array(); |
|
143 | + } |
|
125 | 144 | } |
126 | 145 | |
127 | 146 | /** |
@@ -139,7 +158,9 @@ discard block |
||
139 | 158 | FROM satellite".$filter_query." satellite.launch_site <> '' AND satellite.launch_site IS NOT NULL"; |
140 | 159 | $query_values = array(); |
141 | 160 | $query .= " GROUP BY satellite.launch_site ORDER BY launch_site_count DESC"; |
142 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
161 | + if ($limit) { |
|
162 | + $query .= " LIMIT 10 OFFSET 0"; |
|
163 | + } |
|
143 | 164 | $sth = $this->db->prepare($query); |
144 | 165 | $sth->execute($query_values); |
145 | 166 | $launch_site_array = array(); |
@@ -168,7 +189,9 @@ discard block |
||
168 | 189 | FROM satellite".$filter_query." satellite.owner <> '' AND satellite.owner IS NOT NULL"; |
169 | 190 | $query_values = array(); |
170 | 191 | $query .= " GROUP BY satellite.owner ORDER BY owner_count DESC"; |
171 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
192 | + if ($limit) { |
|
193 | + $query .= " LIMIT 10 OFFSET 0"; |
|
194 | + } |
|
172 | 195 | $sth = $this->db->prepare($query); |
173 | 196 | $sth->execute($query_values); |
174 | 197 | $owner_array = array(); |
@@ -197,7 +220,9 @@ discard block |
||
197 | 220 | FROM satellite".$filter_query." satellite.country_owner <> '' AND satellite.country_owner IS NOT NULL"; |
198 | 221 | $query_values = array(); |
199 | 222 | $query .= " GROUP BY satellite.country_owner ORDER BY country_count DESC"; |
200 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
223 | + if ($limit) { |
|
224 | + $query .= " LIMIT 10 OFFSET 0"; |
|
225 | + } |
|
201 | 226 | $sth = $this->db->prepare($query); |
202 | 227 | $sth->execute($query_values); |
203 | 228 | $owner_array = array(); |
@@ -224,20 +249,26 @@ discard block |
||
224 | 249 | date_default_timezone_set($globalTimezone); |
225 | 250 | $datetime = new DateTime(); |
226 | 251 | $offset = $datetime->format('P'); |
227 | - } else $offset = '+00:00'; |
|
252 | + } else { |
|
253 | + $offset = '+00:00'; |
|
254 | + } |
|
228 | 255 | //$filter_query = $this->getFilter($filters,true,true); |
229 | 256 | $filter_query = ' WHERE'; |
230 | 257 | if ($globalDBdriver == 'mysql') { |
231 | 258 | $query = "SELECT MONTH(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS year_name, count(*) as date_count |
232 | 259 | FROM satellite".$filter_query." satellite.launch_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
233 | - if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
260 | + if ($sincedate != '') { |
|
261 | + $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
262 | + } |
|
234 | 263 | $query .= " GROUP BY year_name, month_name |
235 | 264 | ORDER BY year_name, month_name ASC"; |
236 | 265 | $query_data = array(':offset' => $offset); |
237 | 266 | } else { |
238 | 267 | $query = "SELECT EXTRACT(MONTH FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS month_name, EXTRACT(YEAR FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS year_name, count(*) as date_count |
239 | 268 | FROM satellite".$filter_query." satellite.launch_date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 YEARS'"; |
240 | - if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
269 | + if ($sincedate != '') { |
|
270 | + $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
271 | + } |
|
241 | 272 | $query .= " GROUP BY year_name, month_name |
242 | 273 | ORDER BY year_name, month_name ASC"; |
243 | 274 | $query_data = array(':offset' => $offset); |
@@ -269,20 +300,26 @@ discard block |
||
269 | 300 | date_default_timezone_set($globalTimezone); |
270 | 301 | $datetime = new DateTime(); |
271 | 302 | $offset = $datetime->format('P'); |
272 | - } else $offset = '+00:00'; |
|
303 | + } else { |
|
304 | + $offset = '+00:00'; |
|
305 | + } |
|
273 | 306 | //$filter_query = $this->getFilter($filters,true,true); |
274 | 307 | $filter_query = ' WHERE'; |
275 | 308 | if ($globalDBdriver == 'mysql') { |
276 | 309 | $query = "SELECT YEAR(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS year_name, count(*) as date_count |
277 | 310 | FROM satellite".$filter_query." satellite.launch_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 YEAR)"; |
278 | - if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
311 | + if ($sincedate != '') { |
|
312 | + $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
313 | + } |
|
279 | 314 | $query .= " GROUP BY year_name |
280 | 315 | ORDER BY year_name ASC"; |
281 | 316 | $query_data = array(':offset' => $offset); |
282 | 317 | } else { |
283 | 318 | $query = "SELECT EXTRACT(YEAR FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS year_name, count(*) as date_count |
284 | 319 | FROM satellite".$filter_query." satellite.launch_date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '10 YEARS'"; |
285 | - if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
320 | + if ($sincedate != '') { |
|
321 | + $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
322 | + } |
|
286 | 323 | $query .= " GROUP BY year_name |
287 | 324 | ORDER BY year_name ASC"; |
288 | 325 | $query_data = array(':offset' => $offset); |
@@ -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 | $info = $Satellite->get_info(strtolower(trim($satname))); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | print '<div><span>'._("Orbit").'</span>'.$info['orbit'].'</div>'; |
146 | 146 | } |
147 | 147 | if ($info['launch_date'] != '') { |
148 | - print '<div><span>'._("Launch Date").'</span>'.date('Y-m-d',strtotime($info['launch_date'])).'</div>'; |
|
148 | + print '<div><span>'._("Launch Date").'</span>'.date('Y-m-d', strtotime($info['launch_date'])).'</div>'; |
|
149 | 149 | } |
150 | 150 | if ($info['launch_site'] != '') { |
151 | 151 | 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 | $info = $Satellite->get_info(strtolower(trim($satname))); |
89 | 94 | $position = $Satellite->position($sat); |
90 | 95 | $ground_speed = $position['speed']; |
@@ -52,7 +52,12 @@ |
||
52 | 52 | } else { |
53 | 53 | for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) { |
54 | 54 | var entity = viewer.dataSources.get(dsn).entities.values[i]; |
55 | - if (parseInt(entity.lastupdatesat) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
|
55 | + if (parseInt(entity.lastupdatesat) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) { |
|
56 | + print $globalMapRefresh*2000; |
|
57 | +} else { |
|
58 | + print '60000'; |
|
59 | +} |
|
60 | +?>)) { |
|
56 | 61 | viewer.dataSources.get(dsn).entities.remove(entity); |
57 | 62 | } |
58 | 63 | } |