Completed
Push — master ( 8e51f6...557b77 )
by Yannick
12:09 queued 04:29
created
archive-geojson.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
 $Common = new Common();
10 10
 
11 11
 if (isset($_GET['download'])) {
12
-    if ($_GET['download'] == "true")
13
-    {
12
+	if ($_GET['download'] == "true")
13
+	{
14 14
 	header('Content-disposition: attachment; filename="flightairmap.json"');
15
-    }
15
+	}
16 16
 }
17 17
 header('Content-Type: text/javascript');
18 18
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				}
92 92
 
93 93
 				//waypoint plotting
94
-                /*
94
+				/*
95 95
 				$output .= '{';
96 96
 					$output .= '"type": "Feature",';
97 97
 						$output .= '"properties": {';
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 					$output_time .= (strtotime($spotter_history['date'])*1000).',';
271 271
 				}
272 272
 				if (isset($output_time)) {
273
-				    $output_time  = substr($output_time, 0, -1);
274
-				    $output .= '"time": ['.$output_time.'],';
273
+					$output_time  = substr($output_time, 0, -1);
274
+					$output .= '"time": ['.$output_time.'],';
275 275
 				}
276 276
 
277 277
 
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 						$output .= '"coordinates": [';
286 286
 						
287 287
 				if (isset($output_history)) {
288
-				    $output_history  = substr($output_history, 0, -1);
289
-				    $output .= $output_history;
288
+					$output_history  = substr($output_history, 0, -1);
289
+					$output .= $output_history;
290 290
 				}
291 291
 				
292 292
 						$output .= ']';
Please login to merge, or discard this patch.
getImages.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -4,88 +4,88 @@
 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__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename)) {
29
-    header('Content-type: image/png');
30
-    readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename);
31
-    exit(0);
29
+	header('Content-type: image/png');
30
+	readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename);
31
+	exit(0);
32 32
 }
33 33
 $original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'aircrafts'.DIRECTORY_SEPARATOR.'new'.DIRECTORY_SEPARATOR.$filename;
34 34
 if (!file_exists($original)) {
35
-    echo "File not found";
35
+	echo "File not found";
36 36
 }
37 37
 
38 38
 if (extension_loaded('gd') && function_exists('gd_info')) {
39
-    $image = imagecreatefrompng($original);
40
-    $index = imagecolorexact($image,26,49,81);
41
-    if ($index < 0) {
39
+	$image = imagecreatefrompng($original);
40
+	$index = imagecolorexact($image,26,49,81);
41
+	if ($index < 0) {
42 42
 	$index = imagecolorexact($image,25,49,79);
43
-    }
44
-    if ($index < 0) {
43
+	}
44
+	if ($index < 0) {
45 45
 	$index = imagecolorexact($image,0,0,0);
46
-    }
47
-    $c = hexToRGB($color);
48
-    imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
46
+	}
47
+	$c = hexToRGB($color);
48
+	imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
49 49
  /*
50 50
     $ig = imagecolorat($image, 0, 0);
51 51
     imagecolortransparent($image, $ig);
52 52
    */
53 53
 
54
-    header('Content-type: image/png');
55
-    if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
54
+	header('Content-type: image/png');
55
+	if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
56 56
 	$resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT);
57 57
 	$newimg = imagecreatetruecolor($resize,$resize);
58
-        imagealphablending($newimg, false);
58
+		imagealphablending($newimg, false);
59 59
 	imagesavealpha($newimg, true);
60 60
 	imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image));
61 61
 	if (isset($_GET['heading'])) {
62
-    	    $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
63
-    	    $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
64
-    	    imagealphablending($rotation, false);
65
-	    imagesavealpha($rotation, true);
66
-    	    imagepng($rotation);
67
-    	    imagedestroy($newimg);
68
-    	    imagedestroy($image);
69
-    	    imagedestroy($rotation);
62
+			$heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
63
+			$rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
64
+			imagealphablending($rotation, false);
65
+		imagesavealpha($rotation, true);
66
+			imagepng($rotation);
67
+			imagedestroy($newimg);
68
+			imagedestroy($image);
69
+			imagedestroy($rotation);
70 70
 	
71 71
 	} else {
72
-    	    imagepng($newimg);
73
-    	    imagedestroy($newimg);
74
-    	    imagedestroy($image);
75
-        }
76
-    } else {
72
+			imagepng($newimg);
73
+			imagedestroy($newimg);
74
+			imagedestroy($image);
75
+		}
76
+	} else {
77 77
 	imagealphablending($image, false);
78
-        imagesavealpha($image, true);
78
+		imagesavealpha($image, true);
79 79
 	imagepng($image);
80 80
 	imagepng($image);
81 81
 	if (is_writable('cache')) {
82
-    	    imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename);
82
+			imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename);
83
+	}
84
+		imagedestroy($image);
83 85
 	}
84
-        imagedestroy($image);
85
-    }
86 86
 } else {
87
-    header('Content-type: image/png');
88
-    if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
89
-    else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
87
+	header('Content-type: image/png');
88
+	if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
89
+	else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
90 90
 }
91 91
 ?>
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
live-czml.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 function quaternionrotate($heading, $attitude = 0, $bank = 0) {
16
-    // Assuming the angles are in radians.
17
-    $c1 = cos($heading/2);
18
-    $s1 = sin($heading/2);
19
-    $c2 = cos($attitude/2);
20
-    $s2 = sin($attitude/2);
21
-    $c3 = cos($bank/2);
22
-    $s3 = sin($bank/2);
23
-    $c1c2 = $c1*$c2;
24
-    $s1s2 = $s1*$s2;
25
-    $w =$c1c2*$c3 - $s1s2*$s3;
26
-    $x =$c1c2*$s3 + $s1s2*$c3;
27
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
28
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
29
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
16
+	// Assuming the angles are in radians.
17
+	$c1 = cos($heading/2);
18
+	$s1 = sin($heading/2);
19
+	$c2 = cos($attitude/2);
20
+	$s2 = sin($attitude/2);
21
+	$c3 = cos($bank/2);
22
+	$s3 = sin($bank/2);
23
+	$c1c2 = $c1*$c2;
24
+	$s1s2 = $s1*$s2;
25
+	$w =$c1c2*$c3 - $s1s2*$s3;
26
+	$x =$c1c2*$s3 + $s1s2*$c3;
27
+	$y =$s1*$c2*$c3 + $c1*$s2*$s3;
28
+	$z =$c1*$s2*$c3 - $s1*$c2*$s3;
29
+	return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
30 30
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
31 31
 
32 32
 }
33 33
 
34 34
 
35 35
 if (isset($_GET['download'])) {
36
-    if ($_GET['download'] == "true")
37
-    {
36
+	if ($_GET['download'] == "true")
37
+	{
38 38
 	header('Content-disposition: attachment; filename="flightairmap.json"');
39
-    }
39
+	}
40 40
 }
41 41
 header('Content-Type: text/javascript');
42 42
 
@@ -188,78 +188,78 @@  discard block
 block discarded – undo
188 188
 				$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20 },';
189 189
 			} elseif ($spotter_item['engine_type'] == 'Jet') {
190 190
 				if ($spotter_item['engine_count'] == '1') {
191
-				    if ($spotter_item['wake_category'] == 'M') {
191
+					if ($spotter_item['wake_category'] == 'M') {
192 192
 					$model = 'J1M';
193
-				    } elseif ($spotter_item['wake_category'] == 'L') {
193
+					} elseif ($spotter_item['wake_category'] == 'L') {
194 194
 					$model = '';
195
-				    }
195
+					}
196 196
 				} elseif ($spotter_item['engine_count'] == '2') {
197
-				    if ($spotter_item['wake_category'] == 'M') {
197
+					if ($spotter_item['wake_category'] == 'M') {
198 198
 					$model = 'J2M';
199
-				    } elseif ($spotter_item['wake_category'] == 'H') {
199
+					} elseif ($spotter_item['wake_category'] == 'H') {
200 200
 					$model = 'J2H';
201
-				    } elseif ($spotter_item['wake_category'] == 'L') {
201
+					} elseif ($spotter_item['wake_category'] == 'L') {
202 202
 					$model = 'J2L';
203
-				    }
203
+					}
204 204
 				} elseif ($spotter_item['engine_count'] == '3') {
205
-				    if ($spotter_item['wake_category'] == 'M') {
205
+					if ($spotter_item['wake_category'] == 'M') {
206 206
 					$model = 'J3M';
207
-				    } elseif ($spotter_item['wake_category'] == 'H') {
207
+					} elseif ($spotter_item['wake_category'] == 'H') {
208 208
 					$model = 'J3H';
209
-				    }
209
+					}
210 210
 				} elseif ($spotter_item['engine_count'] == '4') {
211
-				    if ($spotter_item['wake_category'] == 'M') {
211
+					if ($spotter_item['wake_category'] == 'M') {
212 212
 					$model = 'J4M';
213
-				    } elseif ($spotter_item['wake_category'] == 'H') {
213
+					} elseif ($spotter_item['wake_category'] == 'H') {
214 214
 					$model = 'J4H';
215
-				    }
215
+					}
216 216
 				}
217 217
 				if (isset($modelsdb[$model])) {
218
-				    $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },';
218
+					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },';
219 219
 				} else {
220
-				    $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },';
220
+					$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },';
221 221
 				}
222 222
 			} elseif ($spotter_item['engine_type'] == 'Turboprop') {
223 223
 				if ($spotter_item['engine_count'] == '1') {
224
-				    if ($spotter_item['wake_category'] == 'L') {
224
+					if ($spotter_item['wake_category'] == 'L') {
225 225
 					$model = 'T1L';
226
-				    }
226
+					}
227 227
 				} elseif ($spotter_item['engine_count'] == '2') {
228
-				    if ($spotter_item['wake_category'] == 'M') {
228
+					if ($spotter_item['wake_category'] == 'M') {
229 229
 					$model = 'T2M';
230
-				    } elseif ($spotter_item['wake_category'] == 'L') {
230
+					} elseif ($spotter_item['wake_category'] == 'L') {
231 231
 					$model = 'T2L';
232
-				    }
232
+					}
233 233
 				} elseif ($spotter_item['engine_count'] == '4') {
234
-				    if ($spotter_item['wake_category'] == 'M') {
235
-				    } elseif ($spotter_item['wake_category'] == 'H') {
234
+					if ($spotter_item['wake_category'] == 'M') {
235
+					} elseif ($spotter_item['wake_category'] == 'H') {
236 236
 					$model = 'T4H';
237
-				    }
237
+					}
238 238
 				}
239 239
 				if (isset($modelsdb[$model])) {
240
-				    $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },';
240
+					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },';
241 241
 				} else {
242
-				    $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },';
242
+					$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },';
243 243
 				}
244 244
 			} elseif ($spotter_item['engine_type'] == 'Piston') {
245 245
 				if ($spotter_item['engine_count'] == '1') {
246
-				    if ($spotter_item['wake_category'] == 'L') {
246
+					if ($spotter_item['wake_category'] == 'L') {
247 247
 					$model = 'P1L';
248
-				    } elseif ($spotter_item['wake_category'] == 'M') {
248
+					} elseif ($spotter_item['wake_category'] == 'M') {
249 249
 					$model = 'P1M';
250
-				    }
250
+					}
251 251
 				} elseif ($spotter_item['engine_count'] == '2') {
252
-				    if ($spotter_item['wake_category'] == 'M') {
252
+					if ($spotter_item['wake_category'] == 'M') {
253 253
 					$model = 'P2M';
254
-				    } elseif ($spotter_item['wake_category'] == 'L') {
254
+					} elseif ($spotter_item['wake_category'] == 'L') {
255 255
 					$model = 'P2L';
256
-				    }
256
+					}
257 257
 				// ju52 = P3M
258 258
 				}
259 259
 				if (isset($modelsdb[$model])) {
260
-				    $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },';
260
+					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },';
261 261
 				} else {
262
-				    $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },';
262
+					$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },';
263 263
 				}
264 264
 			} else {
265 265
 				$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },';
Please login to merge, or discard this patch.
header.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 ?>
129 129
 <?php 
130
-    if (isset($_POST['archive'])) {
130
+	if (isset($_POST['archive'])) {
131 131
 ?>
132 132
 <?php
133 133
 	if (isset($globalBeta) && $globalBeta) {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	}
144 144
 ?>
145 145
 <?php    
146
-    } else {
146
+	} else {
147 147
 ?>
148 148
 <?php
149 149
 	if (isset($globalBeta) && $globalBeta) {
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	} else {
155 155
 ?>
156 156
 <?php 
157
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
157
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
158 158
 ?>
159 159
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>"></script>
160 160
 <?php
161
-	    }
161
+		}
162 162
 ?>
163 163
 <?php
164 164
 	}
165 165
 ?>
166 166
 <?php
167
-    }
167
+	}
168 168
 }
169 169
 ?>
170 170
 <?php
@@ -248,23 +248,23 @@  discard block
 block discarded – undo
248 248
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
249 249
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
250 250
             <?php
251
-        	if ($globalACARS) {
252
-        	    if (isset($globalDemo) && $globalDemo) {
253
-    	    ?>
251
+			if ($globalACARS) {
252
+				if (isset($globalDemo) && $globalDemo) {
253
+			?>
254 254
             <li><hr /></li>
255 255
             <li><i>_('ACARS data not available publicly'); ?></i></li>
256 256
             <li><a href="">_('Latest ACARS messages'); ?></a></li>
257 257
             <li><a href="">_('Archive ACARS messages'); ?></a></li>
258 258
             <?php
259
-        	} else {
260
-    	    ?>
259
+			} else {
260
+			?>
261 261
             <li><hr /></li>
262 262
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
263 263
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
264 264
             <?php
265
-        	}
266
-        	}
267
-    	    ?>
265
+			}
266
+			}
267
+			?>
268 268
             <li><hr /></li>
269 269
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
270 270
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
@@ -306,14 +306,14 @@  discard block
 block discarded – undo
306 306
   	    <form>
307 307
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
308 308
   		    <?php
309
-  		        $Language = new Language();
310
-  		        $alllang = $Language->getLanguages();
311
-  		        foreach ($alllang as $key => $lang) {
312
-  		            print '<option value="'.$key.'"';
313
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
314
-  		            print '>'.$lang[0].'</option>';
315
-  		        }
316
-  		    ?>
309
+  				$Language = new Language();
310
+  				$alllang = $Language->getLanguages();
311
+  				foreach ($alllang as $key => $lang) {
312
+  					print '<option value="'.$key.'"';
313
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
314
+  					print '>'.$lang[0].'</option>';
315
+  				}
316
+  			?>
317 317
   		</select>
318 318
   	    </form>
319 319
   	</div>
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 }
350 350
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
351 351
 {
352
-    ?>
352
+	?>
353 353
     <div class="top-header clear" role="main">
354 354
         <div id="map"></div>
355 355
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -360,15 +360,15 @@  discard block
 block discarded – undo
360 360
         var zoom = 13;
361 361
 //create the map
362 362
 <?php
363
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
363
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
364 364
 ?>
365 365
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
366 366
 <?php
367
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
367
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
368 368
 ?>
369 369
   map = L.map('map', { zoomControl:true });
370 370
 <?php
371
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
371
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
372 372
 ?>
373 373
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
374 374
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -376,22 +376,22 @@  discard block
 block discarded – undo
376 376
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
377 377
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
378 378
 <?php
379
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
379
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
380 380
 ?>
381 381
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
382 382
 <?php
383
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
383
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
384 384
 ?>
385 385
   map = L.map('map', { zoomControl:true });
386 386
 <?php
387
-    }
387
+	}
388 388
 ?>
389 389
   //initialize the layer group for the aircrft markers
390 390
   var layer_data = L.layerGroup();
391 391
 
392 392
   //a few title layers
393 393
 <?php
394
-    if ($globalMapProvider == 'Mapbox') {
394
+	if ($globalMapProvider == 'Mapbox') {
395 395
 ?>
396 396
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
397 397
     maxZoom: 18,
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
     token : '<?php print $globalMapboxToken; ?>'
403 403
   }).addTo(map);
404 404
 <?php
405
-    } elseif ($globalMapProvider == 'OpenStreetMap') {
405
+	} elseif ($globalMapProvider == 'OpenStreetMap') {
406 406
 ?>
407 407
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
408 408
     maxZoom: 18,
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
       '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>'
411 411
   }).addTo(map);
412 412
 <?php
413
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
413
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
414 414
 ?>
415 415
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
416 416
     maxZoom: 18,
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
420 420
   }).addTo(map);
421 421
 <?php
422
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
422
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
423 423
 ?>
424 424
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
425 425
     maxZoom: 18,
@@ -428,27 +428,27 @@  discard block
 block discarded – undo
428 428
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
429 429
   }).addTo(map);
430 430
 <?php
431
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
431
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
432 432
 ?>
433 433
     var googleLayer = new L.Google('ROADMAP');
434 434
     map.addLayer(googleLayer);
435 435
 <?php
436
-    } elseif ($globalMapProvider == 'Google-Satellite') {
436
+	} elseif ($globalMapProvider == 'Google-Satellite') {
437 437
 ?>
438 438
     var googleLayer = new L.Google('SATELLITE');
439 439
     map.addLayer(googleLayer);
440 440
 <?php
441
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
441
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
442 442
 ?>
443 443
     var googleLayer = new L.Google('HYBRID');
444 444
     map.addLayer(googleLayer);
445 445
 <?php
446
-    } elseif ($globalMapProvider == 'Google-Terrain') {
446
+	} elseif ($globalMapProvider == 'Google-Terrain') {
447 447
 ?>
448 448
     var googleLayer = new L.Google('Terrain');
449 449
     map.addLayer(googleLayer);
450 450
 <?php
451
-    }
451
+	}
452 452
 ?>
453 453
         </script>
454 454
     </div>
Please login to merge, or discard this patch.
install/index.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 	print '</ul>You <strong>must</strong> add these modules/fix errors.</div>';
94 94
 	require('../footer.php');
95
-        exit;
95
+		exit;
96 96
 }
97 97
 
98 98
 if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && (count($error) == 0)) {
@@ -301,17 +301,17 @@  discard block
 block discarded – undo
301 301
 				</tr>
302 302
 				<!--
303 303
 		<?php
304
-		    require_once(dirname(__FILE__).'/../require/class.Connection.php');
305
-		    $Connection = new Connection();
304
+			require_once(dirname(__FILE__).'/../require/class.Connection.php');
305
+			$Connection = new Connection();
306 306
 		?>
307 307
 				-->
308 308
 		<?php
309
-		    if ($Connection->db != NULL) {
309
+			if ($Connection->db != NULL) {
310 310
 			if ($Connection->tableExists('source_location')) {
311
-			    require_once(dirname(__FILE__).'/../require/class.Source.php');
312
-			    $Source = new Source();
313
-			    $alllocations = $Source->getAllLocationInfo();
314
-			    foreach ($alllocations as $location) {
311
+				require_once(dirname(__FILE__).'/../require/class.Source.php');
312
+				$Source = new Source();
313
+				$alllocations = $Source->getAllLocationInfo();
314
+				foreach ($alllocations as $location) {
315 315
 		?>
316 316
 				<tr>
317 317
 	    				<input type="hidden" name="source_id[]" value="<?php print $location['id']; ?>" />
@@ -325,9 +325,9 @@  discard block
 block discarded – undo
325 325
 				</tr>
326 326
 		
327 327
 		<?php
328
-			    }
328
+				}
329
+			}
329 330
 			}
330
-		    }
331 331
 		?>
332 332
 
333 333
 				<tr>
@@ -418,12 +418,12 @@  discard block
 block discarded – undo
418 418
 ?>
419 419
 							<tr>
420 420
 								<?php
421
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
421
+									if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
422 422
 								?>
423 423
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
424 424
 								<td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td>
425 425
 								<?php
426
-								    } else {
426
+									} else {
427 427
 									$hostport = explode(':',$source['host']);
428 428
 									if (isset($hostport[1])) {
429 429
 										$host = $hostport[0];
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 								<td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td>
437 437
 								<td><input type="number" name="port[]" id="port" value="<?php print $port; ?>" /></td>
438 438
 								<?php
439
-								    }
439
+									}
440 440
 								?>
441 441
 								<td>
442 442
 									<select name="format[]" id="format">
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 			<br />
728 728
 			<p>
729 729
 			<?php 
730
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
730
+				if (extension_loaded('gd') && function_exists('gd_info')) {
731 731
 			?>
732 732
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
733 733
 				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
 				<b>The directory cache is not writable, aircraft icon will not be cached</b>
738 738
 			<?php
739 739
 				}
740
-			    } else {
740
+				} else {
741 741
 			?>
742 742
 				<b>PHP GD is not installed, you can t change color of aircraft icon on map</b>
743 743
 			<?php
744
-			    }
744
+				}
745 745
 			?>
746 746
 			</p>
747 747
 			<br />
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 	</p>
761 761
 <?php
762 762
 	require('../footer.php');
763
-        exit;
763
+		exit;
764 764
 }
765 765
 	
766 766
 $settings = array();
@@ -850,8 +850,8 @@  discard block
 block discarded – undo
850 850
 	
851 851
 	$sources = array();
852 852
 	foreach ($source_name as $keys => $name) {
853
-	    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]);
854
-	    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]);
853
+		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]);
854
+		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]);
855 855
 	}
856 856
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
857 857
 
@@ -1116,14 +1116,14 @@  discard block
 block discarded – undo
1116 1116
 
1117 1117
 	// Set some defaults values...
1118 1118
 	if (!isset($globalAircraftImageSources)) {
1119
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1120
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1119
+		$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1120
+		$settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1121 1121
 	}
1122 1122
 
1123 1123
 	if (!isset($globalSchedulesSources)) {
1124
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1125
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1126
-    	}
1124
+		$globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1125
+			$settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1126
+		}
1127 1127
 
1128 1128
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1129 1129
 
@@ -1175,21 +1175,21 @@  discard block
 block discarded – undo
1175 1175
 	$popi = false;
1176 1176
 	$popw = false;
1177 1177
 	foreach ($_SESSION['done'] as $done) {
1178
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1179
-	    if ($done == 'Create database') $pop = true;
1180
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1181
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1182
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1178
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1179
+		if ($done == 'Create database') $pop = true;
1180
+		if ($_SESSION['install'] == 'database_create') $pop = true;
1181
+		if ($_SESSION['install'] == 'database_import') $popi = true;
1182
+		if ($_SESSION['install'] == 'waypoints') $popw = true;
1183 1183
 	}
1184 1184
 	if ($pop) {
1185
-	    sleep(5);
1186
-	    print '<li>Create database....<img src="../images/loading.gif" /></li>';
1185
+		sleep(5);
1186
+		print '<li>Create database....<img src="../images/loading.gif" /></li>';
1187 1187
 	} else if ($popi) {
1188
-	    sleep(5);
1189
-	    print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1188
+		sleep(5);
1189
+		print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1190 1190
 	} else if ($popw) {
1191
-	    sleep(5);
1192
-	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1191
+		sleep(5);
1192
+		print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1193 1193
 	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1194 1194
 	print '</div></ul>';
1195 1195
 	print '<div id="error"></div>';
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
 	unset($_COOKIE['install']);
1253 1253
 	print '<div class="info column"><ul>';
1254 1254
 	foreach ($_SESSION['done'] as $done) {
1255
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1255
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1256 1256
 	}
1257 1257
 	print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>';
1258 1258
 	print '</ul></div>';
Please login to merge, or discard this patch.
require/class.ACARS.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 		$this->SI = new SpotterImport($this->db);
17 17
 	}
18 18
 	/**
19
-	* Change IATA to ICAO value for ident
20
-	*
21
-	* @param String $ident ident
22
-	* @return String the icao
23
-	*/
19
+	 * Change IATA to ICAO value for ident
20
+	 *
21
+	 * @param String $ident ident
22
+	 * @return String the icao
23
+	 */
24 24
 	public function ident2icao($ident) {
25 25
 		if (substr($ident,0,2) == 'AF') {
26 26
 			if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident;
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	/**
39
-	* Deletes all info in the live table
40
-	*
41
-	* @return String success or false
42
-	*
43
-	*/
39
+	 * Deletes all info in the live table
40
+	 *
41
+	 * @return String success or false
42
+	 *
43
+	 */
44 44
 	public function deleteLiveAcarsData()
45 45
 	{
46 46
 		global $globalDBdriver;
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	/**
63
-	* Deletes all info in the archive table
64
-	*
65
-	* @return String success or false
66
-	*
67
-	*/
63
+	 * Deletes all info in the archive table
64
+	 *
65
+	 * @return String success or false
66
+	 *
67
+	 */
68 68
 	public function deleteArchiveAcarsData()
69 69
 	{
70 70
 		global $globalACARSArchiveKeepMonths, $globalDBdriver;
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 
86 86
 
87 87
 	/**
88
-	* Parse ACARS data
89
-	*
90
-	* @param String ACARS data in acarsdec data
91
-	*
92
-	*/
88
+	 * Parse ACARS data
89
+	 *
90
+	 * @param String ACARS data in acarsdec data
91
+	 *
92
+	 */
93 93
 	public function parse($data) {
94 94
 		global $globalDebug, $globalACARSArchive;
95 95
 		//$Image = new Image($this->db);
@@ -666,11 +666,11 @@  discard block
 block discarded – undo
666 666
 
667 667
 
668 668
 	/**
669
-	* Add ACARS data
670
-	*
671
-	* @param String ACARS data in acarsdec data
672
-	*
673
-	*/
669
+	 * Add ACARS data
670
+	 *
671
+	 * @param String ACARS data in acarsdec data
672
+	 *
673
+	 */
674 674
 	function add($data) {
675 675
 		global $globalDebug, $globalACARSArchive;
676 676
 		$Image = new Image($this->db);
@@ -725,15 +725,15 @@  discard block
 block discarded – undo
725 725
 	}
726 726
 
727 727
 	/**
728
-	* Add Live ACARS data in DB
729
-	*
730
-	* @param String $ident ident
731
-	* @param String $registration Registration of the aircraft
732
-	* @param String $label Label of the ACARS message
733
-	* @param String $block_id Block id of the ACARS message
734
-	* @param String $msg_no Number of the ACARS message
735
-	* @param String $message ACARS message
736
-	*/
728
+	 * Add Live ACARS data in DB
729
+	 *
730
+	 * @param String $ident ident
731
+	 * @param String $registration Registration of the aircraft
732
+	 * @param String $label Label of the ACARS message
733
+	 * @param String $block_id Block id of the ACARS message
734
+	 * @param String $msg_no Number of the ACARS message
735
+	 * @param String $message ACARS message
736
+	 */
737 737
 	public function addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') {
738 738
 		global $globalDebug;
739 739
 		date_default_timezone_set('UTC');
@@ -771,15 +771,15 @@  discard block
 block discarded – undo
771 771
 	}
772 772
 
773 773
 	/**
774
-	* Add Archive ACARS data in DB
775
-	*
776
-	* @param String $ident ident
777
-	* @param String $registration Registration of the aircraft
778
-	* @param String $label Label of the ACARS message
779
-	* @param String $block_id Block id of the ACARS message
780
-	* @param String $msg_no Number of the ACARS message
781
-	* @param String $message ACARS message
782
-	*/
774
+	 * Add Archive ACARS data in DB
775
+	 *
776
+	 * @param String $ident ident
777
+	 * @param String $registration Registration of the aircraft
778
+	 * @param String $label Label of the ACARS message
779
+	 * @param String $block_id Block id of the ACARS message
780
+	 * @param String $msg_no Number of the ACARS message
781
+	 * @param String $message ACARS message
782
+	 */
783 783
 	public function addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') {
784 784
 		global $globalDebug;
785 785
 		date_default_timezone_set('UTC');
@@ -813,11 +813,11 @@  discard block
 block discarded – undo
813 813
 	}
814 814
 
815 815
 	/**
816
-	* Get Message title from label from DB
817
-	*
818
-	* @param String $label
819
-	* @return String Return ACARS title
820
-	*/
816
+	 * Get Message title from label from DB
817
+	 *
818
+	 * @param String $label
819
+	 * @return String Return ACARS title
820
+	 */
821 821
 	public function getTitlefromLabel($label) {
822 822
 		$Connection = new Connection($this->db);
823 823
 		$this->db = $Connection->db;
@@ -837,10 +837,10 @@  discard block
 block discarded – undo
837 837
 	}
838 838
 
839 839
 	/**
840
-	* List all Message title & label from DB
841
-	*
842
-	* @return Array Return ACARS data in array
843
-	*/
840
+	 * List all Message title & label from DB
841
+	 *
842
+	 * @return Array Return ACARS data in array
843
+	 */
844 844
 	public function getAllTitleLabel() {
845 845
 		$query = "SELECT * FROM acars_label ORDER BY title";
846 846
 		$query_values = array();
@@ -858,11 +858,11 @@  discard block
 block discarded – undo
858 858
 	}
859 859
 
860 860
 	/**
861
-	* Get Live ACARS data from DB
862
-	*
863
-	* @param String $ident
864
-	* @return Array Return ACARS data in array
865
-	*/
861
+	 * Get Live ACARS data from DB
862
+	 *
863
+	 * @param String $ident
864
+	 * @return Array Return ACARS data in array
865
+	 */
866 866
 	public function getLiveAcarsData($ident) {
867 867
 		$query = "SELECT * FROM acars_live WHERE ident = :ident ORDER BY acars_live_id DESC";
868 868
 		$query_values = array(':ident' => $ident);
@@ -880,10 +880,10 @@  discard block
 block discarded – undo
880 880
 	}
881 881
 
882 882
 	/**
883
-	* Get Latest ACARS data from DB
884
-	*
885
-	* @return Array Return ACARS data in array
886
-	*/
883
+	 * Get Latest ACARS data from DB
884
+	 *
885
+	 * @return Array Return ACARS data in array
886
+	 */
887 887
 	public function getLatestAcarsData($limit = '',$label = '') {
888 888
 		global $globalURL, $globalDBdriver;
889 889
 		$Image = new Image($this->db);
@@ -980,10 +980,10 @@  discard block
 block discarded – undo
980 980
 	}
981 981
 
982 982
 	/**
983
-	* Get Archive ACARS data from DB
984
-	*
985
-	* @return Array Return ACARS data in array
986
-	*/
983
+	 * Get Archive ACARS data from DB
984
+	 *
985
+	 * @return Array Return ACARS data in array
986
+	 */
987 987
 	public function getArchiveAcarsData($limit = '',$label = '') {
988 988
 		global $globalURL, $globalDBdriver;
989 989
 		$Image = new Image($this->db);
@@ -1085,13 +1085,13 @@  discard block
 block discarded – undo
1085 1085
 	}
1086 1086
 
1087 1087
 	/**
1088
-	* Add ModeS data to DB
1089
-	*
1090
-	* @param String $ident ident
1091
-	* @param String $registration Registration of the aircraft
1092
-	* @param String $icao
1093
-	* @param String $ICAOTypeCode
1094
-	*/
1088
+	 * Add ModeS data to DB
1089
+	 *
1090
+	 * @param String $ident ident
1091
+	 * @param String $registration Registration of the aircraft
1092
+	 * @param String $icao
1093
+	 * @param String $ICAOTypeCode
1094
+	 */
1095 1095
 	public function addModeSData($ident,$registration,$icao = '',$ICAOTypeCode = '',$latitude = '', $longitude = '') {
1096 1096
 		global $globalDebug, $globalDBdriver;
1097 1097
 		$ident = trim($ident);
Please login to merge, or discard this patch.
require/class.Image.php 1 patch
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 	}
13 13
 
14 14
 	/**
15
-	* Gets the images based on the aircraft registration
16
-	*
17
-	* @return Array the images list
18
-	*
19
-	*/
15
+	 * Gets the images based on the aircraft registration
16
+	 *
17
+	 * @return Array the images list
18
+	 *
19
+	 */
20 20
 	public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
21 21
 	{
22 22
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 			WHERE spotter_image.registration = :registration";
30 30
 		$sth = $this->db->prepare($query);
31 31
 		$sth->execute(array(':registration' => $registration));
32
-          /*
32
+		  /*
33 33
         $images_array = array();
34 34
 	$temp_array = array();
35 35
 
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	/**
55
-	* Gets the image copyright based on the Exif data
56
-	*
57
-	* @return String image copyright
58
-	*
59
-	*/
55
+	 * Gets the image copyright based on the Exif data
56
+	 *
57
+	 * @return String image copyright
58
+	 *
59
+	 */
60 60
 	public function getExifCopyright($url) {
61 61
 		$exif = exif_read_data($url);
62 62
 		$copyright = '';
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 	}
72 72
 
73 73
 	/**
74
-	* Adds the images based on the aircraft registration
75
-	*
76
-	* @return String either success or error
77
-	*
78
-	*/
74
+	 * Adds the images based on the aircraft registration
75
+	 *
76
+	 * @return String either success or error
77
+	 *
78
+	 */
79 79
 	public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
80 80
 	{
81 81
 		global $globalDebug,$globalAircraftImageFetch;
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 	}
105 105
 
106 106
 	/**
107
-	* Gets the aircraft image
108
-	*
109
-	* @param String $aircraft_registration the registration of the aircraft
110
-	* @return Array the aircraft thumbnail, orignal url and copyright
111
-	*
112
-	*/
107
+	 * Gets the aircraft image
108
+	 *
109
+	 * @param String $aircraft_registration the registration of the aircraft
110
+	 * @return Array the aircraft thumbnail, orignal url and copyright
111
+	 *
112
+	 */
113 113
 	public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $airline_icao = '')
114 114
 	{
115 115
 		global $globalAircraftImageSources, $globalIVAO;
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 	}
150 150
 
151 151
 	/**
152
-	* Gets the aircraft image from Planespotters
153
-	*
154
-	* @param String $aircraft_registration the registration of the aircraft
155
-	* @param String $aircraft_name type of the aircraft
156
-	* @return Array the aircraft thumbnail, orignal url and copyright
157
-	*
158
-	*/
152
+	 * Gets the aircraft image from Planespotters
153
+	 *
154
+	 * @param String $aircraft_registration the registration of the aircraft
155
+	 * @param String $aircraft_name type of the aircraft
156
+	 * @return Array the aircraft thumbnail, orignal url and copyright
157
+	 *
158
+	 */
159 159
 	public function fromPlanespotters($aircraft_registration, $aircraft_name='') {
160 160
 		$Common = new Common();
161 161
 		// If aircraft registration is only number, also check with aircraft model
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
 	}
183 183
 
184 184
 	/**
185
-	* Gets the aircraft image from Deviantart
186
-	*
187
-	* @param String $aircraft_registration the registration of the aircraft
188
-	* @param String $aircraft_name type of the aircraft
189
-	* @return Array the aircraft thumbnail, orignal url and copyright
190
-	*
191
-	*/
185
+	 * Gets the aircraft image from Deviantart
186
+	 *
187
+	 * @param String $aircraft_registration the registration of the aircraft
188
+	 * @param String $aircraft_name type of the aircraft
189
+	 * @return Array the aircraft thumbnail, orignal url and copyright
190
+	 *
191
+	 */
192 192
 	public function fromDeviantart($aircraft_registration, $aircraft_name='') {
193 193
 		$Common = new Common();
194 194
 		// If aircraft registration is only number, also check with aircraft model
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 	}
217 217
 
218 218
 	/**
219
-	* Gets the aircraft image from JetPhotos
220
-	*
221
-	* @param String $aircraft_registration the registration of the aircraft
222
-	* @param String $aircraft_name type of the aircraft
223
-	* @return Array the aircraft thumbnail, orignal url and copyright
224
-	*
225
-	*/
219
+	 * Gets the aircraft image from JetPhotos
220
+	 *
221
+	 * @param String $aircraft_registration the registration of the aircraft
222
+	 * @param String $aircraft_name type of the aircraft
223
+	 * @return Array the aircraft thumbnail, orignal url and copyright
224
+	 *
225
+	 */
226 226
 	public function fromJetPhotos($aircraft_registration, $aircraft_name='') {
227 227
 		$Common = new Common();
228 228
 		$url= 'http://jetphotos.net/showphotos.php?displaymode=2&regsearch='.$aircraft_registration;
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 	}
259 259
 
260 260
 	/**
261
-	* Gets the aircraft image from PlanePictures
262
-	*
263
-	* @param String $aircraft_registration the registration of the aircraft
264
-	* @param String $aircraft_name type of the aircraft
265
-	* @return Array the aircraft thumbnail, orignal url and copyright
266
-	*
267
-	*/
261
+	 * Gets the aircraft image from PlanePictures
262
+	 *
263
+	 * @param String $aircraft_registration the registration of the aircraft
264
+	 * @param String $aircraft_name type of the aircraft
265
+	 * @return Array the aircraft thumbnail, orignal url and copyright
266
+	 *
267
+	 */
268 268
 	public function fromPlanePictures($aircraft_registration, $aircraft_name='') {
269 269
 		$Common = new Common();
270 270
 		$url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2';
@@ -292,13 +292,13 @@  discard block
 block discarded – undo
292 292
 	}
293 293
 
294 294
 	/**
295
-	* Gets the aircraft image from Flickr
296
-	*
297
-	* @param String $aircraft_registration the registration of the aircraft
298
-	* @param String $aircraft_name type of the aircraft
299
-	* @return Array the aircraft thumbnail, orignal url and copyright
300
-	*
301
-	*/
295
+	 * Gets the aircraft image from Flickr
296
+	 *
297
+	 * @param String $aircraft_registration the registration of the aircraft
298
+	 * @param String $aircraft_name type of the aircraft
299
+	 * @return Array the aircraft thumbnail, orignal url and copyright
300
+	 *
301
+	 */
302 302
 	public function fromFlickr($aircraft_registration,$aircraft_name='') {
303 303
 		$Common = new Common();
304 304
 		if ($aircraft_name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.','.urlencode($aircraft_name);
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
 	}
337 337
 
338 338
 	/**
339
-	* Gets the aircraft image from Bing
340
-	*
341
-	* @param String $aircraft_registration the registration of the aircraft
342
-	* @param String $aircraft_name type of the aircraft
343
-	* @return Array the aircraft thumbnail, orignal url and copyright
344
-	*
345
-	*/
339
+	 * Gets the aircraft image from Bing
340
+	 *
341
+	 * @param String $aircraft_registration the registration of the aircraft
342
+	 * @param String $aircraft_name type of the aircraft
343
+	 * @return Array the aircraft thumbnail, orignal url and copyright
344
+	 *
345
+	 */
346 346
 	public function fromBing($aircraft_registration,$aircraft_name='') {
347 347
 		global $globalImageBingKey;
348 348
 		$Common = new Common();
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
 	}
369 369
 
370 370
 	/**
371
-	* Gets the aircraft image from airport-data
372
-	*
373
-	* @param String $aircraft_registration the registration of the aircraft
374
-	* @param String $aircraft_name type of the aircraft
375
-	* @return Array the aircraft thumbnail, orignal url and copyright
376
-	*
377
-	*/
371
+	 * Gets the aircraft image from airport-data
372
+	 *
373
+	 * @param String $aircraft_registration the registration of the aircraft
374
+	 * @param String $aircraft_name type of the aircraft
375
+	 * @return Array the aircraft thumbnail, orignal url and copyright
376
+	 *
377
+	 */
378 378
 	public function fromAirportData($aircraft_registration,$aircraft_name='') {
379 379
 		$Common = new Common();
380 380
 		$url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration;
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
393 393
 	}
394 394
 
395 395
 	/**
396
-	* Gets the aircraft image from WikiMedia
397
-	*
398
-	* @param String $aircraft_registration the registration of the aircraft
399
-	* @param String $aircraft_name type of the aircraft
400
-	* @return Array the aircraft thumbnail, orignal url and copyright
401
-	*
402
-	*/
396
+	 * Gets the aircraft image from WikiMedia
397
+	 *
398
+	 * @param String $aircraft_registration the registration of the aircraft
399
+	 * @param String $aircraft_name type of the aircraft
400
+	 * @return Array the aircraft thumbnail, orignal url and copyright
401
+	 *
402
+	 */
403 403
 	public function fromWikimedia($aircraft_registration,$aircraft_name='') {
404 404
 		$Common = new Common();
405 405
 		if ($aircraft_name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20'.urlencode($aircraft_name);
@@ -449,13 +449,13 @@  discard block
 block discarded – undo
449 449
 	}
450 450
 
451 451
 	/**
452
-	* Gets the aircraft image from custom url
453
-	*
454
-	* @param String $aircraft_registration the registration of the aircraft
455
-	* @param String $aircraft_name type of the aircraft
456
-	* @return Array the aircraft thumbnail, orignal url and copyright
457
-	*
458
-	*/
452
+	 * Gets the aircraft image from custom url
453
+	 *
454
+	 * @param String $aircraft_registration the registration of the aircraft
455
+	 * @param String $aircraft_name type of the aircraft
456
+	 * @return Array the aircraft thumbnail, orignal url and copyright
457
+	 *
458
+	 */
459 459
 	public function fromCustomSource($aircraft_registration,$aircraft_name='') {
460 460
 		global $globalAircraftCustomSources;
461 461
 		//$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true);
Please login to merge, or discard this patch.
require/class.Scheduler.php 1 patch
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -8,29 +8,29 @@  discard block
 block discarded – undo
8 8
 
9 9
 class Schedule {
10 10
 	protected $cookies = array();
11
-        public $db;
11
+		public $db;
12 12
 	public function __construct($dbc = null) {
13 13
 		$Connection = new Connection($dbc);
14 14
 		$this->db = $Connection->db();
15
-        }
15
+		}
16 16
 	
17 17
 	/**
18
-	* Add schedule data to database
19
-	* @param String $ident aircraft ident
20
-	* @param String $departure_airport_icao departure airport icao
21
-	* @param String $departure_airport_time departure airport time
22
-	* @param String $arrival_airport_icao arrival airport icao
23
-	* @param String $arrival_airport_time arrival airport time
18
+	 * Add schedule data to database
19
+	 * @param String $ident aircraft ident
20
+	 * @param String $departure_airport_icao departure airport icao
21
+	 * @param String $departure_airport_time departure airport time
22
+	 * @param String $arrival_airport_icao arrival airport icao
23
+	 * @param String $arrival_airport_time arrival airport time
24 24
 	/ @param String $source source of data
25
-	*/
25
+	 */
26 26
 	
27 27
 	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
28 28
 		date_default_timezone_set('UTC');
29 29
 		$date = date("Y-m-d H:i:s",time());
30
-	        //if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
31
-	        //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
32
-	        $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
33
-	        $query_values = array(':ident' => $ident);
30
+			//if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
31
+			//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
32
+			$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
33
+			$query_values = array(':ident' => $ident);
34 34
 		 try {
35 35
 			$sth = $this->db->prepare($query);
36 36
 			$sth->execute($query_values);
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
 		}
40 40
 		if ($sth->fetchColumn() > 0) {
41 41
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
42
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
43
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
42
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
43
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
44 44
 			} elseif ($arrival_airport_time == '') {
45
-			    $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";
46
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
45
+				$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";
46
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
47 47
 			} elseif ($departure_airport_time == '') {
48
-			    $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";
49
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
48
+				$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";
49
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
50 50
 			} else {
51
-			    //$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";
52
-			    $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";
53
-			    $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);
51
+				//$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";
52
+				$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";
53
+				$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);
54 54
 			}
55 55
 			try {
56 56
 				$sth = $this->db->prepare($query);
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
 			if ($sth->fetchColumn() == 0) {
62 62
 				//$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident';
63 63
 				if ($departure_airport_time == '' && $arrival_airport_time == '') {
64
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
65
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
64
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
65
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
66 66
 				} elseif ($arrival_airport_time == '') {
67
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
68
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
67
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
68
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
69 69
 				} elseif ($departure_airport_time == '') {
70
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
71
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
70
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
71
+					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
72 72
 				} else {
73
-                            	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
74
-				    $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, ':date' => $date, ':source' => $source);
73
+									$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
74
+					$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, ':date' => $date, ':source' => $source);
75 75
 				}
76 76
 				 try {
77 77
 					$sth = $this->db->prepare($query);
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
 	}
105 105
 
106 106
 	public function getSchedule($ident) {
107
-	        $Translation = new Translation($this->db);
108
-	        $operator = $Translation->checkTranslation($ident,false);
109
-	        if ($ident != $operator) {
110
-	    		$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :operator OR CallSign = :ident LIMIT 1";
111
-	    		$query_values = array(':ident' => $ident,'operator' => $operator);
112
-	    	} else {
113
-		        $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :ident LIMIT 1";
114
-	    		$query_values = array(':ident' => $ident);
115
-	    	}
107
+			$Translation = new Translation($this->db);
108
+			$operator = $Translation->checkTranslation($ident,false);
109
+			if ($ident != $operator) {
110
+				$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :operator OR CallSign = :ident LIMIT 1";
111
+				$query_values = array(':ident' => $ident,'operator' => $operator);
112
+			} else {
113
+				$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :ident LIMIT 1";
114
+				$query_values = array(':ident' => $ident);
115
+			}
116 116
 		 try {
117 117
 			$sth = $this->db->prepare($query);
118 118
 			$sth->execute($query_values);
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 
128 128
 	public function checkSchedule($ident) {
129 129
 		global $globalDBdriver;
130
-	        //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
131
-	        if ($globalDBdriver == 'mysql') {
130
+			//$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
131
+			if ($globalDBdriver == 'mysql') {
132 132
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE 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";
133 133
 		} else {
134 134
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE CallSign = :ident 
135 135
 			AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL)
136 136
 			     OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1";
137 137
 		}
138
-	        $query_values = array(':ident' => $ident);
138
+			$query_values = array(':ident' => $ident);
139 139
 		 try {
140 140
 			$sth = $this->db->prepare($query);
141 141
 			$sth->execute($query_values);
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 	}
148 148
 
149 149
 	/**
150
-	* Get flight info from Air France
151
-	* @param String $callsign The callsign
152
-	* @param String $date date we want flight number info
153
-	* @param String $carrier IATA code
154
-	* @return Flight departure and arrival airports and time
155
-	*/
150
+	 * Get flight info from Air France
151
+	 * @param String $callsign The callsign
152
+	 * @param String $date date we want flight number info
153
+	 * @param String $carrier IATA code
154
+	 * @return Flight departure and arrival airports and time
155
+	 */
156 156
 	private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
157 157
 		$Common = new Common();
158 158
 		$check_date = new Datetime($date);
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 	}
189 189
 
190 190
 	/**
191
-	* Get flight info from EasyJet
192
-	* @param String $callsign The callsign
193
-	* @param String $date date we want flight number info
194
-	* @return Flight departure and arrival airports and time
195
-	*/
191
+	 * Get flight info from EasyJet
192
+	 * @param String $callsign The callsign
193
+	 * @param String $date date we want flight number info
194
+	 * @return Flight departure and arrival airports and time
195
+	 */
196 196
 	private function getEasyJet($callsign, $date = 'NOW') {
197 197
 		global $globalTimezone;
198 198
 		$Common = new Common();
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 	}
217 217
 
218 218
 	/**
219
-	* Get flight info from Ryanair
220
-	* @param String $callsign The callsign
221
-	* @return Flight departure and arrival airports and time
222
-	*/
219
+	 * Get flight info from Ryanair
220
+	 * @param String $callsign The callsign
221
+	 * @return Flight departure and arrival airports and time
222
+	 */
223 223
 	private function getRyanair($callsign) {
224 224
 		$Common = new Common();
225 225
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	}
243 243
 
244 244
 	/**
245
-	* Get flight info from Swiss
246
-	* @param String $callsign The callsign
247
-	* @return Flight departure and arrival airports and time
248
-	*/
245
+	 * Get flight info from Swiss
246
+	 * @param String $callsign The callsign
247
+	 * @return Flight departure and arrival airports and time
248
+	 */
249 249
 	private function getSwiss($callsign) {
250 250
 		$Common = new Common();
251 251
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 	}
275 275
 	
276 276
 	/**
277
-	* Get flight info from British Airways API
278
-	* @param String $callsign The callsign
279
-	* @param String $date date we want flight number info
280
-	* @return Flight departure and arrival airports and time
281
-	*/
277
+	 * Get flight info from British Airways API
278
+	 * @param String $callsign The callsign
279
+	 * @param String $date date we want flight number info
280
+	 * @return Flight departure and arrival airports and time
281
+	 */
282 282
 	public function getBritishAirways($callsign, $date = 'NOW') {
283 283
 		global $globalBritishAirwaysKey;
284 284
 		$Common = new Common();
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
 	}
303 303
 
304 304
 	/**
305
-	* Get flight info from Lutfhansa API
306
-	* @param String $callsign The callsign
307
-	* @param String $date date we want flight number info
308
-	* @return Flight departure and arrival airports and time
309
-	*/
305
+	 * Get flight info from Lutfhansa API
306
+	 * @param String $callsign The callsign
307
+	 * @param String $date date we want flight number info
308
+	 * @return Flight departure and arrival airports and time
309
+	 */
310 310
 	public function getLufthansa($callsign, $date = 'NOW') {
311 311
 		global $globalLufthansaKey;
312 312
 		$Common = new Common();
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 	}
337 337
 
338 338
 	/**
339
-	* Get flight info from Transavia API
340
-	* @param String $callsign The callsign
341
-	* @param String $date date we want flight number info
342
-	* @return Flight departure and arrival airports and time
343
-	*/
339
+	 * Get flight info from Transavia API
340
+	 * @param String $callsign The callsign
341
+	 * @param String $date date we want flight number info
342
+	 * @return Flight departure and arrival airports and time
343
+	 */
344 344
 	public function getTransavia($callsign, $date = 'NOW') {
345 345
 		global $globalTransaviaKey;
346 346
 		$Common = new Common();
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
 	}
367 367
 
368 368
 	/**
369
-	* Get flight info from Tunisair
370
-	* @param String $callsign The callsign
371
-	* @return Flight departure and arrival airports and time
372
-	*/
369
+	 * Get flight info from Tunisair
370
+	 * @param String $callsign The callsign
371
+	 * @return Flight departure and arrival airports and time
372
+	 */
373 373
 	public function getTunisair($callsign) {
374 374
 		$Common = new Common();
375 375
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -386,10 +386,10 @@  discard block
 block discarded – undo
386 386
 	}
387 387
 
388 388
 	/**
389
-	* Get flight info from Vueling
390
-	* @param String $callsign The callsign
391
-	* @return Flight departure and arrival airports and time
392
-	*/
389
+	 * Get flight info from Vueling
390
+	 * @param String $callsign The callsign
391
+	 * @return Flight departure and arrival airports and time
392
+	 */
393 393
 	public function getVueling($callsign,$date = 'NOW') {
394 394
 		$Common = new Common();
395 395
 		$check_date = new Datetime($date);
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
 	}
412 412
 
413 413
 	/**
414
-	* Get flight info from Iberia
415
-	* @param String $callsign The callsign
416
-	* @param String $date date we want flight number info
417
-	* @return Flight departure and arrival airports and time
418
-	*/
414
+	 * Get flight info from Iberia
415
+	 * @param String $callsign The callsign
416
+	 * @param String $date date we want flight number info
417
+	 * @return Flight departure and arrival airports and time
418
+	 */
419 419
 	public function getIberia($callsign, $date = 'NOW') {
420 420
 		$Common = new Common();
421 421
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -445,11 +445,11 @@  discard block
 block discarded – undo
445 445
 	}
446 446
 
447 447
 	/**
448
-	* Get flight info from Star Alliance
449
-	* @param String $callsign The callsign
450
-	* @param String $date date we want flight number info
451
-	* @return Flight departure and arrival airports and time
452
-	*/
448
+	 * Get flight info from Star Alliance
449
+	 * @param String $callsign The callsign
450
+	 * @param String $date date we want flight number info
451
+	 * @return Flight departure and arrival airports and time
452
+	 */
453 453
 
454 454
 	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
455 455
 		$Common = new Common();
@@ -481,11 +481,11 @@  discard block
 block discarded – undo
481 481
 
482 482
 
483 483
 	/**
484
-	* Get flight info from Alitalia
485
-	* @param String $callsign The callsign
486
-	* @param String $date date we want flight number info
487
-	* @return Flight departure and arrival airports and time
488
-	*/
484
+	 * Get flight info from Alitalia
485
+	 * @param String $callsign The callsign
486
+	 * @param String $date date we want flight number info
487
+	 * @return Flight departure and arrival airports and time
488
+	 */
489 489
 	private function getAlitalia($callsign, $date = 'NOW') {
490 490
 		$Common = new Common();
491 491
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
 	}
505 505
 
506 506
 	/**
507
-	* Get flight info from Brussels airlines
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 Brussels airlines
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 getBrussels($callsign, $date = 'NOW') {
513 513
 		$Common = new Common();
514 514
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -518,24 +518,24 @@  discard block
 block discarded – undo
518 518
 		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
519 519
 		$data = $Common->getData($url);
520 520
 		if ($data != '') {
521
-		    //echo $data;
522
-		    $parsed_json = json_decode($data);
523
-		    if (isset($parsed_json[0]->FromAirportCode)) {
521
+			//echo $data;
522
+			$parsed_json = json_decode($data);
523
+			if (isset($parsed_json[0]->FromAirportCode)) {
524 524
 			$DepartureAirportIata = $parsed_json[0]->FromAirportCode;
525 525
 			$ArrivalAirportIata = $parsed_json[0]->ToAirportCode;
526 526
 			$departureTime = date('H:i',strtotime($parsed_json[0]->ScheduledDepatureDate));
527 527
 			$arrivalTime = date('H:i',strtotime($parsed_json[0]->ScheduledArrivalDate));
528 528
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
529
-		    }
529
+			}
530 530
 		}
531 531
 	}
532 532
 
533 533
 	/**
534
-	* Get flight info from FlightRadar24
535
-	* @param String $callsign The callsign
536
-	* @param String $date date we want flight number info
537
-	* @return Flight departure and arrival airports and time
538
-	*/
534
+	 * Get flight info from FlightRadar24
535
+	 * @param String $callsign The callsign
536
+	 * @param String $date date we want flight number info
537
+	 * @return Flight departure and arrival airports and time
538
+	 */
539 539
 /*
540 540
 	public function getFlightRadar24($callsign, $date = 'NOW') {
541 541
 		$Common = new Common();
@@ -564,11 +564,11 @@  discard block
 block discarded – undo
564 564
 	}
565 565
   */
566 566
 	/**
567
-	* Get flight info from Lufthansa
568
-	* @param String $callsign The callsign
569
-	* @param String $date date we want flight number info
570
-	* @return Flight departure and arrival airports and time
571
-	*/
567
+	 * Get flight info from Lufthansa
568
+	 * @param String $callsign The callsign
569
+	 * @param String $date date we want flight number info
570
+	 * @return Flight departure and arrival airports and time
571
+	 */
572 572
 
573 573
 /*	private function getLufthansa($callsign, $date = 'NOW') {
574 574
 		$Common = new Common();
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
 	}
597 597
   */
598 598
 	/**
599
-	* Get flight info from flytap
600
-	* @param String $callsign The callsign
601
-	* @return Flight departure and arrival airports and time
602
-	*/
599
+	 * Get flight info from flytap
600
+	 * @param String $callsign The callsign
601
+	 * @return Flight departure and arrival airports and time
602
+	 */
603 603
 	private function getFlyTap($callsign) {
604 604
 		$Common = new Common();
605 605
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -622,10 +622,10 @@  discard block
 block discarded – undo
622 622
 	}
623 623
 
624 624
 	/**
625
-	* Get flight info from flightmapper
626
-	* @param String $callsign The callsign
627
-	* @return Flight departure and arrival airports and time
628
-	*/
625
+	 * Get flight info from flightmapper
626
+	 * @param String $callsign The callsign
627
+	 * @return Flight departure and arrival airports and time
628
+	 */
629 629
 	public function getFlightMapper($callsign) {
630 630
 		$Common = new Common();
631 631
 		$airline_icao = '';
@@ -653,11 +653,11 @@  discard block
 block discarded – undo
653 653
 				$aarr = '';
654 654
 				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
655 655
 				if ($n == 7) {
656
-				    $departureTime = $dhour;
657
-				    $arrivalTime = $ahour;
658
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
659
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
660
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
656
+					$departureTime = $dhour;
657
+					$arrivalTime = $ahour;
658
+					$DepartureAirportIata = str_replace(array('(',')'),'',$darr);
659
+					$ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
660
+					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
661 661
 				}
662 662
 			}
663 663
 		}
@@ -665,10 +665,10 @@  discard block
 block discarded – undo
665 665
 	}
666 666
 
667 667
 	/**
668
-	* Get flight info from flightaware
669
-	* @param String $callsign The callsign
670
-	* @return Flight departure and arrival airports and time
671
-	*/
668
+	 * Get flight info from flightaware
669
+	 * @param String $callsign The callsign
670
+	 * @return Flight departure and arrival airports and time
671
+	 */
672 672
 	public function getFlightAware($callsign) {
673 673
 		$Common = new Common();
674 674
 		/*
@@ -701,10 +701,10 @@  discard block
 block discarded – undo
701 701
 	}
702 702
 
703 703
 	/**
704
-	* Get flight info from CostToTravel
705
-	* @param String $callsign The callsign
706
-	* @return Flight departure and arrival airports and time
707
-	*/
704
+	 * Get flight info from CostToTravel
705
+	 * @param String $callsign The callsign
706
+	 * @return Flight departure and arrival airports and time
707
+	 */
708 708
 	public function getCostToTravel($callsign) {
709 709
 		$Common = new Common();
710 710
 		$url= "http://www.costtotravel.com/flight-number/".$callsign;
@@ -726,11 +726,11 @@  discard block
 block discarded – undo
726 726
 	}
727 727
 
728 728
 	/**
729
-	* Get flight info from Air Canada
730
-	* @param String $callsign The callsign
731
-	* @param String $date date we want flight number info
732
-	* @return Flight departure and arrival airports and time
733
-	*/
729
+	 * Get flight info from Air Canada
730
+	 * @param String $callsign The callsign
731
+	 * @param String $date date we want flight number info
732
+	 * @return Flight departure and arrival airports and time
733
+	 */
734 734
 	private function getAirCanada($callsign,$date = 'NOW') {
735 735
 		$Common = new Common();
736 736
 		date_default_timezone_set('UTC');
@@ -754,11 +754,11 @@  discard block
 block discarded – undo
754 754
 	}
755 755
 
756 756
 	/**
757
-	* Get flight info from Vietnam Airlines
758
-	* @param String $callsign The callsign
759
-	* @param String $date date we want flight number info
760
-	* @return Flight departure and arrival airports and time
761
-	*/
757
+	 * Get flight info from Vietnam Airlines
758
+	 * @param String $callsign The callsign
759
+	 * @param String $date date we want flight number info
760
+	 * @return Flight departure and arrival airports and time
761
+	 */
762 762
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
763 763
 		$Common = new Common();
764 764
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -780,12 +780,12 @@  discard block
 block discarded – undo
780 780
 	}
781 781
 
782 782
 	/**
783
-	* Get flight info from Air Berlin
784
-	* @param String $callsign The callsign
785
-	* @param String $date date we want flight number info
786
-	* @param String $carrier airline code
787
-	* @return Flight departure and arrival airports and time
788
-	*/
783
+	 * Get flight info from Air Berlin
784
+	 * @param String $callsign The callsign
785
+	 * @param String $date date we want flight number info
786
+	 * @param String $carrier airline code
787
+	 * @return Flight departure and arrival airports and time
788
+	 */
789 789
 	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
790 790
 		$Common = new Common();
791 791
 		date_default_timezone_set('UTC');
@@ -814,11 +814,11 @@  discard block
 block discarded – undo
814 814
 			$table = $Common->table2array($data);
815 815
 			$flight = $table;
816 816
 			if (isset($flight[5][4])) {
817
-			    $arrivalTime = $flight[5][4];
818
-			    $arrivalAirport = $flight[5][3];
817
+				$arrivalTime = $flight[5][4];
818
+				$arrivalAirport = $flight[5][3];
819 819
 			} else {
820
-			    $arrivalTime = '';
821
-			    $arrivalAirport = '';
820
+				$arrivalTime = '';
821
+				$arrivalAirport = '';
822 822
 			}
823 823
 		} else return array();
824 824
 		$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';
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 					}
1087 1087
 			}
1088 1088
 		}
1089
-	        return array();
1089
+			return array();
1090 1090
 	}
1091 1091
 }
1092 1092
 
Please login to merge, or discard this patch.
require/class.Translation.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -7,90 +7,90 @@  discard block
 block discarded – undo
7 7
 
8 8
 
9 9
 class Translation {
10
-    public $db;
11
-    public function __construct($dbc = null) {
12
-	    $Connection = new Connection($dbc);
13
-	    $this->db = $Connection->db();
14
-    }
10
+	public $db;
11
+	public function __construct($dbc = null) {
12
+		$Connection = new Connection($dbc);
13
+		$this->db = $Connection->db();
14
+	}
15 15
 
16
-    /**
17
-    * Change IATA to ICAO value for ident
18
-    * 
19
-    * @param String $ident ident
20
-    * @return String the icao
21
-    */
22
-    public function ident2icao($ident) {
16
+	/**
17
+	 * Change IATA to ICAO value for ident
18
+	 * 
19
+	 * @param String $ident ident
20
+	 * @return String the icao
21
+	 */
22
+	public function ident2icao($ident) {
23 23
 	$Spotter = new Spotter();
24 24
 	if (!is_numeric(substr($ident, 0, 3)))
25
-        {
26
-	    if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
27
-        	$airline_icao = substr($ident, 0, 2);
28
-            } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
29
-        	//$airline_icao = substr($ident, 0, 3);
30
-        	return $ident;
31
-            } else return $ident;
32
-        } else return $ident;
33
-        if ($airline_icao == 'AF') {
34
-            if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident;
35
-            else $icao = 'AFR'.ltrim(substr($ident,2),'0');
36
-        } else {
37
-            $identicao = $Spotter->getAllAirlineInfo($airline_icao);
38
-            if (isset($identicao[0])) {
39
-                $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0');
40
-            } else $icao = $ident;
41
-        }
42
-        return $icao;
43
-    }
25
+		{
26
+		if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
27
+			$airline_icao = substr($ident, 0, 2);
28
+			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
29
+			//$airline_icao = substr($ident, 0, 3);
30
+			return $ident;
31
+			} else return $ident;
32
+		} else return $ident;
33
+		if ($airline_icao == 'AF') {
34
+			if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident;
35
+			else $icao = 'AFR'.ltrim(substr($ident,2),'0');
36
+		} else {
37
+			$identicao = $Spotter->getAllAirlineInfo($airline_icao);
38
+			if (isset($identicao[0])) {
39
+				$icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0');
40
+			} else $icao = $ident;
41
+		}
42
+		return $icao;
43
+	}
44 44
 
45 45
 
46
-       public function getOperator($ident) {
47
-                $query = "SELECT * FROM translation WHERE Operator = :ident LIMIT 1";
48
-                $query_values = array(':ident' => $ident);
49
-                 try {
50
-                        $sth = $this->db->prepare($query);
51
-                        $sth->execute($query_values);
52
-                } catch(PDOException $e) {
53
-                        return "error : ".$e->getMessage();
54
-                }
55
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
56
-                if (count($row) > 0) {
57
-                        return $row['operator_correct'];
58
-                } else return $ident;
59
-        }
46
+	   public function getOperator($ident) {
47
+				$query = "SELECT * FROM translation WHERE Operator = :ident LIMIT 1";
48
+				$query_values = array(':ident' => $ident);
49
+				 try {
50
+						$sth = $this->db->prepare($query);
51
+						$sth->execute($query_values);
52
+				} catch(PDOException $e) {
53
+						return "error : ".$e->getMessage();
54
+				}
55
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
56
+				if (count($row) > 0) {
57
+						return $row['operator_correct'];
58
+				} else return $ident;
59
+		}
60 60
 
61
-       public function addOperator($ident,$correct_ident,$source) {
62
-                $query = "INSERT INTO translation (Operator,Operator_correct,Source) VALUES (:ident,:correct_ident,:source)";
63
-                $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source);
64
-                 try {
65
-                        $sth = $this->db->prepare($query);
66
-                        $sth->execute($query_values);
67
-                } catch(PDOException $e) {
68
-                        return "error : ".$e->getMessage();
69
-                }
70
-        }
61
+	   public function addOperator($ident,$correct_ident,$source) {
62
+				$query = "INSERT INTO translation (Operator,Operator_correct,Source) VALUES (:ident,:correct_ident,:source)";
63
+				$query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source);
64
+				 try {
65
+						$sth = $this->db->prepare($query);
66
+						$sth->execute($query_values);
67
+				} catch(PDOException $e) {
68
+						return "error : ".$e->getMessage();
69
+				}
70
+		}
71 71
 
72
-       public function updateOperator($ident,$correct_ident,$source) {
73
-                $query = "UPDATE translation SET Operator_correct = :correct_ident,Source = :source WHERE Operator = :ident";
74
-                $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source);
75
-                 try {
76
-                        $sth = $this->db->prepare($query);
77
-                        $sth->execute($query_values);
78
-                } catch(PDOException $e) {
79
-                        return "error : ".$e->getMessage();
80
-                }
81
-        }
72
+	   public function updateOperator($ident,$correct_ident,$source) {
73
+				$query = "UPDATE translation SET Operator_correct = :correct_ident,Source = :source WHERE Operator = :ident";
74
+				$query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source);
75
+				 try {
76
+						$sth = $this->db->prepare($query);
77
+						$sth->execute($query_values);
78
+				} catch(PDOException $e) {
79
+						return "error : ".$e->getMessage();
80
+				}
81
+		}
82 82
         
83
-        public function checkTranslation($ident,$web = false) {
84
-    	    global $globalTranslationSources, $globalTranslationFetch;
85
-    	    //if (!isset($globalTranslationSources)) $globalTranslationSources = array('planefinder');
86
-    	    $globalTranslationSources = array();
87
-    	    if (!isset($globalTranslationFetch)) $globalTranslationFetch = TRUE;
88
-    	    //echo "Check Translation for ".$ident."...";
89
-    	    $correct = $this->getOperator($ident);
90
-    	    if ($correct != '' && $correct != $ident) {
91
-    		//echo "Found in DB !\n";
92
-    		 return $correct;
93
-    	    } /*
83
+		public function checkTranslation($ident,$web = false) {
84
+			global $globalTranslationSources, $globalTranslationFetch;
85
+			//if (!isset($globalTranslationSources)) $globalTranslationSources = array('planefinder');
86
+			$globalTranslationSources = array();
87
+			if (!isset($globalTranslationFetch)) $globalTranslationFetch = TRUE;
88
+			//echo "Check Translation for ".$ident."...";
89
+			$correct = $this->getOperator($ident);
90
+			if ($correct != '' && $correct != $ident) {
91
+			//echo "Found in DB !\n";
92
+			 return $correct;
93
+			} /*
94 94
     	    elseif ($web && $globalTranslationFetch) {
95 95
     		if (! is_numeric(substr($ident,-4))) {
96 96
     		    if (count($globalTranslationSources) > 0) {
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
     		}
108 108
     	    }
109 109
     	    */
110
-    	    return $this->ident2icao($ident);
111
-        }
110
+			return $this->ident2icao($ident);
111
+		}
112 112
 
113 113
 /*  
114 114
     function fromPlanefinder($icao) {
Please login to merge, or discard this patch.