@@ -367,7 +367,9 @@ discard block |
||
| 367 | 367 | if (isset($globalTimezone)) |
| 368 | 368 | { |
| 369 | 369 | date_default_timezone_set($globalTimezone); |
| 370 | - } else date_default_timezone_set('UTC'); |
|
| 370 | + } else { |
|
| 371 | + date_default_timezone_set('UTC'); |
|
| 372 | + } |
|
| 371 | 373 | if ($showSpecial === true) |
| 372 | 374 | { |
| 373 | 375 | print '<tr class="special">'."\n"; |
@@ -386,8 +388,9 @@ discard block |
||
| 386 | 388 | print '<td class="aircraft_thumbnail">'."\n"; |
| 387 | 389 | |
| 388 | 390 | if ($spotter_item['image_source'] == 'planespotters') { |
| 389 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
| 390 | - else { |
|
| 391 | + if ($spotter_item['image_source_website'] != '') { |
|
| 392 | + $image_src = $spotter_item['image_source_website']; |
|
| 393 | + } else { |
|
| 391 | 394 | $planespotter_url_array = explode("_", $spotter_item['image']); |
| 392 | 395 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
| 393 | 396 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -400,7 +403,9 @@ discard block |
||
| 400 | 403 | } else { |
| 401 | 404 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 402 | 405 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 403 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 406 | + } else { |
|
| 407 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 408 | + } |
|
| 404 | 409 | if (isset($spotter_item['airline_name'])) { |
| 405 | 410 | 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>'; |
| 406 | 411 | } else { |
@@ -422,8 +427,9 @@ discard block |
||
| 422 | 427 | print '<td class="aircraft_thumbnail">'."\n"; |
| 423 | 428 | //print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
| 424 | 429 | if ($spotter_item['image_source'] == 'planespotters') { |
| 425 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
| 426 | - else { |
|
| 430 | + if ($spotter_item['image_source_website'] != '') { |
|
| 431 | + $image_src = $spotter_item['image_source_website']; |
|
| 432 | + } else { |
|
| 427 | 433 | $planespotter_url_array = explode("_", $spotter_array[0]['image']); |
| 428 | 434 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
| 429 | 435 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -440,7 +446,9 @@ discard block |
||
| 440 | 446 | } else { |
| 441 | 447 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 442 | 448 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 443 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 449 | + } else { |
|
| 450 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 451 | + } |
|
| 444 | 452 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 445 | 453 | 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>'; |
| 446 | 454 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
@@ -527,15 +535,21 @@ discard block |
||
| 527 | 535 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
| 528 | 536 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 529 | 537 | $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
| 530 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 538 | + } else { |
|
| 539 | + $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 540 | + } |
|
| 531 | 541 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 532 | 542 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
| 533 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 543 | + } else { |
|
| 544 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 545 | + } |
|
| 534 | 546 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
| 535 | 547 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
| 536 | 548 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 537 | 549 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
| 538 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 550 | + } else { |
|
| 551 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 552 | + } |
|
| 539 | 553 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
| 540 | 554 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
| 541 | 555 | if ($spotter_item['departure_airport_time'] > 2460) { |
@@ -557,7 +571,9 @@ discard block |
||
| 557 | 571 | $longitude = $spotter_item['longitude']; |
| 558 | 572 | } |
| 559 | 573 | $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
| 560 | - } else $distance = ''; |
|
| 574 | + } else { |
|
| 575 | + $distance = ''; |
|
| 576 | + } |
|
| 561 | 577 | if ($distance != '') { |
| 562 | 578 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 563 | 579 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -582,7 +598,9 @@ discard block |
||
| 582 | 598 | } else { |
| 583 | 599 | if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) { |
| 584 | 600 | print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n"; |
| 585 | - if (!isset($Spotter)) $Spotter = new Spotter(); |
|
| 601 | + if (!isset($Spotter)) { |
|
| 602 | + $Spotter = new Spotter(); |
|
| 603 | + } |
|
| 586 | 604 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']); |
| 587 | 605 | print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n"; |
| 588 | 606 | print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n"; |
@@ -598,20 +616,28 @@ discard block |
||
| 598 | 616 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
| 599 | 617 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 600 | 618 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
| 601 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 619 | + } else { |
|
| 620 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 621 | + } |
|
| 602 | 622 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 603 | 623 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
| 604 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 624 | + } else { |
|
| 625 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 626 | + } |
|
| 605 | 627 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
| 606 | 628 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
| 607 | 629 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 608 | 630 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
| 609 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 631 | + } else { |
|
| 632 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 633 | + } |
|
| 610 | 634 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
| 611 | 635 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
| 612 | 636 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 613 | 637 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
| 614 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 638 | + } else { |
|
| 639 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 640 | + } |
|
| 615 | 641 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
| 616 | 642 | } |
| 617 | 643 | if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
@@ -624,7 +650,9 @@ discard block |
||
| 624 | 650 | $longitude = $spotter_item['longitude']; |
| 625 | 651 | } |
| 626 | 652 | $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
| 627 | - } else $distance = ''; |
|
| 653 | + } else { |
|
| 654 | + $distance = ''; |
|
| 655 | + } |
|
| 628 | 656 | if ($distance != '') { |
| 629 | 657 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 630 | 658 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -96,8 +96,11 @@ discard block |
||
| 96 | 96 | $data = array(); |
| 97 | 97 | if ($row['registration'] != '') { |
| 98 | 98 | $image_array = $Image->getSpotterImage($row['registration']); |
| 99 | - 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'])); |
|
| 100 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 99 | + if (count($image_array) > 0) { |
|
| 100 | + $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'])); |
|
| 101 | + } else { |
|
| 102 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 103 | + } |
|
| 101 | 104 | $aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']); |
| 102 | 105 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type); |
| 103 | 106 | if (!empty($aircraft_info)) { |
@@ -113,17 +116,30 @@ discard block |
||
| 113 | 116 | $data['aircraft_base'] = $owner_data['base']; |
| 114 | 117 | $data['aircraft_date_first_reg'] = $owner_data['date_first_reg']; |
| 115 | 118 | } |
| 116 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 117 | - if ($row['registration'] == '') $row['registration'] = 'NA'; |
|
| 118 | - if ($row['ident'] == '') $row['ident'] = 'NA'; |
|
| 119 | + } else { |
|
| 120 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 121 | + } |
|
| 122 | + if ($row['registration'] == '') { |
|
| 123 | + $row['registration'] = 'NA'; |
|
| 124 | + } |
|
| 125 | + if ($row['ident'] == '') { |
|
| 126 | + $row['ident'] = 'NA'; |
|
| 127 | + } |
|
| 119 | 128 | $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3)); |
| 120 | 129 | if (isset($identicao[0])) { |
| 121 | 130 | if (substr($row['ident'],0,2) == 'AF') { |
| 122 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
| 123 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
| 124 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
| 131 | + if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
| 132 | + $icao = $row['ident']; |
|
| 133 | + } else { |
|
| 134 | + $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
| 135 | + } |
|
| 136 | + } else { |
|
| 137 | + $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
| 138 | + } |
|
| 125 | 139 | $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
| 126 | - } else $icao = $row['ident']; |
|
| 140 | + } else { |
|
| 141 | + $icao = $row['ident']; |
|
| 142 | + } |
|
| 127 | 143 | $icao = $Translation->checkTranslation($icao,false); |
| 128 | 144 | //$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url'])); |
| 129 | 145 | if ($row['airline_name'] != '' && !isset($data['airline_name'])) { |
@@ -138,10 +154,14 @@ discard block |
||
| 138 | 154 | //else echo 'No data...'."\n"; |
| 139 | 155 | } |
| 140 | 156 | $data = array_merge($row,$data); |
| 141 | - if ($data['ident'] == null) $data['ident'] = $icao; |
|
| 157 | + if ($data['ident'] == null) { |
|
| 158 | + $data['ident'] = $icao; |
|
| 159 | + } |
|
| 142 | 160 | if ($data['title'] == null) { |
| 143 | 161 | $data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country']; |
| 144 | - } else $data['message'] = strtolower($data['title']); |
|
| 162 | + } else { |
|
| 163 | + $data['message'] = strtolower($data['title']); |
|
| 164 | + } |
|
| 145 | 165 | $ids = $Spotter->getAllIDByRegistration($data['registration']); |
| 146 | 166 | $date = $data['date']; |
| 147 | 167 | if (isset($ids[$date])) { |
@@ -158,8 +178,9 @@ discard block |
||
| 158 | 178 | if (isset($result)) { |
| 159 | 179 | $result[0]['query_number_rows'] = $i; |
| 160 | 180 | return $result; |
| 181 | + } else { |
|
| 182 | + return array(); |
|
| 161 | 183 | } |
| 162 | - else return array(); |
|
| 163 | 184 | } |
| 164 | 185 | |
| 165 | 186 | /* |
@@ -198,7 +219,9 @@ discard block |
||
| 198 | 219 | */ |
| 199 | 220 | public function import($file) { |
| 200 | 221 | global $globalTransaction, $globalDebug; |
| 201 | - if ($globalDebug) echo 'Import '.$file."\n"; |
|
| 222 | + if ($globalDebug) { |
|
| 223 | + echo 'Import '.$file."\n"; |
|
| 224 | + } |
|
| 202 | 225 | $result = array(); |
| 203 | 226 | if (file_exists($file)) { |
| 204 | 227 | if (($handle = fopen($file,'r')) !== FALSE) { |
@@ -209,8 +232,11 @@ discard block |
||
| 209 | 232 | } |
| 210 | 233 | fclose($handle); |
| 211 | 234 | } |
| 212 | - if (!empty($result)) $this->add($result,true); |
|
| 213 | - elseif ($globalDebug) echo 'Nothing to import'; |
|
| 235 | + if (!empty($result)) { |
|
| 236 | + $this->add($result,true); |
|
| 237 | + } elseif ($globalDebug) { |
|
| 238 | + echo 'Nothing to import'; |
|
| 239 | + } |
|
| 214 | 240 | } |
| 215 | 241 | } |
| 216 | 242 | |
@@ -246,14 +272,23 @@ discard block |
||
| 246 | 272 | } |
| 247 | 273 | } |
| 248 | 274 | fclose($handle); |
| 249 | - } elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
|
| 250 | - } elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
|
| 275 | + } elseif ($globalDebug) { |
|
| 276 | + echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
|
| 277 | + } |
|
| 278 | + } elseif ($globalDebug) { |
|
| 279 | + echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
|
| 280 | + } |
|
| 251 | 281 | $result = $Common->arr_diff($all_md5_new,$all_md5); |
| 252 | - if (empty($result) && $globalDebug) echo 'Nothing to update'; |
|
| 282 | + if (empty($result) && $globalDebug) { |
|
| 283 | + echo 'Nothing to update'; |
|
| 284 | + } |
|
| 253 | 285 | foreach ($result as $file => $md5) { |
| 254 | 286 | $Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file); |
| 255 | - if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
|
| 256 | - elseif ($globalDebug) echo 'Download '.$file.' failed'; |
|
| 287 | + if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) { |
|
| 288 | + $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
|
| 289 | + } elseif ($globalDebug) { |
|
| 290 | + echo 'Download '.$file.' failed'; |
|
| 291 | + } |
|
| 257 | 292 | } |
| 258 | 293 | } |
| 259 | 294 | |
@@ -270,13 +305,17 @@ discard block |
||
| 270 | 305 | $Image = new Image(); |
| 271 | 306 | $Spotter = new Spotter(); |
| 272 | 307 | |
| 273 | - if (empty($crash)) return false; |
|
| 308 | + if (empty($crash)) { |
|
| 309 | + return false; |
|
| 310 | + } |
|
| 274 | 311 | if (!$new) { |
| 275 | 312 | $query_delete = 'DELETE FROM accidents WHERE source = :source'; |
| 276 | 313 | $sthd = $Connection->db->prepare($query_delete); |
| 277 | 314 | $sthd->execute(array(':source' => $crash[0]['source'])); |
| 278 | 315 | } |
| 279 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 316 | + if ($globalTransaction) { |
|
| 317 | + $Connection->db->beginTransaction(); |
|
| 318 | + } |
|
| 280 | 319 | $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,'operator' => null); |
| 281 | 320 | $query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source'; |
| 282 | 321 | $sth_check = $Connection->db->prepare($query_check); |
@@ -291,7 +330,9 @@ discard block |
||
| 291 | 330 | return $value === "" ? NULL : $value; |
| 292 | 331 | }, $cr); |
| 293 | 332 | if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) { |
| 294 | - if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
| 333 | + if (strpos($cr['registration'],'-') === FALSE) { |
|
| 334 | + $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
| 335 | + } |
|
| 295 | 336 | $query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']); |
| 296 | 337 | $sth_check->execute($query_check_values); |
| 297 | 338 | $result_check = $sth_check->fetch(PDO::FETCH_ASSOC); |
@@ -313,9 +354,13 @@ discard block |
||
| 313 | 354 | $Connection->db->beginTransaction(); |
| 314 | 355 | } |
| 315 | 356 | } |
| 316 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 357 | + if ($globalTransaction) { |
|
| 358 | + $Connection->db->commit(); |
|
| 359 | + } |
|
| 317 | 360 | } catch(PDOException $e) { |
| 318 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 361 | + if ($globalTransaction) { |
|
| 362 | + $Connection->db->rollBack(); |
|
| 363 | + } |
|
| 319 | 364 | echo $e->getMessage(); |
| 320 | 365 | } |
| 321 | 366 | $sth_check->closeCursor(); |
@@ -354,8 +399,11 @@ discard block |
||
| 354 | 399 | return "error : ".$e->getMessage(); |
| 355 | 400 | } |
| 356 | 401 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 357 | - if ($row['nb'] > 0) return false; |
|
| 358 | - else return true; |
|
| 402 | + if ($row['nb'] > 0) { |
|
| 403 | + return false; |
|
| 404 | + } else { |
|
| 405 | + return true; |
|
| 406 | + } |
|
| 359 | 407 | } |
| 360 | 408 | |
| 361 | 409 | public static function insert_last_accidents_update() { |
@@ -58,8 +58,12 @@ |
||
| 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'); |
| 60 | 60 | print '<div class="pagination">'; |
| 61 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
| 62 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
| 61 | + if ($limit_previous_1 >= 0) { |
|
| 62 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
| 63 | + } |
|
| 64 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
| 65 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
| 66 | + } |
|
| 63 | 67 | print '</div>'; |
| 64 | 68 | } |
| 65 | 69 | print '</div>'; |