Completed
Push — master ( 5119c8...9eb73e )
by Yannick
19:43
created
install/class.update_schema.php 1 patch
Braces   +394 added lines, -146 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1332,20 +1390,28 @@  discard block
 block discarded – undo
1332 1390
 		}
1333 1391
 		if ($globalDBdriver == 'mysql') {
1334 1392
 			$error .= create_db::import_file('../db/airlines.sql');
1335
-			if ($error != '') return $error;
1393
+			if ($error != '') {
1394
+				return $error;
1395
+			}
1336 1396
 		} else {
1337 1397
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
1338
-			if ($error != '') return $error;
1398
+			if ($error != '') {
1399
+				return $error;
1400
+			}
1339 1401
 		}
1340 1402
 		if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) {
1341 1403
 			include_once(dirname(__FILE__).'/class.update_db.php');
1342 1404
 			if (isset($globalVATSIM) && $globalVATSIM) {
1343 1405
 				$error .= update_db::update_vatsim();
1344
-				if ($error != '') return $error;
1406
+				if ($error != '') {
1407
+					return $error;
1408
+				}
1345 1409
 			}
1346 1410
 			if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) {
1347 1411
 				$error .= update_db::update_IVAO();
1348
-				if ($error != '') return $error;
1412
+				if ($error != '') {
1413
+					return $error;
1414
+				}
1349 1415
 			}
1350 1416
 		}
1351 1417
 
@@ -1608,41 +1674,65 @@  discard block
 block discarded – undo
1608 1674
 		if ($globalDBdriver == 'mysql') {
1609 1675
 			if (!$Connection->tableExists('tracker_output')) {
1610 1676
 				$error .= create_db::import_file('../db/tracker_output.sql');
1611
-				if ($error != '') return $error;
1677
+				if ($error != '') {
1678
+					return $error;
1679
+				}
1612 1680
 			}
1613 1681
 			if (!$Connection->tableExists('tracker_live')) {
1614 1682
 				$error .= create_db::import_file('../db/tracker_live.sql');
1615
-				if ($error != '') return $error;
1683
+				if ($error != '') {
1684
+					return $error;
1685
+				}
1616 1686
 			}
1617 1687
 			if (!$Connection->tableExists('marine_output')) {
1618 1688
 				$error .= create_db::import_file('../db/marine_output.sql');
1619
-				if ($error != '') return $error;
1689
+				if ($error != '') {
1690
+					return $error;
1691
+				}
1620 1692
 			}
1621 1693
 			if (!$Connection->tableExists('marine_live')) {
1622 1694
 				$error .= create_db::import_file('../db/marine_live.sql');
1623
-				if ($error != '') return $error;
1695
+				if ($error != '') {
1696
+					return $error;
1697
+				}
1624 1698
 			}
1625 1699
 			if (!$Connection->tableExists('marine_identity')) {
1626 1700
 				$error .= create_db::import_file('../db/marine_identity.sql');
1627
-				if ($error != '') return $error;
1701
+				if ($error != '') {
1702
+					return $error;
1703
+				}
1628 1704
 			}
1629 1705
 			if (!$Connection->tableExists('marine_mid')) {
1630 1706
 				$error .= create_db::import_file('../db/marine_mid.sql');
1631
-				if ($error != '') return $error;
1707
+				if ($error != '') {
1708
+					return $error;
1709
+				}
1632 1710
 			}
1633 1711
 		} else {
1634 1712
 			$error .= create_db::import_file('../db/pgsql/tracker_output.sql');
1635
-			if ($error != '') return $error;
1713
+			if ($error != '') {
1714
+				return $error;
1715
+			}
1636 1716
 			$error .= create_db::import_file('../db/pgsql/tracker_live.sql');
1637
-			if ($error != '') return $error;
1717
+			if ($error != '') {
1718
+				return $error;
1719
+			}
1638 1720
 			$error .= create_db::import_file('../db/pgsql/marine_output.sql');
1639
-			if ($error != '') return $error;
1721
+			if ($error != '') {
1722
+				return $error;
1723
+			}
1640 1724
 			$error .= create_db::import_file('../db/pgsql/marine_live.sql');
1641
-			if ($error != '') return $error;
1725
+			if ($error != '') {
1726
+				return $error;
1727
+			}
1642 1728
 			$error .= create_db::import_file('../db/pgsql/marine_identity.sql');
1643
-			if ($error != '') return $error;
1729
+			if ($error != '') {
1730
+				return $error;
1731
+			}
1644 1732
 			$error .= create_db::import_file('../db/pgsql/marine_mid.sql');
1645
-			if ($error != '') return $error;
1733
+			if ($error != '') {
1734
+				return $error;
1735
+			}
1646 1736
 		}
1647 1737
 		$query = "UPDATE config SET value = '37' WHERE name = 'schema_version'";
1648 1738
 		try {
@@ -1661,39 +1751,61 @@  discard block
 block discarded – undo
1661 1751
 		if ($globalDBdriver == 'mysql') {
1662 1752
 			if (!$Connection->tableExists('marine_image')) {
1663 1753
 				$error .= create_db::import_file('../db/marine_image.sql');
1664
-				if ($error != '') return $error;
1754
+				if ($error != '') {
1755
+					return $error;
1756
+				}
1665 1757
 			}
1666 1758
 			if (!$Connection->tableExists('marine_archive')) {
1667 1759
 				$error .= create_db::import_file('../db/marine_archive.sql');
1668
-				if ($error != '') return $error;
1760
+				if ($error != '') {
1761
+					return $error;
1762
+				}
1669 1763
 			}
1670 1764
 			if (!$Connection->tableExists('marine_archive_output')) {
1671 1765
 				$error .= create_db::import_file('../db/marine_archive_output.sql');
1672
-				if ($error != '') return $error;
1766
+				if ($error != '') {
1767
+					return $error;
1768
+				}
1673 1769
 			}
1674 1770
 			if (!$Connection->tableExists('tracker_archive')) {
1675 1771
 				$error .= create_db::import_file('../db/tracker_archive.sql');
1676
-				if ($error != '') return $error;
1772
+				if ($error != '') {
1773
+					return $error;
1774
+				}
1677 1775
 			}
1678 1776
 			if (!$Connection->tableExists('tracker_archive_output')) {
1679 1777
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
1680
-				if ($error != '') return $error;
1778
+				if ($error != '') {
1779
+					return $error;
1780
+				}
1681 1781
 			}
1682 1782
 			if (!$Connection->tableExists('marine_archive_output')) {
1683 1783
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
1684
-				if ($error != '') return $error;
1784
+				if ($error != '') {
1785
+					return $error;
1786
+				}
1685 1787
 			}
1686 1788
 		} else {
1687 1789
 			$error .= create_db::import_file('../db/pgsql/marine_image.sql');
1688
-			if ($error != '') return $error;
1790
+			if ($error != '') {
1791
+				return $error;
1792
+			}
1689 1793
 			$error .= create_db::import_file('../db/pgsql/marine_archive.sql');
1690
-			if ($error != '') return $error;
1794
+			if ($error != '') {
1795
+				return $error;
1796
+			}
1691 1797
 			$error .= create_db::import_file('../db/pgsql/marine_archive_output.sql');
1692
-			if ($error != '') return $error;
1798
+			if ($error != '') {
1799
+				return $error;
1800
+			}
1693 1801
 			$error .= create_db::import_file('../db/pgsql/tracker_archive.sql');
1694
-			if ($error != '') return $error;
1802
+			if ($error != '') {
1803
+				return $error;
1804
+			}
1695 1805
 			$error .= create_db::import_file('../db/pgsql/tracker_archive_output.sql');
1696
-			if ($error != '') return $error;
1806
+			if ($error != '') {
1807
+				return $error;
1808
+			}
1697 1809
 		}
1698 1810
 		if ($globalDBdriver == 'mysql') {
1699 1811
 			$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
@@ -2064,7 +2176,9 @@  discard block
 block discarded – undo
2064 2176
 		if ($globalDBdriver == 'mysql') {
2065 2177
 			if (!$Connection->tableExists('tracker_archive_output')) {
2066 2178
 				$error .= create_db::import_file('../db/tracker_archive_output.sql');
2067
-				if ($error != '') return $error;
2179
+				if ($error != '') {
2180
+					return $error;
2181
+				}
2068 2182
 			}
2069 2183
 			$query = "ALTER TABLE tracker_live MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN last_altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_archive MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_archive_output MODIFY COLUMN last_altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN altitude float DEFAULT NULL;";
2070 2184
 		} else {
@@ -2095,8 +2209,11 @@  discard block
 block discarded – undo
2095 2209
     	    if ($Connection->tableExists('aircraft')) {
2096 2210
     		if (!$Connection->tableExists('config')) {
2097 2211
     		    $version = '1';
2098
-    		    if ($update) return self::update_from_1();
2099
-    		    else return $version;
2212
+    		    if ($update) {
2213
+    		    	return self::update_from_1();
2214
+    		    } else {
2215
+    		    	return $version;
2216
+    		    }
2100 2217
 		} else {
2101 2218
     		    $Connection = new Connection();
2102 2219
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -2110,178 +2227,309 @@  discard block
 block discarded – undo
2110 2227
     		    if ($update) {
2111 2228
     			if ($result['value'] == '2') {
2112 2229
     			    $error = self::update_from_2();
2113
-    			    if ($error != '') return $error;
2114
-    			    else return self::check_version(true);
2230
+    			    if ($error != '') {
2231
+    			    	return $error;
2232
+    			    } else {
2233
+    			    	return self::check_version(true);
2234
+    			    }
2115 2235
     			} elseif ($result['value'] == '3') {
2116 2236
     			    $error = self::update_from_3();
2117
-    			    if ($error != '') return $error;
2118
-    			    else return self::check_version(true);
2237
+    			    if ($error != '') {
2238
+    			    	return $error;
2239
+    			    } else {
2240
+    			    	return self::check_version(true);
2241
+    			    }
2119 2242
     			} elseif ($result['value'] == '4') {
2120 2243
     			    $error = self::update_from_4();
2121
-    			    if ($error != '') return $error;
2122
-    			    else return self::check_version(true);
2244
+    			    if ($error != '') {
2245
+    			    	return $error;
2246
+    			    } else {
2247
+    			    	return self::check_version(true);
2248
+    			    }
2123 2249
     			} elseif ($result['value'] == '5') {
2124 2250
     			    $error = self::update_from_5();
2125
-    			    if ($error != '') return $error;
2126
-    			    else return self::check_version(true);
2251
+    			    if ($error != '') {
2252
+    			    	return $error;
2253
+    			    } else {
2254
+    			    	return self::check_version(true);
2255
+    			    }
2127 2256
     			} elseif ($result['value'] == '6') {
2128 2257
     			    $error = self::update_from_6();
2129
-    			    if ($error != '') return $error;
2130
-    			    else return self::check_version(true);
2258
+    			    if ($error != '') {
2259
+    			    	return $error;
2260
+    			    } else {
2261
+    			    	return self::check_version(true);
2262
+    			    }
2131 2263
     			} elseif ($result['value'] == '7') {
2132 2264
     			    $error = self::update_from_7();
2133
-    			    if ($error != '') return $error;
2134
-    			    else return self::check_version(true);
2265
+    			    if ($error != '') {
2266
+    			    	return $error;
2267
+    			    } else {
2268
+    			    	return self::check_version(true);
2269
+    			    }
2135 2270
     			} elseif ($result['value'] == '8') {
2136 2271
     			    $error = self::update_from_8();
2137
-    			    if ($error != '') return $error;
2138
-    			    else return self::check_version(true);
2272
+    			    if ($error != '') {
2273
+    			    	return $error;
2274
+    			    } else {
2275
+    			    	return self::check_version(true);
2276
+    			    }
2139 2277
     			} elseif ($result['value'] == '9') {
2140 2278
     			    $error = self::update_from_9();
2141
-    			    if ($error != '') return $error;
2142
-    			    else return self::check_version(true);
2279
+    			    if ($error != '') {
2280
+    			    	return $error;
2281
+    			    } else {
2282
+    			    	return self::check_version(true);
2283
+    			    }
2143 2284
     			} elseif ($result['value'] == '10') {
2144 2285
     			    $error = self::update_from_10();
2145
-    			    if ($error != '') return $error;
2146
-    			    else return self::check_version(true);
2286
+    			    if ($error != '') {
2287
+    			    	return $error;
2288
+    			    } else {
2289
+    			    	return self::check_version(true);
2290
+    			    }
2147 2291
     			} elseif ($result['value'] == '11') {
2148 2292
     			    $error = self::update_from_11();
2149
-    			    if ($error != '') return $error;
2150
-    			    else return self::check_version(true);
2293
+    			    if ($error != '') {
2294
+    			    	return $error;
2295
+    			    } else {
2296
+    			    	return self::check_version(true);
2297
+    			    }
2151 2298
     			} elseif ($result['value'] == '12') {
2152 2299
     			    $error = self::update_from_12();
2153
-    			    if ($error != '') return $error;
2154
-    			    else return self::check_version(true);
2300
+    			    if ($error != '') {
2301
+    			    	return $error;
2302
+    			    } else {
2303
+    			    	return self::check_version(true);
2304
+    			    }
2155 2305
     			} elseif ($result['value'] == '13') {
2156 2306
     			    $error = self::update_from_13();
2157
-    			    if ($error != '') return $error;
2158
-    			    else return self::check_version(true);
2307
+    			    if ($error != '') {
2308
+    			    	return $error;
2309
+    			    } else {
2310
+    			    	return self::check_version(true);
2311
+    			    }
2159 2312
     			} elseif ($result['value'] == '14') {
2160 2313
     			    $error = self::update_from_14();
2161
-    			    if ($error != '') return $error;
2162
-    			    else return self::check_version(true);
2314
+    			    if ($error != '') {
2315
+    			    	return $error;
2316
+    			    } else {
2317
+    			    	return self::check_version(true);
2318
+    			    }
2163 2319
     			} elseif ($result['value'] == '15') {
2164 2320
     			    $error = self::update_from_15();
2165
-    			    if ($error != '') return $error;
2166
-    			    else return self::check_version(true);
2321
+    			    if ($error != '') {
2322
+    			    	return $error;
2323
+    			    } else {
2324
+    			    	return self::check_version(true);
2325
+    			    }
2167 2326
     			} elseif ($result['value'] == '16') {
2168 2327
     			    $error = self::update_from_16();
2169
-    			    if ($error != '') return $error;
2170
-    			    else return self::check_version(true);
2328
+    			    if ($error != '') {
2329
+    			    	return $error;
2330
+    			    } else {
2331
+    			    	return self::check_version(true);
2332
+    			    }
2171 2333
     			} elseif ($result['value'] == '17') {
2172 2334
     			    $error = self::update_from_17();
2173
-    			    if ($error != '') return $error;
2174
-    			    else return self::check_version(true);
2335
+    			    if ($error != '') {
2336
+    			    	return $error;
2337
+    			    } else {
2338
+    			    	return self::check_version(true);
2339
+    			    }
2175 2340
     			} elseif ($result['value'] == '18') {
2176 2341
     			    $error = self::update_from_18();
2177
-    			    if ($error != '') return $error;
2178
-    			    else return self::check_version(true);
2342
+    			    if ($error != '') {
2343
+    			    	return $error;
2344
+    			    } else {
2345
+    			    	return self::check_version(true);
2346
+    			    }
2179 2347
     			} elseif ($result['value'] == '19') {
2180 2348
     			    $error = self::update_from_19();
2181
-    			    if ($error != '') return $error;
2182
-    			    else return self::check_version(true);
2349
+    			    if ($error != '') {
2350
+    			    	return $error;
2351
+    			    } else {
2352
+    			    	return self::check_version(true);
2353
+    			    }
2183 2354
     			} elseif ($result['value'] == '20') {
2184 2355
     			    $error = self::update_from_20();
2185
-    			    if ($error != '') return $error;
2186
-    			    else return self::check_version(true);
2356
+    			    if ($error != '') {
2357
+    			    	return $error;
2358
+    			    } else {
2359
+    			    	return self::check_version(true);
2360
+    			    }
2187 2361
     			} elseif ($result['value'] == '21') {
2188 2362
     			    $error = self::update_from_21();
2189
-    			    if ($error != '') return $error;
2190
-    			    else return self::check_version(true);
2363
+    			    if ($error != '') {
2364
+    			    	return $error;
2365
+    			    } else {
2366
+    			    	return self::check_version(true);
2367
+    			    }
2191 2368
     			} elseif ($result['value'] == '22') {
2192 2369
     			    $error = self::update_from_22();
2193
-    			    if ($error != '') return $error;
2194
-    			    else return self::check_version(true);
2370
+    			    if ($error != '') {
2371
+    			    	return $error;
2372
+    			    } else {
2373
+    			    	return self::check_version(true);
2374
+    			    }
2195 2375
     			} elseif ($result['value'] == '23') {
2196 2376
     			    $error = self::update_from_23();
2197
-    			    if ($error != '') return $error;
2198
-    			    else return self::check_version(true);
2377
+    			    if ($error != '') {
2378
+    			    	return $error;
2379
+    			    } else {
2380
+    			    	return self::check_version(true);
2381
+    			    }
2199 2382
     			} elseif ($result['value'] == '24') {
2200 2383
     			    $error = self::update_from_24();
2201
-    			    if ($error != '') return $error;
2202
-    			    else return self::check_version(true);
2384
+    			    if ($error != '') {
2385
+    			    	return $error;
2386
+    			    } else {
2387
+    			    	return self::check_version(true);
2388
+    			    }
2203 2389
     			} elseif ($result['value'] == '25') {
2204 2390
     			    $error = self::update_from_25();
2205
-    			    if ($error != '') return $error;
2206
-    			    else return self::check_version(true);
2391
+    			    if ($error != '') {
2392
+    			    	return $error;
2393
+    			    } else {
2394
+    			    	return self::check_version(true);
2395
+    			    }
2207 2396
     			} elseif ($result['value'] == '26') {
2208 2397
     			    $error = self::update_from_26();
2209
-    			    if ($error != '') return $error;
2210
-    			    else return self::check_version(true);
2398
+    			    if ($error != '') {
2399
+    			    	return $error;
2400
+    			    } else {
2401
+    			    	return self::check_version(true);
2402
+    			    }
2211 2403
     			} elseif ($result['value'] == '27') {
2212 2404
     			    $error = self::update_from_27();
2213
-    			    if ($error != '') return $error;
2214
-    			    else return self::check_version(true);
2405
+    			    if ($error != '') {
2406
+    			    	return $error;
2407
+    			    } else {
2408
+    			    	return self::check_version(true);
2409
+    			    }
2215 2410
     			} elseif ($result['value'] == '28') {
2216 2411
     			    $error = self::update_from_28();
2217
-    			    if ($error != '') return $error;
2218
-    			    else return self::check_version(true);
2412
+    			    if ($error != '') {
2413
+    			    	return $error;
2414
+    			    } else {
2415
+    			    	return self::check_version(true);
2416
+    			    }
2219 2417
     			} elseif ($result['value'] == '29') {
2220 2418
     			    $error = self::update_from_29();
2221
-    			    if ($error != '') return $error;
2222
-    			    else return self::check_version(true);
2419
+    			    if ($error != '') {
2420
+    			    	return $error;
2421
+    			    } else {
2422
+    			    	return self::check_version(true);
2423
+    			    }
2223 2424
     			} elseif ($result['value'] == '30') {
2224 2425
     			    $error = self::update_from_30();
2225
-    			    if ($error != '') return $error;
2226
-    			    else return self::check_version(true);
2426
+    			    if ($error != '') {
2427
+    			    	return $error;
2428
+    			    } else {
2429
+    			    	return self::check_version(true);
2430
+    			    }
2227 2431
     			} elseif ($result['value'] == '31') {
2228 2432
     			    $error = self::update_from_31();
2229
-    			    if ($error != '') return $error;
2230
-    			    else return self::check_version(true);
2433
+    			    if ($error != '') {
2434
+    			    	return $error;
2435
+    			    } else {
2436
+    			    	return self::check_version(true);
2437
+    			    }
2231 2438
     			} elseif ($result['value'] == '32') {
2232 2439
     			    $error = self::update_from_32();
2233
-    			    if ($error != '') return $error;
2234
-    			    else return self::check_version(true);
2440
+    			    if ($error != '') {
2441
+    			    	return $error;
2442
+    			    } else {
2443
+    			    	return self::check_version(true);
2444
+    			    }
2235 2445
     			} elseif ($result['value'] == '33') {
2236 2446
     			    $error = self::update_from_33();
2237
-    			    if ($error != '') return $error;
2238
-    			    else return self::check_version(true);
2447
+    			    if ($error != '') {
2448
+    			    	return $error;
2449
+    			    } else {
2450
+    			    	return self::check_version(true);
2451
+    			    }
2239 2452
     			} elseif ($result['value'] == '34') {
2240 2453
     			    $error = self::update_from_34();
2241
-    			    if ($error != '') return $error;
2242
-    			    else return self::check_version(true);
2454
+    			    if ($error != '') {
2455
+    			    	return $error;
2456
+    			    } else {
2457
+    			    	return self::check_version(true);
2458
+    			    }
2243 2459
     			} elseif ($result['value'] == '35') {
2244 2460
     			    $error = self::update_from_35();
2245
-    			    if ($error != '') return $error;
2246
-    			    else return self::check_version(true);
2461
+    			    if ($error != '') {
2462
+    			    	return $error;
2463
+    			    } else {
2464
+    			    	return self::check_version(true);
2465
+    			    }
2247 2466
     			} elseif ($result['value'] == '36') {
2248 2467
     			    $error = self::update_from_36();
2249
-    			    if ($error != '') return $error;
2250
-    			    else return self::check_version(true);
2468
+    			    if ($error != '') {
2469
+    			    	return $error;
2470
+    			    } else {
2471
+    			    	return self::check_version(true);
2472
+    			    }
2251 2473
     			} elseif ($result['value'] == '37') {
2252 2474
     			    $error = self::update_from_37();
2253
-    			    if ($error != '') return $error;
2254
-    			    else return self::check_version(true);
2475
+    			    if ($error != '') {
2476
+    			    	return $error;
2477
+    			    } else {
2478
+    			    	return self::check_version(true);
2479
+    			    }
2255 2480
     			} elseif ($result['value'] == '38') {
2256 2481
     			    $error = self::update_from_38();
2257
-    			    if ($error != '') return $error;
2258
-    			    else return self::check_version(true);
2482
+    			    if ($error != '') {
2483
+    			    	return $error;
2484
+    			    } else {
2485
+    			    	return self::check_version(true);
2486
+    			    }
2259 2487
     			} elseif ($result['value'] == '39') {
2260 2488
     			    $error = self::update_from_39();
2261
-    			    if ($error != '') return $error;
2262
-    			    else return self::check_version(true);
2489
+    			    if ($error != '') {
2490
+    			    	return $error;
2491
+    			    } else {
2492
+    			    	return self::check_version(true);
2493
+    			    }
2263 2494
     			} elseif ($result['value'] == '40') {
2264 2495
     			    $error = self::update_from_40();
2265
-    			    if ($error != '') return $error;
2266
-    			    else return self::check_version(true);
2496
+    			    if ($error != '') {
2497
+    			    	return $error;
2498
+    			    } else {
2499
+    			    	return self::check_version(true);
2500
+    			    }
2267 2501
     			} elseif ($result['value'] == '41') {
2268 2502
     			    $error = self::update_from_41();
2269
-    			    if ($error != '') return $error;
2270
-    			    else return self::check_version(true);
2503
+    			    if ($error != '') {
2504
+    			    	return $error;
2505
+    			    } else {
2506
+    			    	return self::check_version(true);
2507
+    			    }
2271 2508
     			} elseif ($result['value'] == '42') {
2272 2509
     			    $error = self::update_from_42();
2273
-    			    if ($error != '') return $error;
2274
-    			    else return self::check_version(true);
2510
+    			    if ($error != '') {
2511
+    			    	return $error;
2512
+    			    } else {
2513
+    			    	return self::check_version(true);
2514
+    			    }
2275 2515
     			} elseif ($result['value'] == '43') {
2276 2516
     			    $error = self::update_from_43();
2277
-    			    if ($error != '') return $error;
2278
-    			    else return self::check_version(true);
2279
-    			} else return '';
2517
+    			    if ($error != '') {
2518
+    			    	return $error;
2519
+    			    } else {
2520
+    			    	return self::check_version(true);
2521
+    			    }
2522
+    			} else {
2523
+    				return '';
2524
+    			}
2525
+    		    } else {
2526
+    		    	return $result['value'];
2280 2527
     		    }
2281
-    		    else return $result['value'];
2282 2528
 		}
2283 2529
 		
2284
-	    } else return $version;
2530
+	    } else {
2531
+	    	return $version;
2532
+	    }
2285 2533
     	}
2286 2534
     	
2287 2535
 }
Please login to merge, or discard this patch.
require/class.TrackerImport.php 1 patch
Braces   +190 added lines, -65 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function checkAll() {
44 44
 	global $globalDebug;
45
-	if ($globalDebug) echo "Update last seen tracked data...\n";
45
+	if ($globalDebug) {
46
+		echo "Update last seen tracked data...\n";
47
+	}
46 48
 	foreach ($this->all_tracked as $key => $flight) {
47 49
 	    if (isset($this->all_tracked[$key]['id'])) {
48 50
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
@@ -55,12 +57,16 @@  discard block
 block discarded – undo
55 57
     public function del() {
56 58
 	global $globalDebug;
57 59
 	// Delete old infos
58
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
60
+	if ($globalDebug) {
61
+		echo 'Delete old values and update latest data...'."\n";
62
+	}
59 63
 	foreach ($this->all_tracked as $key => $flight) {
60 64
     	    if (isset($flight['lastupdate'])) {
61 65
         	if ($flight['lastupdate'] < (time()-3000)) {
62 66
             	    if (isset($this->all_tracked[$key]['id'])) {
63
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
67
+            		if ($globalDebug) {
68
+            			echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
69
+            		}
64 70
 			/*
65 71
 			$TrackerLive = new TrackerLive();
66 72
             		$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']);
@@ -70,7 +76,9 @@  discard block
 block discarded – undo
70 76
             		$Tracker = new Tracker($this->db);
71 77
             		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
72 78
 				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
73
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
79
+				if ($globalDebug && $result != 'success') {
80
+					echo '!!! ERROR : '.$result."\n";
81
+				}
74 82
 			}
75 83
 			// Put in archive
76 84
 //			$Tracker->db = null;
@@ -83,7 +91,9 @@  discard block
 block discarded – undo
83 91
 
84 92
     public function add($line) {
85 93
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
86
-	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
94
+	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') {
95
+		$globalCoordMinChange = '0.02';
96
+	}
87 97
 	date_default_timezone_set('UTC');
88 98
 	$dataFound = false;
89 99
 	$send = false;
@@ -97,19 +107,29 @@  discard block
 block discarded – undo
97 107
 		// Increment message number
98 108
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
99 109
 		    $current_date = date('Y-m-d');
100
-		    if (isset($line['source_name'])) $source = $line['source_name'];
101
-		    else $source = '';
102
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
110
+		    if (isset($line['source_name'])) {
111
+		    	$source = $line['source_name'];
112
+		    } else {
113
+		    	$source = '';
114
+		    }
115
+		    if ($source == '' || $line['format_source'] == 'aprs') {
116
+		    	$source = $line['format_source'];
117
+		    }
103 118
 		    if (!isset($this->stats[$current_date][$source]['msg'])) {
104 119
 		    	$this->stats[$current_date][$source]['msg']['date'] = time();
105 120
 		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
106
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
121
+		    } else {
122
+		    	$this->stats[$current_date][$source]['msg']['nb'] += 1;
123
+		    }
107 124
 		}
108 125
 		
109 126
 		
110 127
 		$Common = new Common();
111
-	        if (!isset($line['id'])) $id = trim($line['ident']);
112
-	        else $id = trim($line['id']);
128
+	        if (!isset($line['id'])) {
129
+	        	$id = trim($line['ident']);
130
+	        } else {
131
+	        	$id = trim($line['id']);
132
+	        }
113 133
 		
114 134
 		if (!isset($this->all_tracked[$id])) {
115 135
 		    $this->all_tracked[$id] = array();
@@ -117,31 +137,46 @@  discard block
 block discarded – undo
117 137
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
118 138
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
119 139
 		    if (!isset($line['id'])) {
120
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
140
+			if (!isset($globalDaemon)) {
141
+				$globalDaemon = TRUE;
142
+			}
121 143
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
122
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
123
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
144
+		     } else {
145
+		     	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
146
+		     }
147
+		    if ($globalAllTracked !== FALSE) {
148
+		    	$dataFound = true;
149
+		    }
124 150
 		}
125 151
 		
126 152
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
127 153
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
128 154
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
129 155
 		    } else {
130
-				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
131
-				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
156
+				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
157
+					echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
158
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
159
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
160
+				}
132 161
 				return '';
133 162
 		    }
134 163
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
135
-			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!";
164
+			if ($globalDebug) {
165
+				echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!";
166
+			}
136 167
 			return '';
137 168
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
138
-			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!";
169
+			if ($globalDebug) {
170
+				echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!";
171
+			}
139 172
 			return '';
140 173
 		} elseif (!isset($line['datetime'])) {
141 174
 			date_default_timezone_set('UTC');
142 175
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
143 176
 		} else {
144
-			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!";
177
+			if ($globalDebug) {
178
+				echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!";
179
+			}
145 180
 			return '';
146 181
 		}
147 182
 		
@@ -153,11 +188,17 @@  discard block
 block discarded – undo
153 188
             		$Tracker = new Tracker($this->db);
154 189
             		$fromsource = NULL;
155 190
             		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
156
-			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
191
+			if ($globalDebug && $result != 'success') {
192
+				echo '!!! ERROR : '.$result."\n";
193
+			}
157 194
 			$Tracker->db = null;
158
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
195
+			if ($globalDebugTimeElapsed) {
196
+				echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
197
+			}
198
+		    }
199
+		    if (!isset($this->all_tracked[$id]['id'])) {
200
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
159 201
 		    }
160
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
161 202
 		}
162 203
 
163 204
 		if (isset($line['speed']) && $line['speed'] != '') {
@@ -168,14 +209,21 @@  discard block
 block discarded – undo
168 209
 		    if ($distance > 100 && $distance < 10000) {
169 210
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
170 211
 			$speed = $speed*3.6;
171
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
172
-  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
212
+			if ($speed < 1000) {
213
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
214
+			}
215
+  			if ($globalDebug) {
216
+  				echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
217
+  			}
173 218
 		    }
174 219
 		}
175 220
 
176 221
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
177
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
178
-	    	    else unset($timediff);
222
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) {
223
+	    	    	$timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
224
+	    	    } else {
225
+	    	    	unset($timediff);
226
+	    	    }
179 227
 	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
180 228
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
181 229
 			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
@@ -183,20 +231,30 @@  discard block
 block discarded – undo
183 231
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
184 232
 				$this->all_tracked[$id]['putinarchive'] = true;
185 233
 				
186
-				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
234
+				if ($globalDebug) {
235
+					echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
236
+				}
187 237
 				$timeelapsed = microtime(true);
188 238
 				$Tracker = new Tracker($this->db);
189 239
 				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
190
-				if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
240
+				if (!empty($all_country)) {
241
+					$this->all_tracked[$id]['over_country'] = $all_country['iso2'];
242
+				}
191 243
 				$Tracker->db = null;
192
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
244
+				if ($globalDebugTimeElapsed) {
245
+					echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
246
+				}
193 247
 				$this->tmd = 0;
194
-				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
248
+				if ($globalDebug) {
249
+					echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
250
+				}
195 251
 			    }
196 252
 			}
197 253
 
198 254
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
199
-				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
255
+				if (!isset($this->all_tracked[$id]['archive_latitude'])) {
256
+					$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
257
+				}
200 258
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
201 259
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
202 260
 				    $dataFound = true;
@@ -205,8 +263,12 @@  discard block
 block discarded – undo
205 263
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
206 264
 			}
207 265
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
208
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
209
-				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
266
+			    if ($line['longitude'] > 180) {
267
+			    	$line['longitude'] = $line['longitude'] - 360;
268
+			    }
269
+				if (!isset($this->all_tracked[$id]['archive_longitude'])) {
270
+					$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
271
+				}
210 272
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
211 273
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
212 274
 				    $dataFound = true;
@@ -224,7 +286,9 @@  discard block
 block discarded – undo
224 286
 		    }
225 287
 		}
226 288
 		if (isset($line['last_update']) && $line['last_update'] != '') {
227
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
289
+		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) {
290
+		    	$dataFound = true;
291
+		    }
228 292
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
229 293
 		}
230 294
 		if (isset($line['format_source']) && $line['format_source'] != '') {
@@ -244,7 +308,9 @@  discard block
 block discarded – undo
244 308
 
245 309
 		if (isset($line['altitude']) && $line['altitude'] != '') {
246 310
 		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
247
-			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
311
+			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) {
312
+				$this->all_tracked[$id]['putinarchive'] = true;
313
+			}
248 314
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude']));
249 315
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
250 316
 			//$dataFound = true;
@@ -256,15 +322,21 @@  discard block
 block discarded – undo
256 322
 		}
257 323
 		
258 324
 		if (isset($line['heading']) && $line['heading'] != '') {
259
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
325
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) {
326
+		    	$this->all_tracked[$id]['putinarchive'] = true;
327
+		    }
260 328
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
261 329
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
262 330
 		    //$dataFound = true;
263 331
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
264 332
   		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
265 333
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
266
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
267
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
334
+		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) {
335
+		    	$this->all_tracked[$id]['putinarchive'] = true;
336
+		    }
337
+  		    if ($globalDebug) {
338
+  		    	echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
339
+  		    }
268 340
   		}
269 341
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
270 342
 
@@ -273,20 +345,31 @@  discard block
 block discarded – undo
273 345
 		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
274 346
 		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
275 347
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
276
-				if ($globalDebug) echo "Check if aircraft is already in DB...";
348
+				if ($globalDebug) {
349
+					echo "Check if aircraft is already in DB...";
350
+				}
277 351
 				$timeelapsed = microtime(true);
278 352
 				$TrackerLive = new TrackerLive($this->db);
279 353
 				if (isset($line['id'])) {
280 354
 				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
281
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
355
+				    if ($globalDebugTimeElapsed) {
356
+				    	echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
357
+				    }
282 358
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
283 359
 				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
284
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
285
-				} else $recent_ident = '';
360
+				    if ($globalDebugTimeElapsed) {
361
+				    	echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
362
+				    }
363
+				} else {
364
+					$recent_ident = '';
365
+				}
286 366
 				$TrackerLive->db=null;
287 367
 
288
-				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
289
-				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
368
+				if ($globalDebug && $recent_ident == '') {
369
+					echo " Not in DB.\n";
370
+				} elseif ($globalDebug && $recent_ident != '') {
371
+					echo " Already in DB.\n";
372
+				}
290 373
 			    } else {
291 374
 				$recent_ident = '';
292 375
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
@@ -294,27 +377,41 @@  discard block
 block discarded – undo
294 377
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
295 378
 			    if($recent_ident == "")
296 379
 			    {
297
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
380
+				if ($globalDebug) {
381
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
382
+				}
298 383
 				//adds the spotter data for the archive
299 384
 				    $highlight = '';
300
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
385
+				    if (!isset($this->all_tracked[$id]['id'])) {
386
+				    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
387
+				    }
301 388
 				    $timeelapsed = microtime(true);
302 389
 				    $Tracker = new Tracker($this->db);
303 390
 				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
304 391
 				    $Tracker->db = null;
305
-				    if ($globalDebug && isset($result)) echo $result."\n";
306
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
392
+				    if ($globalDebug && isset($result)) {
393
+				    	echo $result."\n";
394
+				    }
395
+				    if ($globalDebugTimeElapsed) {
396
+				    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
397
+				    }
307 398
 				    
308 399
 				    
309 400
 				    // Add source stat in DB
310 401
 				    $Stats = new Stats($this->db);
311 402
 				    if (!empty($this->stats)) {
312
-					if ($globalDebug) echo 'Add source stats : ';
403
+					if ($globalDebug) {
404
+						echo 'Add source stats : ';
405
+					}
313 406
 				        foreach($this->stats as $date => $data) {
314 407
 					    foreach($data as $source => $sourced) {
315 408
 					        //print_r($sourced);
316
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
317
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
409
+				    	        if (isset($sourced['polar'])) {
410
+				    	        	echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
411
+				    	        }
412
+				    	        if (isset($sourced['hist'])) {
413
+				    	        	echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
414
+				    	        }
318 415
 				    		if (isset($sourced['msg'])) {
319 416
 				    		    if (time() - $sourced['msg']['date'] > 10) {
320 417
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
@@ -327,7 +424,9 @@  discard block
 block discarded – undo
327 424
 			    			unset($this->stats[$date]);
328 425
 			    		    }
329 426
 				    	}
330
-				    	if ($globalDebug) echo 'Done'."\n";
427
+				    	if ($globalDebug) {
428
+				    		echo 'Done'."\n";
429
+				    	}
331 430
 
332 431
 				    }
333 432
 				    $Stats->db = null;
@@ -337,12 +436,16 @@  discard block
 block discarded – undo
337 436
 				$this->all_tracked[$id]['addedTracker'] = 1;
338 437
 				//print_r($this->all_tracked[$id]);
339 438
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
340
-				    if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
439
+				    if ($globalDebug) {
440
+				    	echo "---- Deleting Live Tracker data older than 9 hours...";
441
+				    }
341 442
 				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
342 443
 				    $TrackerLive = new TrackerLive($this->db);
343 444
 				    $TrackerLive->deleteLiveTrackerData();
344 445
 				    $TrackerLive->db=null;
345
-				    if ($globalDebug) echo " Done\n";
446
+				    if ($globalDebug) {
447
+				    	echo " Done\n";
448
+				    }
346 449
 				    $this->last_delete = time();
347 450
 				}
348 451
 			    } else {
@@ -365,19 +468,25 @@  discard block
 block discarded – undo
365 468
 
366 469
 		    if (!$ignoreImport) {
367 470
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
368
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
471
+				if ($globalDebug) {
472
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
473
+				}
369 474
 				$timeelapsed = microtime(true);
370 475
 				$TrackerLive = new TrackerLive($this->db);
371 476
 				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
372 477
 				$TrackerLive->db = null;
373 478
 				$this->all_tracked[$id]['putinarchive'] = false;
374
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
479
+				if ($globalDebugTimeElapsed) {
480
+					echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
481
+				}
375 482
 
376 483
 				// Put statistics in $this->stats variable
377 484
 				
378 485
 				if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
379 486
 					$source = $this->all_tracked[$id]['source_name'];
380
-					if ($source == '') $source = $this->all_tracked[$id]['format_source'];
487
+					if ($source == '') {
488
+						$source = $this->all_tracked[$id]['format_source'];
489
+					}
381 490
 					if (!isset($this->source_location[$source])) {
382 491
 						$Location = new Source();
383 492
 						$coord = $Location->getLocationInfobySourceName($source);
@@ -398,7 +507,9 @@  discard block
 block discarded – undo
398 507
 					$stats_heading = round($stats_heading/22.5);
399 508
 					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
400 509
 					$current_date = date('Y-m-d');
401
-					if ($stats_heading == 16) $stats_heading = 0;
510
+					if ($stats_heading == 16) {
511
+						$stats_heading = 0;
512
+					}
402 513
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
403 514
 						for ($i=0;$i<=15;$i++) {
404 515
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
@@ -416,7 +527,9 @@  discard block
 block discarded – undo
416 527
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
417 528
 						    end($this->stats[$current_date][$source]['hist']);
418 529
 						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
419
-						} else $mini = 0;
530
+						} else {
531
+							$mini = 0;
532
+						}
420 533
 						for ($i=$mini;$i<=$distance;$i+=10) {
421 534
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
422 535
 						}
@@ -427,19 +540,29 @@  discard block
 block discarded – undo
427 540
 				}
428 541
 
429 542
 				$this->all_tracked[$id]['lastupdate'] = time();
430
-				if ($this->all_tracked[$id]['putinarchive']) $send = true;
431
-				if ($globalDebug) echo $result."\n";
432
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
543
+				if ($this->all_tracked[$id]['putinarchive']) {
544
+					$send = true;
545
+				}
546
+				if ($globalDebug) {
547
+					echo $result."\n";
548
+				}
549
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
550
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
551
+			}
433 552
 			//$this->del();
434 553
 			
435 554
 			
436 555
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
437
-			    if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
556
+			    if ($globalDebug) {
557
+			    	echo "---- Deleting Live Tracker data Not updated since 2 hour...";
558
+			    }
438 559
 			    $TrackerLive = new TrackerLive($this->db);
439 560
 			    $TrackerLive->deleteLiveTrackerDataNotUpdated();
440 561
 			    $TrackerLive->db = null;
441 562
 			    //TrackerLive->deleteLiveTrackerData();
442
-			    if ($globalDebug) echo " Done\n";
563
+			    if ($globalDebug) {
564
+			    	echo " Done\n";
565
+			    }
443 566
 			    $this->last_delete_hourly = time();
444 567
 			}
445 568
 			
@@ -447,7 +570,9 @@  discard block
 block discarded – undo
447 570
 		    //$ignoreImport = false;
448 571
 		}
449 572
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
450
-		if ($send) return $this->all_tracked[$id];
573
+		if ($send) {
574
+			return $this->all_tracked[$id];
575
+		}
451 576
 	    }
452 577
 	}
453 578
     }
Please login to merge, or discard this patch.