@@ -6,6 +6,9 @@ discard block |
||
| 6 | 6 | public $dbs = array(); |
| 7 | 7 | public $latest_schema = 37; |
| 8 | 8 | |
| 9 | + /** |
|
| 10 | + * @param string $dbname |
|
| 11 | + */ |
|
| 9 | 12 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
| 10 | 13 | global $globalDBdriver, $globalNoDB; |
| 11 | 14 | if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
@@ -133,6 +136,9 @@ discard block |
||
| 133 | 136 | return true; |
| 134 | 137 | } |
| 135 | 138 | |
| 139 | + /** |
|
| 140 | + * @param string $table |
|
| 141 | + */ |
|
| 136 | 142 | public function tableExists($table) |
| 137 | 143 | { |
| 138 | 144 | global $globalDBdriver, $globalDBname; |
@@ -182,6 +188,11 @@ discard block |
||
| 182 | 188 | /* |
| 183 | 189 | * Check if index exist |
| 184 | 190 | */ |
| 191 | + |
|
| 192 | + /** |
|
| 193 | + * @param string $table |
|
| 194 | + * @param string $index |
|
| 195 | + */ |
|
| 185 | 196 | public function indexExists($table,$index) |
| 186 | 197 | { |
| 187 | 198 | global $globalDBdriver, $globalDBname; |
@@ -224,6 +235,10 @@ discard block |
||
| 224 | 235 | return $columns; |
| 225 | 236 | } |
| 226 | 237 | |
| 238 | + /** |
|
| 239 | + * @param string $table |
|
| 240 | + * @param string $column |
|
| 241 | + */ |
|
| 227 | 242 | public function getColumnType($table,$column) { |
| 228 | 243 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
| 229 | 244 | $tomet = $select->getColumnMeta(0); |
@@ -234,6 +249,11 @@ discard block |
||
| 234 | 249 | * Check if a column name exist in a table |
| 235 | 250 | * @return Boolean column exist or not |
| 236 | 251 | */ |
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * @param string $table |
|
| 255 | + * @param string $name |
|
| 256 | + */ |
|
| 237 | 257 | public function checkColumnName($table,$name) |
| 238 | 258 | { |
| 239 | 259 | global $globalDBdriver, $globalDBname; |
@@ -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 = 37; |
| 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 $globalDBdriver, $globalNoDB; |
| 11 | 11 | if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
| 12 | 12 | if ($dbc === null) { |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | if ($user === null && $pass === null) { |
| 15 | 15 | $this->createDBConnection(); |
| 16 | 16 | } else { |
| 17 | - $this->createDBConnection(null,$user,$pass); |
|
| 17 | + $this->createDBConnection(null, $user, $pass); |
|
| 18 | 18 | } |
| 19 | 19 | } else { |
| 20 | 20 | $this->createDBConnection($dbname); |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | while (true) { |
| 93 | 93 | try { |
| 94 | 94 | if ($globalDBSdriver == 'mysql') { |
| 95 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
| 95 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
| 96 | 96 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 97 | 97 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 98 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
| 99 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 100 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 101 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 102 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 98 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
| 99 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500); |
|
| 100 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
| 101 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
| 102 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
| 103 | 103 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 104 | 104 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
| 105 | 105 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -109,19 +109,19 @@ discard block |
||
| 109 | 109 | $this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"'); |
| 110 | 110 | //$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"'); |
| 111 | 111 | } else { |
| 112 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
| 112 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
| 113 | 113 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 114 | 114 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 115 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
| 116 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 117 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 118 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 119 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 115 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
| 116 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200); |
|
| 117 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
| 118 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
| 119 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
| 120 | 120 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 121 | 121 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
| 122 | 122 | } |
| 123 | 123 | break; |
| 124 | - } catch(PDOException $e) { |
|
| 124 | + } catch (PDOException $e) { |
|
| 125 | 125 | $i++; |
| 126 | 126 | if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
| 127 | 127 | //exit; |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | try { |
| 146 | 146 | //$Connection = new Connection(); |
| 147 | 147 | $results = $this->db->query($query); |
| 148 | - } catch(PDOException $e) { |
|
| 148 | + } catch (PDOException $e) { |
|
| 149 | 149 | return false; |
| 150 | 150 | } |
| 151 | - if($results->rowCount()>0) { |
|
| 151 | + if ($results->rowCount() > 0) { |
|
| 152 | 152 | return true; |
| 153 | 153 | } |
| 154 | 154 | else return false; |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | return false; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - } catch(PDOException $e) { |
|
| 173 | - if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
| 172 | + } catch (PDOException $e) { |
|
| 173 | + if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
| 174 | 174 | throw $e; |
| 175 | 175 | } |
| 176 | 176 | //echo 'error ! '.$e->getMessage(); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | /* |
| 183 | 183 | * Check if index exist |
| 184 | 184 | */ |
| 185 | - public function indexExists($table,$index) |
|
| 185 | + public function indexExists($table, $index) |
|
| 186 | 186 | { |
| 187 | 187 | global $globalDBdriver, $globalDBname; |
| 188 | 188 | if ($globalDBdriver == 'mysql') { |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | try { |
| 194 | 194 | //$Connection = new Connection(); |
| 195 | 195 | $results = $this->db->query($query); |
| 196 | - } catch(PDOException $e) { |
|
| 196 | + } catch (PDOException $e) { |
|
| 197 | 197 | return false; |
| 198 | 198 | } |
| 199 | 199 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
| 200 | - if($nb[0]['nb'] > 0) { |
|
| 200 | + if ($nb[0]['nb'] > 0) { |
|
| 201 | 201 | return true; |
| 202 | 202 | } |
| 203 | 203 | else return false; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
| 213 | 213 | try { |
| 214 | 214 | $results = $this->db->query($query); |
| 215 | - } catch(PDOException $e) { |
|
| 215 | + } catch (PDOException $e) { |
|
| 216 | 216 | return "error : ".$e->getMessage()."\n"; |
| 217 | 217 | } |
| 218 | 218 | $columns = array(); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | return $columns; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - public function getColumnType($table,$column) { |
|
| 227 | + public function getColumnType($table, $column) { |
|
| 228 | 228 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
| 229 | 229 | $tomet = $select->getColumnMeta(0); |
| 230 | 230 | return $tomet['native_type']; |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * Check if a column name exist in a table |
| 235 | 235 | * @return Boolean column exist or not |
| 236 | 236 | */ |
| 237 | - public function checkColumnName($table,$name) |
|
| 237 | + public function checkColumnName($table, $name) |
|
| 238 | 238 | { |
| 239 | 239 | global $globalDBdriver, $globalDBname; |
| 240 | 240 | if ($globalDBdriver == 'mysql') { |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | try { |
| 246 | 246 | $sth = $this->db()->prepare($query); |
| 247 | - $sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name)); |
|
| 248 | - } catch(PDOException $e) { |
|
| 247 | + $sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name)); |
|
| 248 | + } catch (PDOException $e) { |
|
| 249 | 249 | echo "error : ".$e->getMessage()."\n"; |
| 250 | 250 | } |
| 251 | 251 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | try { |
| 285 | 285 | $sth = $this->db->prepare($query); |
| 286 | 286 | $sth->execute(); |
| 287 | - } catch(PDOException $e) { |
|
| 287 | + } catch (PDOException $e) { |
|
| 288 | 288 | return "error : ".$e->getMessage()."\n"; |
| 289 | 289 | } |
| 290 | 290 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 21 | 21 | $year_data = ''; |
| 22 | 22 | $year_cnt = ''; |
| 23 | -foreach($date_array as $year_item) |
|
| 23 | +foreach ($date_array as $year_item) |
|
| 24 | 24 | { |
| 25 | 25 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
| 26 | 26 | $year_cnt .= $year_item['count'].','; |
| 27 | 27 | } |
| 28 | 28 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 29 | -$year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
| 29 | +$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
| 30 | 30 | print 'c3.generate({ |
| 31 | 31 | bindto: "#chart", |
| 32 | 32 | data: { x: "x", |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | if (!empty($date_array)) |
| 38 | 38 | { |
| 39 | - foreach($date_array as $key => $row) { |
|
| 39 | + foreach ($date_array as $key => $row) { |
|
| 40 | 40 | $years[$key] = $row['year']; |
| 41 | 41 | $months[$key] = $row['month']; |
| 42 | 42 | $counts[$key] = $row['count']; |
| 43 | 43 | } |
| 44 | 44 | // array_multisort($years,SORT_DESC,$months,SORT_DESC,$date_array); |
| 45 | - array_multisort($counts,SORT_DESC,$date_array); |
|
| 45 | + array_multisort($counts, SORT_DESC, $date_array); |
|
| 46 | 46 | print '<div class="table-responsive">'; |
| 47 | 47 | print '<table class="common-date table-striped">'; |
| 48 | 48 | print '<thead>'; |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | print '</thead>'; |
| 53 | 53 | print '<tbody>'; |
| 54 | 54 | $i = 1; |
| 55 | - foreach($date_array as $date_item) |
|
| 55 | + foreach ($date_array as $date_item) |
|
| 56 | 56 | { |
| 57 | 57 | print '<tr>'; |
| 58 | 58 | print '<td><strong>'.$i.'</strong></td>'; |
| 59 | 59 | print '<td>'; |
| 60 | 60 | if ($date_item['month'] < 10) $month = '0'.$date_item['month']; |
| 61 | 61 | else $month = $date_item['month']; |
| 62 | - print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$month.'">'.date('F, Y',strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>'; |
|
| 62 | + print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$month.'">'.date('F, Y', strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>'; |
|
| 63 | 63 | print '</td>'; |
| 64 | 64 | print '<td>'; |
| 65 | 65 | print $date_item['count']; |
@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Pilots"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 12 | 12 | } |
| 13 | -setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/'); |
|
| 14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | +setcookie('stats_airline_icao', $airline_icao, time() + 60*60*24, '/'); |
|
| 14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 16 | 16 | require_once('header.php'); |
| 17 | 17 | include('statistics-sub-menu.php'); |
| 18 | 18 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | </div> |
| 23 | 23 | <p>'._("Below are the <strong>Top 10</strong> most common pilot.").'</p>'; |
| 24 | 24 | |
| 25 | -$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
| 25 | +$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
| 26 | 26 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 27 | 27 | $pilot_data = ''; |
| 28 | -foreach($pilot_array as $pilot_item) |
|
| 28 | +foreach ($pilot_array as $pilot_item) |
|
| 29 | 29 | { |
| 30 | 30 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
| 31 | 31 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | print '</thead>'; |
| 51 | 51 | print '<tbody>'; |
| 52 | 52 | $i = 1; |
| 53 | - foreach($pilot_array as $pilot_item) |
|
| 53 | + foreach ($pilot_array as $pilot_item) |
|
| 54 | 54 | { |
| 55 | 55 | print '<tr>'; |
| 56 | 56 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,12 +6,12 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Arrival Airport"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 12 | 12 | } |
| 13 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 15 | 15 | |
| 16 | 16 | require_once('header.php'); |
| 17 | 17 | include('statistics-sub-menu.php'); |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | <p>'._("Below are the <strong>Top 10</strong> most common arrival airports.").'</p>'; |
| 26 | 26 | print '<div id="chartAirport" class="chart" width="100%"></div>'; |
| 27 | 27 | print '<script>'; |
| 28 | -$airport_airport_array = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
| 28 | +$airport_airport_array = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
| 29 | 29 | |
| 30 | 30 | print 'var series = ['; |
| 31 | 31 | $airport_data = ''; |
| 32 | -foreach($airport_airport_array as $airport_item) |
|
| 32 | +foreach ($airport_airport_array as $airport_item) |
|
| 33 | 33 | { |
| 34 | 34 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
| 35 | 35 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | print '</thead>'; |
| 84 | 84 | print '<tbody>'; |
| 85 | 85 | $i = 1; |
| 86 | -foreach($airport_airport_array as $airport_item) |
|
| 86 | +foreach ($airport_airport_array as $airport_item) |
|
| 87 | 87 | { |
| 88 | 88 | print '<tr>'; |
| 89 | 89 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Busiest Time of the Day"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 12 | 12 | } |
@@ -22,17 +22,17 @@ discard block |
||
| 22 | 22 | </div> |
| 23 | 23 | <p>'._("Below is a list of the most common <strong>time of day</strong>.").'</p>'; |
| 24 | 24 | |
| 25 | -$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
| 25 | +$hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
| 26 | 26 | print '<div id="chartHour" class="chart" width="100%"></div><script>'; |
| 27 | 27 | $hour_data = ''; |
| 28 | 28 | $hour_cnt = ''; |
| 29 | -foreach($hour_array as $hour_item) |
|
| 29 | +foreach ($hour_array as $hour_item) |
|
| 30 | 30 | { |
| 31 | 31 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
| 32 | 32 | $hour_cnt .= $hour_item['hour_count'].','; |
| 33 | 33 | } |
| 34 | 34 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
| 35 | -$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
| 35 | +$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
| 36 | 36 | print 'c3.generate({ |
| 37 | 37 | bindto: "#chartHour", |
| 38 | 38 | data: { |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});'; |
| 41 | 41 | print '</script>'; |
| 42 | 42 | |
| 43 | -$hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name); |
|
| 43 | +$hour_array = $Stats->countAllHours('count', true, $airline_icao, $filter_name); |
|
| 44 | 44 | if (!empty($hour_array)) |
| 45 | 45 | { |
| 46 | 46 | print '<div class="table-responsive">'; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | print '</thead>'; |
| 53 | 53 | print '<tbody>'; |
| 54 | 54 | $i = 1; |
| 55 | - foreach($hour_array as $hour_item) |
|
| 55 | + foreach ($hour_array as $hour_item) |
|
| 56 | 56 | { |
| 57 | 57 | print '<tr>'; |
| 58 | 58 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 20 | 20 | $year_data = ''; |
| 21 | 21 | $year_cnt = ''; |
| 22 | -foreach($date_array as $year_item) |
|
| 22 | +foreach ($date_array as $year_item) |
|
| 23 | 23 | { |
| 24 | 24 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
| 25 | 25 | $year_cnt .= $year_item['count'].','; |
| 26 | 26 | } |
| 27 | 27 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 28 | -$year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
| 28 | +$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
| 29 | 29 | print 'c3.generate({ |
| 30 | 30 | bindto: "#chart", |
| 31 | 31 | data: { x: "x", |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | if (!empty($date_array)) |
| 37 | 37 | { |
| 38 | - foreach($date_array as $key => $row) { |
|
| 38 | + foreach ($date_array as $key => $row) { |
|
| 39 | 39 | $years[$key] = $row['year']; |
| 40 | 40 | $counts[$key] = $row['count']; |
| 41 | 41 | } |
| 42 | 42 | //array_multisort($years,SORT_DESC,$date_array); |
| 43 | - array_multisort($counts,SORT_DESC,$date_array); |
|
| 43 | + array_multisort($counts, SORT_DESC, $date_array); |
|
| 44 | 44 | print '<div class="table-responsive">'; |
| 45 | 45 | print '<table class="common-date table-striped">'; |
| 46 | 46 | print '<thead>'; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | print '</thead>'; |
| 51 | 51 | print '<tbody>'; |
| 52 | 52 | $i = 1; |
| 53 | - foreach($date_array as $date_item) |
|
| 53 | + foreach ($date_array as $date_item) |
|
| 54 | 54 | { |
| 55 | 55 | print '<tr>'; |
| 56 | 56 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft Registrations"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 12 | 12 | } |
| 13 | -setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/'); |
|
| 14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | +setcookie('stats_airline_icao', $airline_icao, time() + 60*60*24, '/'); |
|
| 14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 16 | 16 | |
| 17 | 17 | require_once('header.php'); |
| 18 | 18 | include('statistics-sub-menu.php'); |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | </div> |
| 25 | 25 | <p>'._("Below are the <strong>Top 10</strong> most common aircraft registrations.").'</p>'; |
| 26 | 26 | |
| 27 | -$registration_array = $Stats->countAllAircraftRegistrations(true,$airline_icao,$filter_name,$year,$month); |
|
| 27 | +$registration_array = $Stats->countAllAircraftRegistrations(true, $airline_icao, $filter_name, $year, $month); |
|
| 28 | 28 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 29 | 29 | $registration_data = ''; |
| 30 | -foreach($registration_array as $registration_item) |
|
| 30 | +foreach ($registration_array as $registration_item) |
|
| 31 | 31 | { |
| 32 | 32 | $registration_data .= '[ "'.$registration_item['registration'].' - '.$registration_item['aircraft_name'].' ('.$registration_item['aircraft_icao'].')",'.$registration_item['aircraft_registration_count'].'],'; |
| 33 | 33 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | print '</thead>'; |
| 55 | 55 | print '<tbody>'; |
| 56 | 56 | $i = 1; |
| 57 | - foreach($registration_array as $registration_item) |
|
| 57 | + foreach ($registration_array as $registration_item) |
|
| 58 | 58 | { |
| 59 | 59 | print '<tr>'; |
| 60 | 60 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Country a flight was over"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 12 | 12 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | </div> |
| 23 | 23 | <p>'._("Below are the <strong>Top 10</strong> most common country a flight was over.").'</p>'; |
| 24 | 24 | |
| 25 | -$flightover_array = $Stats->countAllFlightOverCountries(true,$airline_icao,$filter_name); |
|
| 25 | +$flightover_array = $Stats->countAllFlightOverCountries(true, $airline_icao, $filter_name); |
|
| 26 | 26 | /* |
| 27 | 27 | require_once('require/class.Spotter.php'); |
| 28 | 28 | $Spotter = new Spotter(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 32 | 32 | print 'var series = ['; |
| 33 | 33 | $flightover_data = ''; |
| 34 | -foreach($flightover_array as $flightover_item) |
|
| 34 | +foreach ($flightover_array as $flightover_item) |
|
| 35 | 35 | { |
| 36 | 36 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
| 37 | 37 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | print '</thead>'; |
| 81 | 81 | print '<tbody>'; |
| 82 | 82 | $i = 1; |
| 83 | - foreach($flightover_array as $flightover_item) |
|
| 83 | + foreach ($flightover_array as $flightover_item) |
|
| 84 | 84 | { |
| 85 | 85 | print '<tr>'; |
| 86 | 86 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Busiest Day"); |
| 7 | 7 | |
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 12 | 12 | } |
@@ -22,20 +22,20 @@ discard block |
||
| 22 | 22 | </div> |
| 23 | 23 | <p>'._("Below is a chart that plots the busiest day during the <strong>last 7 days</strong>.").'</p>'; |
| 24 | 24 | |
| 25 | -$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
| 25 | +$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
| 26 | 26 | if (count($date_array) == 0) { |
| 27 | 27 | print _("No data available"); |
| 28 | 28 | } else { |
| 29 | 29 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 30 | 30 | $date_data = ''; |
| 31 | 31 | $date_cnt = ''; |
| 32 | -foreach($date_array as $date_item) |
|
| 32 | +foreach ($date_array as $date_item) |
|
| 33 | 33 | { |
| 34 | 34 | $date_data .= '"'.$date_item['date_name'].'",'; |
| 35 | 35 | $date_cnt .= $date_item['date_count'].','; |
| 36 | 36 | } |
| 37 | 37 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
| 38 | -$date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
| 38 | +$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
| 39 | 39 | print 'c3.generate({ |
| 40 | 40 | bindto: "#chart", |
| 41 | 41 | data: { x: "x", |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | print '</script>'; |
| 45 | 45 | } |
| 46 | 46 | if (isset($globalDBArchiveMonths) && $globalDBArchiveMonths > 0) { |
| 47 | - print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."),$globalDBArchiveMonths).'</p>'; |
|
| 47 | + print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."), $globalDBArchiveMonths).'</p>'; |
|
| 48 | 48 | } else { |
| 49 | 49 | print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>'; |
| 50 | 50 | } |
| 51 | -$date_array = $Stats->countAllDates($airline_icao,$filter_name); |
|
| 51 | +$date_array = $Stats->countAllDates($airline_icao, $filter_name); |
|
| 52 | 52 | if (!empty($date_array)) |
| 53 | 53 | { |
| 54 | 54 | print '<div class="table-responsive">'; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | print '</thead>'; |
| 61 | 61 | print '<tbody>'; |
| 62 | 62 | $i = 1; |
| 63 | - foreach($date_array as $date_item) |
|
| 63 | + foreach ($date_array as $date_item) |
|
| 64 | 64 | { |
| 65 | 65 | print '<tr>'; |
| 66 | 66 | print '<td><strong>'.$i.'</strong></td>'; |