@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$country = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))); |
|
11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
10 | +$country = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING))); |
|
11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
12 | 12 | |
13 | 13 | if (isset($_GET['sort'])) { |
14 | 14 | $spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort); |
@@ -18,16 +18,16 @@ discard block |
||
18 | 18 | |
19 | 19 | if (!empty($spotter_array)) |
20 | 20 | { |
21 | - $title = sprintf(_("Most Common Arrival Airports by Country from %s"),$country); |
|
21 | + $title = sprintf(_("Most Common Arrival Airports by Country from %s"), $country); |
|
22 | 22 | require_once('header.php'); |
23 | 23 | print '<div class="select-item">'; |
24 | 24 | print '<form action="'.$globalURL.'/country" method="post">'; |
25 | 25 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
26 | 26 | print '<option></option>'; |
27 | 27 | $all_countries = $Spotter->getAllCountries(); |
28 | - foreach($all_countries as $all_country) |
|
28 | + foreach ($all_countries as $all_country) |
|
29 | 29 | { |
30 | - if($country == $all_country['country']) |
|
30 | + if ($country == $all_country['country']) |
|
31 | 31 | { |
32 | 32 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
33 | 33 | } else { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | if ($_GET['country'] != "NA") |
43 | 43 | { |
44 | 44 | print '<div class="info column">'; |
45 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
45 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
46 | 46 | print '</div>'; |
47 | 47 | } else { |
48 | 48 | print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>'; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | include('country-sub-menu.php'); |
52 | 52 | print '<div class="column">'; |
53 | 53 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
54 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights of airports & airlines from <strong>%s</strong>."),$country).'</p>'; |
|
54 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights of airports & airlines from <strong>%s</strong>."), $country).'</p>'; |
|
55 | 55 | |
56 | 56 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByCountry($country); |
57 | 57 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
62 | 62 | print 'var series = ['; |
63 | 63 | $country_data = ''; |
64 | - foreach($airport_country_array as $airport_item) |
|
64 | + foreach ($airport_country_array as $airport_item) |
|
65 | 65 | { |
66 | 66 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
67 | 67 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | print '</thead>'; |
110 | 110 | print '<tbody>'; |
111 | 111 | $i = 1; |
112 | - foreach($airport_country_array as $airport_item) |
|
112 | + foreach ($airport_country_array as $airport_item) |
|
113 | 113 | { |
114 | 114 | print '<tr>'; |
115 | 115 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
8 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
8 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
9 | 9 | |
10 | 10 | if (!empty($spotter_array)) |
11 | 11 | { |
12 | - $title = sprintf(_("Most Common Departure Airports by Country on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
12 | + $title = sprintf(_("Most Common Departure Airports by Country on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
13 | 13 | |
14 | 14 | require_once('header.php'); |
15 | 15 | print '<div class="select-item">'; |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>'; |
28 | 28 | print '<br />'; |
29 | 29 | print '<div class="info column">'; |
30 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
30 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
31 | 31 | print '</div>'; |
32 | 32 | |
33 | 33 | include('date-sub-menu.php'); |
34 | 34 | print '<div class="column">'; |
35 | 35 | print '<h2>'._("Most Common Departure Airports by Country").'</h2>'; |
36 | - print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
36 | + print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
37 | 37 | $airport_country_array = $Spotter->countAllDepartureAirportCountriesByDate($date); |
38 | 38 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
39 | 39 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
42 | 42 | print 'var series = ['; |
43 | 43 | $country_data = ''; |
44 | - foreach($airport_country_array as $airport_item) |
|
44 | + foreach ($airport_country_array as $airport_item) |
|
45 | 45 | { |
46 | 46 | $country_data .= '[ "'.$airport_item['departure_airport_country_iso3'].'",'.$airport_item['airport_departure_country_count'].'],'; |
47 | 47 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | print '</thead>'; |
90 | 90 | print '<tbody>'; |
91 | 91 | $i = 1; |
92 | - foreach($airport_country_array as $airport_item) |
|
92 | + foreach ($airport_country_array as $airport_item) |
|
93 | 93 | { |
94 | 94 | print '<tr>'; |
95 | 95 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -17,22 +17,22 @@ discard block |
||
17 | 17 | * @return Array the images list |
18 | 18 | * |
19 | 19 | */ |
20 | - public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
20 | + public function getSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
21 | 21 | { |
22 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
23 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
24 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
22 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
23 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
24 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
25 | 25 | $reg = $registration; |
26 | 26 | if ($reg == '' && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao; |
27 | 27 | $reg = trim($reg); |
28 | - $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
28 | + $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
29 | 29 | FROM spotter_image |
30 | 30 | WHERE spotter_image.registration = :registration LIMIT 1"; |
31 | 31 | $sth = $this->db->prepare($query); |
32 | 32 | $sth->execute(array(':registration' => $reg)); |
33 | 33 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
34 | 34 | if (!empty($result)) return $result; |
35 | - elseif ($registration != '') return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
35 | + elseif ($registration != '') return $this->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
48 | 48 | elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
49 | 49 | if ($copyright != '') { |
50 | - $copyright = str_replace('Copyright ','',$copyright); |
|
51 | - $copyright = str_replace('© ','',$copyright); |
|
52 | - $copyright = str_replace('(c) ','',$copyright); |
|
50 | + $copyright = str_replace('Copyright ', '', $copyright); |
|
51 | + $copyright = str_replace('© ', '', $copyright); |
|
52 | + $copyright = str_replace('(c) ', '', $copyright); |
|
53 | 53 | } |
54 | 54 | return $copyright; |
55 | 55 | } |
@@ -60,26 +60,26 @@ discard block |
||
60 | 60 | * @return String either success or error |
61 | 61 | * |
62 | 62 | */ |
63 | - public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
63 | + public function addSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
64 | 64 | { |
65 | - global $globalDebug,$globalAircraftImageFetch; |
|
65 | + global $globalDebug, $globalAircraftImageFetch; |
|
66 | 66 | if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return ''; |
67 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
67 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
68 | 68 | $registration = trim($registration); |
69 | 69 | //getting the aircraft image |
70 | 70 | if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
71 | 71 | elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
72 | 72 | elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
73 | 73 | else return "success"; |
74 | - $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
|
74 | + $image_url = $this->findAircraftImage($registration, $aircraft_icao, $airline_icao); |
|
75 | 75 | if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
76 | 76 | if ($image_url['original'] != '') { |
77 | 77 | if ($globalDebug) echo 'Found !'."\n"; |
78 | - $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
78 | + $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
79 | 79 | try { |
80 | 80 | $sth = $this->db->prepare($query); |
81 | - $sth->execute(array(':registration' => $registration,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website'])); |
|
82 | - } catch(PDOException $e) { |
|
81 | + $sth->execute(array(':registration' => $registration, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website'])); |
|
82 | + } catch (PDOException $e) { |
|
83 | 83 | echo $e->getMessage()."\n"; |
84 | 84 | return "error"; |
85 | 85 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO; |
100 | 100 | $Spotter = new Spotter($this->db); |
101 | 101 | if (!isset($globalIVAO)) $globalIVAO = FALSE; |
102 | - $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
|
102 | + $aircraft_registration = filter_var($aircraft_registration, FILTER_SANITIZE_STRING); |
|
103 | 103 | if ($aircraft_registration != '') { |
104 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
104 | + if (strpos($aircraft_registration, '/') !== false) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
105 | 105 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
106 | 106 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
107 | 107 | if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
@@ -115,24 +115,24 @@ discard block |
||
115 | 115 | if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type']; |
116 | 116 | else $aircraft_name = ''; |
117 | 117 | $aircraft_registration = $aircraft_icao; |
118 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
119 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
118 | + } else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
119 | + if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
120 | 120 | foreach ($globalAircraftImageSources as $source) { |
121 | 121 | $source = strtolower($source); |
122 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl($aircraft_icao,$airline_icao); |
|
123 | - if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters($aircraft_registration,$aircraft_name); |
|
124 | - if ($source == 'flickr') $images_array = $this->fromFlickr($aircraft_registration,$aircraft_name); |
|
125 | - if ($source == 'bing') $images_array = $this->fromBing($aircraft_registration,$aircraft_name); |
|
126 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart($aircraft_registration,$aircraft_name); |
|
127 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia($aircraft_registration,$aircraft_name); |
|
128 | - if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos($aircraft_registration,$aircraft_name); |
|
129 | - if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures($aircraft_registration,$aircraft_name); |
|
130 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData($aircraft_registration,$aircraft_name); |
|
131 | - if ($source == 'customsources') $images_array = $this->fromCustomSource($aircraft_registration,$aircraft_name); |
|
122 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl($aircraft_icao, $airline_icao); |
|
123 | + if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters($aircraft_registration, $aircraft_name); |
|
124 | + if ($source == 'flickr') $images_array = $this->fromFlickr($aircraft_registration, $aircraft_name); |
|
125 | + if ($source == 'bing') $images_array = $this->fromBing($aircraft_registration, $aircraft_name); |
|
126 | + if ($source == 'deviantart') $images_array = $this->fromDeviantart($aircraft_registration, $aircraft_name); |
|
127 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia($aircraft_registration, $aircraft_name); |
|
128 | + if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos($aircraft_registration, $aircraft_name); |
|
129 | + if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures($aircraft_registration, $aircraft_name); |
|
130 | + if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData($aircraft_registration, $aircraft_name); |
|
131 | + if ($source == 'customsources') $images_array = $this->fromCustomSource($aircraft_registration, $aircraft_name); |
|
132 | 132 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
133 | 133 | } |
134 | 134 | if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao); |
135 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
135 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -143,24 +143,24 @@ discard block |
||
143 | 143 | * @return Array the aircraft thumbnail, orignal url and copyright |
144 | 144 | * |
145 | 145 | */ |
146 | - public function fromPlanespotters($aircraft_registration, $aircraft_name='') { |
|
146 | + public function fromPlanespotters($aircraft_registration, $aircraft_name = '') { |
|
147 | 147 | $Common = new Common(); |
148 | 148 | // If aircraft registration is only number, also check with aircraft model |
149 | - if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') { |
|
150 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
149 | + if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') { |
|
150 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
151 | 151 | } else { |
152 | 152 | //$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss'; |
153 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
153 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
154 | 154 | } |
155 | 155 | $data = $Common->getData($url); |
156 | 156 | if ($xml = simplexml_load_string($data)) { |
157 | 157 | if (isset($xml->channel->item)) { |
158 | 158 | $image_url = array(); |
159 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
159 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
160 | 160 | $image_url['thumbnail'] = $thumbnail_url; |
161 | - $image_url['original'] = str_replace('thumbnail','original',$thumbnail_url); |
|
162 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
163 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
161 | + $image_url['original'] = str_replace('thumbnail', 'original', $thumbnail_url); |
|
162 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
163 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
164 | 164 | $image_url['source'] = 'planespotters'; |
165 | 165 | return $image_url; |
166 | 166 | } |
@@ -176,25 +176,25 @@ discard block |
||
176 | 176 | * @return Array the aircraft thumbnail, orignal url and copyright |
177 | 177 | * |
178 | 178 | */ |
179 | - public function fromDeviantart($aircraft_registration, $aircraft_name='') { |
|
179 | + public function fromDeviantart($aircraft_registration, $aircraft_name = '') { |
|
180 | 180 | $Common = new Common(); |
181 | 181 | // If aircraft registration is only number, also check with aircraft model |
182 | - if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') { |
|
183 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$aircraft_registration.'%20'.urlencode($aircraft_name); |
|
182 | + if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') { |
|
183 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$aircraft_registration.'%20'.urlencode($aircraft_name); |
|
184 | 184 | } else { |
185 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$aircraft_registration; |
|
185 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$aircraft_registration; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $data = $Common->getData($url); |
189 | 189 | if ($xml = simplexml_load_string($data)) { |
190 | 190 | if (isset($xml->channel->item->link)) { |
191 | 191 | $image_url = array(); |
192 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
192 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
193 | 193 | $image_url['thumbnail'] = $thumbnail_url; |
194 | - $original_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
194 | + $original_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
195 | 195 | $image_url['original'] = $original_url; |
196 | - $image_url['copyright'] = str_replace('Copyright ','',trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
197 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
196 | + $image_url['copyright'] = str_replace('Copyright ', '', trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
197 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
198 | 198 | $image_url['source'] = 'deviantart'; |
199 | 199 | return $image_url; |
200 | 200 | } |
@@ -210,32 +210,32 @@ discard block |
||
210 | 210 | * @return Array the aircraft thumbnail, orignal url and copyright |
211 | 211 | * |
212 | 212 | */ |
213 | - public function fromJetPhotos($aircraft_registration, $aircraft_name='') { |
|
213 | + public function fromJetPhotos($aircraft_registration, $aircraft_name = '') { |
|
214 | 214 | $Common = new Common(); |
215 | - $url= 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
215 | + $url = 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
216 | 216 | $data = $Common->getData($url); |
217 | 217 | $dom = new DOMDocument(); |
218 | 218 | @$dom->loadHTML($data); |
219 | 219 | $all_pics = array(); |
220 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
220 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
221 | 221 | if ($image->getAttribute('itemprop') == "http://schema.org/image") { |
222 | 222 | $all_pics[] = $image->getAttribute('src'); |
223 | 223 | } |
224 | 224 | } |
225 | 225 | $all_authors = array(); |
226 | - foreach($dom->getElementsByTagName('meta') as $author) { |
|
226 | + foreach ($dom->getElementsByTagName('meta') as $author) { |
|
227 | 227 | if ($author->getAttribute('itemprop') == "http://schema.org/author") { |
228 | 228 | $all_authors[] = $author->getAttribute('content'); |
229 | 229 | } |
230 | 230 | } |
231 | 231 | $all_ref = array(); |
232 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
232 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
233 | 233 | $all_ref[] = $link->getAttribute('href'); |
234 | 234 | } |
235 | 235 | if (isset($all_pics[0])) { |
236 | 236 | $image_url = array(); |
237 | 237 | $image_url['thumbnail'] = $all_pics[0]; |
238 | - $image_url['original'] = str_replace('_tb','',$all_pics[0]); |
|
238 | + $image_url['original'] = str_replace('_tb', '', $all_pics[0]); |
|
239 | 239 | $image_url['copyright'] = $all_authors[0]; |
240 | 240 | $image_url['source_website'] = 'http://jetphotos.net'.$all_ref[8]; |
241 | 241 | $image_url['source'] = 'JetPhotos'; |
@@ -252,24 +252,24 @@ discard block |
||
252 | 252 | * @return Array the aircraft thumbnail, orignal url and copyright |
253 | 253 | * |
254 | 254 | */ |
255 | - public function fromPlanePictures($aircraft_registration, $aircraft_name='') { |
|
255 | + public function fromPlanePictures($aircraft_registration, $aircraft_name = '') { |
|
256 | 256 | $Common = new Common(); |
257 | - $url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
257 | + $url = 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
258 | 258 | $data = $Common->getData($url); |
259 | 259 | $dom = new DOMDocument(); |
260 | 260 | @$dom->loadHTML($data); |
261 | 261 | $all_pics = array(); |
262 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
262 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
263 | 263 | $all_pics[] = $image->getAttribute('src'); |
264 | 264 | } |
265 | 265 | $all_links = array(); |
266 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
267 | - $all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href')); |
|
266 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
267 | + $all_links[] = array('text' => $link->textContent, 'href' => $link->getAttribute('href')); |
|
268 | 268 | } |
269 | - if (isset($all_pics[1]) && !preg_match('/bit.ly/',$all_pics[1]) && !preg_match('/flagge/',$all_pics[1])) { |
|
269 | + if (isset($all_pics[1]) && !preg_match('/bit.ly/', $all_pics[1]) && !preg_match('/flagge/', $all_pics[1])) { |
|
270 | 270 | $image_url = array(); |
271 | 271 | $image_url['thumbnail'] = 'http://www.planepictures.net/'.$all_pics[1]; |
272 | - $image_url['original'] = 'http://www.planepictures.net/'.str_replace('_TN','',$all_pics[1]); |
|
272 | + $image_url['original'] = 'http://www.planepictures.net/'.str_replace('_TN', '', $all_pics[1]); |
|
273 | 273 | $image_url['copyright'] = $all_links[6]['text']; |
274 | 274 | $image_url['source_website'] = 'http://www.planepictures.net/'.$all_links[2]['href']; |
275 | 275 | $image_url['source'] = 'PlanePictures'; |
@@ -286,19 +286,19 @@ discard block |
||
286 | 286 | * @return Array the aircraft thumbnail, orignal url and copyright |
287 | 287 | * |
288 | 288 | */ |
289 | - public function fromFlickr($aircraft_registration,$aircraft_name='') { |
|
289 | + public function fromFlickr($aircraft_registration, $aircraft_name = '') { |
|
290 | 290 | $Common = new Common(); |
291 | 291 | if ($aircraft_name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.','.urlencode($aircraft_name); |
292 | 292 | else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.',aircraft'; |
293 | 293 | $data = $Common->getData($url); |
294 | 294 | if ($xml = simplexml_load_string($data)) { |
295 | 295 | if (isset($xml->channel->item)) { |
296 | - $original_url = trim((string)$xml->channel->item->enclosure->attributes()->url); |
|
296 | + $original_url = trim((string) $xml->channel->item->enclosure->attributes()->url); |
|
297 | 297 | $image_url = array(); |
298 | 298 | $image_url['thumbnail'] = $original_url; |
299 | 299 | $image_url['original'] = $original_url; |
300 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
301 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
300 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
301 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
302 | 302 | $image_url['source'] = 'flickr'; |
303 | 303 | return $image_url; |
304 | 304 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | return false; |
307 | 307 | } |
308 | 308 | |
309 | - public function fromIvaoMtl($aircraft_icao,$airline_icao) { |
|
309 | + public function fromIvaoMtl($aircraft_icao, $airline_icao) { |
|
310 | 310 | $Common = new Common(); |
311 | 311 | //echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg'; |
312 | 312 | if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) { |
@@ -330,14 +330,14 @@ discard block |
||
330 | 330 | * @return Array the aircraft thumbnail, orignal url and copyright |
331 | 331 | * |
332 | 332 | */ |
333 | - public function fromBing($aircraft_registration,$aircraft_name='') { |
|
333 | + public function fromBing($aircraft_registration, $aircraft_name = '') { |
|
334 | 334 | global $globalImageBingKey; |
335 | 335 | $Common = new Common(); |
336 | 336 | if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false; |
337 | 337 | if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27'; |
338 | 338 | else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27'; |
339 | - $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
|
340 | - $data = $Common->getData($url,'get','',$headers); |
|
339 | + $headers = array("Authorization: Basic ".base64_encode("ignored:".$globalImageBingKey)); |
|
340 | + $data = $Common->getData($url, 'get', '', $headers); |
|
341 | 341 | $result = json_decode($data); |
342 | 342 | if (isset($result->d->results[0]->MediaUrl)) { |
343 | 343 | $image_url = array(); |
@@ -362,14 +362,14 @@ discard block |
||
362 | 362 | * @return Array the aircraft thumbnail, orignal url and copyright |
363 | 363 | * |
364 | 364 | */ |
365 | - public function fromAirportData($aircraft_registration,$aircraft_name='') { |
|
365 | + public function fromAirportData($aircraft_registration, $aircraft_name = '') { |
|
366 | 366 | $Common = new Common(); |
367 | 367 | $url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration; |
368 | 368 | $data = $Common->getData($url); |
369 | 369 | $result = json_decode($data); |
370 | 370 | if (isset($result->count) && $result->count > 0) { |
371 | 371 | $image_url = array(); |
372 | - $image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image); |
|
372 | + $image_url['original'] = str_replace('thumbnails', 'large', $result->data[0]->image); |
|
373 | 373 | $image_url['source_website'] = $result->data[0]->link; |
374 | 374 | $image_url['thumbnail'] = $result->data[0]->image; |
375 | 375 | $image_url['copyright'] = $result->data[0]->photographer; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | * @return Array the aircraft thumbnail, orignal url and copyright |
388 | 388 | * |
389 | 389 | */ |
390 | - public function fromWikimedia($aircraft_registration,$aircraft_name='') { |
|
390 | + public function fromWikimedia($aircraft_registration, $aircraft_name = '') { |
|
391 | 391 | $Common = new Common(); |
392 | 392 | if ($aircraft_name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20'.urlencode($aircraft_name); |
393 | 393 | else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20aircraft'; |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $result = json_decode($data); |
396 | 396 | if (isset($result->query->search[0]->title)) { |
397 | 397 | $fileo = $result->query->search[0]->title; |
398 | - if (substr($fileo,-3) == 'pdf') return false; |
|
398 | + if (substr($fileo, -3) == 'pdf') return false; |
|
399 | 399 | $file = urlencode($fileo); |
400 | 400 | $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file; |
401 | 401 | $data2 = $Common->getData($url2); |
@@ -420,11 +420,11 @@ discard block |
||
420 | 420 | if (isset($result2->query->pages)) { |
421 | 421 | foreach ($result2->query->pages as $page) { |
422 | 422 | if (isset($page->imageinfo[0]->extmetadata->Artist)) { |
423 | - $image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
423 | + $image_url['copyright'] = preg_replace('/ from(.*)/', '', strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
424 | 424 | if (isset($page->imageinfo[0]->extmetadata->License->value)) { |
425 | 425 | $image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')'; |
426 | 426 | } |
427 | - $image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright'])); |
|
427 | + $image_url['copyright'] = trim(str_replace('\n', '', $image_url['copyright'])); |
|
428 | 428 | return $image_url; |
429 | 429 | } |
430 | 430 | } |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | * @return Array the aircraft thumbnail, orignal url and copyright |
444 | 444 | * |
445 | 445 | */ |
446 | - public function fromCustomSource($aircraft_registration,$aircraft_name='') { |
|
446 | + public function fromCustomSource($aircraft_registration, $aircraft_name = '') { |
|
447 | 447 | global $globalAircraftImageCustomSources, $globalDebug; |
448 | 448 | //$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true); |
449 | 449 | if (!empty($globalAircraftImageCustomSources)) { |
@@ -460,15 +460,15 @@ discard block |
||
460 | 460 | print_r($source); |
461 | 461 | print_r($customsources); |
462 | 462 | } |
463 | - $url = str_replace('{registration}',$aircraft_registration,$source['original']); |
|
464 | - $url_thumbnail = str_replace('{registration}',$aircraft_registration,$source['thumbnail']); |
|
463 | + $url = str_replace('{registration}', $aircraft_registration, $source['original']); |
|
464 | + $url_thumbnail = str_replace('{registration}', $aircraft_registration, $source['thumbnail']); |
|
465 | 465 | if ($Common->urlexist($url)) { |
466 | 466 | $image_url = array(); |
467 | 467 | $image_url['thumbnail'] = $url_thumbnail; |
468 | 468 | $image_url['original'] = $url; |
469 | 469 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
470 | 470 | else $exifCopyright = ''; |
471 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
471 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
472 | 472 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
473 | 473 | else $image_url['copyright'] = $source['source_website']; |
474 | 474 | $image_url['source_website'] = $source['source_website']; |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
12 | -$spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", $sort); |
|
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Arrival Airports by Country of %s"),$spotter_array[0]['ident']); |
|
16 | + $title = sprintf(_("Most Common Arrival Airports by Country of %s"), $spotter_array[0]['ident']); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
19 | 19 | print '<h1>'.$spotter_array[0]['ident'].'</h1>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('ident-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights with the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights with the ident/callsign <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
28 | 28 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByIdent($ident); |
29 | 29 | //print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
30 | 30 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | print 'var series = ['; |
65 | 65 | $country_data = ''; |
66 | - foreach($airport_country_array as $airport_item) |
|
66 | + foreach ($airport_country_array as $airport_item) |
|
67 | 67 | { |
68 | 68 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
69 | 69 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | print '</thead>'; |
112 | 112 | print '<tbody>'; |
113 | 113 | $i = 1; |
114 | - foreach($airport_country_array as $airport_item) |
|
114 | + foreach ($airport_country_array as $airport_item) |
|
115 | 115 | { |
116 | 116 | print '<tr>'; |
117 | 117 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
8 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
8 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
9 | 9 | |
10 | 10 | if (!empty($spotter_array)) |
11 | 11 | { |
12 | - $title = sprintf(_("Most Common Arrival Airports by Country on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
12 | + $title = sprintf(_("Most Common Arrival Airports by Country on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
13 | 13 | require_once('header.php'); |
14 | 14 | print '<div class="select-item">'; |
15 | 15 | print '<form action="'.$globalURL.'/date" method="post" class="form-inline">'; |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>'; |
27 | 27 | print '<br />'; |
28 | 28 | print '<div class="info column">'; |
29 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
29 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
30 | 30 | print '</div>'; |
31 | 31 | |
32 | 32 | include('date-sub-menu.php'); |
33 | 33 | print '<div class="column">'; |
34 | 34 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
35 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
35 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
36 | 36 | |
37 | 37 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByDate($date); |
38 | 38 | //print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | print 'var series = ['; |
75 | 75 | $country_data = ''; |
76 | - foreach($airport_country_array as $airport_item) |
|
76 | + foreach ($airport_country_array as $airport_item) |
|
77 | 77 | { |
78 | 78 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
79 | 79 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | print '</thead>'; |
122 | 122 | print '<tbody>'; |
123 | 123 | $i = 1; |
124 | - foreach($airport_country_array as $airport_item) |
|
124 | + foreach ($airport_country_array as $airport_item) |
|
125 | 125 | { |
126 | 126 | print '<tr>'; |
127 | 127 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * @param Array $headers header to submit with the form |
15 | 15 | * @return String the result |
16 | 16 | */ |
17 | - public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') { |
|
17 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') { |
|
18 | 18 | global $globalProxy, $globalForceIPv4; |
19 | 19 | $ch = curl_init(); |
20 | 20 | curl_setopt($ch, CURLOPT_URL, $url); |
21 | 21 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
22 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
22 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
23 | 23 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
24 | 24 | } |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
30 | 30 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
31 | 31 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
32 | - curl_setopt($ch,CURLOPT_ENCODING , "gzip"); |
|
32 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
33 | 33 | //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'); |
34 | 34 | // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0'); |
35 | 35 | if ($useragent == '') { |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | } |
40 | 40 | if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
41 | 41 | else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
42 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
|
42 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback")); |
|
43 | 43 | if ($type == 'post') { |
44 | 44 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
45 | 45 | if (is_array($data)) { |
46 | 46 | curl_setopt($ch, CURLOPT_POST, count($data)); |
47 | 47 | $data_string = ''; |
48 | - foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
48 | + foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
49 | 49 | rtrim($data_string, '&'); |
50 | 50 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
51 | 51 | } else { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | if ($cookie != '') { |
59 | 59 | if (is_array($cookie)) { |
60 | - curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';')); |
|
60 | + curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';')); |
|
61 | 61 | } else { |
62 | 62 | curl_setopt($ch, CURLOPT_COOKIE, $cookie); |
63 | 63 | } |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | $info = curl_getinfo($ch); |
70 | 70 | //var_dump($info); |
71 | 71 | curl_close($ch); |
72 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
72 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
73 | 73 | echo "Cloudflare Detected\n"; |
74 | 74 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
75 | 75 | $useragent = UAgent::random(); |
76 | 76 | cloudflare::useUserAgent($useragent); |
77 | 77 | if ($clearanceCookie = cloudflare::bypass($url)) { |
78 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
78 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
79 | 79 | } |
80 | 80 | } else { |
81 | 81 | return $result; |
@@ -116,27 +116,27 @@ discard block |
||
116 | 116 | if ($data == '') return array(); |
117 | 117 | $html = str_get_html($data); |
118 | 118 | if ($html === false) return array(); |
119 | - $tabledata=array(); |
|
120 | - foreach($html->find('tr') as $element) |
|
119 | + $tabledata = array(); |
|
120 | + foreach ($html->find('tr') as $element) |
|
121 | 121 | { |
122 | 122 | $td = array(); |
123 | - foreach( $element->find('th') as $row) |
|
123 | + foreach ($element->find('th') as $row) |
|
124 | 124 | { |
125 | 125 | $td [] = trim($row->plaintext); |
126 | 126 | } |
127 | - $td=array_filter($td); |
|
127 | + $td = array_filter($td); |
|
128 | 128 | $tabledata[] = $td; |
129 | 129 | |
130 | 130 | $td = array(); |
131 | 131 | $tdi = array(); |
132 | - foreach( $element->find('td') as $row) |
|
132 | + foreach ($element->find('td') as $row) |
|
133 | 133 | { |
134 | 134 | $td [] = trim($row->plaintext); |
135 | 135 | $tdi [] = trim($row->innertext); |
136 | 136 | } |
137 | - $td=array_filter($td); |
|
138 | - $tdi=array_filter($tdi); |
|
139 | - $tabledata[]=array_merge($td,$tdi); |
|
137 | + $td = array_filter($td); |
|
138 | + $tdi = array_filter($tdi); |
|
139 | + $tabledata[] = array_merge($td, $tdi); |
|
140 | 140 | } |
141 | 141 | $html->clear(); |
142 | 142 | unset($html); |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | public function text2array($data) { |
152 | 152 | $html = str_get_html($data); |
153 | 153 | if ($html === false) return array(); |
154 | - $tabledata=array(); |
|
155 | - foreach($html->find('p') as $element) |
|
154 | + $tabledata = array(); |
|
155 | + foreach ($html->find('p') as $element) |
|
156 | 156 | { |
157 | 157 | $tabledata [] = trim($element->plaintext); |
158 | 158 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
174 | 174 | if ($lat == $latc && $lon == $lonc) return 0; |
175 | - $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
|
175 | + $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc))) + cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon) - floatval($lonc)))))*60*1.1515; |
|
176 | 176 | if ($unit == "km") { |
177 | - return round($dist * 1.609344); |
|
177 | + return round($dist*1.609344); |
|
178 | 178 | } elseif ($unit == "m") { |
179 | - return round($dist * 1.609344 * 1000); |
|
179 | + return round($dist*1.609344*1000); |
|
180 | 180 | } elseif ($unit == "mile" || $unit == "mi") { |
181 | 181 | return round($dist); |
182 | 182 | } elseif ($unit == "nm") { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param float $distance distance covered |
193 | 193 | * @return whether distance is realistic |
194 | 194 | */ |
195 | - public function withinThreshold ($timeDifference, $distance) { |
|
195 | + public function withinThreshold($timeDifference, $distance) { |
|
196 | 196 | $x = abs($timeDifference); |
197 | 197 | $d = abs($distance); |
198 | 198 | if ($x == 0 || $d == 0) return true; |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | return ($array !== array_values($array)); |
209 | 209 | } |
210 | 210 | |
211 | - public function isInteger($input){ |
|
211 | + public function isInteger($input) { |
|
212 | 212 | return(ctype_digit(strval($input))); |
213 | 213 | } |
214 | 214 | |
215 | 215 | |
216 | - public function convertDec($dms,$latlong) { |
|
216 | + public function convertDec($dms, $latlong) { |
|
217 | 217 | if ($latlong == 'latitude') { |
218 | 218 | $deg = substr($dms, 0, 2); |
219 | 219 | $min = substr($dms, 2, 4); |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | $deg = substr($dms, 0, 3); |
222 | 222 | $min = substr($dms, 3, 5); |
223 | 223 | } |
224 | - return $deg+(($min*60)/3600); |
|
224 | + return $deg + (($min*60)/3600); |
|
225 | 225 | } |
226 | 226 | |
227 | - public function convertDM($coord,$latlong) { |
|
227 | + public function convertDM($coord, $latlong) { |
|
228 | 228 | if ($latlong == 'latitude') { |
229 | 229 | if ($coord < 0) $NSEW = 'S'; |
230 | 230 | else $NSEW = 'N'; |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | } |
235 | 235 | $coord = abs($coord); |
236 | 236 | $deg = floor($coord); |
237 | - $coord = ($coord-$deg)*60; |
|
237 | + $coord = ($coord - $deg)*60; |
|
238 | 238 | $min = $coord; |
239 | - return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW); |
|
239 | + return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | public function xcopy($source, $dest) |
249 | 249 | { |
250 | 250 | $files = glob($source.'*.*'); |
251 | - foreach($files as $file){ |
|
252 | - $file_to_go = str_replace($source,$dest,$file); |
|
251 | + foreach ($files as $file) { |
|
252 | + $file_to_go = str_replace($source, $dest, $file); |
|
253 | 253 | copy($file, $file_to_go); |
254 | 254 | } |
255 | 255 | return true; |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | * @param String $url url to check |
261 | 261 | * @return bool Return true on succes false on failure |
262 | 262 | */ |
263 | - public function urlexist($url){ |
|
264 | - $headers=get_headers($url); |
|
265 | - return stripos($headers[0],"200 OK")?true:false; |
|
263 | + public function urlexist($url) { |
|
264 | + $headers = get_headers($url); |
|
265 | + return stripos($headers[0], "200 OK") ? true : false; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | public function hex2str($hex) { |
274 | 274 | $str = ''; |
275 | 275 | $hexln = strlen($hex); |
276 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
276 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
277 | 277 | return $str; |
278 | 278 | } |
279 | 279 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @return String Return result |
284 | 284 | */ |
285 | 285 | public function hex2rgb($hex) { |
286 | - $hex = str_replace('#','',$hex); |
|
286 | + $hex = str_replace('#', '', $hex); |
|
287 | 287 | return sscanf($hex, "%02x%02x%02x"); |
288 | 288 | } |
289 | 289 | |
@@ -291,33 +291,33 @@ discard block |
||
291 | 291 | //difference in longitudinal coordinates |
292 | 292 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
293 | 293 | //difference in the phi of latitudinal coordinates |
294 | - $dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4)); |
|
294 | + $dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4)); |
|
295 | 295 | //we need to recalculate $dLon if it is greater than pi |
296 | - if(abs($dLon) > pi()) { |
|
297 | - if($dLon > 0) { |
|
298 | - $dLon = (2 * pi() - $dLon) * -1; |
|
296 | + if (abs($dLon) > pi()) { |
|
297 | + if ($dLon > 0) { |
|
298 | + $dLon = (2*pi() - $dLon)*-1; |
|
299 | 299 | } else { |
300 | - $dLon = 2 * pi() + $dLon; |
|
300 | + $dLon = 2*pi() + $dLon; |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | //return the angle, normalized |
304 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
304 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
305 | 305 | } |
306 | 306 | |
307 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.2) { |
|
307 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.2) { |
|
308 | 308 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
309 | - $a = -($lon2-$lon1); |
|
309 | + $a = -($lon2 - $lon1); |
|
310 | 310 | $b = $lat2 - $lat1; |
311 | - $c = -($a*$lat1+$b*$lon1); |
|
312 | - $d = $a*$lat3+$b*$lon3+$c; |
|
311 | + $c = -($a*$lat1 + $b*$lon1); |
|
312 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
313 | 313 | if ($d > -$approx && $d < $approx) return true; |
314 | 314 | else return false; |
315 | 315 | } |
316 | 316 | |
317 | 317 | public function array_merge_noappend() { |
318 | 318 | $output = array(); |
319 | - foreach(func_get_args() as $array) { |
|
320 | - foreach($array as $key => $value) { |
|
319 | + foreach (func_get_args() as $array) { |
|
320 | + foreach ($array as $key => $value) { |
|
321 | 321 | $output[$key] = isset($output[$key]) ? |
322 | 322 | array_merge($output[$key], $value) : $value; |
323 | 323 | } |
@@ -381,34 +381,34 @@ discard block |
||
381 | 381 | return $result; |
382 | 382 | } |
383 | 383 | |
384 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){ |
|
384 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) { |
|
385 | 385 | global $globalMapRefresh; |
386 | 386 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
387 | 387 | $r = 6378; |
388 | 388 | $latitude = deg2rad($latitude); |
389 | 389 | $longitude = deg2rad($longitude); |
390 | 390 | $bearing = deg2rad($heading); |
391 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
392 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
393 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
391 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
392 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
393 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
394 | 394 | } |
395 | 395 | |
396 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
396 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
397 | 397 | // distance in meter |
398 | 398 | $R = 6378.14; |
399 | - $latitude1 = $latitude * (M_PI/180); |
|
400 | - $longitude1 = $longitude * (M_PI/180); |
|
401 | - $brng = $bearing * (M_PI/180); |
|
399 | + $latitude1 = $latitude*(M_PI/180); |
|
400 | + $longitude1 = $longitude*(M_PI/180); |
|
401 | + $brng = $bearing*(M_PI/180); |
|
402 | 402 | $d = $distance; |
403 | 403 | |
404 | 404 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
405 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
405 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
406 | 406 | |
407 | - $latitude2 = $latitude2 * (180/M_PI); |
|
408 | - $longitude2 = $longitude2 * (180/M_PI); |
|
407 | + $latitude2 = $latitude2*(180/M_PI); |
|
408 | + $longitude2 = $longitude2*(180/M_PI); |
|
409 | 409 | |
410 | - $flat = round ($latitude2,6); |
|
411 | - $flong = round ($longitude2,6); |
|
410 | + $flat = round($latitude2, 6); |
|
411 | + $flong = round($longitude2, 6); |
|
412 | 412 | /* |
413 | 413 | $dx = $distance*cos($bearing); |
414 | 414 | $dy = $distance*sin($bearing); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | $flong = $longitude + $dlong; |
418 | 418 | $flat = $latitude + $dlat; |
419 | 419 | */ |
420 | - return array('latitude' => $flat,'longitude' => $flong); |
|
420 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
@@ -431,14 +431,14 @@ discard block |
||
431 | 431 | * @param integer $level GZIP compression level (default: 9) |
432 | 432 | * @return string New filename (with .gz appended) if success, or false if operation fails |
433 | 433 | */ |
434 | - public function gzCompressFile($source, $level = 9){ |
|
435 | - $dest = $source . '.gz'; |
|
436 | - $mode = 'wb' . $level; |
|
434 | + public function gzCompressFile($source, $level = 9) { |
|
435 | + $dest = $source.'.gz'; |
|
436 | + $mode = 'wb'.$level; |
|
437 | 437 | $error = false; |
438 | 438 | if ($fp_out = gzopen($dest, $mode)) { |
439 | - if ($fp_in = fopen($source,'rb')) { |
|
439 | + if ($fp_in = fopen($source, 'rb')) { |
|
440 | 440 | while (!feof($fp_in)) |
441 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
441 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
442 | 442 | fclose($fp_in); |
443 | 443 | } else { |
444 | 444 | $error = true; |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | } |
455 | 455 | |
456 | 456 | public function remove_accents($string) { |
457 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
457 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
458 | 458 | $chars = array( |
459 | 459 | // Decompositions for Latin-1 Supplement |
460 | 460 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
512 | 512 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
513 | 513 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
514 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
514 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
515 | 515 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
516 | 516 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
517 | 517 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -527,13 +527,13 @@ discard block |
||
527 | 527 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
528 | 528 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
529 | 529 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
530 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
531 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
532 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
533 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
534 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
535 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
536 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
530 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
531 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
532 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
533 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
534 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
535 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
536 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
537 | 537 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
538 | 538 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
539 | 539 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) { |
568 | 568 | if (is_numeric($string[$i]) && $concat_flag) { |
569 | 569 | $int .= $string[$i]; |
570 | - } elseif(!$concat && $concat_flag && strlen($int) > 0) { |
|
570 | + } elseif (!$concat && $concat_flag && strlen($int) > 0) { |
|
571 | 571 | $concat_flag = false; |
572 | 572 | } |
573 | 573 | } |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($registration != '') { |
9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | -} else $spotter_array=array(); |
|
11 | +} else $spotter_array = array(); |
|
12 | 12 | |
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Arrival Airports by Country of aircraft with registration %s"),$registration); |
|
16 | + $title = sprintf(_("Most Common Arrival Airports by Country of aircraft with registration %s"), $registration); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
19 | 19 | print '<h1>'.$_GET['registration'].' - '.$aircraft_array[0]['aircraft_name'].' ('.$aircraft_array[0]['aircraft_icao'].')</h1>'; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | include('registration-sub-menu.php'); |
26 | 26 | print '<div class="column">'; |
27 | 27 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
28 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights with aircraft registration <strong>%s</strong>."),$registration).'</p>'; |
|
28 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights with aircraft registration <strong>%s</strong>."), $registration).'</p>'; |
|
29 | 29 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByRegistration($registration); |
30 | 30 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
31 | 31 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
34 | 34 | print 'var series = ['; |
35 | 35 | $country_data = ''; |
36 | - foreach($airport_country_array as $airport_item) |
|
36 | + foreach ($airport_country_array as $airport_item) |
|
37 | 37 | { |
38 | 38 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
39 | 39 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | print '</thead>'; |
82 | 82 | print '<tbody>'; |
83 | 83 | $i = 1; |
84 | - foreach($airport_country_array as $airport_item) |
|
84 | + foreach ($airport_country_array as $airport_item) |
|
85 | 85 | { |
86 | 86 | print '<tr>'; |
87 | 87 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | } |
10 | 10 | |
11 | 11 | $Spotter = new Spotter(); |
12 | -$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))); |
|
13 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
14 | -$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort); |
|
12 | +$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING))); |
|
13 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
14 | +$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort); |
|
15 | 15 | |
16 | 16 | if (!empty($spotter_array)) |
17 | 17 | { |
18 | - $title = sprintf(_("Most Common Arrival Airports by Country from %s"),$manufacturer); |
|
18 | + $title = sprintf(_("Most Common Arrival Airports by Country from %s"), $manufacturer); |
|
19 | 19 | |
20 | 20 | require_once('header.php'); |
21 | 21 | print '<div class="select-item">'; |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | $Stats = new Stats(); |
25 | 25 | $all_manufacturers = $Stats->getAllManufacturers(); |
26 | 26 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
27 | - foreach($all_manufacturers as $all_manufacturer) |
|
27 | + foreach ($all_manufacturers as $all_manufacturer) |
|
28 | 28 | { |
29 | - if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
29 | + if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
30 | 30 | { |
31 | 31 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
32 | 32 | } else { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | include('manufacturer-sub-menu.php'); |
46 | 46 | print '<div class="column">'; |
47 | 47 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
48 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s</strong>."),$manufacturer).'</p>'; |
|
48 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s</strong>."), $manufacturer).'</p>'; |
|
49 | 49 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByManufacturer($manufacturer); |
50 | 50 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
51 | 51 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
54 | 54 | print 'var series = ['; |
55 | 55 | $country_data = ''; |
56 | - foreach($airport_country_array as $airport_item) |
|
56 | + foreach ($airport_country_array as $airport_item) |
|
57 | 57 | { |
58 | 58 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
59 | 59 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | print '</thead>'; |
102 | 102 | print '<tbody>'; |
103 | 103 | $i = 1; |
104 | - foreach($airport_country_array as $airport_item) |
|
104 | + foreach ($airport_country_array as $airport_item) |
|
105 | 105 | { |
106 | 106 | print '<tr>'; |
107 | 107 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -4,16 +4,16 @@ discard block |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | $Spotter = new Spotter(); |
7 | -if (!isset($_GET['aircraft_manufacturer'])){ |
|
7 | +if (!isset($_GET['aircraft_manufacturer'])) { |
|
8 | 8 | header('Location: '.$globalURL.''); |
9 | 9 | } else { |
10 | 10 | //calculuation for the pagination |
11 | - if(!isset($_GET['limit'])) |
|
11 | + if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
15 | 15 | $absolute_difference = 25; |
16 | - } else { |
|
16 | + } else { |
|
17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
18 | 18 | $limit_start = $limit_explode[0]; |
19 | 19 | $limit_end = $limit_explode[1]; |
@@ -27,19 +27,19 @@ discard block |
||
27 | 27 | $limit_previous_1 = $limit_start - $absolute_difference; |
28 | 28 | $limit_previous_2 = $limit_end - $absolute_difference; |
29 | 29 | |
30 | - $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))); |
|
31 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
30 | + $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING))); |
|
31 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
32 | 32 | $page_url = $globalURL.'/manufacturer/'.$manufacturer; |
33 | 33 | |
34 | 34 | if ($sort != '') { |
35 | - $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,$limit_start.",".$absolute_difference, $sort); |
|
35 | + $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, $limit_start.",".$absolute_difference, $sort); |
|
36 | 36 | } else { |
37 | - $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,$limit_start.",".$absolute_difference, ''); |
|
37 | + $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, $limit_start.",".$absolute_difference, ''); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | if (!empty($spotter_array)) |
41 | 41 | { |
42 | - $title = sprintf(_("Detailed View for %s"),$manufacturer); |
|
42 | + $title = sprintf(_("Detailed View for %s"), $manufacturer); |
|
43 | 43 | |
44 | 44 | require_once('header.php'); |
45 | 45 | print '<div class="select-item">'; |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | $Stats = new Stats(); |
49 | 49 | $all_manufacturers = $Stats->getAllManufacturers(); |
50 | 50 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
51 | - foreach($all_manufacturers as $all_manufacturer) |
|
51 | + foreach ($all_manufacturers as $all_manufacturer) |
|
52 | 52 | { |
53 | - if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
53 | + if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
54 | 54 | { |
55 | 55 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
56 | 56 | } else { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | print '</div>'; |
68 | 68 | |
69 | 69 | print '<div class="table column">'; |
70 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong."),$manufacturer).'</p>'; |
|
70 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong."), $manufacturer).'</p>'; |
|
71 | 71 | |
72 | 72 | include('manufacturer-sub-menu.php'); |
73 | 73 | include('table-output.php'); |