@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -$date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
|
| 2 | +$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING); |
|
| 3 | 3 | if ($date == '') $date = date('Y-m-d'); |
| 4 | 4 | header('Location: '.$globalURL.'/accident/'.$date); |
| 5 | 5 | ?> |
| 6 | 6 | \ No newline at end of file |
@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
| 3 | -if ($date == '') $date = date('Y-m-d'); |
|
| 3 | +if ($date == '') { |
|
| 4 | + $date = date('Y-m-d'); |
|
| 5 | +} |
|
| 4 | 6 | header('Location: '.$globalURL.'/accident/'.$date); |
| 5 | 7 | ?> |
| 6 | 8 | \ No newline at end of file |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -$date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
|
| 2 | +$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING); |
|
| 3 | 3 | if ($date == '') $date = date('Y-m-d'); |
| 4 | 4 | header('Location: '.$globalURL.'/date/'.$date); |
| 5 | 5 | ?> |
| 6 | 6 | \ No newline at end of file |
@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
| 3 | -if ($date == '') $date = date('Y-m-d'); |
|
| 3 | +if ($date == '') { |
|
| 4 | + $date = date('Y-m-d'); |
|
| 5 | +} |
|
| 4 | 6 | header('Location: '.$globalURL.'/date/'.$date); |
| 5 | 7 | ?> |
| 6 | 8 | \ No newline at end of file |
@@ -10,10 +10,10 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | $date = date('Y-m-d'); |
| 12 | 12 | } else { |
| 13 | - $date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
| 13 | + $date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if(!isset($_GET['limit'])) |
|
| 16 | +if (!isset($_GET['limit'])) |
|
| 17 | 17 | { |
| 18 | 18 | $limit_start = 0; |
| 19 | 19 | $limit_end = 25; |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | print '<br />'; |
| 49 | 49 | |
| 50 | 50 | print '<div class="info column">'; |
| 51 | -print '<h1>'.sprintf(_("Incidents from %s"),date("l F j, Y",strtotime($date))).'</h1>'; |
|
| 51 | +print '<h1>'.sprintf(_("Incidents from %s"), date("l F j, Y", strtotime($date))).'</h1>'; |
|
| 52 | 52 | print '</div>'; |
| 53 | 53 | |
| 54 | 54 | print '<div class="table column">'; |
| 55 | -print '<p>'.sprintf(_("The table below shows the Incidents on <strong>%s</strong>."),date("l M j, Y",strtotime($date))).'</p>'; |
|
| 56 | -$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference,'incident',$date); |
|
| 55 | +print '<p>'.sprintf(_("The table below shows the Incidents on <strong>%s</strong>."), date("l M j, Y", strtotime($date))).'</p>'; |
|
| 56 | +$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference, 'incident', $date); |
|
| 57 | 57 | //print_r($spotter_array); |
| 58 | 58 | if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) { |
| 59 | 59 | include('table-output.php'); |
@@ -38,8 +38,12 @@ |
||
| 38 | 38 | if (!empty($spotter_array) && $spotter_array[0]['query_number_rows'] != 0) { |
| 39 | 39 | include('table-output.php'); |
| 40 | 40 | print '<div class="pagination">'; |
| 41 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
| 42 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
| 41 | + if ($limit_previous_1 >= 0) { |
|
| 42 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
| 43 | + } |
|
| 44 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
| 45 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
| 46 | + } |
|
| 43 | 47 | print '</div>'; |
| 44 | 48 | } |
| 45 | 49 | print '</div>'; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | print '<th class="more"></th>'; |
| 94 | 94 | print '</thead>'; |
| 95 | -} else if (strtolower($current_page) == "upcoming"){ |
|
| 95 | +} else if (strtolower($current_page) == "upcoming") { |
|
| 96 | 96 | print '<thead>'; |
| 97 | 97 | if ($_GET['sort'] == "airline_name_asc") |
| 98 | 98 | { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | */ |
| 144 | 144 | print '</thead>'; |
| 145 | -} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){ |
|
| 145 | +} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
|
| 146 | 146 | print '<thead>'; |
| 147 | 147 | print '<th class="aircraft_thumbnail"></th>'; |
| 148 | 148 | print '<th class="logo">'._("Airline").'</th>'; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | print '</thead>'; |
| 180 | 180 | } else { |
| 181 | 181 | |
| 182 | - if ($hide_th_links === true){ |
|
| 182 | + if ($hide_th_links === true) { |
|
| 183 | 183 | print '<thead>'; |
| 184 | 184 | print '<th class="aircraft_thumbnail"></th>'; |
| 185 | 185 | if ($_GET['sort'] == "airline_name_asc") |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | print '<tbody>'."\n"; |
| 363 | -foreach($spotter_array as $spotter_item) |
|
| 363 | +foreach ($spotter_array as $spotter_item) |
|
| 364 | 364 | { |
| 365 | 365 | if (isset($globalTimezone)) |
| 366 | 366 | { |
@@ -391,13 +391,13 @@ discard block |
||
| 391 | 391 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
| 392 | 392 | } |
| 393 | 393 | if (isset($spotter_item['airline_name'])) { |
| 394 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 394 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 395 | 395 | } else { |
| 396 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 396 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 397 | 397 | } |
| 398 | 398 | } else { |
| 399 | 399 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 400 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 400 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 401 | 401 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 402 | 402 | if (isset($spotter_item['airline_name'])) { |
| 403 | 403 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | print '<img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" />'."\n"; |
| 412 | 412 | print '</td>'."\n"; |
| 413 | 413 | } |
| 414 | - } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
|
| 414 | + } elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") { |
|
| 415 | 415 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
| 416 | 416 | $spotter_item['squawk'] = '-'; |
| 417 | 417 | } |
@@ -427,17 +427,17 @@ discard block |
||
| 427 | 427 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
| 428 | 428 | } |
| 429 | 429 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 430 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 430 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 431 | 431 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
| 432 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 432 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 433 | 433 | } elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) { |
| 434 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 434 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 435 | 435 | } else { |
| 436 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 436 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 437 | 437 | } |
| 438 | 438 | } else { |
| 439 | 439 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 440 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 440 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 441 | 441 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 442 | 442 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 443 | 443 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | } |
| 501 | 501 | print '</td>'."\n"; |
| 502 | 502 | // Aircraft type |
| 503 | - if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){ |
|
| 503 | + if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") { |
|
| 504 | 504 | print '<td class="type">'."\n"; |
| 505 | 505 | if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) { |
| 506 | 506 | print '<span class="nomobile">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</span>'."\n"; |
@@ -524,22 +524,22 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
| 526 | 526 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 527 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
| 528 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 527 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
| 528 | + } else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
| 529 | 529 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 530 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
| 530 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
| 531 | 531 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
| 532 | 532 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
| 533 | 533 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
| 534 | 534 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 535 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
| 535 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
| 536 | 536 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
| 537 | 537 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
| 538 | 538 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
| 539 | 539 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 540 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
| 540 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
| 541 | 541 | } else { |
| 542 | - $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 542 | + $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
| 543 | 543 | } |
| 544 | 544 | print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n"; |
| 545 | 545 | } |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | $latitude = $spotter_item['latitude']; |
| 555 | 555 | $longitude = $spotter_item['longitude']; |
| 556 | 556 | } |
| 557 | - $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
|
| 557 | + $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude); |
|
| 558 | 558 | } else $distance = ''; |
| 559 | 559 | if ($distance != '') { |
| 560 | 560 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -595,20 +595,20 @@ discard block |
||
| 595 | 595 | } |
| 596 | 596 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
| 597 | 597 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 598 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
| 598 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
| 599 | 599 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
| 600 | 600 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 601 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
| 601 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
| 602 | 602 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
| 603 | 603 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
| 604 | 604 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
| 605 | 605 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 606 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
| 606 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
| 607 | 607 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
| 608 | 608 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
| 609 | 609 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
| 610 | 610 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 611 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
| 611 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
| 612 | 612 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
| 613 | 613 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
| 614 | 614 | } |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | $latitude = $spotter_item['latitude']; |
| 622 | 622 | $longitude = $spotter_item['longitude']; |
| 623 | 623 | } |
| 624 | - $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
|
| 624 | + $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude); |
|
| 625 | 625 | } else $distance = ''; |
| 626 | 626 | if ($distance != '') { |
| 627 | 627 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | } |
| 636 | 636 | print '</td>'."\n"; |
| 637 | 637 | // Route stop |
| 638 | - if(strtolower($current_page) != "upcoming"){ |
|
| 638 | + if (strtolower($current_page) != "upcoming") { |
|
| 639 | 639 | print '<td class="route_stop">'."\n"; |
| 640 | 640 | if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') { |
| 641 | 641 | print '<span class="nomobile">-</span>'."\n"; |
@@ -659,21 +659,21 @@ discard block |
||
| 659 | 659 | } else { |
| 660 | 660 | //if (!isset($globalUnitDistance) || $globalUnitDistance == 'km') { |
| 661 | 661 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
| 662 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
| 663 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
| 662 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
| 663 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
| 664 | 664 | //} elseif ($globalUnitDistance == 'mi') { |
| 665 | 665 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
| 666 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
| 667 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
| 666 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
| 667 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
| 668 | 668 | //} elseif ($globalUnitDistance == 'nm') { |
| 669 | 669 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 670 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
| 671 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
| 670 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
| 671 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | print '</td>'."\n"; |
| 675 | 675 | } |
| 676 | - if(strtolower($current_page) != "upcoming"){ |
|
| 676 | + if (strtolower($current_page) != "upcoming") { |
|
| 677 | 677 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
| 678 | 678 | print '<td class="pilot">'."\n"; |
| 679 | 679 | if ((!isset($spotter_item['pilot_id']) || $spotter_item['pilot_id'] == '') && (!isset($spotter_item['pilot_name']) || $spotter_item['pilot_name'] == '')) { |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
| 709 | 709 | if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') { |
| 710 | 710 | print '<td class="message"><p>'."\n"; |
| 711 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 711 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 712 | 712 | print '</p><p class="decode">'; |
| 713 | 713 | $decode_array = json_decode($spotter_item['decode']); |
| 714 | 714 | foreach ($decode_array as $key => $value) { |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | print '</td>'."\n"; |
| 719 | 719 | } else { |
| 720 | 720 | print '<td class="message">'."\n"; |
| 721 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 721 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 722 | 722 | print '</td>'."\n"; |
| 723 | 723 | } |
| 724 | 724 | } |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | } |
| 744 | 744 | print '</td>'."\n"; |
| 745 | 745 | print '<td class="message">'."\n"; |
| 746 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 746 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 747 | 747 | print '</td>'."\n"; |
| 748 | 748 | } |
| 749 | 749 | if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") { |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | print '</td>'."\n"; |
| 770 | 770 | */ |
| 771 | 771 | print '<td class="message">'."\n"; |
| 772 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 772 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 773 | 773 | print '</td>'."\n"; |
| 774 | 774 | } |
| 775 | 775 | // Date |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -$date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
|
| 2 | +$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING); |
|
| 3 | 3 | if ($date == '') $date = date('Y-m-d'); |
| 4 | 4 | header('Location: '.$globalURL.'/incident/'.$date); |
| 5 | 5 | ?> |
| 6 | 6 | \ No newline at end of file |
@@ -1,5 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
| 3 | -if ($date == '') $date = date('Y-m-d'); |
|
| 3 | +if ($date == '') { |
|
| 4 | + $date = date('Y-m-d'); |
|
| 5 | +} |
|
| 4 | 6 | header('Location: '.$globalURL.'/incident/'.$date); |
| 5 | 7 | ?> |
| 6 | 8 | \ No newline at end of file |
@@ -26,20 +26,20 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return Array Return Accidents data in array |
| 28 | 28 | */ |
| 29 | - public function getAccidentData($limit = '',$type = '',$date = '') { |
|
| 29 | + public function getAccidentData($limit = '', $type = '', $date = '') { |
|
| 30 | 30 | global $globalURL, $globalDBdriver; |
| 31 | 31 | $Image = new Image($this->db); |
| 32 | 32 | $Spotter = new Spotter($this->db); |
| 33 | 33 | $Translation = new Translation($this->db); |
| 34 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 34 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 35 | 35 | date_default_timezone_set('UTC'); |
| 36 | 36 | $result = array(); |
| 37 | 37 | $limit_query = ''; |
| 38 | 38 | if ($limit != "") |
| 39 | 39 | { |
| 40 | 40 | $limit_array = explode(",", $limit); |
| 41 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 42 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 41 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 42 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 43 | 43 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 44 | 44 | { |
| 45 | 45 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -48,20 +48,20 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | if ($type != '') { |
| 50 | 50 | if ($date != '') { |
| 51 | - if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) { |
|
| 51 | + if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) { |
|
| 52 | 52 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY date DESC".$limit_query; |
| 53 | 53 | } else { |
| 54 | 54 | $date = $date.'%'; |
| 55 | 55 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY date DESC".$limit_query; |
| 56 | 56 | } |
| 57 | - $query_values = array(':type' => $type,':date' => $date); |
|
| 57 | + $query_values = array(':type' => $type, ':date' => $date); |
|
| 58 | 58 | } else { |
| 59 | 59 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type GROUP BY registration) ORDER BY date DESC".$limit_query; |
| 60 | 60 | $query_values = array(':type' => $type); |
| 61 | 61 | } |
| 62 | 62 | } else { |
| 63 | 63 | if ($date != '') { |
| 64 | - if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) { |
|
| 64 | + if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) { |
|
| 65 | 65 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY date DESC".$limit_query; |
| 66 | 66 | } else { |
| 67 | 67 | $date = $date.'%'; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | try { |
| 78 | 78 | $sth = $this->db->prepare($query); |
| 79 | 79 | $sth->execute($query_values); |
| 80 | - } catch(PDOException $e) { |
|
| 80 | + } catch (PDOException $e) { |
|
| 81 | 81 | return "error : ".$e->getMessage(); |
| 82 | 82 | } |
| 83 | 83 | $i = 0; |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | $data = array(); |
| 86 | 86 | if ($row['registration'] != '') { |
| 87 | 87 | $image_array = $Image->getSpotterImage($row['registration']); |
| 88 | - if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
| 89 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 88 | + if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website'])); |
|
| 89 | + else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
| 90 | 90 | $aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']); |
| 91 | 91 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type); |
| 92 | 92 | if (!empty($aircraft_info)) { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $data['aircraft_name'] = $aircraft_info[0]['type']; |
| 95 | 95 | $data['aircraft_manufacturer'] = $aircraft_info[0]['manufacturer']; |
| 96 | 96 | } else { |
| 97 | - $data = array_merge($data,array('aircraft_type' => 'NA')); |
|
| 97 | + $data = array_merge($data, array('aircraft_type' => 'NA')); |
|
| 98 | 98 | } |
| 99 | 99 | $owner_data = $Spotter->getAircraftOwnerByRegistration($row['registration']); |
| 100 | 100 | if (!empty($owner_data)) { |
@@ -102,20 +102,20 @@ discard block |
||
| 102 | 102 | $data['aircraft_base'] = $owner_data['base']; |
| 103 | 103 | $data['aircraft_date_first_reg'] = $owner_data['date_first_reg']; |
| 104 | 104 | } |
| 105 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 105 | + } else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
| 106 | 106 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
| 107 | 107 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
| 108 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
|
| 108 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2)); |
|
| 109 | 109 | if (isset($identicao[0])) { |
| 110 | - if (substr($row['ident'],0,2) == 'AF') { |
|
| 111 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
| 112 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
| 113 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
| 114 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
| 110 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
| 111 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
| 112 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
| 113 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
| 114 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
| 115 | 115 | } else $icao = $row['ident']; |
| 116 | - $icao = $Translation->checkTranslation($icao,false); |
|
| 116 | + $icao = $Translation->checkTranslation($icao, false); |
|
| 117 | 117 | //$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url'])); |
| 118 | - $data = array_merge($row,$data); |
|
| 118 | + $data = array_merge($row, $data); |
|
| 119 | 119 | if ($data['ident'] == null) $data['ident'] = $icao; |
| 120 | 120 | if ($data['title'] == null) { |
| 121 | 121 | $data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country']; |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | if ($globalDebug) echo 'Import '.$file."\n"; |
| 141 | 141 | $result = array(); |
| 142 | 142 | if (file_exists($file)) { |
| 143 | - if (($handle = fopen($file,'r')) !== FALSE) { |
|
| 144 | - while (($data = fgetcsv($handle,2000,",")) !== FALSE) { |
|
| 143 | + if (($handle = fopen($file, 'r')) !== FALSE) { |
|
| 144 | + while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) { |
|
| 145 | 145 | if (isset($data[1]) && $data[1] != '0000-00-00 00:00:00') { |
| 146 | - $result[] = array('registration' => $data[0],'date' => strtotime($data[1]),'url' => $data[2],'country' => $data[3],'place' => $data[4],'title' => $data[5],'fatalities' => $data[6],'latitude' => $data[7],'longitude' => $data[8],'type' => $data[9],'ident' => $data[10],'aircraft_manufacturer' => $data[11],'aircraft_name' => $data[12],'source' => 'website_fam'); |
|
| 146 | + $result[] = array('registration' => $data[0], 'date' => strtotime($data[1]), 'url' => $data[2], 'country' => $data[3], 'place' => $data[4], 'title' => $data[5], 'fatalities' => $data[6], 'latitude' => $data[7], 'longitude' => $data[8], 'type' => $data[9], 'ident' => $data[10], 'aircraft_manufacturer' => $data[11], 'aircraft_name' => $data[12], 'source' => 'website_fam'); |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | fclose($handle); |
| 150 | 150 | } |
| 151 | - if (!empty($result)) $this->add($result,true); |
|
| 151 | + if (!empty($result)) $this->add($result, true); |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | $all_md5_new = array(); |
| 160 | 160 | if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) { |
| 161 | 161 | if ($this->check_accidents_nb() > 0) { |
| 162 | - if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) { |
|
| 163 | - while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) { |
|
| 162 | + if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) { |
|
| 163 | + while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) { |
|
| 164 | 164 | if (isset($data[1])) { |
| 165 | 165 | $year = $data[0]; |
| 166 | 166 | $all_md5[$year] = $data[1]; |
@@ -170,10 +170,10 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | - $Common->download('https://data.flightairmap.fr/data/cr/cr-all.md5',dirname(__FILE__).'/../install/tmp/cr-all.md5'); |
|
| 173 | + $Common->download('https://data.flightairmap.fr/data/cr/cr-all.md5', dirname(__FILE__).'/../install/tmp/cr-all.md5'); |
|
| 174 | 174 | if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) { |
| 175 | - if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) { |
|
| 176 | - while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) { |
|
| 175 | + if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) { |
|
| 176 | + while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) { |
|
| 177 | 177 | if (isset($data[1])) { |
| 178 | 178 | $year = $data[0]; |
| 179 | 179 | $all_md5_new[$year] = $data[1]; |
@@ -184,15 +184,15 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | //print_r($all_md5_new); |
| 186 | 186 | //print_r($all_md5); |
| 187 | - $result = $Common->arr_diff($all_md5_new,$all_md5); |
|
| 187 | + $result = $Common->arr_diff($all_md5_new, $all_md5); |
|
| 188 | 188 | //print_r($result); |
| 189 | 189 | foreach ($result as $file => $md5) { |
| 190 | - $Common->download('https://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file); |
|
| 190 | + $Common->download('https://data.flightairmap.fr/data/cr/'.$file, dirname(__FILE__).'/../install/tmp/'.$file); |
|
| 191 | 191 | if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - public function add($crash,$new = false) { |
|
| 195 | + public function add($crash, $new = false) { |
|
| 196 | 196 | global $globalTransaction, $globalDebug; |
| 197 | 197 | require_once('class.Connection.php'); |
| 198 | 198 | require_once('class.Image.php'); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $sthd->execute(array(':source' => $crash[0]['source'])); |
| 207 | 207 | } |
| 208 | 208 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 209 | - $initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null); |
|
| 209 | + $initial_array = array('ident' => null, 'type' => 'accident', 'url' => null, 'registration' => null, 'date' => null, 'place' => null, 'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '', 'source' => '', 'aircraft_manufacturer' => null, 'aircraft_name' => null); |
|
| 210 | 210 | $query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source'; |
| 211 | 211 | $sth_check = $Connection->db->prepare($query_check); |
| 212 | 212 | $query = 'INSERT INTO accidents (aircraft_manufacturer,aircraft_name,ident,registration,date,url,country,place,title,fatalities,latitude,longitude,type,source) VALUES (:aircraft_manufacturer,:aircraft_name,:ident,:registration,:date,:url,:country,:place,:title,:fatalities,:latitude,:longitude,:type,:source)'; |
@@ -219,14 +219,14 @@ discard block |
||
| 219 | 219 | $cr = array_map(function($value) { |
| 220 | 220 | return $value === "" ? NULL : $value; |
| 221 | 221 | }, $cr); |
| 222 | - if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) { |
|
| 223 | - $query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']); |
|
| 222 | + if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && $cr['date'] < time() && !preg_match('/\s/', $cr['registration'])) { |
|
| 223 | + $query_check_values = array(':registration' => $cr['registration'], ':date' => date('Y-m-d', $cr['date']), ':type' => $cr['type'], ':source' => $cr['source']); |
|
| 224 | 224 | $sth_check->execute($query_check_values); |
| 225 | 225 | $result_check = $sth_check->fetch(PDO::FETCH_ASSOC); |
| 226 | 226 | if ($result_check['nb'] == 0) { |
| 227 | - $query_values = array(':registration' => trim($cr['registration']),':date' => date('Y-m-d',$cr['date']),':url' => $cr['url'],':country' => $cr['country'],':place' => $cr['place'],':title' => $cr['title'],':fatalities' => $cr['fatalities'],':latitude' => $cr['latitude'],':longitude' => $cr['longitude'],':type' => $cr['type'],':source' => $cr['source'],':ident' => $cr['ident'],':aircraft_manufacturer' => $cr['aircraft_manufacturer'],':aircraft_name' => $cr['aircraft_name']); |
|
| 227 | + $query_values = array(':registration' => trim($cr['registration']), ':date' => date('Y-m-d', $cr['date']), ':url' => $cr['url'], ':country' => $cr['country'], ':place' => $cr['place'], ':title' => $cr['title'], ':fatalities' => $cr['fatalities'], ':latitude' => $cr['latitude'], ':longitude' => $cr['longitude'], ':type' => $cr['type'], ':source' => $cr['source'], ':ident' => $cr['ident'], ':aircraft_manufacturer' => $cr['aircraft_manufacturer'], ':aircraft_name' => $cr['aircraft_name']); |
|
| 228 | 228 | $sth->execute($query_values); |
| 229 | - if ($cr['date'] > time()-(30*86400)) { |
|
| 229 | + if ($cr['date'] > time() - (30*86400)) { |
|
| 230 | 230 | if (empty($Image->getSpotterImage($cr['registration']))) { |
| 231 | 231 | //if ($globalDebug) echo 'Get image...'."\n"; |
| 232 | 232 | $Image->addSpotterImage($cr['registration']); |
@@ -235,13 +235,13 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | - if ($globalTransaction && $j % 90 == 0) { |
|
| 238 | + if ($globalTransaction && $j%90 == 0) { |
|
| 239 | 239 | $Connection->db->commit(); |
| 240 | 240 | $Connection->db->beginTransaction(); |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | if ($globalTransaction) $Connection->db->commit(); |
| 244 | - } catch(PDOException $e) { |
|
| 244 | + } catch (PDOException $e) { |
|
| 245 | 245 | if ($globalTransaction) $Connection->db->rollBack(); |
| 246 | 246 | echo $e->getMessage(); |
| 247 | 247 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $Connection = new Connection(); |
| 256 | 256 | $sth = $Connection->db->prepare($query); |
| 257 | 257 | $sth->execute(); |
| 258 | - } catch(PDOException $e) { |
|
| 258 | + } catch (PDOException $e) { |
|
| 259 | 259 | return "error : ".$e->getMessage(); |
| 260 | 260 | } |
| 261 | 261 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $Connection = new Connection(); |
| 274 | 274 | $sth = $Connection->db->prepare($query); |
| 275 | 275 | $sth->execute(); |
| 276 | - } catch(PDOException $e) { |
|
| 276 | + } catch (PDOException $e) { |
|
| 277 | 277 | return "error : ".$e->getMessage(); |
| 278 | 278 | } |
| 279 | 279 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $Connection = new Connection(); |
| 289 | 289 | $sth = $Connection->db->prepare($query); |
| 290 | 290 | $sth->execute(); |
| 291 | - } catch(PDOException $e) { |
|
| 291 | + } catch (PDOException $e) { |
|
| 292 | 292 | return "error : ".$e->getMessage(); |
| 293 | 293 | } |
| 294 | 294 | } |
@@ -10,10 +10,10 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | $date = date('Y-m-d'); |
| 12 | 12 | } else { |
| 13 | - $date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
| 13 | + $date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if(!isset($_GET['limit'])) |
|
| 16 | +if (!isset($_GET['limit'])) |
|
| 17 | 17 | { |
| 18 | 18 | $limit_start = 0; |
| 19 | 19 | $limit_end = 25; |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | print '<br />'; |
| 49 | 49 | |
| 50 | 50 | print '<div class="info column">'; |
| 51 | -print '<h1>'.sprintf(_("Accidents from %s"),date("l F j, Y",strtotime($date))).'</h1>'; |
|
| 51 | +print '<h1>'.sprintf(_("Accidents from %s"), date("l F j, Y", strtotime($date))).'</h1>'; |
|
| 52 | 52 | print '</div>'; |
| 53 | 53 | |
| 54 | 54 | print '<div class="table column">'; |
| 55 | -print '<p>'.sprintf(_("The table below shows the Accidents on <strong>%s</strong>."),date("l M j, Y",strtotime($date))).'</p>'; |
|
| 56 | -$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference,'accident',$date); |
|
| 55 | +print '<p>'.sprintf(_("The table below shows the Accidents on <strong>%s</strong>."), date("l M j, Y", strtotime($date))).'</p>'; |
|
| 56 | +$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference, 'accident', $date); |
|
| 57 | 57 | //print_r($spotter_array); |
| 58 | 58 | if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) { |
| 59 | 59 | include('table-output.php'); |
@@ -38,8 +38,12 @@ |
||
| 38 | 38 | if (!empty($spotter_array) && $spotter_array[0]['query_number_rows'] != 0) { |
| 39 | 39 | include('table-output.php'); |
| 40 | 40 | print '<div class="pagination">'; |
| 41 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
| 42 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
| 41 | + if ($limit_previous_1 >= 0) { |
|
| 42 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
| 43 | + } |
|
| 44 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
| 45 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
| 46 | + } |
|
| 43 | 47 | print '</div>'; |
| 44 | 48 | } |
| 45 | 49 | print '</div>'; |