Completed
Push — master ( 8d4415...1bf6ad )
by Yannick
72:06 queued 32:47
created
require/class.SBS.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -198,20 +198,20 @@
 block discarded – undo
198 198
 
199 199
 	private function parityCheck($msg, $bin) {
200 200
 		$modes_checksum_table = array(
201
-		    0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178,
202
-		    0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14,
203
-		    0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449,
204
-		    0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22,
205
-		    0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7,
206
-		    0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612,
207
-		    0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace,
208
-		    0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53,
209
-		    0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441,
210
-		    0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80,
211
-		    0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409,
212
-		    0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
213
-		    0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
214
-		    0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
201
+			0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178,
202
+			0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14,
203
+			0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449,
204
+			0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22,
205
+			0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7,
206
+			0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612,
207
+			0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace,
208
+			0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53,
209
+			0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441,
210
+			0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80,
211
+			0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409,
212
+			0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
213
+			0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
214
+			0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
215 215
 		);
216 216
 		$crc = 0;
217 217
 		$checksum = intval(substr($msg,22,6),16);
Please login to merge, or discard this patch.
getImages.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -4,31 +4,31 @@  discard block
 block discarded – undo
4 4
 	$hex = str_replace("#", "", $hex);
5 5
 	$color = array();
6 6
 	if (strlen($hex) == 3) {
7
-	    $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
-	    $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
-	    $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
7
+		$color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
+		$color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
+		$color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
10 10
 	} else if (strlen($hex) == 6) {
11
-	    $color['r'] = hexdec(substr($hex, 0, 2));
12
-	    $color['g'] = hexdec(substr($hex, 2, 2));
13
-	    $color['b'] = hexdec(substr($hex, 4, 2));
11
+		$color['r'] = hexdec(substr($hex, 0, 2));
12
+		$color['g'] = hexdec(substr($hex, 2, 2));
13
+		$color['b'] = hexdec(substr($hex, 4, 2));
14 14
 	}
15 15
 	return $color;
16 16
 }
17 17
 
18 18
 
19 19
 if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { 
20
-    exit(0);
20
+	exit(0);
21 21
 }
22 22
 $color = $_GET['color'];
23 23
 if (!isset($_GET['filename']) || !preg_match('/^[a-z0-9-_]+\.png$/', strtolower($_GET['filename']))) {
24
-    echo "Incorrect filename";
25
-    exit(0);
24
+	echo "Incorrect filename";
25
+	exit(0);
26 26
 }
27 27
 $filename = $_GET['filename'];
28 28
 if (file_exists(dirname(__FILE__).'/cache/'.$color.'-'.$filename) && is_readable(dirname(__FILE__).'/cache/'.$color.'-'.$filename)) {
29
-    header('Content-type: image/png');
30
-    readfile(dirname(__FILE__).'/cache/'.$color.'-'.$filename);
31
-    exit(0);
29
+	header('Content-type: image/png');
30
+	readfile(dirname(__FILE__).'/cache/'.$color.'-'.$filename);
31
+	exit(0);
32 32
 }
33 33
 if (isset($_GET['tracker'])) {
34 34
 	$original = dirname(__FILE__).'/images/vehicules/color/'.$filename;
@@ -45,68 +45,68 @@  discard block
 block discarded – undo
45 45
 	$original = dirname(__FILE__).'/images/aircrafts/new/'.$filename;
46 46
 }
47 47
 if (!file_exists($original)) {
48
-    echo "File not found";
48
+	echo "File not found";
49 49
 }
50 50
 
51 51
 if (extension_loaded('gd') && function_exists('gd_info')) {
52
-    $image = imagecreatefrompng($original);
53
-    $index = imagecolorexact($image,26,49,81);
54
-    if ($index < 0) {
52
+	$image = imagecreatefrompng($original);
53
+	$index = imagecolorexact($image,26,49,81);
54
+	if ($index < 0) {
55 55
 	$index = imagecolorexact($image,25,49,79);
56
-    }
57
-    if ($index < 0) {
56
+	}
57
+	if ($index < 0) {
58 58
 	$index = imagecolorexact($image,0,0,0);
59
-    }
60
-    $c = hexToRGB($color);
61
-    imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
59
+	}
60
+	$c = hexToRGB($color);
61
+	imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
62 62
  /*
63 63
     $ig = imagecolorat($image, 0, 0);
64 64
     imagecolortransparent($image, $ig);
65 65
    */
66 66
 
67
-    header('Content-type: image/png');
68
-    if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
67
+	header('Content-type: image/png');
68
+	if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
69 69
 	$resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT);
70 70
 	$newimg = imagecreatetruecolor($resize,$resize);
71
-        imagealphablending($newimg, false);
71
+		imagealphablending($newimg, false);
72 72
 	imagesavealpha($newimg, true);
73 73
 	imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image));
74 74
 	if (isset($_GET['heading'])) {
75
-    	    $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
76
-    	    $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
77
-    	    imagealphablending($rotation, false);
78
-	    imagesavealpha($rotation, true);
79
-    	    imagepng($rotation);
80
-    	    imagedestroy($newimg);
81
-    	    imagedestroy($image);
82
-    	    imagedestroy($rotation);
75
+			$heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
76
+			$rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
77
+			imagealphablending($rotation, false);
78
+		imagesavealpha($rotation, true);
79
+			imagepng($rotation);
80
+			imagedestroy($newimg);
81
+			imagedestroy($image);
82
+			imagedestroy($rotation);
83 83
 	
84 84
 	} else {
85
-    	    imagepng($newimg);
86
-    	    imagedestroy($newimg);
87
-    	    imagedestroy($image);
88
-        }
89
-    } else {
85
+			imagepng($newimg);
86
+			imagedestroy($newimg);
87
+			imagedestroy($image);
88
+		}
89
+	} else {
90 90
 	imagealphablending($image, false);
91
-        imagesavealpha($image, true);
91
+		imagesavealpha($image, true);
92 92
 	imagepng($image);
93 93
 	imagepng($image);
94 94
 	if (is_writable(dirname(__FILE__).'/cache')) {
95
-    	    imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename);
95
+			imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename);
96
+	}
97
+		imagedestroy($image);
96 98
 	}
97
-        imagedestroy($image);
98
-    }
99 99
 } else {
100
-    header('Content-type: image/png');
101
-    if (isset($_GET['tracker'])) {
102
-        readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
103
-    } elseif (isset($_GET['marine'])) {
104
-        readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
105
-    } elseif (isset($_GET['satellite'])) {
106
-        readfile(dirname(__FILE__).'/images/satellites/'.$filename);
107
-    } else {
108
-        if ($color == 'FF0000') readfile(dirname(__FILE__).'/images/aircrafts/selected/'.$filename);
100
+	header('Content-type: image/png');
101
+	if (isset($_GET['tracker'])) {
102
+		readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
103
+	} elseif (isset($_GET['marine'])) {
104
+		readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
105
+	} elseif (isset($_GET['satellite'])) {
106
+		readfile(dirname(__FILE__).'/images/satellites/'.$filename);
107
+	} else {
108
+		if ($color == 'FF0000') readfile(dirname(__FILE__).'/images/aircrafts/selected/'.$filename);
109 109
 	else readfile(dirname(__FILE__).'/images/aircrafts/'.$filename);
110
-    }
110
+	}
111 111
 }
112 112
 ?>
113 113
\ No newline at end of file
Please login to merge, or discard this patch.
install/install-action.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	if ($check_version == '0') {
87 87
 		
88 88
 		if ($globalDBdriver == 'mysql') {
89
-		    $error .= create_db::import_all_db('../db/');
89
+			$error .= create_db::import_all_db('../db/');
90 90
 		} elseif ($globalDBdriver == 'pgsql') {
91
-		    $error .= create_db::import_all_db('../db/pgsql/');
91
+			$error .= create_db::import_all_db('../db/pgsql/');
92 92
 		}
93 93
 		if ($error != '') {
94 94
 			$_SESSION['error'] = $error;
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 			$_SESSION['install'] = 'populate';
99 99
 			$_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B';
100 100
 		} else {
101
-		    $_SESSION['install'] = 'sources';
102
-		    $_SESSION['next'] = 'Insert data in source table';
101
+			$_SESSION['install'] = 'sources';
102
+			$_SESSION['next'] = 'Insert data in source table';
103 103
 		}
104 104
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
105 105
 		print json_encode($result);
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database'));
157 157
 	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
158 158
 	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
159
-	    $_SESSION['install'] = 'notam';
160
-	    $_SESSION['next'] = 'Populate NOTAM table with externals data';
161
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
162
-	    print json_encode($result);
159
+		$_SESSION['install'] = 'notam';
160
+		$_SESSION['next'] = 'Populate NOTAM table with externals data';
161
+		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
162
+		print json_encode($result);
163 163
 	/*
164 164
 	} elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
165 165
 	    $_SESSION['install'] = 'owner';
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 	    print json_encode($result);
170 170
 	*/
171 171
 	} else {
172
-	    $_SESSION['install'] = 'sources';
173
-	    $_SESSION['next'] = 'Insert data in source table';
174
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
175
-	    print json_encode($result);
172
+		$_SESSION['install'] = 'sources';
173
+		$_SESSION['next'] = 'Insert data in source table';
174
+		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
175
+		print json_encode($result);
176 176
 	}
177 177
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') {
178 178
 	if (!is_writable('tmp')) {
Please login to merge, or discard this patch.
install/index.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 			<p>
189 189
 				<label for="siteurl">Site directory</label>
190 190
 				<?php
191
-				    // Try to detect site directory
192
-				    if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
191
+					// Try to detect site directory
192
+					if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
193 193
 					if (isset($_SERVER['REQUEST_URI'])) {
194 194
 						$URL = $_SERVER['REQUEST_URI'];
195 195
 						$globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL)));
196 196
 					}
197
-				    }
197
+					}
198 198
 				?>
199 199
 				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
200 200
 				<p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
@@ -373,17 +373,17 @@  discard block
 block discarded – undo
373 373
 				</tr>
374 374
 				
375 375
 		<?php
376
-		    if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') {
376
+			if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') {
377 377
 		?>
378 378
 		<!--
379 379
 		<?php
380
-			    require_once(dirname(__FILE__).'/../require/class.Connection.php');
381
-			    $Connection = new Connection();
380
+				require_once(dirname(__FILE__).'/../require/class.Connection.php');
381
+				$Connection = new Connection();
382 382
 		?>
383 383
 		-->
384 384
 		<?php
385 385
 			if ($Connection->db != NULL) {
386
-			    if ($Connection->tableExists('source_location')) {
386
+				if ($Connection->tableExists('source_location')) {
387 387
 				require_once(dirname(__FILE__).'/../require/class.Source.php');
388 388
 				$Source = new Source();
389 389
 				//$alllocations = $Source->getAllLocationInfo();
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 		
404 404
 		<?php
405 405
 				}
406
-			    }
406
+				}
407
+			}
407 408
 			}
408
-		    }
409 409
 		?>
410 410
 
411 411
 				<tr>
@@ -515,12 +515,12 @@  discard block
 block discarded – undo
515 515
 ?>
516 516
 							<tr>
517 517
 								<?php
518
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
518
+									if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
519 519
 								?>
520 520
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
521 521
 								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
522 522
 								<?php
523
-								    } else {
523
+									} else {
524 524
 									$hostport = explode(':',$source['host']);
525 525
 									if (isset($hostport[1])) {
526 526
 										$host = $hostport[0];
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 								<td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td>
534 534
 								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php print $port; ?>" /></td>
535 535
 								<?php
536
-								    }
536
+									}
537 537
 								?>
538 538
 								<td>
539 539
 									<select name="format[]" id="format">
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
 			    </thead>
674 674
 			    <tbody>
675 675
 				<?php
676
-				    if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) {
676
+					if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) {
677 677
 					foreach ($globalNewsFeeds as $type => $feedslng) {
678
-					    foreach ($feedslng as $lng => $feeds) {
678
+						foreach ($feedslng as $lng => $feeds) {
679 679
 						foreach ($feeds as $feed) {
680 680
 				?>
681 681
 				<tr>
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
 				
701 701
 				<?php
702 702
 						}
703
-					    }
703
+						}
704
+					}
704 705
 					}
705
-				    }
706 706
 				?>
707 707
 				<tr>
708 708
 				    <td><input type="url" name="newsurl[]" /></td>
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 			<br />
1093 1093
 			<p>
1094 1094
 			<?php 
1095
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
1095
+				if (extension_loaded('gd') && function_exists('gd_info')) {
1096 1096
 			?>
1097 1097
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
1098 1098
 				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
@@ -1102,11 +1102,11 @@  discard block
 block discarded – undo
1102 1102
 				<b>The directory cache is not writable, aircraft icon will not be cached</b>
1103 1103
 			<?php
1104 1104
 				}
1105
-			    } else {
1105
+				} else {
1106 1106
 			?>
1107 1107
 				<b>PHP GD is not installed, you can't change color of aircraft icon on map</b>
1108 1108
 			<?php
1109
-			    }
1109
+				}
1110 1110
 			?>
1111 1111
 			</p>
1112 1112
 			<br />
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 	</p>
1131 1131
 <?php
1132 1132
 	require('../footer.php');
1133
-        exit;
1133
+		exit;
1134 1134
 }
1135 1135
 // '	
1136 1136
 $settings = array();
@@ -1221,8 +1221,8 @@  discard block
 block discarded – undo
1221 1221
 	
1222 1222
 	$sources = array();
1223 1223
 	foreach ($source_name as $keys => $name) {
1224
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1225
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1224
+		if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1225
+		else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1226 1226
 	}
1227 1227
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1228 1228
 
@@ -1232,13 +1232,13 @@  discard block
 block discarded – undo
1232 1232
 	
1233 1233
 	$newsfeeds = array();
1234 1234
 	foreach($newsurl as $newskey => $url) {
1235
-	    if ($url != '') {
1235
+		if ($url != '') {
1236 1236
 		$type = $newstype[$newskey];
1237 1237
 		$lng = $newslng[$newskey];
1238 1238
 		if (isset($newsfeeds[$type][$lng])) {
1239
-		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1239
+			$newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1240 1240
 		} else $newsfeeds[$type][$lng] = array($url);
1241
-	    }
1241
+		}
1242 1242
 	}
1243 1243
 	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
1244 1244
 
@@ -1681,14 +1681,14 @@  discard block
 block discarded – undo
1681 1681
 
1682 1682
 	// Set some defaults values...
1683 1683
 	if (!isset($globalAircraftImageSources)) {
1684
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1685
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1684
+		$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1685
+		$settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1686 1686
 	}
1687 1687
 
1688 1688
 	if (!isset($globalSchedulesSources)) {
1689
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1690
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1691
-    	}
1689
+		$globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1690
+			$settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1691
+		}
1692 1692
 
1693 1693
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1694 1694
 
@@ -1736,21 +1736,21 @@  discard block
 block discarded – undo
1736 1736
 	$popi = false;
1737 1737
 	$popw = false;
1738 1738
 	foreach ($_SESSION['done'] as $done) {
1739
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1740
-	    if ($done == 'Create database') $pop = true;
1741
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1742
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1743
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1739
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1740
+		if ($done == 'Create database') $pop = true;
1741
+		if ($_SESSION['install'] == 'database_create') $pop = true;
1742
+		if ($_SESSION['install'] == 'database_import') $popi = true;
1743
+		if ($_SESSION['install'] == 'waypoints') $popw = true;
1744 1744
 	}
1745 1745
 	if ($pop) {
1746
-	    sleep(5);
1747
-	    print '<li>Create database....<img src="../images/loading.gif" /></li>';
1746
+		sleep(5);
1747
+		print '<li>Create database....<img src="../images/loading.gif" /></li>';
1748 1748
 	} else if ($popi) {
1749
-	    sleep(5);
1750
-	    print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1749
+		sleep(5);
1750
+		print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1751 1751
 	} else if ($popw) {
1752
-	    sleep(5);
1753
-	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1752
+		sleep(5);
1753
+		print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1754 1754
 	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1755 1755
 	print '</div></ul>';
1756 1756
 	print '<div id="error"></div>';
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
 	unset($_COOKIE['install']);
1817 1817
 	print '<div class="info column"><ul>';
1818 1818
 	foreach ($_SESSION['done'] as $done) {
1819
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1819
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1820 1820
 	}
1821 1821
 	print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>';
1822 1822
 	print '</ul></div>';
Please login to merge, or discard this patch.
require/class.TrackerImport.php 1 patch
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 require_once(dirname(__FILE__).'/class.Source.php');
8 8
 
9 9
 class TrackerImport {
10
-    private $all_tracked = array();
11
-    private $last_delete_hourly = 0;
12
-    private $last_delete = 0;
13
-    private $stats = array();
14
-    private $tmd = 0;
15
-    private $source_location = array();
16
-    public $db = null;
17
-    public $nb = 0;
10
+	private $all_tracked = array();
11
+	private $last_delete_hourly = 0;
12
+	private $last_delete = 0;
13
+	private $stats = array();
14
+	private $tmd = 0;
15
+	private $source_location = array();
16
+	public $db = null;
17
+	public $nb = 0;
18 18
 
19
-    public function __construct($dbc = null) {
19
+	public function __construct($dbc = null) {
20 20
 	global $globalBeta;
21 21
 	$Connection = new Connection($dbc);
22 22
 	$this->db = $Connection->db();
@@ -38,50 +38,50 @@  discard block
 block discarded – undo
38 38
 	    }
39 39
 	}
40 40
 	*/
41
-    }
41
+	}
42 42
 
43
-    public function checkAll() {
43
+	public function checkAll() {
44 44
 	global $globalDebug;
45 45
 	if ($globalDebug) echo "Update last seen tracked data...\n";
46 46
 	foreach ($this->all_tracked as $key => $flight) {
47
-	    if (isset($this->all_tracked[$key]['id'])) {
47
+		if (isset($this->all_tracked[$key]['id'])) {
48 48
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
49
-    		$Tracker = new Tracker($this->db);
50
-        	$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'],$this->all_tracked[$key]['datetime']);
51
-            }
49
+			$Tracker = new Tracker($this->db);
50
+			$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'],$this->all_tracked[$key]['datetime']);
51
+			}
52
+	}
52 53
 	}
53
-    }
54 54
 
55
-    public function del() {
55
+	public function del() {
56 56
 	global $globalDebug;
57 57
 	// Delete old infos
58 58
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
59 59
 	foreach ($this->all_tracked as $key => $flight) {
60
-    	    if (isset($flight['lastupdate'])) {
61
-        	if ($flight['lastupdate'] < (time()-3000)) {
62
-            	    if (isset($this->all_tracked[$key]['id'])) {
63
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
60
+			if (isset($flight['lastupdate'])) {
61
+			if ($flight['lastupdate'] < (time()-3000)) {
62
+					if (isset($this->all_tracked[$key]['id'])) {
63
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
64 64
 			/*
65 65
 			$TrackerLive = new TrackerLive();
66 66
             		$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']);
67 67
 			$TrackerLive->db = null;
68 68
 			*/
69
-            		//$real_arrival = $this->arrival($key);
70
-            		$Tracker = new Tracker($this->db);
71
-            		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
69
+					//$real_arrival = $this->arrival($key);
70
+					$Tracker = new Tracker($this->db);
71
+					if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
72 72
 				$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 73
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
74 74
 			}
75 75
 			// Put in archive
76 76
 //			$Tracker->db = null;
77
-            	    }
78
-            	    unset($this->all_tracked[$key]);
79
-    	        }
80
-	    }
81
-        }
82
-    }
77
+					}
78
+					unset($this->all_tracked[$key]);
79
+				}
80
+		}
81
+		}
82
+	}
83 83
 
84
-    public function add($line) {
84
+	public function add($line) {
85 85
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
86 86
 	if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015';
87 87
 	date_default_timezone_set('UTC');
@@ -90,47 +90,47 @@  discard block
 block discarded – undo
90 90
 	
91 91
 	// SBS format is CSV format
92 92
 	if(is_array($line) && isset($line['ident'])) {
93
-	    //print_r($line);
94
-  	    if (isset($line['ident'])) {
93
+		//print_r($line);
94
+  		if (isset($line['ident'])) {
95 95
 
96 96
 		
97 97
 		// Increment message number
98 98
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
99
-		    $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'];
103
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
104
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
105
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
106
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
99
+			$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'];
103
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
104
+				$this->stats[$current_date][$source]['msg']['date'] = time();
105
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
106
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
107 107
 		}
108 108
 		
109 109
 		
110 110
 		$Common = new Common();
111
-	        if (!isset($line['id'])) $id = trim($line['ident']);
112
-	        else $id = trim($line['id']);
111
+			if (!isset($line['id'])) $id = trim($line['ident']);
112
+			else $id = trim($line['id']);
113 113
 		
114 114
 		if (!isset($this->all_tracked[$id])) {
115
-		    $this->all_tracked[$id] = array();
116
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
117
-		    $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
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
119
-		    if (!isset($line['id'])) {
115
+			$this->all_tracked[$id] = array();
116
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
117
+			$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
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
119
+			if (!isset($line['id'])) {
120 120
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
121 121
 			$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;
122
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
123
+			if ($globalAllTracked !== FALSE) $dataFound = true;
124 124
 		}
125 125
 		
126 126
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
127
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
127
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
128 128
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
129
-		    } else {
129
+			} else {
130 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 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";
132 132
 				return '';
133
-		    }
133
+			}
134 134
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
135 135
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
136 136
 			return '';
@@ -147,38 +147,38 @@  discard block
 block discarded – undo
147 147
 		
148 148
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
149 149
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
150
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
151
-		    if ($this->all_tracked[$id]['addedTracker'] == 1) {
150
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
151
+			if ($this->all_tracked[$id]['addedTracker'] == 1) {
152 152
 			$timeelapsed = microtime(true);
153
-            		$Tracker = new Tracker($this->db);
154
-            		$fromsource = NULL;
155
-            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
153
+					$Tracker = new Tracker($this->db);
154
+					$fromsource = NULL;
155
+					$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
156 156
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
157 157
 			$Tracker->db = null;
158 158
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
159
-		    }
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']));
159
+			}
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 161
 		}
162 162
 
163 163
 		if (isset($line['speed']) && $line['speed'] != '') {
164
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
165
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
164
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
165
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
166 166
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
167
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
168
-		    if ($distance > 100 && $distance < 10000) {
167
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
168
+			if ($distance > 100 && $distance < 10000) {
169 169
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
170 170
 			$speed = $speed*3.6;
171 171
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
172 172
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
173
-		    }
173
+			}
174 174
 		}
175 175
 
176
-	        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);
179
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && 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')))) {
176
+			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);
179
+				if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && 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 180
 			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
-			    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'],0.08)) {
181
+				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'],0.08)) {
182 182
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
183 183
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
184 184
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -192,30 +192,30 @@  discard block
 block discarded – undo
192 192
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
193 193
 				$this->tmd = 0;
194 194
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
195
-			    }
195
+				}
196 196
 			}
197 197
 
198 198
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
199 199
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
200 200
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
201
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
202
-				    $dataFound = true;
203
-				    $this->all_tracked[$id]['time_last_coord'] = time();
201
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
202
+					$dataFound = true;
203
+					$this->all_tracked[$id]['time_last_coord'] = time();
204 204
 				}
205 205
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
206 206
 			}
207 207
 			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;
208
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
209 209
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
210 210
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
211
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
212
-				    $dataFound = true;
213
-				    $this->all_tracked[$id]['time_last_coord'] = time();
211
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
212
+					$dataFound = true;
213
+					$this->all_tracked[$id]['time_last_coord'] = time();
214 214
 				}
215 215
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
216 216
 			}
217 217
 
218
-		    } else if ($globalDebug && $timediff > 20) {
218
+			} else if ($globalDebug && $timediff > 20) {
219 219
 			$this->tmd = $this->tmd + 1;
220 220
 			if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) {
221 221
 				echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
@@ -223,131 +223,131 @@  discard block
 block discarded – undo
223 223
 				echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
224 224
 				echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
225 225
 			}
226
-		    }
226
+			}
227 227
 		}
228 228
 		if (isset($line['last_update']) && $line['last_update'] != '') {
229
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
230
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
229
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
230
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
231 231
 		}
232 232
 		if (isset($line['format_source']) && $line['format_source'] != '') {
233
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
233
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
234 234
 		}
235 235
 		if (isset($line['source_name']) && $line['source_name'] != '') {
236
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
236
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
237 237
 		}
238 238
 		if (isset($line['comment']) && $line['comment'] != '') {
239
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
240
-		    //$dataFound = true;
239
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
240
+			//$dataFound = true;
241 241
 		}
242 242
 		if (isset($line['type']) && $line['type'] != '') {
243
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
244
-		    //$dataFound = true;
243
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
244
+			//$dataFound = true;
245 245
 		}
246 246
 
247 247
 		if (isset($line['altitude']) && $line['altitude'] != '') {
248
-		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
248
+			//if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
249 249
 			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;
250 250
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude']));
251 251
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
252 252
 			//$dataFound = true;
253
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
253
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
254 254
   		}
255 255
 
256 256
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
257
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
257
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
258 258
 		}
259 259
 		
260 260
 		if (isset($line['heading']) && $line['heading'] != '') {
261
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
262
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
263
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
264
-		    //$dataFound = true;
261
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
262
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
263
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
264
+			//$dataFound = true;
265 265
   		} 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']) {
266
-  		    $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']);
267
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
268
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
269
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
266
+  			$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']);
267
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
268
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
269
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
270 270
   		}
271 271
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
272 272
 
273 273
 		if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) {
274
-		    $this->all_tracked[$id]['lastupdate'] = time();
275
-		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
276
-		        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'])) {
277
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
274
+			$this->all_tracked[$id]['lastupdate'] = time();
275
+			if ($this->all_tracked[$id]['addedTracker'] == 0) {
276
+				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'])) {
277
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
278 278
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
279 279
 				$timeelapsed = microtime(true);
280 280
 				$TrackerLive = new TrackerLive($this->db);
281 281
 				if (isset($line['id'])) {
282
-				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
283
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
282
+					$recent_ident = $TrackerLive->checkIdRecent($line['id']);
283
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
284 284
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
285
-				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
286
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
285
+					$recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
286
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
287 287
 				} else $recent_ident = '';
288 288
 				$TrackerLive->db=null;
289 289
 
290 290
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
291 291
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
292
-			    } else {
292
+				} else {
293 293
 				$recent_ident = '';
294 294
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
295
-			    }
296
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
297
-			    if($recent_ident == "")
298
-			    {
295
+				}
296
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
297
+				if($recent_ident == "")
298
+				{
299 299
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
300 300
 				//adds the spotter data for the archive
301
-				    $highlight = '';
302
-				    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')));
303
-				    $timeelapsed = microtime(true);
304
-				    $Tracker = new Tracker($this->db);
305
-				    $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']);
306
-				    $Tracker->db = null;
307
-				    if ($globalDebug && isset($result)) echo $result."\n";
308
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
301
+					$highlight = '';
302
+					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')));
303
+					$timeelapsed = microtime(true);
304
+					$Tracker = new Tracker($this->db);
305
+					$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']);
306
+					$Tracker->db = null;
307
+					if ($globalDebug && isset($result)) echo $result."\n";
308
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
309 309
 				    
310 310
 				    
311
-				    // Add source stat in DB
312
-				    $Stats = new Stats($this->db);
313
-				    if (!empty($this->stats)) {
311
+					// Add source stat in DB
312
+					$Stats = new Stats($this->db);
313
+					if (!empty($this->stats)) {
314 314
 					if ($globalDebug) echo 'Add source stats : ';
315
-				        foreach($this->stats as $date => $data) {
316
-					    foreach($data as $source => $sourced) {
317
-					        //print_r($sourced);
318
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
319
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
320
-				    		if (isset($sourced['msg'])) {
321
-				    		    if (time() - $sourced['msg']['date'] > 10) {
322
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
323
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date);
324
-			    			        unset($this->stats[$date][$source]['msg']);
325
-			    			    }
326
-			    			}
327
-			    		    }
328
-			    		    if ($date != date('Y-m-d')) {
329
-			    			unset($this->stats[$date]);
330
-			    		    }
331
-				    	}
332
-				    	if ($globalDebug) echo 'Done'."\n";
315
+						foreach($this->stats as $date => $data) {
316
+						foreach($data as $source => $sourced) {
317
+							//print_r($sourced);
318
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
319
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
320
+							if (isset($sourced['msg'])) {
321
+								if (time() - $sourced['msg']['date'] > 10) {
322
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
323
+									echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date);
324
+									unset($this->stats[$date][$source]['msg']);
325
+								}
326
+							}
327
+							}
328
+							if ($date != date('Y-m-d')) {
329
+							unset($this->stats[$date]);
330
+							}
331
+						}
332
+						if ($globalDebug) echo 'Done'."\n";
333 333
 
334
-				    }
335
-				    $Stats->db = null;
334
+					}
335
+					$Stats->db = null;
336 336
 				    
337
-				    $this->del();
337
+					$this->del();
338 338
 				//$ignoreImport = false;
339 339
 				$this->all_tracked[$id]['addedTracker'] = 1;
340 340
 				//print_r($this->all_tracked[$id]);
341 341
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
342
-				    if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
343
-				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
344
-				    $TrackerLive = new TrackerLive($this->db);
345
-				    $TrackerLive->deleteLiveTrackerData();
346
-				    $TrackerLive->db=null;
347
-				    if ($globalDebug) echo " Done\n";
348
-				    $this->last_delete = time();
342
+					if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
343
+					//TrackerLive->deleteLiveTrackerDataNotUpdated();
344
+					$TrackerLive = new TrackerLive($this->db);
345
+					$TrackerLive->deleteLiveTrackerData();
346
+					$TrackerLive->db=null;
347
+					if ($globalDebug) echo " Done\n";
348
+					$this->last_delete = time();
349 349
 				}
350
-			    } else {
350
+				} else {
351 351
 				$this->all_tracked[$id]['id'] = $recent_ident;
352 352
 				$this->all_tracked[$id]['addedTracker'] = 1;
353 353
 				if (isset($globalDaemon) && !$globalDaemon) {
@@ -356,16 +356,16 @@  discard block
 block discarded – undo
356 356
 					$Tracker->db = null;
357 357
 				}
358 358
 				
359
-			    }
359
+				}
360 360
 			}
361
-		    }
362
-		    //adds the spotter LIVE data
363
-		    if ($globalDebug) {
361
+			}
362
+			//adds the spotter LIVE data
363
+			if ($globalDebug) {
364 364
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
365
-		    }
366
-		    $ignoreImport = false;
365
+			}
366
+			$ignoreImport = false;
367 367
 
368
-		    if (!$ignoreImport) {
368
+			if (!$ignoreImport) {
369 369
 			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'])) {
370 370
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
371 371
 				$timeelapsed = microtime(true);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 					if ($stats_heading == 16) $stats_heading = 0;
404 404
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
405 405
 						for ($i=0;$i<=15;$i++) {
406
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
406
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
407 407
 						}
408 408
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
409 409
 					} else {
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 					//var_dump($this->stats);
417 417
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
418 418
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
419
-						    end($this->stats[$current_date][$source]['hist']);
420
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
419
+							end($this->stats[$current_date][$source]['hist']);
420
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
421 421
 						} else $mini = 0;
422 422
 						for ($i=$mini;$i<=$distance;$i+=10) {
423
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
423
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
424 424
 						}
425 425
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
426 426
 					} else {
@@ -436,22 +436,22 @@  discard block
 block discarded – undo
436 436
 			
437 437
 			
438 438
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
439
-			    if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
440
-			    $TrackerLive = new TrackerLive($this->db);
441
-			    $TrackerLive->deleteLiveTrackerDataNotUpdated();
442
-			    $TrackerLive->db = null;
443
-			    //TrackerLive->deleteLiveTrackerData();
444
-			    if ($globalDebug) echo " Done\n";
445
-			    $this->last_delete_hourly = time();
439
+				if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
440
+				$TrackerLive = new TrackerLive($this->db);
441
+				$TrackerLive->deleteLiveTrackerDataNotUpdated();
442
+				$TrackerLive->db = null;
443
+				//TrackerLive->deleteLiveTrackerData();
444
+				if ($globalDebug) echo " Done\n";
445
+				$this->last_delete_hourly = time();
446 446
 			}
447 447
 			
448
-		    }
449
-		    //$ignoreImport = false;
448
+			}
449
+			//$ignoreImport = false;
450 450
 		}
451 451
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
452 452
 		if ($send) return $this->all_tracked[$id];
453
-	    }
453
+		}
454
+	}
454 455
 	}
455
-    }
456 456
 }
457 457
 ?>
Please login to merge, or discard this patch.
require/class.TrackerArchive.php 1 patch
Indentation   +594 added lines, -594 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 	}
11 11
 
12 12
 	/**
13
-	* Get SQL query part for filter used
14
-	* @param Array $filter the filter
15
-	* @return Array the SQL part
16
-	*/
13
+	 * Get SQL query part for filter used
14
+	 * @param Array $filter the filter
15
+	 * @return Array the SQL part
16
+	 */
17 17
 	public function getFilter($filter = array(),$where = false,$and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
@@ -106,44 +106,44 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 
108 108
 
109
-        /**
110
-        * Gets all the spotter information based on a particular callsign
111
-        *
112
-        * @return Array the spotter information
113
-        *
114
-        */
115
-        public function getLastArchiveTrackerDataByIdent($ident)
116
-        {
109
+		/**
110
+		 * Gets all the spotter information based on a particular callsign
111
+		 *
112
+		 * @return Array the spotter information
113
+		 *
114
+		 */
115
+		public function getLastArchiveTrackerDataByIdent($ident)
116
+		{
117 117
 		$Tracker = new Tracker($this->db);
118
-                date_default_timezone_set('UTC');
118
+				date_default_timezone_set('UTC');
119 119
 
120
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
121
-                //$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
122
-                $query  = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
120
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
121
+				//$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
122
+				$query  = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
123 123
 
124
-                $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident));
124
+				$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident));
125 125
 
126
-                return $spotter_array;
127
-        }
126
+				return $spotter_array;
127
+		}
128 128
 
129 129
 
130
-        /**
131
-        * Gets last the spotter information based on a particular id
132
-        *
133
-        * @return Array the spotter information
134
-        *
135
-        */
136
-        public function getLastArchiveTrackerDataById($id)
137
-        {
138
-    		$Tracker = new Tracker($this->db);
139
-                date_default_timezone_set('UTC');
140
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
141
-                //$query  = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id";
142
-                //$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
143
-                $query  = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1";
130
+		/**
131
+		 * Gets last the spotter information based on a particular id
132
+		 *
133
+		 * @return Array the spotter information
134
+		 *
135
+		 */
136
+		public function getLastArchiveTrackerDataById($id)
137
+		{
138
+			$Tracker = new Tracker($this->db);
139
+				date_default_timezone_set('UTC');
140
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
141
+				//$query  = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id";
142
+				//$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
143
+				$query  = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1";
144 144
 
145 145
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
146
-                  /*
146
+				  /*
147 147
                 try {
148 148
                         $Connection = new Connection();
149 149
                         $sth = Connection->$db->prepare($query);
@@ -153,189 +153,189 @@  discard block
 block discarded – undo
153 153
                 }
154 154
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
155 155
                 */
156
-                $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id));
157
-
158
-                return $spotter_array;
159
-        }
160
-
161
-        /**
162
-        * Gets all the spotter information based on a particular id
163
-        *
164
-        * @return Array the spotter information
165
-        *
166
-        */
167
-        public function getAllArchiveTrackerDataById($id,$date = '')
156
+				$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id));
157
+
158
+				return $spotter_array;
159
+		}
160
+
161
+		/**
162
+		 * Gets all the spotter information based on a particular id
163
+		 *
164
+		 * @return Array the spotter information
165
+		 *
166
+		 */
167
+		public function getAllArchiveTrackerDataById($id,$date = '')
168 168
 	{
169
-                date_default_timezone_set('UTC');
170
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
171
-                if ($date == '') $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
172
-                else $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id AND date < '".date('c',$date)."' ORDER BY date";
169
+				date_default_timezone_set('UTC');
170
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
171
+				if ($date == '') $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
172
+				else $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id AND date < '".date('c',$date)."' ORDER BY date";
173 173
 
174 174
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
175 175
 
176
-                try {
177
-                        $sth = $this->db->prepare($query);
178
-                        $sth->execute(array(':id' => $id));
179
-                } catch(PDOException $e) {
180
-                        echo $e->getMessage();
181
-                        die;
182
-                }
183
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
184
-
185
-                return $spotter_array;
186
-        }
187
-
188
-        /**
189
-        * Gets coordinate & time spotter information based on a particular id
190
-        *
191
-        * @return Array the spotter information
192
-        *
193
-        */
194
-        public function getCoordArchiveTrackerDataById($id)
195
-        {
196
-                date_default_timezone_set('UTC');
197
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
198
-                $query  = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id";
176
+				try {
177
+						$sth = $this->db->prepare($query);
178
+						$sth->execute(array(':id' => $id));
179
+				} catch(PDOException $e) {
180
+						echo $e->getMessage();
181
+						die;
182
+				}
183
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
184
+
185
+				return $spotter_array;
186
+		}
187
+
188
+		/**
189
+		 * Gets coordinate & time spotter information based on a particular id
190
+		 *
191
+		 * @return Array the spotter information
192
+		 *
193
+		 */
194
+		public function getCoordArchiveTrackerDataById($id)
195
+		{
196
+				date_default_timezone_set('UTC');
197
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
198
+				$query  = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id";
199 199
 
200 200
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
201 201
 
202
-                try {
203
-                        $sth = $this->db->prepare($query);
204
-                        $sth->execute(array(':id' => $id));
205
-                } catch(PDOException $e) {
206
-                        echo $e->getMessage();
207
-                        die;
208
-                }
209
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
202
+				try {
203
+						$sth = $this->db->prepare($query);
204
+						$sth->execute(array(':id' => $id));
205
+				} catch(PDOException $e) {
206
+						echo $e->getMessage();
207
+						die;
208
+				}
209
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
210 210
 
211
-                return $spotter_array;
212
-        }
211
+				return $spotter_array;
212
+		}
213 213
 
214 214
 
215
-        /**
216
-        * Gets altitude information based on a particular callsign
217
-        *
218
-        * @return Array the spotter information
219
-        *
220
-        */
221
-        public function getAltitudeArchiveTrackerDataByIdent($ident)
222
-        {
215
+		/**
216
+		 * Gets altitude information based on a particular callsign
217
+		 *
218
+		 * @return Array the spotter information
219
+		 *
220
+		 */
221
+		public function getAltitudeArchiveTrackerDataByIdent($ident)
222
+		{
223 223
 
224
-                date_default_timezone_set('UTC');
224
+				date_default_timezone_set('UTC');
225 225
 
226
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
227
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
226
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
227
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
228 228
 
229
-                try {
230
-                        $sth = $this->db->prepare($query);
231
-                        $sth->execute(array(':ident' => $ident));
232
-                } catch(PDOException $e) {
233
-                        echo $e->getMessage();
234
-                        die;
235
-                }
236
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
229
+				try {
230
+						$sth = $this->db->prepare($query);
231
+						$sth->execute(array(':ident' => $ident));
232
+				} catch(PDOException $e) {
233
+						echo $e->getMessage();
234
+						die;
235
+				}
236
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
237 237
 
238
-                return $spotter_array;
239
-        }
238
+				return $spotter_array;
239
+		}
240 240
 
241
-        /**
242
-        * Gets altitude information based on a particular id
243
-        *
244
-        * @return Array the spotter information
245
-        *
246
-        */
247
-        public function getAltitudeArchiveTrackerDataById($id)
248
-        {
241
+		/**
242
+		 * Gets altitude information based on a particular id
243
+		 *
244
+		 * @return Array the spotter information
245
+		 *
246
+		 */
247
+		public function getAltitudeArchiveTrackerDataById($id)
248
+		{
249 249
 
250
-                date_default_timezone_set('UTC');
250
+				date_default_timezone_set('UTC');
251 251
 
252
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
253
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
252
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
253
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
254 254
 
255
-                try {
256
-                        $sth = $this->db->prepare($query);
257
-                        $sth->execute(array(':id' => $id));
258
-                } catch(PDOException $e) {
259
-                        echo $e->getMessage();
260
-                        die;
261
-                }
262
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
255
+				try {
256
+						$sth = $this->db->prepare($query);
257
+						$sth->execute(array(':id' => $id));
258
+				} catch(PDOException $e) {
259
+						echo $e->getMessage();
260
+						die;
261
+				}
262
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
263 263
 
264
-                return $spotter_array;
265
-        }
264
+				return $spotter_array;
265
+		}
266 266
 
267
-        /**
268
-        * Gets altitude & speed information based on a particular id
269
-        *
270
-        * @return Array the spotter information
271
-        *
272
-        */
273
-        public function getAltitudeSpeedArchiveTrackerDataById($id)
274
-        {
267
+		/**
268
+		 * Gets altitude & speed information based on a particular id
269
+		 *
270
+		 * @return Array the spotter information
271
+		 *
272
+		 */
273
+		public function getAltitudeSpeedArchiveTrackerDataById($id)
274
+		{
275 275
 
276
-                date_default_timezone_set('UTC');
276
+				date_default_timezone_set('UTC');
277 277
 
278
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
279
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date";
278
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
279
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date";
280 280
 
281
-                try {
282
-                        $sth = $this->db->prepare($query);
283
-                        $sth->execute(array(':id' => $id));
284
-                } catch(PDOException $e) {
285
-                        echo $e->getMessage();
286
-                        die;
287
-                }
288
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
281
+				try {
282
+						$sth = $this->db->prepare($query);
283
+						$sth->execute(array(':id' => $id));
284
+				} catch(PDOException $e) {
285
+						echo $e->getMessage();
286
+						die;
287
+				}
288
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
289 289
 
290
-                return $spotter_array;
291
-        }
290
+				return $spotter_array;
291
+		}
292 292
 
293 293
 
294
-        /**
295
-        * Gets altitude information based on a particular callsign
296
-        *
297
-        * @return Array the spotter information
298
-        *
299
-        */
300
-        public function getLastAltitudeArchiveTrackerDataByIdent($ident)
301
-        {
294
+		/**
295
+		 * Gets altitude information based on a particular callsign
296
+		 *
297
+		 * @return Array the spotter information
298
+		 *
299
+		 */
300
+		public function getLastAltitudeArchiveTrackerDataByIdent($ident)
301
+		{
302 302
 
303
-                date_default_timezone_set('UTC');
303
+				date_default_timezone_set('UTC');
304 304
 
305
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
306
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
305
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
306
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
307 307
 //                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident";
308 308
 
309
-                try {
310
-                        $sth = $this->db->prepare($query);
311
-                        $sth->execute(array(':ident' => $ident));
312
-                } catch(PDOException $e) {
313
-                        echo $e->getMessage();
314
-                        die;
315
-                }
316
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
309
+				try {
310
+						$sth = $this->db->prepare($query);
311
+						$sth->execute(array(':ident' => $ident));
312
+				} catch(PDOException $e) {
313
+						echo $e->getMessage();
314
+						die;
315
+				}
316
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
317 317
 
318
-                return $spotter_array;
319
-        }
318
+				return $spotter_array;
319
+		}
320 320
 
321 321
 
322 322
 
323
-       /**
324
-        * Gets all the archive spotter information
325
-        *
326
-        * @return Array the spotter information
327
-        *
328
-        */
329
-        public function getTrackerArchiveData($ident,$famtrackid,$date)
330
-        {
331
-    		$Tracker = new Tracker($this->db);
332
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
333
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate";
323
+	   /**
324
+	    * Gets all the archive spotter information
325
+	    *
326
+	    * @return Array the spotter information
327
+	    *
328
+	    */
329
+		public function getTrackerArchiveData($ident,$famtrackid,$date)
330
+		{
331
+			$Tracker = new Tracker($this->db);
332
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
333
+				$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate";
334 334
 
335
-                $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%'));
335
+				$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%'));
336 336
 
337
-                return $spotter_array;
338
-        }
337
+				return $spotter_array;
338
+		}
339 339
 
340 340
 	public function deleteTrackerArchiveTrackData()
341 341
 	{
@@ -355,34 +355,34 @@  discard block
 block discarded – undo
355 355
 	}
356 356
 
357 357
 	/**
358
-        * Gets Minimal Live Tracker data
359
-        *
360
-        * @return Array the spotter information
361
-        *
362
-        */
363
-        public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
364
-        {
365
-                global $globalDBdriver, $globalLiveInterval;
366
-                date_default_timezone_set('UTC');
367
-
368
-                $filter_query = '';
369
-                if (isset($filter['source']) && !empty($filter['source'])) {
370
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
371
-                }
372
-                // Use spotter_output also ?
373
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
374
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
375
-                }
376
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
377
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
378
-                }
379
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
380
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
381
-                }
358
+	 * Gets Minimal Live Tracker data
359
+	 *
360
+	 * @return Array the spotter information
361
+	 *
362
+	 */
363
+		public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
364
+		{
365
+				global $globalDBdriver, $globalLiveInterval;
366
+				date_default_timezone_set('UTC');
382 367
 
383
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
384
-                if ($globalDBdriver == 'mysql') {
385
-                        /*
368
+				$filter_query = '';
369
+				if (isset($filter['source']) && !empty($filter['source'])) {
370
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
371
+				}
372
+				// Use spotter_output also ?
373
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
374
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
375
+				}
376
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
377
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
378
+				}
379
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
380
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
381
+				}
382
+
383
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
384
+				if ($globalDBdriver == 'mysql') {
385
+						/*
386 386
                         $query  = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk 
387 387
                     		    FROM tracker_archive 
388 388
                     		    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
@@ -401,56 +401,56 @@  discard block
 block discarded – undo
401 401
 				    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
402 402
 				    WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
403 403
                         	    '.$filter_query.' ORDER BY famtrackid';
404
-                } else {
405
-                        //$query  = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao';
406
-                        $query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
404
+				} else {
405
+						//$query  = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao';
406
+						$query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
407 407
                         	    FROM tracker_archive 
408 408
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
409 409
                         	    WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".'
410 410
                         	    '.$filter_query.' ORDER BY famtrackid';
411
-                }
412
-                //echo $query;
413
-                try {
414
-                        $sth = $this->db->prepare($query);
415
-                        $sth->execute();
416
-                } catch(PDOException $e) {
417
-                        echo $e->getMessage();
418
-                        die;
419
-                }
420
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
411
+				}
412
+				//echo $query;
413
+				try {
414
+						$sth = $this->db->prepare($query);
415
+						$sth->execute();
416
+				} catch(PDOException $e) {
417
+						echo $e->getMessage();
418
+						die;
419
+				}
420
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
421 421
 
422
-                return $spotter_array;
423
-        }
422
+				return $spotter_array;
423
+		}
424 424
 
425 425
 	/**
426
-        * Gets Minimal Live Tracker data
427
-        *
428
-        * @return Array the spotter information
429
-        *
430
-        */
431
-        public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
432
-        {
433
-                global $globalDBdriver, $globalLiveInterval;
434
-                date_default_timezone_set('UTC');
435
-
436
-                $filter_query = '';
437
-                if (isset($filter['source']) && !empty($filter['source'])) {
438
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
439
-                }
440
-                // Should use spotter_output also ?
441
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
442
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
443
-                }
444
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
445
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
446
-                }
447
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
448
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
449
-                }
426
+	 * Gets Minimal Live Tracker data
427
+	 *
428
+	 * @return Array the spotter information
429
+	 *
430
+	 */
431
+		public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
432
+		{
433
+				global $globalDBdriver, $globalLiveInterval;
434
+				date_default_timezone_set('UTC');
435
+
436
+				$filter_query = '';
437
+				if (isset($filter['source']) && !empty($filter['source'])) {
438
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
439
+				}
440
+				// Should use spotter_output also ?
441
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
442
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
443
+				}
444
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
445
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
446
+				}
447
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
448
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
449
+				}
450 450
 
451
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
452
-                if ($globalDBdriver == 'mysql') {
453
-                        /*
451
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
452
+				if ($globalDBdriver == 'mysql') {
453
+						/*
454 454
                         $query  = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk 
455 455
                     		    FROM tracker_archive 
456 456
                     		    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
@@ -461,95 +461,95 @@  discard block
 block discarded – undo
461 461
 				    WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
462 462
                         	    '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow';
463 463
 
464
-                } else {
465
-                        //$query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao';
466
-                       /*
464
+				} else {
465
+						//$query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao';
466
+					   /*
467 467
                         $query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
468 468
                         	    FROM tracker_archive_output 
469 469
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
470 470
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
471 471
                         	    '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow';
472 472
                         */
473
-                        $query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
473
+						$query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
474 474
                         	    FROM tracker_archive_output 
475 475
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
476 476
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
477 477
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
478 478
 //                        	    .' GROUP BY spotter_output.famtrackid, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
479 479
                         	    
480
-                }
481
-                //echo $query;
482
-                try {
483
-                        $sth = $this->db->prepare($query);
484
-                        $sth->execute();
485
-                } catch(PDOException $e) {
486
-                        echo $e->getMessage();
487
-                        die;
488
-                }
489
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
480
+				}
481
+				//echo $query;
482
+				try {
483
+						$sth = $this->db->prepare($query);
484
+						$sth->execute();
485
+				} catch(PDOException $e) {
486
+						echo $e->getMessage();
487
+						die;
488
+				}
489
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
490 490
 
491
-                return $spotter_array;
492
-        }
491
+				return $spotter_array;
492
+		}
493 493
 
494 494
 	 /**
495
-        * Gets count Live Tracker data
496
-        *
497
-        * @return Array the spotter information
498
-        *
499
-        */
500
-        public function getLiveTrackerCount($begindate,$enddate,$filter = array())
501
-        {
502
-                global $globalDBdriver, $globalLiveInterval;
503
-                date_default_timezone_set('UTC');
504
-
505
-                $filter_query = '';
506
-                if (isset($filter['source']) && !empty($filter['source'])) {
507
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
508
-                }
509
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
510
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
511
-                }
512
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
513
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
514
-                }
515
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
516
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
517
-                }
495
+	  * Gets count Live Tracker data
496
+	  *
497
+	  * @return Array the spotter information
498
+	  *
499
+	  */
500
+		public function getLiveTrackerCount($begindate,$enddate,$filter = array())
501
+		{
502
+				global $globalDBdriver, $globalLiveInterval;
503
+				date_default_timezone_set('UTC');
518 504
 
519
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
520
-                if ($globalDBdriver == 'mysql') {
505
+				$filter_query = '';
506
+				if (isset($filter['source']) && !empty($filter['source'])) {
507
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
508
+				}
509
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
510
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
511
+				}
512
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
513
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
514
+				}
515
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
516
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
517
+				}
518
+
519
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
520
+				if ($globalDBdriver == 'mysql') {
521 521
 			$query = 'SELECT COUNT(DISTINCT famtrackid) as nb 
522 522
 			FROM tracker_archive l 
523 523
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
524
-                } else {
524
+				} else {
525 525
 			$query = 'SELECT COUNT(DISTINCT famtrackid) as nb FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
526
-                }
527
-                //echo $query;
528
-                try {
529
-                        $sth = $this->db->prepare($query);
530
-                        $sth->execute();
531
-                } catch(PDOException $e) {
532
-                        echo $e->getMessage();
533
-                        die;
534
-                }
526
+				}
527
+				//echo $query;
528
+				try {
529
+						$sth = $this->db->prepare($query);
530
+						$sth->execute();
531
+				} catch(PDOException $e) {
532
+						echo $e->getMessage();
533
+						die;
534
+				}
535 535
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
536 536
 		$sth->closeCursor();
537
-                return $result['nb'];
537
+				return $result['nb'];
538 538
 
539
-        }
539
+		}
540 540
 
541 541
 
542 542
 
543 543
 	// tracker_archive_output
544 544
 	
545
-    /**
546
-    * Gets all the spotter information
547
-    *
548
-    * @return Array the spotter information
549
-    *
550
-    */
551
-    public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
552
-    {
545
+	/**
546
+	 * Gets all the spotter information
547
+	 *
548
+	 * @return Array the spotter information
549
+	 *
550
+	 */
551
+	public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
552
+	{
553 553
 	global $globalTimezone, $globalDBdriver;
554 554
 	require_once(dirname(__FILE__).'/class.Translation.php');
555 555
 	$Translation = new Translation($this->db);
@@ -563,159 +563,159 @@  discard block
 block discarded – undo
563 563
 	$filter_query = $this->getFilter($filters);
564 564
 	if ($q != "")
565 565
 	{
566
-	    if (!is_string($q))
567
-	    {
566
+		if (!is_string($q))
567
+		{
568 568
 		return false;
569
-	    } else {
569
+		} else {
570 570
 	        
571 571
 		$q_array = explode(" ", $q);
572 572
 		
573 573
 		foreach ($q_array as $q_item){
574
-		    $additional_query .= " AND (";
575
-		    $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
576
-		    $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
577
-		    $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR ";
578
-		    $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
579
-		    $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR ";
580
-		    $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR ";
581
-		    $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR ";
582
-		    $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
583
-		    $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR ";
584
-		    $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR ";
585
-		    $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR ";
586
-		    $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
587
-		    $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
588
-		    $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
589
-		    $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
590
-		    $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR ";
591
-		    $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR ";
592
-		    $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR ";
593
-		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
594
-		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
595
-		    $translate = $Translation->ident2icao($q_item);
596
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
597
-		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
598
-		    $additional_query .= ")";
574
+			$additional_query .= " AND (";
575
+			$additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
576
+			$additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
577
+			$additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR ";
578
+			$additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
579
+			$additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR ";
580
+			$additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR ";
581
+			$additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR ";
582
+			$additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
583
+			$additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR ";
584
+			$additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR ";
585
+			$additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR ";
586
+			$additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
587
+			$additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
588
+			$additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
589
+			$additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
590
+			$additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR ";
591
+			$additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR ";
592
+			$additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR ";
593
+			$additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
594
+			$additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
595
+			$translate = $Translation->ident2icao($q_item);
596
+			if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
597
+			$additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
598
+			$additional_query .= ")";
599
+		}
599 600
 		}
600
-	    }
601 601
 	}
602 602
 	
603 603
 	if ($registration != "")
604 604
 	{
605
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
606
-	    if (!is_string($registration))
607
-	    {
605
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
606
+		if (!is_string($registration))
607
+		{
608 608
 		return false;
609
-	    } else {
609
+		} else {
610 610
 		$additional_query .= " AND (tracker_archive_output.registration = '".$registration."')";
611
-	    }
611
+		}
612 612
 	}
613 613
 	
614 614
 	if ($aircraft_icao != "")
615 615
 	{
616
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
617
-	    if (!is_string($aircraft_icao))
618
-	    {
616
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
617
+		if (!is_string($aircraft_icao))
618
+		{
619 619
 		return false;
620
-	    } else {
620
+		} else {
621 621
 		$additional_query .= " AND (tracker_archive_output.aircraft_icao = '".$aircraft_icao."')";
622
-	    }
622
+		}
623 623
 	}
624 624
 	
625 625
 	if ($aircraft_manufacturer != "")
626 626
 	{
627
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
628
-	    if (!is_string($aircraft_manufacturer))
629
-	    {
627
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
628
+		if (!is_string($aircraft_manufacturer))
629
+		{
630 630
 		return false;
631
-	    } else {
631
+		} else {
632 632
 		$additional_query .= " AND (tracker_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
633
-	    }
633
+		}
634 634
 	}
635 635
 	
636 636
 	if ($highlights == "true")
637 637
 	{
638
-	    if (!is_string($highlights))
639
-	    {
638
+		if (!is_string($highlights))
639
+		{
640 640
 		return false;
641
-	    } else {
641
+		} else {
642 642
 		$additional_query .= " AND (tracker_archive_output.highlight <> '')";
643
-	    }
643
+		}
644 644
 	}
645 645
 	
646 646
 	if ($airline_icao != "")
647 647
 	{
648
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
649
-	    if (!is_string($airline_icao))
650
-	    {
648
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
649
+		if (!is_string($airline_icao))
650
+		{
651 651
 		return false;
652
-	    } else {
652
+		} else {
653 653
 		$additional_query .= " AND (tracker_archive_output.airline_icao = '".$airline_icao."')";
654
-	    }
654
+		}
655 655
 	}
656 656
 	
657 657
 	if ($airline_country != "")
658 658
 	{
659
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
660
-	    if (!is_string($airline_country))
661
-	    {
659
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
660
+		if (!is_string($airline_country))
661
+		{
662 662
 		return false;
663
-	    } else {
663
+		} else {
664 664
 		$additional_query .= " AND (tracker_archive_output.airline_country = '".$airline_country."')";
665
-	    }
665
+		}
666 666
 	}
667 667
 	
668 668
 	if ($airline_type != "")
669 669
 	{
670
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
671
-	    if (!is_string($airline_type))
672
-	    {
670
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
671
+		if (!is_string($airline_type))
672
+		{
673 673
 		return false;
674
-	    } else {
674
+		} else {
675 675
 		if ($airline_type == "passenger")
676 676
 		{
677
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')";
677
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')";
678 678
 		}
679 679
 		if ($airline_type == "cargo")
680 680
 		{
681
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')";
681
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')";
682 682
 		}
683 683
 		if ($airline_type == "military")
684 684
 		{
685
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'military')";
685
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'military')";
686
+		}
686 687
 		}
687
-	    }
688 688
 	}
689 689
 	
690 690
 	if ($airport != "")
691 691
 	{
692
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
693
-	    if (!is_string($airport))
694
-	    {
692
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
693
+		if (!is_string($airport))
694
+		{
695 695
 		return false;
696
-	    } else {
696
+		} else {
697 697
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_icao = '".$airport."') OR (tracker_archive_output.arrival_airport_icao = '".$airport."'))";
698
-	    }
698
+		}
699 699
 	}
700 700
 	
701 701
 	if ($airport_country != "")
702 702
 	{
703
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
704
-	    if (!is_string($airport_country))
705
-	    {
703
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
704
+		if (!is_string($airport_country))
705
+		{
706 706
 		return false;
707
-	    } else {
707
+		} else {
708 708
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_country = '".$airport_country."') OR (tracker_archive_output.arrival_airport_country = '".$airport_country."'))";
709
-	    }
709
+		}
710 710
 	}
711 711
     
712 712
 	if ($callsign != "")
713 713
 	{
714
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
715
-	    if (!is_string($callsign))
716
-	    {
714
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
715
+		if (!is_string($callsign))
716
+		{
717 717
 		return false;
718
-	    } else {
718
+		} else {
719 719
 		$translate = $Translation->ident2icao($callsign);
720 720
 		if ($translate != $callsign) {
721 721
 			$additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)";
@@ -723,99 +723,99 @@  discard block
 block discarded – undo
723 723
 		} else {
724 724
 			$additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')";
725 725
 		}
726
-	    }
726
+		}
727 727
 	}
728 728
 
729 729
 	if ($owner != "")
730 730
 	{
731
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
732
-	    if (!is_string($owner))
733
-	    {
731
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
732
+		if (!is_string($owner))
733
+		{
734 734
 		return false;
735
-	    } else {
735
+		} else {
736 736
 		$additional_query .= " AND (tracker_archive_output.owner_name = '".$owner."')";
737
-	    }
737
+		}
738 738
 	}
739 739
 
740 740
 	if ($pilot_name != "")
741 741
 	{
742
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
743
-	    if (!is_string($pilot_name))
744
-	    {
742
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
743
+		if (!is_string($pilot_name))
744
+		{
745 745
 		return false;
746
-	    } else {
746
+		} else {
747 747
 		$additional_query .= " AND (tracker_archive_output.pilot_name = '".$pilot_name."')";
748
-	    }
748
+		}
749 749
 	}
750 750
 	
751 751
 	if ($pilot_id != "")
752 752
 	{
753
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
754
-	    if (!is_string($pilot_id))
755
-	    {
753
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
754
+		if (!is_string($pilot_id))
755
+		{
756 756
 		return false;
757
-	    } else {
757
+		} else {
758 758
 		$additional_query .= " AND (tracker_archive_output.pilot_id = '".$pilot_id."')";
759
-	    }
759
+		}
760 760
 	}
761 761
 	
762 762
 	if ($departure_airport_route != "")
763 763
 	{
764
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
765
-	    if (!is_string($departure_airport_route))
766
-	    {
764
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
765
+		if (!is_string($departure_airport_route))
766
+		{
767 767
 		return false;
768
-	    } else {
768
+		} else {
769 769
 		$additional_query .= " AND (tracker_archive_output.departure_airport_icao = '".$departure_airport_route."')";
770
-	    }
770
+		}
771 771
 	}
772 772
 	
773 773
 	if ($arrival_airport_route != "")
774 774
 	{
775
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
776
-	    if (!is_string($arrival_airport_route))
777
-	    {
775
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
776
+		if (!is_string($arrival_airport_route))
777
+		{
778 778
 		return false;
779
-	    } else {
779
+		} else {
780 780
 		$additional_query .= " AND (tracker_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
781
-	    }
781
+		}
782 782
 	}
783 783
 	
784 784
 	if ($altitude != "")
785 785
 	{
786
-	    $altitude_array = explode(",", $altitude);
786
+		$altitude_array = explode(",", $altitude);
787 787
 	    
788
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
789
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
788
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
789
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
790 790
 	    
791 791
 
792
-	    if ($altitude_array[1] != "")
793
-	    {                
792
+		if ($altitude_array[1] != "")
793
+		{                
794 794
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
795 795
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
796 796
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
797
-	    } else {
797
+		} else {
798 798
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
799 799
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
800
-	    }
800
+		}
801 801
 	}
802 802
 	
803 803
 	if ($date_posted != "")
804 804
 	{
805
-	    $date_array = explode(",", $date_posted);
805
+		$date_array = explode(",", $date_posted);
806 806
 	    
807
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
808
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
807
+		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
808
+		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
809 809
 	    
810
-	    if ($globalTimezone != '') {
810
+		if ($globalTimezone != '') {
811 811
 		date_default_timezone_set($globalTimezone);
812 812
 		$datetime = new DateTime();
813 813
 		$offset = $datetime->format('P');
814
-	    } else $offset = '+00:00';
814
+		} else $offset = '+00:00';
815 815
 
816 816
 
817
-	    if ($date_array[1] != "")
818
-	    {                
817
+		if ($date_array[1] != "")
818
+		{                
819 819
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
820 820
 		$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
821 821
 		if ($globalDBdriver == 'mysql') {
@@ -823,28 +823,28 @@  discard block
 block discarded – undo
823 823
 		} else {
824 824
 			$additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) ";
825 825
 		}
826
-	    } else {
826
+		} else {
827 827
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
828
-                if ($globalDBdriver == 'mysql') {
828
+				if ($globalDBdriver == 'mysql') {
829 829
 			$additional_query .= " AND TIMESTAMP(CONVERT_TZ(tracker_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' ";
830 830
 		} else {
831 831
 			$additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) ";
832 832
 		}
833
-	    }
833
+		}
834 834
 	}
835 835
 	
836 836
 	if ($limit != "")
837 837
 	{
838
-	    $limit_array = explode(",", $limit);
838
+		$limit_array = explode(",", $limit);
839 839
 	    
840
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
841
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
840
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
841
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
842 842
 	    
843
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
844
-	    {
843
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
844
+		{
845 845
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
846 846
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
847
-	    }
847
+		}
848 848
 	}
849 849
 	
850 850
 
@@ -875,33 +875,33 @@  discard block
 block discarded – undo
875 875
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query);
876 876
 
877 877
 	return $spotter_array;
878
-    }
878
+	}
879 879
 
880
-    public function deleteTrackerArchiveData()
881
-    {
880
+	public function deleteTrackerArchiveData()
881
+	{
882 882
 		global $globalArchiveKeepMonths, $globalDBdriver;
883
-                date_default_timezone_set('UTC');
884
-                if ($globalDBdriver == 'mysql') {
883
+				date_default_timezone_set('UTC');
884
+				if ($globalDBdriver == 'mysql') {
885 885
 			$query = 'DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
886 886
 		} else {
887 887
 			$query = "DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
888 888
 		}
889
-                try {
890
-                        $sth = $this->db->prepare($query);
891
-                        $sth->execute();
892
-                } catch(PDOException $e) {
893
-                        return "error";
894
-                }
889
+				try {
890
+						$sth = $this->db->prepare($query);
891
+						$sth->execute();
892
+				} catch(PDOException $e) {
893
+						return "error";
894
+				}
895 895
 	}
896 896
 
897
-    /**
898
-    * Gets all the spotter information based on the callsign
899
-    *
900
-    * @return Array the spotter information
901
-    *
902
-    */
903
-    public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '')
904
-    {
897
+	/**
898
+	 * Gets all the spotter information based on the callsign
899
+	 *
900
+	 * @return Array the spotter information
901
+	 *
902
+	 */
903
+	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '')
904
+	{
905 905
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
906 906
 	
907 907
 	date_default_timezone_set('UTC');
@@ -913,35 +913,35 @@  discard block
 block discarded – undo
913 913
 	
914 914
 	if ($ident != "")
915 915
 	{
916
-	    if (!is_string($ident))
917
-	    {
916
+		if (!is_string($ident))
917
+		{
918 918
 		return false;
919
-	    } else {
919
+		} else {
920 920
 		$additional_query = " AND (tracker_archive_output.ident = :ident)";
921 921
 		$query_values = array(':ident' => $ident);
922
-	    }
922
+		}
923 923
 	}
924 924
 	
925 925
 	if ($limit != "")
926 926
 	{
927
-	    $limit_array = explode(",", $limit);
927
+		$limit_array = explode(",", $limit);
928 928
 	    
929
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
930
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
929
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
930
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
931 931
 	    
932
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
933
-	    {
932
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
933
+		{
934 934
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
935 935
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
936
-	    }
936
+		}
937 937
 	}
938 938
 
939 939
 	if ($sort != "")
940 940
 	{
941
-	    $search_orderby_array = $Tracker->getOrderBy();
942
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
941
+		$search_orderby_array = $Tracker->getOrderBy();
942
+		$orderby_query = $search_orderby_array[$sort]['sql'];
943 943
 	} else {
944
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
944
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
945 945
 	}
946 946
 
947 947
 	$query = $global_query." WHERE tracker_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -949,17 +949,17 @@  discard block
 block discarded – undo
949 949
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
950 950
 
951 951
 	return $spotter_array;
952
-    }
952
+	}
953 953
 
954 954
 
955
-    /**
956
-    * Gets all the spotter information based on the owner
957
-    *
958
-    * @return Array the spotter information
959
-    *
960
-    */
961
-    public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
962
-    {
955
+	/**
956
+	 * Gets all the spotter information based on the owner
957
+	 *
958
+	 * @return Array the spotter information
959
+	 *
960
+	 */
961
+	public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
962
+	{
963 963
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
964 964
 	
965 965
 	date_default_timezone_set('UTC');
@@ -972,35 +972,35 @@  discard block
 block discarded – undo
972 972
 	
973 973
 	if ($owner != "")
974 974
 	{
975
-	    if (!is_string($owner))
976
-	    {
975
+		if (!is_string($owner))
976
+		{
977 977
 		return false;
978
-	    } else {
978
+		} else {
979 979
 		$additional_query = " AND (tracker_archive_output.owner_name = :owner)";
980 980
 		$query_values = array(':owner' => $owner);
981
-	    }
981
+		}
982 982
 	}
983 983
 	
984 984
 	if ($limit != "")
985 985
 	{
986
-	    $limit_array = explode(",", $limit);
986
+		$limit_array = explode(",", $limit);
987 987
 	    
988
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
989
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
988
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
989
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
990 990
 	    
991
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
992
-	    {
991
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
992
+		{
993 993
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
994 994
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
995
-	    }
995
+		}
996 996
 	}
997 997
 
998 998
 	if ($sort != "")
999 999
 	{
1000
-	    $search_orderby_array = $Tracker->getOrderBy();
1001
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1000
+		$search_orderby_array = $Tracker->getOrderBy();
1001
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1002 1002
 	} else {
1003
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1003
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1004 1004
 	}
1005 1005
 
1006 1006
 	$query = $global_query.$filter_query." tracker_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query;
@@ -1008,16 +1008,16 @@  discard block
 block discarded – undo
1008 1008
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1009 1009
 
1010 1010
 	return $spotter_array;
1011
-    }
1012
-
1013
-    /**
1014
-    * Gets all the spotter information based on the pilot
1015
-    *
1016
-    * @return Array the spotter information
1017
-    *
1018
-    */
1019
-    public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1020
-    {
1011
+	}
1012
+
1013
+	/**
1014
+	 * Gets all the spotter information based on the pilot
1015
+	 *
1016
+	 * @return Array the spotter information
1017
+	 *
1018
+	 */
1019
+	public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1020
+	{
1021 1021
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
1022 1022
 	
1023 1023
 	date_default_timezone_set('UTC');
@@ -1036,24 +1036,24 @@  discard block
 block discarded – undo
1036 1036
 	
1037 1037
 	if ($limit != "")
1038 1038
 	{
1039
-	    $limit_array = explode(",", $limit);
1039
+		$limit_array = explode(",", $limit);
1040 1040
 	    
1041
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1042
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1041
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1042
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1043 1043
 	    
1044
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1045
-	    {
1044
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1045
+		{
1046 1046
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1047 1047
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1048
-	    }
1048
+		}
1049 1049
 	}
1050 1050
 
1051 1051
 	if ($sort != "")
1052 1052
 	{
1053
-	    $search_orderby_array = $Tracker->getOrderBy();
1054
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1053
+		$search_orderby_array = $Tracker->getOrderBy();
1054
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1055 1055
 	} else {
1056
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1056
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1057 1057
 	}
1058 1058
 
1059 1059
 	$query = $global_query.$filter_query." tracker_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1061,16 +1061,16 @@  discard block
 block discarded – undo
1061 1061
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1062 1062
 
1063 1063
 	return $spotter_array;
1064
-    }
1065
-
1066
-    /**
1067
-    * Gets all number of flight over countries
1068
-    *
1069
-    * @return Array the airline country list
1070
-    *
1071
-    */
1072
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1073
-    {
1064
+	}
1065
+
1066
+	/**
1067
+	 * Gets all number of flight over countries
1068
+	 *
1069
+	 * @return Array the airline country list
1070
+	 *
1071
+	 */
1072
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1073
+	{
1074 1074
 	global $globalDBdriver;
1075 1075
 	/*
1076 1076
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1080,14 +1080,14 @@  discard block
 block discarded – undo
1080 1080
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1081 1081
 		    FROM countries c, tracker_archive s
1082 1082
 		    WHERE c.iso2 = s.over_country ";
1083
-                if ($olderthanmonths > 0) {
1084
-            		if ($globalDBdriver == 'mysql') {
1083
+				if ($olderthanmonths > 0) {
1084
+					if ($globalDBdriver == 'mysql') {
1085 1085
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1086 1086
 			} else {
1087 1087
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1088 1088
 			}
1089 1089
 		}
1090
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1090
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1091 1091
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1092 1092
 	if ($limit) $query .= " LIMIT 0,10";
1093 1093
       
@@ -1100,23 +1100,23 @@  discard block
 block discarded – undo
1100 1100
         
1101 1101
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1102 1102
 	{
1103
-	    $temp_array['flight_count'] = $row['nb'];
1104
-	    $temp_array['flight_country'] = $row['name'];
1105
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1106
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1107
-	    $flight_array[] = $temp_array;
1103
+		$temp_array['flight_count'] = $row['nb'];
1104
+		$temp_array['flight_country'] = $row['name'];
1105
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1106
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1107
+		$flight_array[] = $temp_array;
1108 1108
 	}
1109 1109
 	return $flight_array;
1110
-    }
1111
-
1112
-    /**
1113
-    * Gets all number of flight over countries
1114
-    *
1115
-    * @return Array the airline country list
1116
-    *
1117
-    */
1118
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1119
-    {
1110
+	}
1111
+
1112
+	/**
1113
+	 * Gets all number of flight over countries
1114
+	 *
1115
+	 * @return Array the airline country list
1116
+	 *
1117
+	 */
1118
+	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1119
+	{
1120 1120
 	global $globalDBdriver;
1121 1121
 	/*
1122 1122
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1126,14 +1126,14 @@  discard block
 block discarded – undo
1126 1126
 	$query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb
1127 1127
 		    FROM countries c, tracker_archive s, spotter_output o
1128 1128
 		    WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.famtrackid = s.famtrackid ";
1129
-                if ($olderthanmonths > 0) {
1130
-            		if ($globalDBdriver == 'mysql') {
1129
+				if ($olderthanmonths > 0) {
1130
+					if ($globalDBdriver == 'mysql') {
1131 1131
 				$query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1132 1132
 			} else {
1133 1133
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1134 1134
 			}
1135 1135
 		}
1136
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1136
+				if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1137 1137
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1138 1138
 	if ($limit) $query .= " LIMIT 0,10";
1139 1139
       
@@ -1146,24 +1146,24 @@  discard block
 block discarded – undo
1146 1146
         
1147 1147
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1148 1148
 	{
1149
-	    $temp_array['airline_icao'] = $row['airline_icao'];
1150
-	    $temp_array['flight_count'] = $row['nb'];
1151
-	    $temp_array['flight_country'] = $row['name'];
1152
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1153
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1154
-	    $flight_array[] = $temp_array;
1149
+		$temp_array['airline_icao'] = $row['airline_icao'];
1150
+		$temp_array['flight_count'] = $row['nb'];
1151
+		$temp_array['flight_country'] = $row['name'];
1152
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1153
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1154
+		$flight_array[] = $temp_array;
1155 1155
 	}
1156 1156
 	return $flight_array;
1157
-    }
1158
-
1159
-    /**
1160
-    * Gets last spotter information based on a particular callsign
1161
-    *
1162
-    * @return Array the spotter information
1163
-    *
1164
-    */
1165
-    public function getDateArchiveTrackerDataById($id,$date)
1166
-    {
1157
+	}
1158
+
1159
+	/**
1160
+	 * Gets last spotter information based on a particular callsign
1161
+	 *
1162
+	 * @return Array the spotter information
1163
+	 *
1164
+	 */
1165
+	public function getDateArchiveTrackerDataById($id,$date)
1166
+	{
1167 1167
 	$Tracker = new Tracker($this->db);
1168 1168
 	date_default_timezone_set('UTC');
1169 1169
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1171,16 +1171,16 @@  discard block
 block discarded – undo
1171 1171
 	$date = date('c',$date);
1172 1172
 	$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date));
1173 1173
 	return $spotter_array;
1174
-    }
1175
-
1176
-    /**
1177
-    * Gets all the spotter information based on a particular callsign
1178
-    *
1179
-    * @return Array the spotter information
1180
-    *
1181
-    */
1182
-    public function getDateArchiveTrackerDataByIdent($ident,$date)
1183
-    {
1174
+	}
1175
+
1176
+	/**
1177
+	 * Gets all the spotter information based on a particular callsign
1178
+	 *
1179
+	 * @return Array the spotter information
1180
+	 *
1181
+	 */
1182
+	public function getDateArchiveTrackerDataByIdent($ident,$date)
1183
+	{
1184 1184
 	$Tracker = new Tracker($this->db);
1185 1185
 	date_default_timezone_set('UTC');
1186 1186
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1188,16 +1188,16 @@  discard block
 block discarded – undo
1188 1188
 	$date = date('c',$date);
1189 1189
 	$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1190 1190
 	return $spotter_array;
1191
-    }
1192
-
1193
-    /**
1194
-    * Gets all the spotter information based on the airport
1195
-    *
1196
-    * @return Array the spotter information
1197
-    *
1198
-    */
1199
-    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1200
-    {
1191
+	}
1192
+
1193
+	/**
1194
+	 * Gets all the spotter information based on the airport
1195
+	 *
1196
+	 * @return Array the spotter information
1197
+	 *
1198
+	 */
1199
+	public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1200
+	{
1201 1201
 	global $global_query;
1202 1202
 	$Tracker = new Tracker($this->db);
1203 1203
 	date_default_timezone_set('UTC');
@@ -1208,35 +1208,35 @@  discard block
 block discarded – undo
1208 1208
 	
1209 1209
 	if ($airport != "")
1210 1210
 	{
1211
-	    if (!is_string($airport))
1212
-	    {
1211
+		if (!is_string($airport))
1212
+		{
1213 1213
 		return false;
1214
-	    } else {
1214
+		} else {
1215 1215
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_icao = :airport) OR (tracker_archive_output.arrival_airport_icao = :airport))";
1216 1216
 		$query_values = array(':airport' => $airport);
1217
-	    }
1217
+		}
1218 1218
 	}
1219 1219
 	
1220 1220
 	if ($limit != "")
1221 1221
 	{
1222
-	    $limit_array = explode(",", $limit);
1222
+		$limit_array = explode(",", $limit);
1223 1223
 	    
1224
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1225
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1224
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1225
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1226 1226
 	    
1227
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1228
-	    {
1227
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1228
+		{
1229 1229
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1230 1230
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1231
-	    }
1231
+		}
1232 1232
 	}
1233 1233
 	
1234 1234
 	if ($sort != "")
1235 1235
 	{
1236
-	    $search_orderby_array = $Tracker->getOrderBy();
1237
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1236
+		$search_orderby_array = $Tracker->getOrderBy();
1237
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1238 1238
 	} else {
1239
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1239
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1240 1240
 	}
1241 1241
 
1242 1242
 	$query = $global_query.$filter_query." tracker_archive_output.ident <> '' ".$additional_query." AND ((tracker_archive_output.departure_airport_icao <> 'NA') AND (tracker_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1244,6 +1244,6 @@  discard block
 block discarded – undo
1244 1244
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1245 1245
 
1246 1246
 	return $spotter_array;
1247
-    }
1247
+	}
1248 1248
 }
1249 1249
 ?>
1250 1250
\ No newline at end of file
Please login to merge, or discard this patch.
install/class.update_db.php 1 patch
Indentation   +357 added lines, -357 removed lines patch added patch discarded remove patch
@@ -85,38 +85,38 @@  discard block
 block discarded – undo
85 85
 		try {
86 86
 			//$Connection = new Connection();
87 87
 			$sth = $Connection->db->prepare($query);
88
-                        $sth->execute(array(':source' => $database_file));
89
-                } catch(PDOException $e) {
90
-                        return "error : ".$e->getMessage();
91
-                }
88
+						$sth->execute(array(':source' => $database_file));
89
+				} catch(PDOException $e) {
90
+						return "error : ".$e->getMessage();
91
+				}
92 92
 
93
-    		if ($globalDebug) echo " - Add routes to DB -";
94
-    		update_db::connect_sqlite($database_file);
93
+			if ($globalDebug) echo " - Add routes to DB -";
94
+			update_db::connect_sqlite($database_file);
95 95
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
96 96
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
97 97
 		try {
98
-                        $sth = update_db::$db_sqlite->prepare($query);
99
-                        $sth->execute();
100
-                } catch(PDOException $e) {
101
-                        return "error : ".$e->getMessage();
102
-                }
98
+						$sth = update_db::$db_sqlite->prepare($query);
99
+						$sth->execute();
100
+				} catch(PDOException $e) {
101
+						return "error : ".$e->getMessage();
102
+				}
103 103
 		//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
104 104
 		$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
105 105
 		$Connection = new Connection();
106 106
 		$sth_dest = $Connection->db->prepare($query_dest);
107 107
 		try {
108 108
 			if ($globalTransaction) $Connection->db->beginTransaction();
109
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
109
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
110 110
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
111 111
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
112 112
 				$sth_dest->execute($query_dest_values);
113
-            		}
113
+					}
114 114
 			if ($globalTransaction) $Connection->db->commit();
115 115
 		} catch(PDOException $e) {
116 116
 			if ($globalTransaction) $Connection->db->rollBack(); 
117 117
 			return "error : ".$e->getMessage();
118 118
 		}
119
-                return '';
119
+				return '';
120 120
 	}
121 121
 	public static function retrieve_route_oneworld($database_file) {
122 122
 		global $globalDebug, $globalTransaction;
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 		try {
128 128
 			//$Connection = new Connection();
129 129
 			$sth = $Connection->db->prepare($query);
130
-                        $sth->execute(array(':source' => 'oneworld'));
131
-                } catch(PDOException $e) {
132
-                        return "error : ".$e->getMessage();
133
-                }
130
+						$sth->execute(array(':source' => 'oneworld'));
131
+				} catch(PDOException $e) {
132
+						return "error : ".$e->getMessage();
133
+				}
134 134
 
135
-    		if ($globalDebug) echo " - Add routes to DB -";
135
+			if ($globalDebug) echo " - Add routes to DB -";
136 136
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
137 137
 		$Spotter = new Spotter();
138 138
 		if ($fh = fopen($database_file,"r")) {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			}
157 157
 			if ($globalTransaction) $Connection->db->commit();
158 158
 		}
159
-                return '';
159
+				return '';
160 160
 	}
161 161
 	
162 162
 	public static function retrieve_route_skyteam($database_file) {
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 		try {
169 169
 			//$Connection = new Connection();
170 170
 			$sth = $Connection->db->prepare($query);
171
-                        $sth->execute(array(':source' => 'skyteam'));
172
-                } catch(PDOException $e) {
173
-                        return "error : ".$e->getMessage();
174
-                }
171
+						$sth->execute(array(':source' => 'skyteam'));
172
+				} catch(PDOException $e) {
173
+						return "error : ".$e->getMessage();
174
+				}
175 175
 
176
-    		if ($globalDebug) echo " - Add routes to DB -";
176
+			if ($globalDebug) echo " - Add routes to DB -";
177 177
 
178 178
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
179 179
 		$Spotter = new Spotter();
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				return "error : ".$e->getMessage();
200 200
 			}
201 201
 		}
202
-                return '';
202
+				return '';
203 203
 	}
204 204
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
205 205
 		global $globalTransaction;
@@ -208,27 +208,27 @@  discard block
 block discarded – undo
208 208
 		try {
209 209
 			$Connection = new Connection();
210 210
 			$sth = $Connection->db->prepare($query);
211
-                        $sth->execute(array(':source' => $database_file));
212
-                } catch(PDOException $e) {
213
-                        return "error : ".$e->getMessage();
214
-                }
211
+						$sth->execute(array(':source' => $database_file));
212
+				} catch(PDOException $e) {
213
+						return "error : ".$e->getMessage();
214
+				}
215 215
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
216 216
 		try {
217 217
 			$Connection = new Connection();
218 218
 			$sth = $Connection->db->prepare($query);
219
-                        $sth->execute(array(':source' => $database_file));
220
-                } catch(PDOException $e) {
221
-                        return "error : ".$e->getMessage();
222
-                }
219
+						$sth->execute(array(':source' => $database_file));
220
+				} catch(PDOException $e) {
221
+						return "error : ".$e->getMessage();
222
+				}
223 223
 
224
-    		update_db::connect_sqlite($database_file);
224
+			update_db::connect_sqlite($database_file);
225 225
 		$query = 'select * from Aircraft';
226 226
 		try {
227
-                        $sth = update_db::$db_sqlite->prepare($query);
228
-                        $sth->execute();
229
-                } catch(PDOException $e) {
230
-                        return "error : ".$e->getMessage();
231
-                }
227
+						$sth = update_db::$db_sqlite->prepare($query);
228
+						$sth->execute();
229
+				} catch(PDOException $e) {
230
+						return "error : ".$e->getMessage();
231
+				}
232 232
 		//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
233 233
 		$query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)';
234 234
 		
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
240 240
 		try {
241 241
 			if ($globalTransaction) $Connection->db->beginTransaction();
242
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
242
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
243 243
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
244 244
 				if ($values['UserString4'] == 'M') $type = 'military';
245 245
 				else $type = null;
246 246
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
247 247
 				$sth_dest->execute($query_dest_values);
248 248
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
249
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
250
-				    $sth_dest_owner->execute($query_dest_owner_values);
249
+					$query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
250
+					$sth_dest_owner->execute($query_dest_owner_values);
251 251
 				}
252
-            		}
252
+					}
253 253
 			if ($globalTransaction) $Connection->db->commit();
254 254
 		} catch(PDOException $e) {
255 255
 			return "error : ".$e->getMessage();
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 		try {
261 261
 			$Connection = new Connection();
262 262
 			$sth = $Connection->db->prepare($query);
263
-                        $sth->execute(array(':source' => $database_file));
264
-                } catch(PDOException $e) {
265
-                        return "error : ".$e->getMessage();
266
-                }
263
+						$sth->execute(array(':source' => $database_file));
264
+				} catch(PDOException $e) {
265
+						return "error : ".$e->getMessage();
266
+				}
267 267
 		return '';
268 268
 	}
269 269
 
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 		try {
276 276
 			$Connection = new Connection();
277 277
 			$sth = $Connection->db->prepare($query);
278
-                        $sth->execute(array(':source' => $database_file));
279
-                } catch(PDOException $e) {
280
-                        return "error : ".$e->getMessage();
281
-                }
278
+						$sth->execute(array(':source' => $database_file));
279
+				} catch(PDOException $e) {
280
+						return "error : ".$e->getMessage();
281
+				}
282 282
 		
283 283
 		if ($fh = fopen($database_file,"r")) {
284 284
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -288,26 +288,26 @@  discard block
 block discarded – undo
288 288
 			$sth_dest = $Connection->db->prepare($query_dest);
289 289
 			try {
290 290
 				if ($globalTransaction) $Connection->db->beginTransaction();
291
-            			while (!feof($fh)) {
292
-            				$values = array();
293
-            				$line = $Common->hex2str(fgets($fh,9999));
291
+						while (!feof($fh)) {
292
+							$values = array();
293
+							$line = $Common->hex2str(fgets($fh,9999));
294 294
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
295
-            				$values['ModeS'] = substr($line,0,6);
296
-            				$values['Registration'] = trim(substr($line,69,6));
297
-            				$aircraft_name = trim(substr($line,48,6));
298
-            				// Check if we can find ICAO, else set it to GLID
299
-            				$aircraft_name_split = explode(' ',$aircraft_name);
300
-            				$search_more = '';
301
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
302
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
303
-            				$sth_search = $Connection->db->prepare($query_search);
295
+							$values['ModeS'] = substr($line,0,6);
296
+							$values['Registration'] = trim(substr($line,69,6));
297
+							$aircraft_name = trim(substr($line,48,6));
298
+							// Check if we can find ICAO, else set it to GLID
299
+							$aircraft_name_split = explode(' ',$aircraft_name);
300
+							$search_more = '';
301
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
302
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
303
+							$sth_search = $Connection->db->prepare($query_search);
304 304
 					try {
305
-                                    		$sth_search->execute();
306
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
307
-	            				//if (count($result) > 0) {
308
-	            				if (isset($result['icao']) && $result['icao'] != '') {
309
-	            				    $values['ICAOTypeCode'] = $result['icao'];
310
-	            				} 
305
+											$sth_search->execute();
306
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
307
+								//if (count($result) > 0) {
308
+								if (isset($result['icao']) && $result['icao'] != '') {
309
+									$values['ICAOTypeCode'] = $result['icao'];
310
+								} 
311 311
 					} catch(PDOException $e) {
312 312
 						return "error : ".$e->getMessage();
313 313
 					}
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 		try {
331 331
 			$Connection = new Connection();
332 332
 			$sth = $Connection->db->prepare($query);
333
-                        $sth->execute(array(':source' => $database_file));
334
-                } catch(PDOException $e) {
335
-                        return "error : ".$e->getMessage();
336
-                }
333
+						$sth->execute(array(':source' => $database_file));
334
+				} catch(PDOException $e) {
335
+						return "error : ".$e->getMessage();
336
+				}
337 337
 		return '';
338 338
 	}
339 339
 
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 		try {
345 345
 			$Connection = new Connection();
346 346
 			$sth = $Connection->db->prepare($query);
347
-                        $sth->execute(array(':source' => $database_file));
348
-                } catch(PDOException $e) {
349
-                        return "error : ".$e->getMessage();
350
-                }
347
+						$sth->execute(array(':source' => $database_file));
348
+				} catch(PDOException $e) {
349
+						return "error : ".$e->getMessage();
350
+				}
351 351
 		
352 352
 		if ($fh = fopen($database_file,"r")) {
353 353
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -358,25 +358,25 @@  discard block
 block discarded – undo
358 358
 			try {
359 359
 				if ($globalTransaction) $Connection->db->beginTransaction();
360 360
 				$tmp = fgetcsv($fh,9999,',',"'");
361
-            			while (!feof($fh)) {
362
-            				$line = fgetcsv($fh,9999,',',"'");
361
+						while (!feof($fh)) {
362
+							$line = fgetcsv($fh,9999,',',"'");
363 363
             				
364 364
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
365 365
 					//print_r($line);
366
-            				$values['ModeS'] = $line[1];
367
-            				$values['Registration'] = $line[3];
368
-            				$values['ICAOTypeCode'] = '';
369
-            				$aircraft_name = $line[2];
370
-            				// Check if we can find ICAO, else set it to GLID
371
-            				$aircraft_name_split = explode(' ',$aircraft_name);
372
-            				$search_more = '';
373
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
374
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
375
-            				$sth_search = $Connection->db->prepare($query_search);
366
+							$values['ModeS'] = $line[1];
367
+							$values['Registration'] = $line[3];
368
+							$values['ICAOTypeCode'] = '';
369
+							$aircraft_name = $line[2];
370
+							// Check if we can find ICAO, else set it to GLID
371
+							$aircraft_name_split = explode(' ',$aircraft_name);
372
+							$search_more = '';
373
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
374
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
375
+							$sth_search = $Connection->db->prepare($query_search);
376 376
 					try {
377
-                                    		$sth_search->execute();
378
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
379
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
377
+											$sth_search->execute();
378
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
379
+								if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
380 380
 					} catch(PDOException $e) {
381 381
 						return "error : ".$e->getMessage();
382 382
 					}
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
 		try {
400 400
 			$Connection = new Connection();
401 401
 			$sth = $Connection->db->prepare($query);
402
-                        $sth->execute(array(':source' => $database_file));
403
-                } catch(PDOException $e) {
404
-                        return "error : ".$e->getMessage();
405
-                }
402
+						$sth->execute(array(':source' => $database_file));
403
+				} catch(PDOException $e) {
404
+						return "error : ".$e->getMessage();
405
+				}
406 406
 		return '';
407 407
 	}
408 408
 
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
 		try {
414 414
 			$Connection = new Connection();
415 415
 			$sth = $Connection->db->prepare($query);
416
-                        $sth->execute(array(':source' => $database_file));
417
-                } catch(PDOException $e) {
418
-                        return "error : ".$e->getMessage();
419
-                }
416
+						$sth->execute(array(':source' => $database_file));
417
+				} catch(PDOException $e) {
418
+						return "error : ".$e->getMessage();
419
+				}
420 420
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
421 421
 		$Spotter = new Spotter();
422 422
 		if ($fh = fopen($database_file,"r")) {
423 423
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
424 424
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
425
-		        $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
425
+				$query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
426 426
 		        
427 427
 			$Connection = new Connection();
428 428
 			$sth_dest = $Connection->db->prepare($query_dest);
@@ -430,126 +430,126 @@  discard block
 block discarded – undo
430 430
 			try {
431 431
 				if ($globalTransaction) $Connection->db->beginTransaction();
432 432
 				$tmp = fgetcsv($fh,9999,',','"');
433
-            			while (!feof($fh)) {
434
-            				$line = fgetcsv($fh,9999,',','"');
435
-            				$values = array();
436
-            				//print_r($line);
437
-            				if ($country == 'F') {
438
-            				    $values['registration'] = $line[0];
439
-            				    $values['base'] = $line[4];
440
-            				    $values['owner'] = $line[5];
441
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
442
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
443
-					    $values['cancel'] = $line[7];
433
+						while (!feof($fh)) {
434
+							$line = fgetcsv($fh,9999,',','"');
435
+							$values = array();
436
+							//print_r($line);
437
+							if ($country == 'F') {
438
+								$values['registration'] = $line[0];
439
+								$values['base'] = $line[4];
440
+								$values['owner'] = $line[5];
441
+								if ($line[6] == '') $values['date_first_reg'] = null;
442
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
443
+						$values['cancel'] = $line[7];
444 444
 					} elseif ($country == 'EI') {
445
-					    // TODO : add modeS & reg to aircraft_modes
446
-            				    $values['registration'] = $line[0];
447
-            				    $values['base'] = $line[3];
448
-            				    $values['owner'] = $line[2];
449
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
450
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
451
-					    $values['cancel'] = '';
452
-					    $values['modes'] = $line[7];
453
-					    $values['icao'] = $line[8];
445
+						// TODO : add modeS & reg to aircraft_modes
446
+								$values['registration'] = $line[0];
447
+								$values['base'] = $line[3];
448
+								$values['owner'] = $line[2];
449
+								if ($line[1] == '') $values['date_first_reg'] = null;
450
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
451
+						$values['cancel'] = '';
452
+						$values['modes'] = $line[7];
453
+						$values['icao'] = $line[8];
454 454
 					    
455 455
 					} elseif ($country == 'HB') {
456
-					    // TODO : add modeS & reg to aircraft_modes
457
-            				    $values['registration'] = $line[0];
458
-            				    $values['base'] = null;
459
-            				    $values['owner'] = $line[5];
460
-            				    $values['date_first_reg'] = null;
461
-					    $values['cancel'] = '';
462
-					    $values['modes'] = $line[4];
463
-					    $values['icao'] = $line[7];
456
+						// TODO : add modeS & reg to aircraft_modes
457
+								$values['registration'] = $line[0];
458
+								$values['base'] = null;
459
+								$values['owner'] = $line[5];
460
+								$values['date_first_reg'] = null;
461
+						$values['cancel'] = '';
462
+						$values['modes'] = $line[4];
463
+						$values['icao'] = $line[7];
464 464
 					} elseif ($country == 'OK') {
465
-					    // TODO : add modeS & reg to aircraft_modes
466
-            				    $values['registration'] = $line[3];
467
-            				    $values['base'] = null;
468
-            				    $values['owner'] = $line[5];
469
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
470
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
471
-					    $values['cancel'] = '';
465
+						// TODO : add modeS & reg to aircraft_modes
466
+								$values['registration'] = $line[3];
467
+								$values['base'] = null;
468
+								$values['owner'] = $line[5];
469
+								if ($line[18] == '') $values['date_first_reg'] = null;
470
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
471
+						$values['cancel'] = '';
472 472
 					} elseif ($country == 'VH') {
473
-					    // TODO : add modeS & reg to aircraft_modes
474
-            				    $values['registration'] = $line[0];
475
-            				    $values['base'] = null;
476
-            				    $values['owner'] = $line[12];
477
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
478
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
479
-
480
-					    $values['cancel'] = $line[39];
473
+						// TODO : add modeS & reg to aircraft_modes
474
+								$values['registration'] = $line[0];
475
+								$values['base'] = null;
476
+								$values['owner'] = $line[12];
477
+								if ($line[28] == '') $values['date_first_reg'] = null;
478
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
479
+
480
+						$values['cancel'] = $line[39];
481 481
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
482
-            				    $values['registration'] = $line[0];
483
-            				    $values['base'] = null;
484
-            				    $values['owner'] = $line[4];
485
-            				    $values['date_first_reg'] = null;
486
-					    $values['cancel'] = '';
482
+								$values['registration'] = $line[0];
483
+								$values['base'] = null;
484
+								$values['owner'] = $line[4];
485
+								$values['date_first_reg'] = null;
486
+						$values['cancel'] = '';
487 487
 					} elseif ($country == 'CC') {
488
-            				    $values['registration'] = $line[0];
489
-            				    $values['base'] = null;
490
-            				    $values['owner'] = $line[6];
491
-            				    $values['date_first_reg'] = null;
492
-					    $values['cancel'] = '';
488
+								$values['registration'] = $line[0];
489
+								$values['base'] = null;
490
+								$values['owner'] = $line[6];
491
+								$values['date_first_reg'] = null;
492
+						$values['cancel'] = '';
493 493
 					} elseif ($country == 'HJ') {
494
-            				    $values['registration'] = $line[0];
495
-            				    $values['base'] = null;
496
-            				    $values['owner'] = $line[8];
497
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
498
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
499
-					    $values['cancel'] = '';
494
+								$values['registration'] = $line[0];
495
+								$values['base'] = null;
496
+								$values['owner'] = $line[8];
497
+								if ($line[7] == '') $values['date_first_reg'] = null;
498
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
499
+						$values['cancel'] = '';
500 500
 					} elseif ($country == 'PP') {
501
-            				    $values['registration'] = $line[0];
502
-            				    $values['base'] = null;
503
-            				    $values['owner'] = $line[4];
504
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
505
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
506
-					    $values['cancel'] = $line[7];
501
+								$values['registration'] = $line[0];
502
+								$values['base'] = null;
503
+								$values['owner'] = $line[4];
504
+								if ($line[6] == '') $values['date_first_reg'] = null;
505
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
506
+						$values['cancel'] = $line[7];
507 507
 					} elseif ($country == 'E7') {
508
-            				    $values['registration'] = $line[0];
509
-            				    $values['base'] = null;
510
-            				    $values['owner'] = $line[4];
511
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
512
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
513
-					    $values['cancel'] = '';
508
+								$values['registration'] = $line[0];
509
+								$values['base'] = null;
510
+								$values['owner'] = $line[4];
511
+								if ($line[5] == '') $values['date_first_reg'] = null;
512
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
513
+						$values['cancel'] = '';
514 514
 					} elseif ($country == '8Q') {
515
-            				    $values['registration'] = $line[0];
516
-            				    $values['base'] = null;
517
-            				    $values['owner'] = $line[3];
518
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
519
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
520
-					    $values['cancel'] = '';
515
+								$values['registration'] = $line[0];
516
+								$values['base'] = null;
517
+								$values['owner'] = $line[3];
518
+								if ($line[7] == '') $values['date_first_reg'] = null;
519
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
520
+						$values['cancel'] = '';
521 521
 					} elseif ($country == 'ZK') {
522
-            				    $values['registration'] = $line[0];
523
-            				    $values['base'] = null;
524
-            				    $values['owner'] = $line[3];
525
-            				    $values['date_first_reg'] = null;
526
-					    $values['cancel'] = '';
527
-					    $values['modes'] = $line[5];
528
-					    $values['icao'] = $line[9];
522
+								$values['registration'] = $line[0];
523
+								$values['base'] = null;
524
+								$values['owner'] = $line[3];
525
+								$values['date_first_reg'] = null;
526
+						$values['cancel'] = '';
527
+						$values['modes'] = $line[5];
528
+						$values['icao'] = $line[9];
529 529
 					} elseif ($country == 'M') {
530
-            				    $values['registration'] = $line[0];
531
-            				    $values['base'] = null;
532
-            				    $values['owner'] = $line[6];
533
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
534
-					    $values['cancel'] = date("Y-m-d",strtotime($line[8]));
535
-					    $values['modes'] = $line[4];
536
-					    $values['icao'] = $line[10];
530
+								$values['registration'] = $line[0];
531
+								$values['base'] = null;
532
+								$values['owner'] = $line[6];
533
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
534
+						$values['cancel'] = date("Y-m-d",strtotime($line[8]));
535
+						$values['modes'] = $line[4];
536
+						$values['icao'] = $line[10];
537 537
 					} elseif ($country == 'OY') {
538
-            				    $values['registration'] = $line[0];
539
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
540
-					    $values['modes'] = $line[5];
541
-					    $values['icao'] = $line[6];
538
+								$values['registration'] = $line[0];
539
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
540
+						$values['modes'] = $line[5];
541
+						$values['icao'] = $line[6];
542 542
 					} elseif ($country == 'PH') {
543
-            				    $values['registration'] = $line[0];
544
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
545
-					    $values['modes'] = $line[4];
546
-					    $values['icao'] = $line[5];
543
+								$values['registration'] = $line[0];
544
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
545
+						$values['modes'] = $line[4];
546
+						$values['icao'] = $line[5];
547 547
 					} elseif ($country == 'OM' || $country == 'TF') {
548
-            				    $values['registration'] = $line[0];
549
-            				    $values['base'] = null;
550
-            				    $values['owner'] = $line[3];
551
-            				    $values['date_first_reg'] = null;
552
-					    $values['cancel'] = '';
548
+								$values['registration'] = $line[0];
549
+								$values['base'] = null;
550
+								$values['owner'] = $line[3];
551
+								$values['date_first_reg'] = null;
552
+						$values['cancel'] = '';
553 553
 					}
554 554
 					if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) {
555 555
 						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
                         return "error : ".$e->getMessage();
683 683
                 }
684 684
                 */
685
-                /*
685
+				/*
686 686
 		$query = 'ALTER TABLE airport DROP INDEX icaoidx';
687 687
 		try {
688 688
 			$Connection = new Connection();
@@ -927,10 +927,10 @@  discard block
 block discarded – undo
927 927
 		try {
928 928
 			$Connection = new Connection();
929 929
 			$sth = $Connection->db->prepare($query);
930
-                        $sth->execute(array(':source' => 'translation.csv'));
931
-                } catch(PDOException $e) {
932
-                        return "error : ".$e->getMessage();
933
-                }
930
+						$sth->execute(array(':source' => 'translation.csv'));
931
+				} catch(PDOException $e) {
932
+						return "error : ".$e->getMessage();
933
+				}
934 934
 
935 935
 		
936 936
 		//update_db::unzip($out_file);
@@ -949,21 +949,21 @@  discard block
 block discarded – undo
949 949
 					$data = $row;
950 950
 					$operator = $data[2];
951 951
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
952
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
953
-                                                //echo substr($operator, 0, 2)."\n";;
954
-                                                if (count($airline_array) > 0) {
952
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
953
+												//echo substr($operator, 0, 2)."\n";;
954
+												if (count($airline_array) > 0) {
955 955
 							//print_r($airline_array);
956 956
 							$operator = $airline_array[0]['icao'].substr($operator,2);
957
-                                                }
958
-                                        }
957
+												}
958
+										}
959 959
 					
960 960
 					$operator_correct = $data[3];
961 961
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
962
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
963
-                                                if (count($airline_array) > 0) {
964
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
965
-                                            	}
966
-                                        }
962
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
963
+												if (count($airline_array) > 0) {
964
+													$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
965
+												}
966
+										}
967 967
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
968 968
 					try {
969 969
 						$sth = $Connection->db->prepare($query);
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 			//$Connection->db->commit();
978 978
 		}
979 979
 		return '';
980
-        }
980
+		}
981 981
 	
982 982
 	public static function translation_fam() {
983 983
 		global $tmp_dir, $globalTransaction;
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 			//$Connection->db->commit();
1016 1016
 		}
1017 1017
 		return '';
1018
-        }
1018
+		}
1019 1019
 
1020 1020
 	/*
1021 1021
 	* This function use FAA public data.
@@ -1027,19 +1027,19 @@  discard block
 block discarded – undo
1027 1027
 		try {
1028 1028
 			$Connection = new Connection();
1029 1029
 			$sth = $Connection->db->prepare($query);
1030
-                        $sth->execute(array(':source' => 'website_faa'));
1031
-                } catch(PDOException $e) {
1032
-                        return "error : ".$e->getMessage();
1033
-                }
1030
+						$sth->execute(array(':source' => 'website_faa'));
1031
+				} catch(PDOException $e) {
1032
+						return "error : ".$e->getMessage();
1033
+				}
1034 1034
 
1035 1035
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source";
1036 1036
 		try {
1037 1037
 			$Connection = new Connection();
1038 1038
 			$sth = $Connection->db->prepare($query);
1039
-                        $sth->execute(array(':source' => 'website_faa'));
1040
-                } catch(PDOException $e) {
1041
-                        return "error : ".$e->getMessage();
1042
-                }
1039
+						$sth->execute(array(':source' => 'website_faa'));
1040
+				} catch(PDOException $e) {
1041
+						return "error : ".$e->getMessage();
1042
+				}
1043 1043
 
1044 1044
 		$delimiter = ",";
1045 1045
 		$mfr = array();
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 		}
1208 1208
 		*/
1209 1209
 		return '';
1210
-        }
1210
+		}
1211 1211
         
1212 1212
 	public static function owner_fam() {
1213 1213
 		global $tmp_dir, $globalTransaction;
@@ -1215,10 +1215,10 @@  discard block
 block discarded – undo
1215 1215
 		try {
1216 1216
 			$Connection = new Connection();
1217 1217
 			$sth = $Connection->db->prepare($query);
1218
-                        $sth->execute(array(':source' => 'website_fam'));
1219
-                } catch(PDOException $e) {
1220
-                        return "error : ".$e->getMessage();
1221
-                }
1218
+						$sth->execute(array(':source' => 'website_fam'));
1219
+				} catch(PDOException $e) {
1220
+						return "error : ".$e->getMessage();
1221
+				}
1222 1222
 
1223 1223
 		$delimiter = "\t";
1224 1224
 		$Connection = new Connection();
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 			if ($globalTransaction) $Connection->db->commit();
1245 1245
 		}
1246 1246
 		return '';
1247
-        }
1247
+		}
1248 1248
 
1249 1249
 	public static function routes_fam() {
1250 1250
 		global $tmp_dir, $globalTransaction, $globalDebug;
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 			if ($globalTransaction) $Connection->db->commit();
1287 1287
 		}
1288 1288
 		return '';
1289
-        }
1289
+		}
1290 1290
 
1291 1291
 	public static function marine_identity_fam() {
1292 1292
 		global $tmp_dir, $globalTransaction;
@@ -1294,10 +1294,10 @@  discard block
 block discarded – undo
1294 1294
 		try {
1295 1295
 			$Connection = new Connection();
1296 1296
 			$sth = $Connection->db->prepare($query);
1297
-                        $sth->execute();
1298
-                } catch(PDOException $e) {
1299
-                        return "error : ".$e->getMessage();
1300
-                }
1297
+						$sth->execute();
1298
+				} catch(PDOException $e) {
1299
+						return "error : ".$e->getMessage();
1300
+				}
1301 1301
 
1302 1302
 		
1303 1303
 		//update_db::unzip($out_file);
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 			if ($globalTransaction) $Connection->db->commit();
1328 1328
 		}
1329 1329
 		return '';
1330
-        }
1330
+		}
1331 1331
 
1332 1332
 	public static function satellite_fam() {
1333 1333
 		global $tmp_dir, $globalTransaction;
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
 			if ($globalTransaction) $Connection->db->commit();
1399 1399
 		}
1400 1400
 		return '';
1401
-        }
1401
+		}
1402 1402
 
1403 1403
 	public static function tle($filename,$tletype) {
1404 1404
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1409,10 +1409,10 @@  discard block
 block discarded – undo
1409 1409
 		try {
1410 1410
 			$Connection = new Connection();
1411 1411
 			$sth = $Connection->db->prepare($query);
1412
-                        $sth->execute(array(':source' => $filename));
1413
-                } catch(PDOException $e) {
1414
-                        return "error : ".$e->getMessage();
1415
-                }
1412
+						$sth->execute(array(':source' => $filename));
1413
+				} catch(PDOException $e) {
1414
+						return "error : ".$e->getMessage();
1415
+				}
1416 1416
 		
1417 1417
 		$Connection = new Connection();
1418 1418
 		if (($handle = fopen($filename, 'r')) !== FALSE)
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
 			//$Connection->db->commit();
1448 1448
 		}
1449 1449
 		return '';
1450
-        }
1450
+		}
1451 1451
 
1452 1452
 	public static function satellite_ucsdb($filename) {
1453 1453
 		global $tmp_dir, $globalTransaction;
@@ -1706,11 +1706,11 @@  discard block
 block discarded – undo
1706 1706
 							try {
1707 1707
 								$sth = $Connection->db->prepare($query);
1708 1708
 								$sth->execute(array(
1709
-								    ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1710
-								    ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1711
-								    ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1712
-								    ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1713
-								    )
1709
+									':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1710
+									':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1711
+									':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1712
+									':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1713
+									)
1714 1714
 								);
1715 1715
 							} catch(PDOException $e) {
1716 1716
 								return "error : ".$e->getMessage();
@@ -1734,13 +1734,13 @@  discard block
 block discarded – undo
1734 1734
 			//$Connection->db->commit();
1735 1735
 		}
1736 1736
 		return '';
1737
-        }
1737
+		}
1738 1738
 
1739 1739
 	/**
1740
-        * Convert a HTML table to an array
1741
-        * @param String $data HTML page
1742
-        * @return Array array of the tables in HTML page
1743
-        */
1740
+	 * Convert a HTML table to an array
1741
+	 * @param String $data HTML page
1742
+	 * @return Array array of the tables in HTML page
1743
+	 */
1744 1744
 /*
1745 1745
         private static function table2array($data) {
1746 1746
                 $html = str_get_html($data);
@@ -1770,11 +1770,11 @@  discard block
 block discarded – undo
1770 1770
                 return(array_filter($tabledata));
1771 1771
         }
1772 1772
 */
1773
-       /**
1774
-        * Get data from form result
1775
-        * @param String $url form URL
1776
-        * @return String the result
1777
-        */
1773
+	   /**
1774
+	    * Get data from form result
1775
+	    * @param String $url form URL
1776
+	    * @return String the result
1777
+	    */
1778 1778
 /*
1779 1779
         private static function getData($url) {
1780 1780
                 $ch = curl_init();
@@ -1924,7 +1924,7 @@  discard block
 block discarded – undo
1924 1924
 			if ($globalTransaction) $Connection->db->commit();
1925 1925
 		}
1926 1926
 		return '';
1927
-        }
1927
+		}
1928 1928
 	
1929 1929
 	public static function update_airspace() {
1930 1930
 		global $tmp_dir, $globalDBdriver;
@@ -1934,11 +1934,11 @@  discard block
 block discarded – undo
1934 1934
 			$query = 'DROP TABLE airspace';
1935 1935
 			try {
1936 1936
 				$sth = $Connection->db->prepare($query);
1937
-                    		$sth->execute();
1938
-	                } catch(PDOException $e) {
1937
+							$sth->execute();
1938
+					} catch(PDOException $e) {
1939 1939
 				return "error : ".$e->getMessage();
1940
-	                }
1941
-	        }
1940
+					}
1941
+			}
1942 1942
 
1943 1943
 
1944 1944
 		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
@@ -2003,10 +2003,10 @@  discard block
 block discarded – undo
2003 2003
 			$query = 'DROP TABLE countries';
2004 2004
 			try {
2005 2005
 				$sth = $Connection->db->prepare($query);
2006
-            	        	$sth->execute();
2007
-	                } catch(PDOException $e) {
2008
-    	                	echo "error : ".$e->getMessage();
2009
-	                }
2006
+							$sth->execute();
2007
+					} catch(PDOException $e) {
2008
+							echo "error : ".$e->getMessage();
2009
+					}
2010 2010
 		}
2011 2011
 		if ($globalDBdriver == 'mysql') {
2012 2012
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -2465,7 +2465,7 @@  discard block
 block discarded – undo
2465 2465
 						$error = update_db::airlines_fam();
2466 2466
 						update_db::insert_airlines_version($airlines_md5);
2467 2467
 					} else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed.";
2468
-			    } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
2468
+				} else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
2469 2469
 			} elseif ($globalDebug) echo "No update.";
2470 2470
 		} else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed.";
2471 2471
 		if ($error != '') {
@@ -2956,10 +2956,10 @@  discard block
 block discarded – undo
2956 2956
 		try {
2957 2957
 			$Connection = new Connection();
2958 2958
 			$sth = $Connection->db->prepare($query);
2959
-                        $sth->execute();
2960
-                } catch(PDOException $e) {
2961
-                        return "error : ".$e->getMessage();
2962
-                }
2959
+						$sth->execute();
2960
+				} catch(PDOException $e) {
2961
+						return "error : ".$e->getMessage();
2962
+				}
2963 2963
 
2964 2964
 		$error = '';
2965 2965
 		if ($globalDebug) echo "Notam : Download...";
@@ -3015,8 +3015,8 @@  discard block
 block discarded – undo
3015 3015
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
3016 3016
 					$data['permanent'] = 0;
3017 3017
 				} else {
3018
-				    $data['date_end'] = NULL;
3019
-				    $data['permanent'] = 1;
3018
+					$data['date_end'] = NULL;
3019
+					$data['permanent'] = 1;
3020 3020
 				}
3021 3021
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
3022 3022
 				$NOTAM = new NOTAM();
@@ -3090,13 +3090,13 @@  discard block
 block discarded – undo
3090 3090
 		try {
3091 3091
 			$Connection = new Connection();
3092 3092
 			$sth = $Connection->db->prepare($query);
3093
-                        $sth->execute();
3094
-                } catch(PDOException $e) {
3095
-                        return "error : ".$e->getMessage();
3096
-                }
3097
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3098
-                if ($row['nb'] > 0) return false;
3099
-                else return true;
3093
+						$sth->execute();
3094
+				} catch(PDOException $e) {
3095
+						return "error : ".$e->getMessage();
3096
+				}
3097
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3098
+				if ($row['nb'] > 0) return false;
3099
+				else return true;
3100 3100
 	}
3101 3101
 
3102 3102
 	public static function insert_last_update() {
@@ -3105,10 +3105,10 @@  discard block
 block discarded – undo
3105 3105
 		try {
3106 3106
 			$Connection = new Connection();
3107 3107
 			$sth = $Connection->db->prepare($query);
3108
-                        $sth->execute();
3109
-                } catch(PDOException $e) {
3110
-                        return "error : ".$e->getMessage();
3111
-                }
3108
+						$sth->execute();
3109
+				} catch(PDOException $e) {
3110
+						return "error : ".$e->getMessage();
3111
+				}
3112 3112
 	}
3113 3113
 
3114 3114
 	public static function check_airspace_version($version) {
@@ -3116,13 +3116,13 @@  discard block
 block discarded – undo
3116 3116
 		try {
3117 3117
 			$Connection = new Connection();
3118 3118
 			$sth = $Connection->db->prepare($query);
3119
-                        $sth->execute(array(':version' => $version));
3120
-                } catch(PDOException $e) {
3121
-                        return "error : ".$e->getMessage();
3122
-                }
3123
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3124
-                if ($row['nb'] > 0) return true;
3125
-                else return false;
3119
+						$sth->execute(array(':version' => $version));
3120
+				} catch(PDOException $e) {
3121
+						return "error : ".$e->getMessage();
3122
+				}
3123
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3124
+				if ($row['nb'] > 0) return true;
3125
+				else return false;
3126 3126
 	}
3127 3127
 
3128 3128
 	public static function check_geoid_version($version) {
@@ -3130,13 +3130,13 @@  discard block
 block discarded – undo
3130 3130
 		try {
3131 3131
 			$Connection = new Connection();
3132 3132
 			$sth = $Connection->db->prepare($query);
3133
-                        $sth->execute(array(':version' => $version));
3134
-                } catch(PDOException $e) {
3135
-                        return "error : ".$e->getMessage();
3136
-                }
3137
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3138
-                if ($row['nb'] > 0) return true;
3139
-                else return false;
3133
+						$sth->execute(array(':version' => $version));
3134
+				} catch(PDOException $e) {
3135
+						return "error : ".$e->getMessage();
3136
+				}
3137
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3138
+				if ($row['nb'] > 0) return true;
3139
+				else return false;
3140 3140
 	}
3141 3141
 
3142 3142
 	public static function check_marine_identity_version($version) {
@@ -3237,10 +3237,10 @@  discard block
 block discarded – undo
3237 3237
 		try {
3238 3238
 			$Connection = new Connection();
3239 3239
 			$sth = $Connection->db->prepare($query);
3240
-                        $sth->execute(array(':version' => $version));
3241
-                } catch(PDOException $e) {
3242
-                        return "error : ".$e->getMessage();
3243
-                }
3240
+						$sth->execute(array(':version' => $version));
3241
+				} catch(PDOException $e) {
3242
+						return "error : ".$e->getMessage();
3243
+				}
3244 3244
 	}
3245 3245
 
3246 3246
 	public static function insert_marine_identity_version($version) {
@@ -3277,13 +3277,13 @@  discard block
 block discarded – undo
3277 3277
 		try {
3278 3278
 			$Connection = new Connection();
3279 3279
 			$sth = $Connection->db->prepare($query);
3280
-                        $sth->execute();
3281
-                } catch(PDOException $e) {
3282
-                        return "error : ".$e->getMessage();
3283
-                }
3284
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3285
-                if ($row['nb'] > 0) return false;
3286
-                else return true;
3280
+						$sth->execute();
3281
+				} catch(PDOException $e) {
3282
+						return "error : ".$e->getMessage();
3283
+				}
3284
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3285
+				if ($row['nb'] > 0) return false;
3286
+				else return true;
3287 3287
 	}
3288 3288
 
3289 3289
 	public static function insert_last_notam_update() {
@@ -3292,10 +3292,10 @@  discard block
 block discarded – undo
3292 3292
 		try {
3293 3293
 			$Connection = new Connection();
3294 3294
 			$sth = $Connection->db->prepare($query);
3295
-                        $sth->execute();
3296
-                } catch(PDOException $e) {
3297
-                        return "error : ".$e->getMessage();
3298
-                }
3295
+						$sth->execute();
3296
+				} catch(PDOException $e) {
3297
+						return "error : ".$e->getMessage();
3298
+				}
3299 3299
 	}
3300 3300
 
3301 3301
 	public static function check_last_airspace_update() {
@@ -3308,13 +3308,13 @@  discard block
 block discarded – undo
3308 3308
 		try {
3309 3309
 			$Connection = new Connection();
3310 3310
 			$sth = $Connection->db->prepare($query);
3311
-                        $sth->execute();
3312
-                } catch(PDOException $e) {
3313
-                        return "error : ".$e->getMessage();
3314
-                }
3315
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3316
-                if ($row['nb'] > 0) return false;
3317
-                else return true;
3311
+						$sth->execute();
3312
+				} catch(PDOException $e) {
3313
+						return "error : ".$e->getMessage();
3314
+				}
3315
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3316
+				if ($row['nb'] > 0) return false;
3317
+				else return true;
3318 3318
 	}
3319 3319
 
3320 3320
 	public static function insert_last_airspace_update() {
@@ -3323,10 +3323,10 @@  discard block
 block discarded – undo
3323 3323
 		try {
3324 3324
 			$Connection = new Connection();
3325 3325
 			$sth = $Connection->db->prepare($query);
3326
-                        $sth->execute();
3327
-                } catch(PDOException $e) {
3328
-                        return "error : ".$e->getMessage();
3329
-                }
3326
+						$sth->execute();
3327
+				} catch(PDOException $e) {
3328
+						return "error : ".$e->getMessage();
3329
+				}
3330 3330
 	}
3331 3331
 
3332 3332
 	public static function check_last_geoid_update() {
@@ -3339,13 +3339,13 @@  discard block
 block discarded – undo
3339 3339
 		try {
3340 3340
 			$Connection = new Connection();
3341 3341
 			$sth = $Connection->db->prepare($query);
3342
-                        $sth->execute();
3343
-                } catch(PDOException $e) {
3344
-                        return "error : ".$e->getMessage();
3345
-                }
3346
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3347
-                if ($row['nb'] > 0) return false;
3348
-                else return true;
3342
+						$sth->execute();
3343
+				} catch(PDOException $e) {
3344
+						return "error : ".$e->getMessage();
3345
+				}
3346
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3347
+				if ($row['nb'] > 0) return false;
3348
+				else return true;
3349 3349
 	}
3350 3350
 
3351 3351
 	public static function insert_last_geoid_update() {
@@ -3354,10 +3354,10 @@  discard block
 block discarded – undo
3354 3354
 		try {
3355 3355
 			$Connection = new Connection();
3356 3356
 			$sth = $Connection->db->prepare($query);
3357
-                        $sth->execute();
3358
-                } catch(PDOException $e) {
3359
-                        return "error : ".$e->getMessage();
3360
-                }
3357
+						$sth->execute();
3358
+				} catch(PDOException $e) {
3359
+						return "error : ".$e->getMessage();
3360
+				}
3361 3361
 	}
3362 3362
 
3363 3363
 	public static function check_last_owner_update() {
@@ -3463,13 +3463,13 @@  discard block
 block discarded – undo
3463 3463
 		try {
3464 3464
 			$Connection = new Connection();
3465 3465
 			$sth = $Connection->db->prepare($query);
3466
-                        $sth->execute();
3467
-                } catch(PDOException $e) {
3468
-                        return "error : ".$e->getMessage();
3469
-                }
3470
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3471
-                if ($row['nb'] > 0) return false;
3472
-                else return true;
3466
+						$sth->execute();
3467
+				} catch(PDOException $e) {
3468
+						return "error : ".$e->getMessage();
3469
+				}
3470
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3471
+				if ($row['nb'] > 0) return false;
3472
+				else return true;
3473 3473
 	}
3474 3474
 
3475 3475
 	public static function insert_last_schedules_update() {
@@ -3649,10 +3649,10 @@  discard block
 block discarded – undo
3649 3649
 		try {
3650 3650
 			$Connection = new Connection();
3651 3651
 			$sth = $Connection->db->prepare($query);
3652
-                        $sth->execute();
3653
-                } catch(PDOException $e) {
3654
-                        return "error : ".$e->getMessage();
3655
-                }
3652
+						$sth->execute();
3653
+				} catch(PDOException $e) {
3654
+						return "error : ".$e->getMessage();
3655
+				}
3656 3656
 	}
3657 3657
 	public static function delete_duplicateowner() {
3658 3658
 		global $globalDBdriver;
@@ -3664,10 +3664,10 @@  discard block
 block discarded – undo
3664 3664
 		try {
3665 3665
 			$Connection = new Connection();
3666 3666
 			$sth = $Connection->db->prepare($query);
3667
-                        $sth->execute();
3668
-                } catch(PDOException $e) {
3669
-                        return "error : ".$e->getMessage();
3670
-                }
3667
+						$sth->execute();
3668
+				} catch(PDOException $e) {
3669
+						return "error : ".$e->getMessage();
3670
+				}
3671 3671
 	}
3672 3672
 	
3673 3673
 	public static function update_all() {
Please login to merge, or discard this patch.
require/class.Scheduler.php 1 patch
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 	}
29 29
 
30 30
 	/**
31
-	* Add schedule data to database
32
-	* @param String $ident aircraft ident
33
-	* @param String $departure_airport_icao departure airport icao
34
-	* @param String $departure_airport_time departure airport time
35
-	* @param String $arrival_airport_icao arrival airport icao
36
-	* @param String $arrival_airport_time arrival airport time
31
+	 * Add schedule data to database
32
+	 * @param String $ident aircraft ident
33
+	 * @param String $departure_airport_icao departure airport icao
34
+	 * @param String $departure_airport_time departure airport time
35
+	 * @param String $arrival_airport_icao arrival airport icao
36
+	 * @param String $arrival_airport_time arrival airport time
37 37
 	/ @param String $source source of data
38
-	*/
38
+	 */
39 39
 	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
40 40
 		date_default_timezone_set('UTC');
41 41
 		$date = date("Y-m-d H:i:s",time());
@@ -51,18 +51,18 @@  discard block
 block discarded – undo
51 51
 		}
52 52
 		if ($sth->fetchColumn() > 0) {
53 53
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
54
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
55
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
54
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
55
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
56 56
 			} elseif ($arrival_airport_time == '') {
57
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
58
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
57
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
58
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
59 59
 			} elseif ($departure_airport_time == '') {
60
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
61
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
60
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
61
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
62 62
 			} else {
63
-			    //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
64
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
65
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
63
+				//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
64
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
65
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
66 66
 			}
67 67
 			try {
68 68
 				$sth = $this->db->prepare($query);
@@ -149,15 +149,15 @@  discard block
 block discarded – undo
149 149
 	*/
150 150
 	public function checkSchedule($ident) {
151 151
 		global $globalDBdriver;
152
-	        //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
153
-	        if ($globalDBdriver == 'mysql') {
152
+			//$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
153
+			if ($globalDBdriver == 'mysql') {
154 154
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident AND ((date_added BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND DATE(NOW()) and date_modified IS NULL) OR (date_modified BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()))) LIMIT 1";
155 155
 		} else {
156 156
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident 
157 157
 			AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL)
158 158
 			     OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1";
159 159
 		}
160
-	        $query_values = array(':ident' => $ident);
160
+			$query_values = array(':ident' => $ident);
161 161
 		 try {
162 162
 			$sth = $this->db->prepare($query);
163 163
 			$sth->execute($query_values);
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	/**
173
-	* Get flight info from Air France
174
-	* @param String $callsign The callsign
175
-	* @param String $date date we want flight number info
176
-	* @param String $carrier IATA code
177
-	* @return Flight departure and arrival airports and time
178
-	*/
173
+	 * Get flight info from Air France
174
+	 * @param String $callsign The callsign
175
+	 * @param String $date date we want flight number info
176
+	 * @param String $carrier IATA code
177
+	 * @return Flight departure and arrival airports and time
178
+	 */
179 179
 	public function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
180 180
 		$Common = new Common();
181 181
 		$check_date = new Datetime($date);
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 	}
212 212
 
213 213
 	/**
214
-	* Get flight info from EasyJet
215
-	* @param String $callsign The callsign
216
-	* @param String $date date we want flight number info
217
-	* @return Flight departure and arrival airports and time
218
-	*/
214
+	 * Get flight info from EasyJet
215
+	 * @param String $callsign The callsign
216
+	 * @param String $date date we want flight number info
217
+	 * @return Flight departure and arrival airports and time
218
+	 */
219 219
 	private function getEasyJet($callsign, $date = 'NOW') {
220 220
 		global $globalTimezone;
221 221
 		$Common = new Common();
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	}
240 240
 
241 241
 	/**
242
-	* Get flight info from Ryanair
243
-	* @param String $callsign The callsign
244
-	* @return Flight departure and arrival airports and time
245
-	*/
242
+	 * Get flight info from Ryanair
243
+	 * @param String $callsign The callsign
244
+	 * @return Flight departure and arrival airports and time
245
+	 */
246 246
 	private function getRyanair($callsign) {
247 247
 		$Common = new Common();
248 248
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 	}
266 266
 
267 267
 	/**
268
-	* Get flight info from Swiss
269
-	* @param String $callsign The callsign
270
-	* @return Flight departure and arrival airports and time
271
-	*/
268
+	 * Get flight info from Swiss
269
+	 * @param String $callsign The callsign
270
+	 * @return Flight departure and arrival airports and time
271
+	 */
272 272
 	private function getSwiss($callsign) {
273 273
 		$Common = new Common();
274 274
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 	}
298 298
 	
299 299
 	/**
300
-	* Get flight info from British Airways API
301
-	* @param String $callsign The callsign
302
-	* @param String $date date we want flight number info
303
-	* @return Flight departure and arrival airports and time
304
-	*/
300
+	 * Get flight info from British Airways API
301
+	 * @param String $callsign The callsign
302
+	 * @param String $date date we want flight number info
303
+	 * @return Flight departure and arrival airports and time
304
+	 */
305 305
 	public function getBritishAirways($callsign, $date = 'NOW') {
306 306
 		global $globalBritishAirwaysKey;
307 307
 		$Common = new Common();
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
 	}
326 326
 
327 327
 	/**
328
-	* Get flight info from Lutfhansa API
329
-	* @param String $callsign The callsign
330
-	* @param String $date date we want flight number info
331
-	* @return Flight departure and arrival airports and time
332
-	*/
328
+	 * Get flight info from Lutfhansa API
329
+	 * @param String $callsign The callsign
330
+	 * @param String $date date we want flight number info
331
+	 * @return Flight departure and arrival airports and time
332
+	 */
333 333
 	public function getLufthansa($callsign, $date = 'NOW') {
334 334
 		global $globalLufthansaKey;
335 335
 		$Common = new Common();
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
 	}
360 360
 
361 361
 	/**
362
-	* Get flight info from Transavia API
363
-	* @param String $callsign The callsign
364
-	* @param String $date date we want flight number info
365
-	* @return Flight departure and arrival airports and time
366
-	*/
362
+	 * Get flight info from Transavia API
363
+	 * @param String $callsign The callsign
364
+	 * @param String $date date we want flight number info
365
+	 * @return Flight departure and arrival airports and time
366
+	 */
367 367
 	public function getTransavia($callsign, $date = 'NOW') {
368 368
 		global $globalTransaviaKey;
369 369
 		$Common = new Common();
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
 	}
390 390
 
391 391
 	/**
392
-	* Get flight info from Tunisair
393
-	* @param String $callsign The callsign
394
-	* @return Flight departure and arrival airports and time
395
-	*/
392
+	 * Get flight info from Tunisair
393
+	 * @param String $callsign The callsign
394
+	 * @return Flight departure and arrival airports and time
395
+	 */
396 396
 	public function getTunisair($callsign) {
397 397
 		$Common = new Common();
398 398
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -409,10 +409,10 @@  discard block
 block discarded – undo
409 409
 	}
410 410
 
411 411
 	/**
412
-	* Get flight info from Vueling
413
-	* @param String $callsign The callsign
414
-	* @return Flight departure and arrival airports and time
415
-	*/
412
+	 * Get flight info from Vueling
413
+	 * @param String $callsign The callsign
414
+	 * @return Flight departure and arrival airports and time
415
+	 */
416 416
 	public function getVueling($callsign,$date = 'NOW') {
417 417
 		$Common = new Common();
418 418
 		$check_date = new Datetime($date);
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
 	}
435 435
 
436 436
 	/**
437
-	* Get flight info from Iberia
438
-	* @param String $callsign The callsign
439
-	* @param String $date date we want flight number info
440
-	* @return Flight departure and arrival airports and time
441
-	*/
437
+	 * Get flight info from Iberia
438
+	 * @param String $callsign The callsign
439
+	 * @param String $date date we want flight number info
440
+	 * @return Flight departure and arrival airports and time
441
+	 */
442 442
 	public function getIberia($callsign, $date = 'NOW') {
443 443
 		$Common = new Common();
444 444
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 	}
469 469
 
470 470
 	/**
471
-	* Get flight info from Star Alliance
472
-	* @param String $callsign The callsign
473
-	* @param String $date date we want flight number info
474
-	* @return Flight departure and arrival airports and time
475
-	*/
471
+	 * Get flight info from Star Alliance
472
+	 * @param String $callsign The callsign
473
+	 * @param String $date date we want flight number info
474
+	 * @return Flight departure and arrival airports and time
475
+	 */
476 476
 
477 477
 	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
478 478
 		$Common = new Common();
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
 
505 505
 
506 506
 	/**
507
-	* Get flight info from Alitalia
508
-	* @param String $callsign The callsign
509
-	* @param String $date date we want flight number info
510
-	* @return Flight departure and arrival airports and time
511
-	*/
507
+	 * Get flight info from Alitalia
508
+	 * @param String $callsign The callsign
509
+	 * @param String $date date we want flight number info
510
+	 * @return Flight departure and arrival airports and time
511
+	 */
512 512
 	private function getAlitalia($callsign, $date = 'NOW') {
513 513
 		$Common = new Common();
514 514
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -527,11 +527,11 @@  discard block
 block discarded – undo
527 527
 	}
528 528
 
529 529
 	/**
530
-	* Get flight info from Brussels airlines
531
-	* @param String $callsign The callsign
532
-	* @param String $date date we want flight number info
533
-	* @return Flight departure and arrival airports and time
534
-	*/
530
+	 * Get flight info from Brussels airlines
531
+	 * @param String $callsign The callsign
532
+	 * @param String $date date we want flight number info
533
+	 * @return Flight departure and arrival airports and time
534
+	 */
535 535
 	private function getBrussels($callsign, $date = 'NOW') {
536 536
 		$Common = new Common();
537 537
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -541,24 +541,24 @@  discard block
 block discarded – undo
541 541
 		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
542 542
 		$data = $Common->getData($url);
543 543
 		if ($data != '') {
544
-		    //echo $data;
545
-		    $parsed_json = json_decode($data,true);
546
-		    if (isset($parsed_json[0]['FromAirportCode'])) {
544
+			//echo $data;
545
+			$parsed_json = json_decode($data,true);
546
+			if (isset($parsed_json[0]['FromAirportCode'])) {
547 547
 			$DepartureAirportIata = $parsed_json[0]['FromAirportCode'];
548 548
 			$ArrivalAirportIata = $parsed_json[0]['ToAirportCode'];
549 549
 			$departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate']));
550 550
 			$arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate']));
551 551
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
552
-		    }
552
+			}
553 553
 		}
554 554
 	}
555 555
 
556 556
 	/**
557
-	* Get flight info from FlightRadar24
558
-	* @param String $callsign The callsign
559
-	* @param String $date date we want flight number info
560
-	* @return Flight departure and arrival airports and time
561
-	*/
557
+	 * Get flight info from FlightRadar24
558
+	 * @param String $callsign The callsign
559
+	 * @param String $date date we want flight number info
560
+	 * @return Flight departure and arrival airports and time
561
+	 */
562 562
 /*
563 563
 	public function getFlightRadar24($callsign, $date = 'NOW') {
564 564
 		$Common = new Common();
@@ -587,11 +587,11 @@  discard block
 block discarded – undo
587 587
 	}
588 588
   */
589 589
 	/**
590
-	* Get flight info from Lufthansa
591
-	* @param String $callsign The callsign
592
-	* @param String $date date we want flight number info
593
-	* @return Flight departure and arrival airports and time
594
-	*/
590
+	 * Get flight info from Lufthansa
591
+	 * @param String $callsign The callsign
592
+	 * @param String $date date we want flight number info
593
+	 * @return Flight departure and arrival airports and time
594
+	 */
595 595
 
596 596
 /*	private function getLufthansa($callsign, $date = 'NOW') {
597 597
 		$Common = new Common();
@@ -619,10 +619,10 @@  discard block
 block discarded – undo
619 619
 	}
620 620
   */
621 621
 	/**
622
-	* Get flight info from flytap
623
-	* @param String $callsign The callsign
624
-	* @return Flight departure and arrival airports and time
625
-	*/
622
+	 * Get flight info from flytap
623
+	 * @param String $callsign The callsign
624
+	 * @return Flight departure and arrival airports and time
625
+	 */
626 626
 	private function getFlyTap($callsign) {
627 627
 		$Common = new Common();
628 628
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -645,10 +645,10 @@  discard block
 block discarded – undo
645 645
 	}
646 646
 
647 647
 	/**
648
-	* Get flight info from flightmapper
649
-	* @param String $callsign The callsign
650
-	* @return Flight departure and arrival airports and time
651
-	*/
648
+	 * Get flight info from flightmapper
649
+	 * @param String $callsign The callsign
650
+	 * @return Flight departure and arrival airports and time
651
+	 */
652 652
 	public function getFlightMapper($callsign) {
653 653
 		$Common = new Common();
654 654
 		$airline_icao = '';
@@ -676,11 +676,11 @@  discard block
 block discarded – undo
676 676
 				$aarr = '';
677 677
 				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
678 678
 				if ($n == 7) {
679
-				    $departureTime = $dhour;
680
-				    $arrivalTime = $ahour;
681
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
682
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
683
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
679
+					$departureTime = $dhour;
680
+					$arrivalTime = $ahour;
681
+					$DepartureAirportIata = str_replace(array('(',')'),'',$darr);
682
+					$ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
683
+					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
684 684
 				}
685 685
 			}
686 686
 		}
@@ -688,10 +688,10 @@  discard block
 block discarded – undo
688 688
 	}
689 689
 
690 690
 	/**
691
-	* Get flight info from flightaware
692
-	* @param String $callsign The callsign
693
-	* @return Flight departure and arrival airports and time
694
-	*/
691
+	 * Get flight info from flightaware
692
+	 * @param String $callsign The callsign
693
+	 * @return Flight departure and arrival airports and time
694
+	 */
695 695
 	public function getFlightAware($callsign) {
696 696
 		global $globalFlightAwareUsername, $globalFlightAwarePassword;
697 697
 		date_default_timezone_set('UTC');
@@ -716,11 +716,11 @@  discard block
 block discarded – undo
716 716
 				$flight = $result['FlightInfoStatusResult']['flights'][0];
717 717
 				if (isset($flight['origin'])) {
718 718
 					return array(
719
-					    'DepartureAirportIATA' => $flight['origin']['alternate_ident'],
720
-					    'DepartureTime' => $flight['filed_departure_time']['time'],
721
-					    'ArrivalAirportIATA' => $flight['destination']['alternate_ident'],
722
-					    'ArrivalTime' => $flight['filed_arrival_time']['time'],
723
-					    'Source' => 'website_flightaware');
719
+						'DepartureAirportIATA' => $flight['origin']['alternate_ident'],
720
+						'DepartureTime' => $flight['filed_departure_time']['time'],
721
+						'ArrivalAirportIATA' => $flight['destination']['alternate_ident'],
722
+						'ArrivalTime' => $flight['filed_arrival_time']['time'],
723
+						'Source' => 'website_flightaware');
724 724
 				}
725 725
 			}
726 726
 		}
@@ -733,21 +733,21 @@  discard block
 block discarded – undo
733 733
 			$flight = reset($flights['flights']);
734 734
 			if (isset($flight['activityLog']['flights'][0]['origin'])) {
735 735
 				return array(
736
-				    'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'],
737
-				    'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']),
738
-				    'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'],
739
-				    'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']),
740
-				    'Source' => 'website_flightaware');
736
+					'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'],
737
+					'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']),
738
+					'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'],
739
+					'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']),
740
+					'Source' => 'website_flightaware');
741 741
 			}
742 742
 		}
743 743
 		return array();
744 744
 	}
745 745
 
746 746
 	/**
747
-	* Get flight info from CostToTravel
748
-	* @param String $callsign The callsign
749
-	* @return Flight departure and arrival airports and time
750
-	*/
747
+	 * Get flight info from CostToTravel
748
+	 * @param String $callsign The callsign
749
+	 * @return Flight departure and arrival airports and time
750
+	 */
751 751
 	public function getCostToTravel($callsign) {
752 752
 		$Common = new Common();
753 753
 		$url= "http://www.costtotravel.com/flight-number/".$callsign;
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
 	}
771 771
 
772 772
 	/**
773
-	* Get flight info from Air Canada
774
-	* @param String $callsign The callsign
775
-	* @param String $date date we want flight number info
776
-	* @return Flight departure and arrival airports and time
777
-	*/
773
+	 * Get flight info from Air Canada
774
+	 * @param String $callsign The callsign
775
+	 * @param String $date date we want flight number info
776
+	 * @return Flight departure and arrival airports and time
777
+	 */
778 778
 	private function getAirCanada($callsign,$date = 'NOW') {
779 779
 		$Common = new Common();
780 780
 		if (class_exists("DomDocument") === FALSE) return array();
@@ -799,11 +799,11 @@  discard block
 block discarded – undo
799 799
 	}
800 800
 
801 801
 	/**
802
-	* Get flight info from Vietnam Airlines
803
-	* @param String $callsign The callsign
804
-	* @param String $date date we want flight number info
805
-	* @return Flight departure and arrival airports and time
806
-	*/
802
+	 * Get flight info from Vietnam Airlines
803
+	 * @param String $callsign The callsign
804
+	 * @param String $date date we want flight number info
805
+	 * @return Flight departure and arrival airports and time
806
+	 */
807 807
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
808 808
 		$Common = new Common();
809 809
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -825,12 +825,12 @@  discard block
 block discarded – undo
825 825
 	}
826 826
 
827 827
 	/**
828
-	* Get flight info from Air Berlin
829
-	* @param String $callsign The callsign
830
-	* @param String $date date we want flight number info
831
-	* @param String $carrier airline code
832
-	* @return Flight departure and arrival airports and time
833
-	*/
828
+	 * Get flight info from Air Berlin
829
+	 * @param String $callsign The callsign
830
+	 * @param String $date date we want flight number info
831
+	 * @param String $carrier airline code
832
+	 * @return Flight departure and arrival airports and time
833
+	 */
834 834
 	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
835 835
 		$Common = new Common();
836 836
 		date_default_timezone_set('UTC');
@@ -859,11 +859,11 @@  discard block
 block discarded – undo
859 859
 			$table = $Common->table2array($data);
860 860
 			$flight = $table;
861 861
 			if (isset($flight[5][4])) {
862
-			    $arrivalTime = $flight[5][4];
863
-			    $arrivalAirport = $flight[5][3];
862
+				$arrivalTime = $flight[5][4];
863
+				$arrivalAirport = $flight[5][3];
864 864
 			} else {
865
-			    $arrivalTime = '';
866
-			    $arrivalAirport = '';
865
+				$arrivalTime = '';
866
+				$arrivalAirport = '';
867 867
 			}
868 868
 		} else return array();
869 869
 		$url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner';
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  discard block
 block discarded – undo
14 14
 $usecoord = false;
15 15
 if (isset($_GET['test'])) exit();
16 16
 if (isset($_GET['tracker'])) {
17
-    $tracker = true;
17
+	$tracker = true;
18 18
 }
19 19
 if (isset($_GET['marine'])) {
20
-    $marine = true;
20
+	$marine = true;
21 21
 }
22 22
 if ($tracker) {
23
-    require_once('require/class.Tracker.php');
24
-    require_once('require/class.TrackerLive.php');
25
-    require_once('require/class.TrackerArchive.php');
23
+	require_once('require/class.Tracker.php');
24
+	require_once('require/class.TrackerLive.php');
25
+	require_once('require/class.TrackerArchive.php');
26 26
 } elseif ($marine) {
27
-    require_once('require/class.Marine.php');
28
-    require_once('require/class.MarineLive.php');
29
-    require_once('require/class.MarineArchive.php');
27
+	require_once('require/class.Marine.php');
28
+	require_once('require/class.MarineLive.php');
29
+	require_once('require/class.MarineArchive.php');
30 30
 } else {
31
-    require_once('require/class.Spotter.php');
32
-    require_once('require/class.SpotterLive.php');
33
-    require_once('require/class.SpotterArchive.php');
31
+	require_once('require/class.Spotter.php');
32
+	require_once('require/class.SpotterLive.php');
33
+	require_once('require/class.SpotterArchive.php');
34 34
 }
35 35
 
36 36
 $begintime = microtime(true);
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 $Common = new Common();
51 51
 
52 52
 if (isset($_GET['download'])) {
53
-    if ($_GET['download'] == "true")
54
-    {
53
+	if ($_GET['download'] == "true")
54
+	{
55 55
 	header('Content-disposition: attachment; filename="flightairmap.json"');
56
-    }
56
+	}
57 57
 }
58 58
 header('Content-Type: text/javascript');
59 59
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	$usecoord = true;
132 132
 	$coord = explode(',',$_GET['coord']);
133 133
 	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
134
-	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
134
+		&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
135 135
 		if ($tracker) {
136 136
 			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
137 137
 		} elseif ($marine) {
@@ -635,17 +635,17 @@  discard block
 block discarded – undo
635 635
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
636 636
 				
637 637
 				if (
638
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
639
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
638
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
639
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
640 640
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
641 641
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
642
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
643
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
644
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
645
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
646
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
647
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
648
-				    ) {
642
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
643
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
644
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
645
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
646
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
647
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
648
+					) {
649 649
 					if ($tracker) {
650 650
 						if ($from_archive || $globalArchive) {
651 651
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
 							$spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']);
654 654
 						}
655 655
 						if (((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') ||
656
-						    (!isset($_COOKIE['mapmatching']) && $globalMapMatching === TRUE)) && 
657
-						    isset($_GET['zoom']) && $_GET['zoom'] > 12 && 
658
-						    isset($spotter_item['type']) && (
656
+							(!isset($_COOKIE['mapmatching']) && $globalMapMatching === TRUE)) && 
657
+							isset($_GET['zoom']) && $_GET['zoom'] > 12 && 
658
+							isset($spotter_item['type']) && (
659 659
 							$spotter_item['type'] == 'Firetruck' ||
660 660
 							$spotter_item['type'] == 'Ambulance' ||
661 661
 							$spotter_item['type'] == 'Truck (18 Wheeler)' ||
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 							$spotter_item['type'] == 'Jeep' ||
668 668
 							$spotter_item['type'] == 'Motorcycle' ||
669 669
 							$spotter_item['type'] == 'Car'
670
-						    )
670
+							)
671 671
 						) {
672 672
 							require(dirname(__FILE__).'/require/class.MapMatching.php');
673 673
 							$MapMatching = new MapMatching();
@@ -770,75 +770,75 @@  discard block
 block discarded – undo
770 770
 				}
771 771
 				
772 772
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
773
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
774
-				     && (isset($spotter_item['departure_airport']) 
775
-				        && $spotter_item['departure_airport'] != 'NA' 
776
-				        && isset($spotter_item['arrival_airport']) 
777
-				        && $spotter_item['arrival_airport'] != 'NA' 
778
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
779
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
780
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
781
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
782
-				    if (isset($spotter_item['departure_airport_latitude'])) {
773
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
774
+					 && (isset($spotter_item['departure_airport']) 
775
+						&& $spotter_item['departure_airport'] != 'NA' 
776
+						&& isset($spotter_item['arrival_airport']) 
777
+						&& $spotter_item['arrival_airport'] != 'NA' 
778
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
779
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
780
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
781
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
782
+					if (isset($spotter_item['departure_airport_latitude'])) {
783 783
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
784
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
784
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
785 785
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
786 786
 					if (isset($dairport[0]['latitude'])) {
787
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
787
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
788 788
 					}
789
-				    }
790
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
789
+					}
790
+					if (isset($spotter_item['arrival_airport_latitude'])) {
791 791
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
792
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
792
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
793 793
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
794 794
 					if (isset($aairport[0]['latitude'])) {
795
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
795
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
796 796
 					}
797
-				    }
798
-				    $output_air  = substr($output_air, 0, -1);
799
-				    $output_air .= ']}},';
800
-				    $output .= $output_air;
801
-				    unset($output_air);
797
+					}
798
+					$output_air  = substr($output_air, 0, -1);
799
+					$output_air .= ']}},';
800
+					$output .= $output_air;
801
+					unset($output_air);
802 802
 				}
803 803
 
804 804
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
805 805
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
806 806
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
807
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
808
-				     && (isset($spotter_item['arrival_airport']) 
809
-				        && $spotter_item['arrival_airport'] != 'NA' 
810
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
811
-				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
812
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
813
-				    $havedata = false;
814
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
815
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
807
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
808
+					 && (isset($spotter_item['arrival_airport']) 
809
+						&& $spotter_item['arrival_airport'] != 'NA' 
810
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
811
+							|| (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
812
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
813
+					$havedata = false;
814
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
815
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
816 816
 				    
817
-				    //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
818
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
817
+					//$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
818
+					if (isset($spotter_item['arrival_airport_latitude'])) {
819 819
 					//$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
820 820
 					$end_lon = $spotter_item['arrival_airport_longitude'];
821 821
 					$end_lat = $spotter_item['arrival_airport_latitude'];
822 822
 					$havedata = true;
823
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
823
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
824 824
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
825 825
 					if (isset($aairport[0]['latitude'])) {
826
-					    //$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
827
-					    $end_lon = $aairport[0]['longitude'];
828
-					    $end_lat = $aairport[0]['latitude'];
829
-					    $havedata = true;
826
+						//$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
827
+						$end_lon = $aairport[0]['longitude'];
828
+						$end_lat = $aairport[0]['latitude'];
829
+						$havedata = true;
830 830
 					}
831
-				    }
832
-				    if ($havedata) {
831
+					}
832
+					if ($havedata) {
833 833
 					$line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon);
834 834
 					foreach ($line[0] as $coord) {
835 835
 						$output_dest .= '['.$coord[0].','.$coord[1].'],';
836 836
 					}
837 837
 					$output_dest  = substr($output_dest, 0, -1);
838
-				    }
839
-				    $output_dest .= ']}},';
840
-				    if ($havedata) $output .= $output_dest;
841
-				    unset($output_dest);
838
+					}
839
+					$output_dest .= ']}},';
840
+					if ($havedata) $output .= $output_dest;
841
+					unset($output_dest);
842 842
 				}
843 843
 			}
844 844
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.