@@ -3,8 +3,8 @@ |
||
| 3 | 3 | require_once('require/class.Spotter.php'); |
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | if (!isset($_GET['owner'])) { |
| 6 | - header('Location: '.$globalURL.'/owner'); |
|
| 7 | - die(); |
|
| 6 | + header('Location: '.$globalURL.'/owner'); |
|
| 7 | + die(); |
|
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | 10 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
@@ -7,18 +7,18 @@ discard block |
||
| 7 | 7 | die(); |
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 11 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 11 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | 14 | $filter = array(); |
| 15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 17 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort, $filter); |
|
| 15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
| 16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
| 17 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
| 18 | 18 | |
| 19 | 19 | if (!empty($spotter_array)) |
| 20 | 20 | { |
| 21 | - $title = sprintf(_("Most Common Arrival Airports by Country of %s"),$spotter_array[0]['aircraft_owner']); |
|
| 21 | + $title = sprintf(_("Most Common Arrival Airports by Country of %s"), $spotter_array[0]['aircraft_owner']); |
|
| 22 | 22 | require_once('header.php'); |
| 23 | 23 | print '<div class="info column">'; |
| 24 | 24 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | include('owner-sub-menu.php'); |
| 30 | 30 | print '<div class="column">'; |
| 31 | 31 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
| 32 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
| 33 | - $airport_country_array = $Spotter->countAllArrivalAirportCountriesByOwner($owner,$filter); |
|
| 32 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
| 33 | + $airport_country_array = $Spotter->countAllArrivalAirportCountriesByOwner($owner, $filter); |
|
| 34 | 34 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
| 35 | 35 | print '<div id="chartCountry" class="chart" width="100%"></div> |
| 36 | 36 | <script> |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | var data = google.visualization.arrayToDataTable([ |
| 41 | 41 | ["'._("Country").'", "'._("# of times").'"], '; |
| 42 | 42 | $country_data = ''; |
| 43 | - foreach($airport_country_array as $airport_item) |
|
| 43 | + foreach ($airport_country_array as $airport_item) |
|
| 44 | 44 | { |
| 45 | 45 | $country_data .= '[ "'.$airport_item['arrival_airport_country'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
| 46 | 46 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | print '</thead>'; |
| 75 | 75 | print '<tbody>'; |
| 76 | 76 | $i = 1; |
| 77 | - foreach($airport_country_array as $airport_item) |
|
| 77 | + foreach ($airport_country_array as $airport_item) |
|
| 78 | 78 | { |
| 79 | 79 | print '<tr>'; |
| 80 | 80 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -12,8 +12,12 @@ |
||
| 12 | 12 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 13 | 13 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
| 14 | 14 | $filter = array(); |
| 15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 15 | +if ($year != '') { |
|
| 16 | + $filter = array_merge($filter,array('year' => $year)); |
|
| 17 | +} |
|
| 18 | +if ($month != '') { |
|
| 19 | + $filter = array_merge($filter,array('month' => $month)); |
|
| 20 | +} |
|
| 17 | 21 | $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort, $filter); |
| 18 | 22 | |
| 19 | 23 | if (!empty($spotter_array)) |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | require_once('require/class.Spotter.php'); |
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | if (!isset($_GET['owner'])) { |
| 6 | - header('Location: '.$globalURL.'/owner'); |
|
| 7 | - die(); |
|
| 6 | + header('Location: '.$globalURL.'/owner'); |
|
| 7 | + die(); |
|
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | 10 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
@@ -7,22 +7,22 @@ discard block |
||
| 7 | 7 | die(); |
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 11 | -$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING); |
|
| 12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 11 | +$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING); |
|
| 12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | 14 | $filter = array(); |
| 15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
| 16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
| 17 | 17 | if ($sort != '') { |
| 18 | - $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter); |
|
| 18 | + $spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort, $filter); |
|
| 19 | 19 | } else { |
| 20 | - $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", '',$filter); |
|
| 20 | + $spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", '', $filter); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (!empty($spotter_array)) |
| 24 | 24 | { |
| 25 | - $title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['pilot_name']); |
|
| 25 | + $title = sprintf(_("Most Common Aircraft of %s"), $spotter_array[0]['pilot_name']); |
|
| 26 | 26 | require_once('header.php'); |
| 27 | 27 | print '<div class="info column">'; |
| 28 | 28 | print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>'; |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | include('pilot-sub-menu.php'); |
| 34 | 34 | print '<div class="column">'; |
| 35 | 35 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
| 36 | - print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>'; |
|
| 36 | + print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights piloted by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>'; |
|
| 37 | 37 | |
| 38 | - $aircraft_array = $Spotter->countAllAircraftTypesByPilot($pilot,$filter); |
|
| 38 | + $aircraft_array = $Spotter->countAllAircraftTypesByPilot($pilot, $filter); |
|
| 39 | 39 | if (!empty($aircraft_array)) |
| 40 | 40 | { |
| 41 | 41 | print '<div class="table-responsive">'; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | print '</thead>'; |
| 48 | 48 | print '<tbody>'; |
| 49 | 49 | $i = 1; |
| 50 | - foreach($aircraft_array as $aircraft_item) |
|
| 50 | + foreach ($aircraft_array as $aircraft_item) |
|
| 51 | 51 | { |
| 52 | 52 | print '<tr>'; |
| 53 | 53 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -12,8 +12,12 @@ |
||
| 12 | 12 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 13 | 13 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
| 14 | 14 | $filter = array(); |
| 15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 15 | +if ($year != '') { |
|
| 16 | + $filter = array_merge($filter,array('year' => $year)); |
|
| 17 | +} |
|
| 18 | +if ($month != '') { |
|
| 19 | + $filter = array_merge($filter,array('month' => $month)); |
|
| 20 | +} |
|
| 17 | 21 | if ($sort != '') { |
| 18 | 22 | $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter); |
| 19 | 23 | } else { |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | require_once('require/class.Spotter.php'); |
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | if (!isset($_GET['owner'])) { |
| 6 | - header('Location: '.$globalURL.'/owner'); |
|
| 7 | - die(); |
|
| 6 | + header('Location: '.$globalURL.'/owner'); |
|
| 7 | + die(); |
|
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | 10 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
@@ -7,18 +7,18 @@ discard block |
||
| 7 | 7 | die(); |
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 11 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 11 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | 14 | $filter = array(); |
| 15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 17 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
| 15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
| 16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
| 17 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
| 18 | 18 | |
| 19 | 19 | if (!empty($spotter_array)) |
| 20 | 20 | { |
| 21 | - $title = sprintf(_("Most Common Airlines of %s"),$spotter_array[0]['aircraft_owner']); |
|
| 21 | + $title = sprintf(_("Most Common Airlines of %s"), $spotter_array[0]['aircraft_owner']); |
|
| 22 | 22 | require_once('header.php'); |
| 23 | 23 | print '<div class="info column">'; |
| 24 | 24 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | include('owner-sub-menu.php'); |
| 30 | 30 | print '<div class="column">'; |
| 31 | 31 | print '<h2>'._("Most Common Airlines").'</h2>'; |
| 32 | - print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
| 32 | + print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
| 33 | 33 | |
| 34 | - $airline_array = $Spotter->countAllAirlinesByOwner($owner,$filter); |
|
| 34 | + $airline_array = $Spotter->countAllAirlinesByOwner($owner, $filter); |
|
| 35 | 35 | if (!empty($airline_array)) |
| 36 | 36 | { |
| 37 | 37 | print '<div class="table-responsive">'; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | print '</thead>'; |
| 47 | 47 | print '<tbody>'; |
| 48 | 48 | $i = 1; |
| 49 | - foreach($airline_array as $airline_item) |
|
| 49 | + foreach ($airline_array as $airline_item) |
|
| 50 | 50 | { |
| 51 | 51 | print '<tr>'; |
| 52 | 52 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -12,8 +12,12 @@ |
||
| 12 | 12 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 13 | 13 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
| 14 | 14 | $filter = array(); |
| 15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 15 | +if ($year != '') { |
|
| 16 | + $filter = array_merge($filter,array('year' => $year)); |
|
| 17 | +} |
|
| 18 | +if ($month != '') { |
|
| 19 | + $filter = array_merge($filter,array('month' => $month)); |
|
| 20 | +} |
|
| 17 | 21 | $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
| 18 | 22 | |
| 19 | 23 | if (!empty($spotter_array)) |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | header('Location: '.$globalURL.'/pilot/'.$_POST['pilot']); |
| 10 | 10 | //} else if (isset($_GET['airport'])){ |
| 11 | 11 | } else { |
| 12 | - $Spotter= new Spotter(); |
|
| 12 | + $Spotter = new Spotter(); |
|
| 13 | 13 | $Stats = new Stats(); |
| 14 | 14 | $title = _("Pilots"); |
| 15 | 15 | require_once('header.php'); |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | //ksort($pilot_names); |
| 23 | 23 | $previous = null; |
| 24 | 24 | print '<div class="alphabet-legend">'; |
| 25 | - foreach($pilot_names as $value) { |
|
| 25 | + foreach ($pilot_names as $value) { |
|
| 26 | 26 | $firstLetter = mb_strtoupper(mb_substr($value['pilot_name'], 0, 1)); |
| 27 | - if($previous !== $firstLetter && $firstLetter != "'") |
|
| 27 | + if ($previous !== $firstLetter && $firstLetter != "'") |
|
| 28 | 28 | { |
| 29 | - if ($previous !== null){ |
|
| 29 | + if ($previous !== null) { |
|
| 30 | 30 | print ' | '; |
| 31 | 31 | } |
| 32 | 32 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | print '</div>'; |
| 37 | 37 | $previous = null; |
| 38 | - foreach($pilot_names as $value) { |
|
| 38 | + foreach ($pilot_names as $value) { |
|
| 39 | 39 | $firstLetter = mb_strtoupper(mb_substr($value['pilot_name'], 0, 1)); |
| 40 | 40 | if ($firstLetter != "") |
| 41 | 41 | { |
| 42 | - if($previous !== $firstLetter && $firstLetter != "'") |
|
| 42 | + if ($previous !== $firstLetter && $firstLetter != "'") |
|
| 43 | 43 | { |
| 44 | - if ($previous !== null){ |
|
| 44 | + if ($previous !== null) { |
|
| 45 | 45 | print '</div>'; |
| 46 | 46 | } |
| 47 | 47 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -31,7 +31,9 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
| 33 | 33 | } |
| 34 | - if ($firstLetter != "'") $previous = $firstLetter; |
|
| 34 | + if ($firstLetter != "'") { |
|
| 35 | + $previous = $firstLetter; |
|
| 36 | + } |
|
| 35 | 37 | } |
| 36 | 38 | print '</div>'; |
| 37 | 39 | $previous = null; |
@@ -46,10 +48,15 @@ discard block |
||
| 46 | 48 | } |
| 47 | 49 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
| 48 | 50 | } |
| 49 | - if ($firstLetter != "'") $previous = $firstLetter; |
|
| 51 | + if ($firstLetter != "'") { |
|
| 52 | + $previous = $firstLetter; |
|
| 53 | + } |
|
| 50 | 54 | print '<div class="alphabet-item">'; |
| 51 | - if (isset($value['pilot_id']) && $value['pilot_id'] != '') print '<a href="'.$globalURL.'/pilot/'.$value['pilot_id'].'">'.$value['pilot_name'].' ('.$value['pilot_id'].')'; |
|
| 52 | - else print '<a href="'.$globalURL.'/pilot/'.$value['pilot_name'].'">'.$value['pilot_name']; |
|
| 55 | + if (isset($value['pilot_id']) && $value['pilot_id'] != '') { |
|
| 56 | + print '<a href="'.$globalURL.'/pilot/'.$value['pilot_id'].'">'.$value['pilot_name'].' ('.$value['pilot_id'].')'; |
|
| 57 | + } else { |
|
| 58 | + print '<a href="'.$globalURL.'/pilot/'.$value['pilot_name'].'">'.$value['pilot_name']; |
|
| 59 | + } |
|
| 53 | 60 | print '</a>'; |
| 54 | 61 | print '</div>'; |
| 55 | 62 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | header('Location: '.$globalURL.'/owner/'.$_POST['owner']); |
| 11 | 11 | //} else if (isset($_GET['airport'])){ |
| 12 | 12 | } else { |
| 13 | - $Spotter= new Spotter(); |
|
| 13 | + $Spotter = new Spotter(); |
|
| 14 | 14 | $Stats = new Stats(); |
| 15 | 15 | $Common = new Common(); |
| 16 | 16 | $title = _("Owners"); |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | ksort($owner_names); |
| 25 | 25 | $previous = null; |
| 26 | 26 | print '<div class="alphabet-legend">'; |
| 27 | - foreach($owner_names as $value) { |
|
| 27 | + foreach ($owner_names as $value) { |
|
| 28 | 28 | $firstLetter = $Common->remove_accents(mb_strtoupper(mb_substr($value['owner_name'], 0, 1))); |
| 29 | - if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
| 29 | + if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
| 30 | 30 | { |
| 31 | - if ($previous !== null){ |
|
| 31 | + if ($previous !== null) { |
|
| 32 | 32 | print ' | '; |
| 33 | 33 | } |
| 34 | 34 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | print '</div>'; |
| 39 | 39 | $previous = null; |
| 40 | - foreach($owner_names as $value) { |
|
| 40 | + foreach ($owner_names as $value) { |
|
| 41 | 41 | $firstLetter = $Common->remove_accents(mb_strtoupper(mb_substr($value['owner_name'], 0, 1))); |
| 42 | 42 | if ($firstLetter != "") |
| 43 | 43 | { |
| 44 | - if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
| 44 | + if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
| 45 | 45 | { |
| 46 | - if ($previous !== null){ |
|
| 46 | + if ($previous !== null) { |
|
| 47 | 47 | print '</div>'; |
| 48 | 48 | } |
| 49 | 49 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -33,7 +33,9 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
| 35 | 35 | } |
| 36 | - if ($firstLetter != "'" && $firstLetter != '"') $previous = $firstLetter; |
|
| 36 | + if ($firstLetter != "'" && $firstLetter != '"') { |
|
| 37 | + $previous = $firstLetter; |
|
| 38 | + } |
|
| 37 | 39 | } |
| 38 | 40 | print '</div>'; |
| 39 | 41 | $previous = null; |
@@ -48,7 +50,9 @@ discard block |
||
| 48 | 50 | } |
| 49 | 51 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
| 50 | 52 | } |
| 51 | - if ($firstLetter != "'" && $firstLetter != '"') $previous = $firstLetter; |
|
| 53 | + if ($firstLetter != "'" && $firstLetter != '"') { |
|
| 54 | + $previous = $firstLetter; |
|
| 55 | + } |
|
| 52 | 56 | print '<div class="alphabet-item">'; |
| 53 | 57 | print '<a href="'.$globalURL.'/owner/'.$value['owner_name'].'">'; |
| 54 | 58 | print $value['owner_name']; |
@@ -64,8 +64,11 @@ discard block |
||
| 64 | 64 | $globalDBSname = $globalDBname; |
| 65 | 65 | $globalDBSuser = $globalDBuser; |
| 66 | 66 | $globalDBSpass = $globalDBpass; |
| 67 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
| 68 | - else $globalDBSport = $globalDBport; |
|
| 67 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
| 68 | + $globalDBSport = 3306; |
|
| 69 | + } else { |
|
| 70 | + $globalDBSport = $globalDBport; |
|
| 71 | + } |
|
| 69 | 72 | } else { |
| 70 | 73 | $DBname = 'default'; |
| 71 | 74 | $globalDBSdriver = $globalDBdriver; |
@@ -73,8 +76,11 @@ discard block |
||
| 73 | 76 | $globalDBSname = $globalDBname; |
| 74 | 77 | $globalDBSuser = $user; |
| 75 | 78 | $globalDBSpass = $pass; |
| 76 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
| 77 | - else $globalDBSport = $globalDBport; |
|
| 79 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
| 80 | + $globalDBSport = 3306; |
|
| 81 | + } else { |
|
| 82 | + $globalDBSport = $globalDBport; |
|
| 83 | + } |
|
| 78 | 84 | } |
| 79 | 85 | } else { |
| 80 | 86 | $globalDBSdriver = $globalDB[$DBname]['driver']; |
@@ -82,11 +88,16 @@ discard block |
||
| 82 | 88 | $globalDBSname = $globalDB[$DBname]['name']; |
| 83 | 89 | $globalDBSuser = $globalDB[$DBname]['user']; |
| 84 | 90 | $globalDBSpass = $globalDB[$DBname]['pass']; |
| 85 | - if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port']; |
|
| 86 | - else $globalDBSport = 3306; |
|
| 91 | + if (isset($globalDB[$DBname]['port'])) { |
|
| 92 | + $globalDBSport = $globalDB[$DBname]['port']; |
|
| 93 | + } else { |
|
| 94 | + $globalDBSport = 3306; |
|
| 95 | + } |
|
| 87 | 96 | } |
| 88 | 97 | // Set number of try to connect to DB |
| 89 | - if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5; |
|
| 98 | + if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) { |
|
| 99 | + $globalDBretry = 5; |
|
| 100 | + } |
|
| 90 | 101 | $i = 0; |
| 91 | 102 | while (true) { |
| 92 | 103 | try { |
@@ -95,10 +106,16 @@ discard block |
||
| 95 | 106 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 96 | 107 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 97 | 108 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
| 98 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 99 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 100 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 101 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 109 | + if (!isset($globalDBTimeOut)) { |
|
| 110 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 111 | + } else { |
|
| 112 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 113 | + } |
|
| 114 | + if (!isset($globalDBPersistent)) { |
|
| 115 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 116 | + } else { |
|
| 117 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 118 | + } |
|
| 102 | 119 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 103 | 120 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
| 104 | 121 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -112,23 +129,35 @@ discard block |
||
| 112 | 129 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 113 | 130 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 114 | 131 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
| 115 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 116 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 117 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 118 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 132 | + if (!isset($globalDBTimeOut)) { |
|
| 133 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 134 | + } else { |
|
| 135 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 136 | + } |
|
| 137 | + if (!isset($globalDBPersistent)) { |
|
| 138 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 139 | + } else { |
|
| 140 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 141 | + } |
|
| 119 | 142 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 120 | 143 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
| 121 | 144 | } |
| 122 | 145 | break; |
| 123 | 146 | } catch(PDOException $e) { |
| 124 | 147 | $i++; |
| 125 | - if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
|
| 148 | + if (isset($globalDebug) && $globalDebug) { |
|
| 149 | + echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
|
| 150 | + } |
|
| 126 | 151 | //exit; |
| 127 | - if ($i > $globalDBretry) return false; |
|
| 152 | + if ($i > $globalDBretry) { |
|
| 153 | + return false; |
|
| 154 | + } |
|
| 128 | 155 | //return false; |
| 129 | 156 | } |
| 130 | 157 | } |
| 131 | - if ($DBname === 'default') $this->db = $this->dbs['default']; |
|
| 158 | + if ($DBname === 'default') { |
|
| 159 | + $this->db = $this->dbs['default']; |
|
| 160 | + } |
|
| 132 | 161 | return true; |
| 133 | 162 | } |
| 134 | 163 | |
@@ -140,7 +169,9 @@ discard block |
||
| 140 | 169 | } else { |
| 141 | 170 | $query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'"; |
| 142 | 171 | } |
| 143 | - if ($this->db == NULL) return false; |
|
| 172 | + if ($this->db == NULL) { |
|
| 173 | + return false; |
|
| 174 | + } |
|
| 144 | 175 | try { |
| 145 | 176 | //$Connection = new Connection(); |
| 146 | 177 | $results = $this->db->query($query); |
@@ -149,21 +180,28 @@ discard block |
||
| 149 | 180 | } |
| 150 | 181 | if($results->rowCount()>0) { |
| 151 | 182 | return true; |
| 183 | + } else { |
|
| 184 | + return false; |
|
| 152 | 185 | } |
| 153 | - else return false; |
|
| 154 | 186 | } |
| 155 | 187 | |
| 156 | 188 | public function connectionExists() |
| 157 | 189 | { |
| 158 | 190 | global $globalDBdriver, $globalDBCheckConnection; |
| 159 | - if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true; |
|
| 191 | + if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) { |
|
| 192 | + return true; |
|
| 193 | + } |
|
| 160 | 194 | $query = "SELECT 1 + 1"; |
| 161 | - if ($this->db === null) return false; |
|
| 195 | + if ($this->db === null) { |
|
| 196 | + return false; |
|
| 197 | + } |
|
| 162 | 198 | try { |
| 163 | 199 | $sum = @$this->db->query($query); |
| 164 | 200 | if ($sum instanceof \PDOStatement) { |
| 165 | 201 | $sum = $sum->fetchColumn(0); |
| 166 | - } else $sum = 0; |
|
| 202 | + } else { |
|
| 203 | + $sum = 0; |
|
| 204 | + } |
|
| 167 | 205 | if (intval($sum) !== 2) { |
| 168 | 206 | return false; |
| 169 | 207 | } |
@@ -198,8 +236,9 @@ discard block |
||
| 198 | 236 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
| 199 | 237 | if($nb[0]['nb'] > 0) { |
| 200 | 238 | return true; |
| 239 | + } else { |
|
| 240 | + return false; |
|
| 201 | 241 | } |
| 202 | - else return false; |
|
| 203 | 242 | } |
| 204 | 243 | |
| 205 | 244 | /* |
@@ -243,9 +282,12 @@ discard block |
||
| 243 | 282 | } |
| 244 | 283 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 245 | 284 | $sth->closeCursor(); |
| 246 | - if ($result['nb'] > 0) return true; |
|
| 247 | - else return false; |
|
| 248 | -/* } else { |
|
| 285 | + if ($result['nb'] > 0) { |
|
| 286 | + return true; |
|
| 287 | + } else { |
|
| 288 | + return false; |
|
| 289 | + } |
|
| 290 | + /* } else { |
|
| 249 | 291 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
| 250 | 292 | try { |
| 251 | 293 | $results = $this->db->query($query); |
@@ -284,7 +326,9 @@ discard block |
||
| 284 | 326 | $sth->closeCursor(); |
| 285 | 327 | return $result['value']; |
| 286 | 328 | } |
| 287 | - } else return $version; |
|
| 329 | + } else { |
|
| 330 | + return $version; |
|
| 331 | + } |
|
| 288 | 332 | } |
| 289 | 333 | |
| 290 | 334 | /* |
@@ -292,8 +336,11 @@ discard block |
||
| 292 | 336 | * @return Boolean if latest version or not |
| 293 | 337 | */ |
| 294 | 338 | public function latest() { |
| 295 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 296 | - else return false; |
|
| 339 | + if ($this->check_schema_version() == $this->latest_schema) { |
|
| 340 | + return true; |
|
| 341 | + } else { |
|
| 342 | + return false; |
|
| 343 | + } |
|
| 297 | 344 | } |
| 298 | 345 | |
| 299 | 346 | } |
@@ -6,6 +6,9 @@ discard block |
||
| 6 | 6 | public $dbs = array(); |
| 7 | 7 | public $latest_schema = 36; |
| 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; |
| 11 | 14 | if ($dbc === null) { |
@@ -132,6 +135,9 @@ discard block |
||
| 132 | 135 | return true; |
| 133 | 136 | } |
| 134 | 137 | |
| 138 | + /** |
|
| 139 | + * @param string $table |
|
| 140 | + */ |
|
| 135 | 141 | public function tableExists($table) |
| 136 | 142 | { |
| 137 | 143 | global $globalDBdriver, $globalDBname; |
@@ -181,6 +187,11 @@ discard block |
||
| 181 | 187 | /* |
| 182 | 188 | * Check if index exist |
| 183 | 189 | */ |
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * @param string $table |
|
| 193 | + * @param string $index |
|
| 194 | + */ |
|
| 184 | 195 | public function indexExists($table,$index) |
| 185 | 196 | { |
| 186 | 197 | global $globalDBdriver, $globalDBname; |
@@ -223,6 +234,10 @@ discard block |
||
| 223 | 234 | return $columns; |
| 224 | 235 | } |
| 225 | 236 | |
| 237 | + /** |
|
| 238 | + * @param string $table |
|
| 239 | + * @param string $column |
|
| 240 | + */ |
|
| 226 | 241 | public function getColumnType($table,$column) { |
| 227 | 242 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
| 228 | 243 | $tomet = $select->getColumnMeta(0); |
@@ -233,6 +248,11 @@ discard block |
||
| 233 | 248 | * Check if a column name exist in a table |
| 234 | 249 | * @return Boolean column exist or not |
| 235 | 250 | */ |
| 251 | + |
|
| 252 | + /** |
|
| 253 | + * @param string $table |
|
| 254 | + * @param string $name |
|
| 255 | + */ |
|
| 236 | 256 | public function checkColumnName($table,$name) |
| 237 | 257 | { |
| 238 | 258 | global $globalDBdriver, $globalDBname; |
@@ -7,18 +7,18 @@ discard block |
||
| 7 | 7 | public $latest_schema = 36; |
| 8 | 8 | |
| 9 | 9 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
| 10 | - global $globalDBdriver; |
|
| 11 | - if ($dbc === null) { |
|
| 10 | + global $globalDBdriver; |
|
| 11 | + if ($dbc === null) { |
|
| 12 | 12 | if ($this->db === null && $dbname === null) { |
| 13 | - if ($user === null && $pass === null) { |
|
| 13 | + if ($user === null && $pass === null) { |
|
| 14 | 14 | $this->createDBConnection(); |
| 15 | - } else { |
|
| 15 | + } else { |
|
| 16 | 16 | $this->createDBConnection(null,$user,$pass); |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | } else { |
| 19 | - $this->createDBConnection($dbname); |
|
| 19 | + $this->createDBConnection($dbname); |
|
| 20 | 20 | } |
| 21 | - } elseif ($dbname === null || $dbname === 'default') { |
|
| 21 | + } elseif ($dbname === null || $dbname === 'default') { |
|
| 22 | 22 | $this->db = $dbc; |
| 23 | 23 | if ($this->connectionExists() === false) { |
| 24 | 24 | /* |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | $this->createDBConnection(); |
| 30 | 30 | } |
| 31 | - } else { |
|
| 31 | + } else { |
|
| 32 | 32 | //$this->connectionExists(); |
| 33 | 33 | $this->dbs[$dbname] = $dbc; |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function db() { |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Creates the database connection |
|
| 51 | - * |
|
| 52 | - * @return Boolean of the database connection |
|
| 53 | - * |
|
| 54 | - */ |
|
| 50 | + * Creates the database connection |
|
| 51 | + * |
|
| 52 | + * @return Boolean of the database connection |
|
| 53 | + * |
|
| 54 | + */ |
|
| 55 | 55 | |
| 56 | 56 | public function createDBConnection($DBname = null, $user = null, $pass = null) |
| 57 | 57 | { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | 150 | if($results->rowCount()>0) { |
| 151 | - return true; |
|
| 151 | + return true; |
|
| 152 | 152 | } |
| 153 | 153 | else return false; |
| 154 | 154 | } |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | $sum = $sum->fetchColumn(0); |
| 166 | 166 | } else $sum = 0; |
| 167 | 167 | if (intval($sum) !== 2) { |
| 168 | - return false; |
|
| 168 | + return false; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | } catch(PDOException $e) { |
| 172 | 172 | if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
| 173 | - throw $e; |
|
| 174 | - } |
|
| 175 | - //echo 'error ! '.$e->getMessage(); |
|
| 173 | + throw $e; |
|
| 174 | + } |
|
| 175 | + //echo 'error ! '.$e->getMessage(); |
|
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | return true; |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | $version = 0; |
| 277 | 277 | if ($this->tableExists('aircraft')) { |
| 278 | 278 | if (!$this->tableExists('config')) { |
| 279 | - $version = '1'; |
|
| 280 | - return $version; |
|
| 279 | + $version = '1'; |
|
| 280 | + return $version; |
|
| 281 | 281 | } else { |
| 282 | 282 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
| 283 | 283 | try { |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | * @return Boolean if latest version or not |
| 299 | 299 | */ |
| 300 | 300 | public function latest() { |
| 301 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 302 | - else return false; |
|
| 301 | + if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 302 | + else return false; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | } |
@@ -1,19 +1,19 @@ 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 = 36; |
| 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; |
| 11 | 11 | if ($dbc === null) { |
| 12 | 12 | if ($this->db === null && $dbname === null) { |
| 13 | 13 | if ($user === null && $pass === null) { |
| 14 | 14 | $this->createDBConnection(); |
| 15 | 15 | } else { |
| 16 | - $this->createDBConnection(null,$user,$pass); |
|
| 16 | + $this->createDBConnection(null, $user, $pass); |
|
| 17 | 17 | } |
| 18 | 18 | } else { |
| 19 | 19 | $this->createDBConnection($dbname); |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | while (true) { |
| 92 | 92 | try { |
| 93 | 93 | if ($globalDBSdriver == 'mysql') { |
| 94 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
| 94 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
| 95 | 95 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 96 | 96 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 97 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
| 98 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 99 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 100 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 101 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 97 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
| 98 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500); |
|
| 99 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
| 100 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
| 101 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
| 102 | 102 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 103 | 103 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
| 104 | 104 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -108,19 +108,19 @@ discard block |
||
| 108 | 108 | $this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"'); |
| 109 | 109 | //$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"'); |
| 110 | 110 | } else { |
| 111 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
| 111 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
| 112 | 112 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 113 | 113 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 114 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
| 115 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 116 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 117 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 118 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 114 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
| 115 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200); |
|
| 116 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
| 117 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
| 118 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
| 119 | 119 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 120 | 120 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
| 121 | 121 | } |
| 122 | 122 | break; |
| 123 | - } catch(PDOException $e) { |
|
| 123 | + } catch (PDOException $e) { |
|
| 124 | 124 | $i++; |
| 125 | 125 | if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
| 126 | 126 | //exit; |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | try { |
| 145 | 145 | //$Connection = new Connection(); |
| 146 | 146 | $results = $this->db->query($query); |
| 147 | - } catch(PDOException $e) { |
|
| 147 | + } catch (PDOException $e) { |
|
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | - if($results->rowCount()>0) { |
|
| 150 | + if ($results->rowCount() > 0) { |
|
| 151 | 151 | return true; |
| 152 | 152 | } |
| 153 | 153 | else return false; |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | return false; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - } catch(PDOException $e) { |
|
| 172 | - if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
| 171 | + } catch (PDOException $e) { |
|
| 172 | + if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
| 173 | 173 | throw $e; |
| 174 | 174 | } |
| 175 | 175 | //echo 'error ! '.$e->getMessage(); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | /* |
| 182 | 182 | * Check if index exist |
| 183 | 183 | */ |
| 184 | - public function indexExists($table,$index) |
|
| 184 | + public function indexExists($table, $index) |
|
| 185 | 185 | { |
| 186 | 186 | global $globalDBdriver, $globalDBname; |
| 187 | 187 | if ($globalDBdriver == 'mysql') { |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | try { |
| 193 | 193 | //$Connection = new Connection(); |
| 194 | 194 | $results = $this->db->query($query); |
| 195 | - } catch(PDOException $e) { |
|
| 195 | + } catch (PDOException $e) { |
|
| 196 | 196 | return false; |
| 197 | 197 | } |
| 198 | 198 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
| 199 | - if($nb[0]['nb'] > 0) { |
|
| 199 | + if ($nb[0]['nb'] > 0) { |
|
| 200 | 200 | return true; |
| 201 | 201 | } |
| 202 | 202 | else return false; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
| 212 | 212 | try { |
| 213 | 213 | $results = $this->db->query($query); |
| 214 | - } catch(PDOException $e) { |
|
| 214 | + } catch (PDOException $e) { |
|
| 215 | 215 | return "error : ".$e->getMessage()."\n"; |
| 216 | 216 | } |
| 217 | 217 | $columns = array(); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | return $columns; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - public function getColumnType($table,$column) { |
|
| 226 | + public function getColumnType($table, $column) { |
|
| 227 | 227 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
| 228 | 228 | $tomet = $select->getColumnMeta(0); |
| 229 | 229 | return $tomet['native_type']; |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * Check if a column name exist in a table |
| 234 | 234 | * @return Boolean column exist or not |
| 235 | 235 | */ |
| 236 | - public function checkColumnName($table,$name) |
|
| 236 | + public function checkColumnName($table, $name) |
|
| 237 | 237 | { |
| 238 | 238 | global $globalDBdriver, $globalDBname; |
| 239 | 239 | if ($globalDBdriver == 'mysql') { |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | try { |
| 245 | 245 | $sth = $this->db()->prepare($query); |
| 246 | - $sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name)); |
|
| 247 | - } catch(PDOException $e) { |
|
| 246 | + $sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name)); |
|
| 247 | + } catch (PDOException $e) { |
|
| 248 | 248 | echo "error : ".$e->getMessage()."\n"; |
| 249 | 249 | } |
| 250 | 250 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | try { |
| 284 | 284 | $sth = $this->db->prepare($query); |
| 285 | 285 | $sth->execute(); |
| 286 | - } catch(PDOException $e) { |
|
| 286 | + } catch (PDOException $e) { |
|
| 287 | 287 | return "error : ".$e->getMessage()."\n"; |
| 288 | 288 | } |
| 289 | 289 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | ["'._("Month").'", "'._("# of Fatalities").'"], '; |
| 24 | 24 | |
| 25 | 25 | $date_data = ''; |
| 26 | -foreach($date_array as $date_item) |
|
| 26 | +foreach ($date_array as $date_item) |
|
| 27 | 27 | { |
| 28 | - $date_data .= '[ "'.date('F, Y',strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'",'.$date_item['count'].'],'; |
|
| 28 | + $date_data .= '[ "'.date('F, Y', strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'",'.$date_item['count'].'],'; |
|
| 29 | 29 | } |
| 30 | 30 | $date_data = substr($date_data, 0, -1); |
| 31 | 31 | print $date_data; |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | if (!empty($date_array)) |
| 52 | 52 | { |
| 53 | - foreach($date_array as $key => $row) { |
|
| 53 | + foreach ($date_array as $key => $row) { |
|
| 54 | 54 | $years[$key] = $row['year']; |
| 55 | 55 | $months[$key] = $row['month']; |
| 56 | 56 | $counts[$key] = $row['count']; |
| 57 | 57 | } |
| 58 | 58 | // array_multisort($years,SORT_DESC,$months,SORT_DESC,$date_array); |
| 59 | - array_multisort($counts,SORT_DESC,$date_array); |
|
| 59 | + array_multisort($counts, SORT_DESC, $date_array); |
|
| 60 | 60 | print '<div class="table-responsive">'; |
| 61 | 61 | print '<table class="common-date table-striped">'; |
| 62 | 62 | print '<thead>'; |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | print '</thead>'; |
| 67 | 67 | print '<tbody>'; |
| 68 | 68 | $i = 1; |
| 69 | - foreach($date_array as $date_item) |
|
| 69 | + foreach ($date_array as $date_item) |
|
| 70 | 70 | { |
| 71 | 71 | print '<tr>'; |
| 72 | 72 | print '<td><strong>'.$i.'</strong></td>'; |
| 73 | 73 | print '<td>'; |
| 74 | 74 | if ($date_item['month'] < 10) $month = '0'.$date_item['month']; |
| 75 | 75 | else $month = $date_item['month']; |
| 76 | - print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$month.'">'.date('F, Y',strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>'; |
|
| 76 | + print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$month.'">'.date('F, Y', strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>'; |
|
| 77 | 77 | print '</td>'; |
| 78 | 78 | print '<td>'; |
| 79 | 79 | print $date_item['count']; |
@@ -71,8 +71,11 @@ |
||
| 71 | 71 | print '<tr>'; |
| 72 | 72 | print '<td><strong>'.$i.'</strong></td>'; |
| 73 | 73 | print '<td>'; |
| 74 | - if ($date_item['month'] < 10) $month = '0'.$date_item['month']; |
|
| 75 | - else $month = $date_item['month']; |
|
| 74 | + if ($date_item['month'] < 10) { |
|
| 75 | + $month = '0'.$date_item['month']; |
|
| 76 | + } else { |
|
| 77 | + $month = $date_item['month']; |
|
| 78 | + } |
|
| 76 | 79 | print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$month.'">'.date('F, Y',strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>'; |
| 77 | 80 | print '</td>'; |
| 78 | 81 | print '<td>'; |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 12 | 12 | } |
| 13 | 13 | setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/'); |
| 14 | 14 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | function drawChart() { |
| 32 | 32 | var data = google.visualization.arrayToDataTable([ |
| 33 | 33 | ["'._("Aircraft Manufacturer").'", "'._("# of times").'"], '; |
| 34 | - $registration_data = ''; |
|
| 34 | + $registration_data = ''; |
|
| 35 | 35 | foreach($registration_array as $registration_item) |
| 36 | 36 | { |
| 37 | 37 | $registration_data .= '[ "'.$registration_item['registration'].' - '.$registration_item['aircraft_name'].' ('.$registration_item['aircraft_icao'].')",'.$registration_item['aircraft_registration_count'].'],'; |
@@ -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'); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | </div> |
| 24 | 24 | <p>'._("Below are the <strong>Top 10</strong> most common aircraft registrations.").'</p>'; |
| 25 | 25 | |
| 26 | -$registration_array = $Stats->countAllAircraftRegistrations(true,$airline_icao,$filter_name,$year,$month); |
|
| 26 | +$registration_array = $Stats->countAllAircraftRegistrations(true, $airline_icao, $filter_name, $year, $month); |
|
| 27 | 27 | print '<div id="chart" class="chart" width="100%"></div> |
| 28 | 28 | <script> |
| 29 | 29 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | var data = google.visualization.arrayToDataTable([ |
| 33 | 33 | ["'._("Aircraft Manufacturer").'", "'._("# of times").'"], '; |
| 34 | 34 | $registration_data = ''; |
| 35 | -foreach($registration_array as $registration_item) |
|
| 35 | +foreach ($registration_array as $registration_item) |
|
| 36 | 36 | { |
| 37 | 37 | $registration_data .= '[ "'.$registration_item['registration'].' - '.$registration_item['aircraft_name'].' ('.$registration_item['aircraft_icao'].')",'.$registration_item['aircraft_registration_count'].'],'; |
| 38 | 38 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | print '</thead>'; |
| 68 | 68 | print '<tbody>'; |
| 69 | 69 | $i = 1; |
| 70 | - foreach($registration_array as $registration_item) |
|
| 70 | + foreach ($registration_array as $registration_item) |
|
| 71 | 71 | { |
| 72 | 72 | print '<tr>'; |
| 73 | 73 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,11 +5,15 @@ |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft Registrations"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 12 | -} |
|
| 13 | + if (isset($globalFilter['airline'])) { |
|
| 14 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 15 | + } |
|
| 16 | + } |
|
| 13 | 17 | setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/'); |
| 14 | 18 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 15 | 19 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 12 | 12 | } |
| 13 | 13 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 14 | 14 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,12 +6,12 @@ discard block |
||
| 6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft"); |
| 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 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | </div> |
| 23 | 23 | <p>'._("Below are the <strong>Top 10</strong> most common aircraft types.").'</p>'; |
| 24 | 24 | |
| 25 | -$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
| 25 | +$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
| 26 | 26 | print '<div id="chart" class="chart" width="100%"></div> |
| 27 | 27 | <script> |
| 28 | 28 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | var data = google.visualization.arrayToDataTable([ |
| 32 | 32 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
| 33 | 33 | $aircraft_data = ''; |
| 34 | -foreach($aircraft_array as $aircraft_item) |
|
| 34 | +foreach ($aircraft_array as $aircraft_item) |
|
| 35 | 35 | { |
| 36 | 36 | $aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
| 37 | 37 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | print '</thead>'; |
| 65 | 65 | print '<tbody>'; |
| 66 | 66 | $i = 1; |
| 67 | - foreach($aircraft_array as $aircraft_item) |
|
| 67 | + foreach ($aircraft_array as $aircraft_item) |
|
| 68 | 68 | { |
| 69 | 69 | print '<tr>'; |
| 70 | 70 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,11 +5,15 @@ |
||
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft"); |
| 7 | 7 | |
| 8 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 8 | +if (!isset($filter_name)) { |
|
| 9 | + $filter_name = ''; |
|
| 10 | +} |
|
| 9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 12 | -} |
|
| 13 | + if (isset($globalFilter['airline'])) { |
|
| 14 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 15 | + } |
|
| 16 | + } |
|
| 13 | 17 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 14 | 18 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
| 15 | 19 | |