Code Duplication    Length = 11-11 lines in 13 locations

require/class.Spotter.php 13 locations

@@ 416-426 (lines=11) @@
413
			}
414
		}
415
416
		if ($registration != "")
417
		{
418
			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
419
			if (!is_string($registration))
420
			{
421
				return false;
422
			} else {
423
				$additional_query .= " AND spotter_output.registration = :registration";
424
				$query_values = array_merge($query_values,array(':registration' => $registration));
425
			}
426
		}
427
428
		if ($aircraft_icao != "")
429
		{
@@ 428-438 (lines=11) @@
425
			}
426
		}
427
428
		if ($aircraft_icao != "")
429
		{
430
			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
431
			if (!is_string($aircraft_icao))
432
			{
433
				return false;
434
			} else {
435
				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
436
				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
437
			}
438
		}
439
440
		if ($aircraft_manufacturer != "")
441
		{
@@ 440-450 (lines=11) @@
437
			}
438
		}
439
440
		if ($aircraft_manufacturer != "")
441
		{
442
			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
443
			if (!is_string($aircraft_manufacturer))
444
			{
445
				return false;
446
			} else {
447
				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
448
				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
449
			}
450
		}
451
452
		if ($highlights == "true")
453
		{
@@ 462-472 (lines=11) @@
459
			}
460
		}
461
462
		if ($airline_icao != "")
463
		{
464
			$registration = filter_var($airline_icao,FILTER_SANITIZE_STRING);
465
			if (!is_string($airline_icao))
466
			{
467
				return false;
468
			} else {
469
				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
470
				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
471
			}
472
		}
473
474
		if ($airline_country != "")
475
		{
@@ 474-484 (lines=11) @@
471
			}
472
		}
473
474
		if ($airline_country != "")
475
		{
476
			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
477
			if (!is_string($airline_country))
478
			{
479
				return false;
480
			} else {
481
				$additional_query .= " AND spotter_output.airline_country = :airline_country";
482
				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
483
			}
484
		}
485
486
		if ($airline_type != "")
487
		{
@@ 507-517 (lines=11) @@
504
			}
505
		}
506
507
		if ($airport != "")
508
		{
509
			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
510
			if (!is_string($airport))
511
			{
512
				return false;
513
			} else {
514
				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
515
				$query_values = array_merge($query_values,array(':airport' => $airport));
516
			}
517
		}
518
519
		if ($airport_country != "")
520
		{
@@ 519-529 (lines=11) @@
516
			}
517
		}
518
519
		if ($airport_country != "")
520
		{
521
			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
522
			if (!is_string($airport_country))
523
			{
524
				return false;
525
			} else {
526
				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
527
				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
528
			}
529
		}
530
    
531
		if ($callsign != "")
532
		{
@@ 549-559 (lines=11) @@
546
			}
547
		}
548
549
		if ($owner != "")
550
		{
551
			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
552
			if (!is_string($owner))
553
			{
554
				return false;
555
			} else {
556
				$additional_query .= " AND spotter_output.owner_name = :owner";
557
				$query_values = array_merge($query_values,array(':owner' => $owner));
558
			}
559
		}
560
561
		if ($pilot_name != "")
562
		{
@@ 561-571 (lines=11) @@
558
			}
559
		}
560
561
		if ($pilot_name != "")
562
		{
563
			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
564
			if (!is_string($pilot_name))
565
			{
566
				return false;
567
			} else {
568
				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
569
				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
570
			}
571
		}
572
573
		if ($pilot_id != "")
574
		{
@@ 573-583 (lines=11) @@
570
			}
571
		}
572
573
		if ($pilot_id != "")
574
		{
575
			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
576
			if (!is_string($pilot_id))
577
			{
578
				return false;
579
			} else {
580
				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
581
				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
582
			}
583
		}
584
585
		if ($departure_airport_route != "")
586
		{
@@ 585-595 (lines=11) @@
582
			}
583
		}
584
585
		if ($departure_airport_route != "")
586
		{
587
			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
588
			if (!is_string($departure_airport_route))
589
			{
590
				return false;
591
			} else {
592
				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
593
				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
594
			}
595
		}
596
597
		if ($arrival_airport_route != "")
598
		{
@@ 597-607 (lines=11) @@
594
			}
595
		}
596
597
		if ($arrival_airport_route != "")
598
		{
599
			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
600
			if (!is_string($arrival_airport_route))
601
			{
602
				return false;
603
			} else {
604
				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
605
				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
606
			}
607
		}
608
609
		if ($altitude != "")
610
		{
@@ 1550-1560 (lines=11) @@
1547
			}
1548
		}
1549
		
1550
		if ($arrival_airport_icao != "")
1551
		{
1552
			if (!is_string($arrival_airport_icao))
1553
			{
1554
				return false;
1555
			} else {
1556
				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1557
				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1558
				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1559
			}
1560
		}
1561
		
1562
		if ($limit != "")
1563
		{