Completed
Push — master ( 116ecf...9aa308 )
by Yannick
08:10
created
install/class.create_db.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 			}
30 30
 			fclose($handle);
31 31
 		}
32
-                //Connection::$db->commit();
33
-                $Connection->db = null;
34
-                return '';
32
+				//Connection::$db->commit();
33
+				$Connection->db = null;
34
+				return '';
35 35
 	}
36 36
 
37 37
 	public static function import_all_db($directory) {
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		//foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename)
41 41
 		while(false !== ($filename = readdir($dh)))
42 42
 		{
43
-		    if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename);
43
+			if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename);
44 44
 		}
45 45
 		return $error;
46 46
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$host = filter_var($host,FILTER_SANITIZE_STRING);
56 56
 		// Dirty hack
57 57
 		if ($host != 'localhost' && $host != '127.0.0.1') {
58
-		    $grantright = $_SERVER['SERVER_ADDR'];
58
+			$grantright = $_SERVER['SERVER_ADDR'];
59 59
 		} else $grantright = 'localhost';
60 60
 		try {
61 61
 			$dbh = new PDO($db_type.':host='.$host,$root,$root_pass);
Please login to merge, or discard this patch.
require/class.Translation.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -7,91 +7,91 @@  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
-                $sth->closeCursor();
57
-                if (count($row) > 0) {
58
-                        return $row['operator_correct'];
59
-                } else return $ident;
60
-        }
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
+				$sth->closeCursor();
57
+				if (count($row) > 0) {
58
+						return $row['operator_correct'];
59
+				} else return $ident;
60
+		}
61 61
 
62
-       public function addOperator($ident,$correct_ident,$source) {
63
-                $query = "INSERT INTO translation (Operator,Operator_correct,Source) VALUES (:ident,:correct_ident,:source)";
64
-                $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source);
65
-                 try {
66
-                        $sth = $this->db->prepare($query);
67
-                        $sth->execute($query_values);
68
-                } catch(PDOException $e) {
69
-                        return "error : ".$e->getMessage();
70
-                }
71
-        }
62
+	   public function addOperator($ident,$correct_ident,$source) {
63
+				$query = "INSERT INTO translation (Operator,Operator_correct,Source) VALUES (:ident,:correct_ident,:source)";
64
+				$query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source);
65
+				 try {
66
+						$sth = $this->db->prepare($query);
67
+						$sth->execute($query_values);
68
+				} catch(PDOException $e) {
69
+						return "error : ".$e->getMessage();
70
+				}
71
+		}
72 72
 
73
-       public function updateOperator($ident,$correct_ident,$source) {
74
-                $query = "UPDATE translation SET Operator_correct = :correct_ident,Source = :source WHERE Operator = :ident";
75
-                $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source);
76
-                 try {
77
-                        $sth = $this->db->prepare($query);
78
-                        $sth->execute($query_values);
79
-                } catch(PDOException $e) {
80
-                        return "error : ".$e->getMessage();
81
-                }
82
-        }
73
+	   public function updateOperator($ident,$correct_ident,$source) {
74
+				$query = "UPDATE translation SET Operator_correct = :correct_ident,Source = :source WHERE Operator = :ident";
75
+				$query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source);
76
+				 try {
77
+						$sth = $this->db->prepare($query);
78
+						$sth->execute($query_values);
79
+				} catch(PDOException $e) {
80
+						return "error : ".$e->getMessage();
81
+				}
82
+		}
83 83
         
84
-        public function checkTranslation($ident,$web = false) {
85
-    	    global $globalTranslationSources, $globalTranslationFetch;
86
-    	    //if (!isset($globalTranslationSources)) $globalTranslationSources = array('planefinder');
87
-    	    $globalTranslationSources = array();
88
-    	    if (!isset($globalTranslationFetch)) $globalTranslationFetch = TRUE;
89
-    	    //echo "Check Translation for ".$ident."...";
90
-    	    $correct = $this->getOperator($ident);
91
-    	    if ($correct != '' && $correct != $ident) {
92
-    		//echo "Found in DB !\n";
93
-    		 return $correct;
94
-    	    } /*
84
+		public function checkTranslation($ident,$web = false) {
85
+			global $globalTranslationSources, $globalTranslationFetch;
86
+			//if (!isset($globalTranslationSources)) $globalTranslationSources = array('planefinder');
87
+			$globalTranslationSources = array();
88
+			if (!isset($globalTranslationFetch)) $globalTranslationFetch = TRUE;
89
+			//echo "Check Translation for ".$ident."...";
90
+			$correct = $this->getOperator($ident);
91
+			if ($correct != '' && $correct != $ident) {
92
+			//echo "Found in DB !\n";
93
+			 return $correct;
94
+			} /*
95 95
     	    elseif ($web && $globalTranslationFetch) {
96 96
     		if (! is_numeric(substr($ident,-4))) {
97 97
     		    if (count($globalTranslationSources) > 0) {
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
     		}
109 109
     	    }
110 110
     	    */
111
-    	    return $this->ident2icao($ident);
112
-        }
111
+			return $this->ident2icao($ident);
112
+		}
113 113
 
114 114
 /*  
115 115
     function fromPlanefinder($icao) {
Please login to merge, or discard this patch.
aircraft-statistics-airline-country.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 	print '<div class="select-item">';
22 22
 	print '<form action="'.$globalURL.'/aircraft" method="post">';
23 23
 	print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
24
-    	print '<option></option>';
25
-    	$Stats = new Stats();
26
-    	$aircraft_types = $Stats->getAllAircraftTypes();
27
-    	if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
28
-    	foreach($aircraft_types as $aircrafttype)
29
-    	{
30
-    		if($aircraft_type == $aircrafttype['aircraft_icao'])
31
-    		{
32
-    			print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
33
-    		} else {
34
-    			print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
35
-    		}
24
+		print '<option></option>';
25
+		$Stats = new Stats();
26
+		$aircraft_types = $Stats->getAllAircraftTypes();
27
+		if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
28
+		foreach($aircraft_types as $aircrafttype)
29
+		{
30
+			if($aircraft_type == $aircrafttype['aircraft_icao'])
31
+			{
32
+				print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
33
+			} else {
34
+				print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
35
+			}
36 36
 	}
37 37
 	print '</select>';
38 38
 	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         	function drawChart() {
65 65
         	    var data = google.visualization.arrayToDataTable([
66 66
             		["Country", "# of times"], ';
67
-            		$country_data = '';
67
+					$country_data = '';
68 68
 	foreach($airline_array as $airline_item)
69 69
 	{
70 70
 		$country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],';
Please login to merge, or discard this patch.
aircraft-detailed.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 		print '<div class="select-item">';
43 43
 		print '<form action="'.$globalURL.'/aircraft" method="post">';
44 44
 		print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
45
-    		print '<option></option>';
46
-    		$Stats = new Stats();
45
+			print '<option></option>';
46
+			$Stats = new Stats();
47 47
 		$aircraft_types = $Stats->getAllAircraftTypes();
48 48
 		if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
49 49
 		foreach($aircraft_types as $aircrafttype)
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 			} else {
55 55
 				print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
56 56
 			}
57
-    		}
58
-    		print '</select>';
59
-	    	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
57
+			}
58
+			print '</select>';
59
+			print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
60 60
 	  	print '</form>';
61 61
 	  	print '</div>';
62 62
 	    
63 63
 		if ($aircraft_type != "NA")
64 64
 		{
65
-	    		print '<div class="info column">';
66
-	      		print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>';
67
-	      		print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
68
-	      		print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; 
69
-	      		if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
70
-	    		print '</div>';
65
+				print '<div class="info column">';
66
+		  		print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>';
67
+		  		print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
68
+		  		print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; 
69
+		  		if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
70
+				print '</div>';
71 71
 		} else {
72 72
 			print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>';
73 73
 		}
Please login to merge, or discard this patch.
install/index.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -305,17 +305,17 @@  discard block
 block discarded – undo
305 305
 				</tr>
306 306
 				<!--
307 307
 		<?php
308
-		    require_once(dirname(__FILE__).'/../require/class.Connection.php');
309
-		    $Connection = new Connection();
308
+			require_once(dirname(__FILE__).'/../require/class.Connection.php');
309
+			$Connection = new Connection();
310 310
 		?>
311 311
 				-->
312 312
 		<?php
313
-		    if ($Connection->db != NULL) {
313
+			if ($Connection->db != NULL) {
314 314
 			if ($Connection->tableExists('source_location')) {
315
-			    require_once(dirname(__FILE__).'/../require/class.Source.php');
316
-			    $Source = new Source();
317
-			    $alllocations = $Source->getAllLocationInfo();
318
-			    foreach ($alllocations as $location) {
315
+				require_once(dirname(__FILE__).'/../require/class.Source.php');
316
+				$Source = new Source();
317
+				$alllocations = $Source->getAllLocationInfo();
318
+				foreach ($alllocations as $location) {
319 319
 		?>
320 320
 				<tr>
321 321
 	    				<input type="hidden" name="source_id[]" value="<?php print $location['id']; ?>" />
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 				</tr>
330 330
 		
331 331
 		<?php
332
-			    }
332
+				}
333
+			}
333 334
 			}
334
-		    }
335 335
 		?>
336 336
 
337 337
 				<tr>
@@ -424,12 +424,12 @@  discard block
 block discarded – undo
424 424
 ?>
425 425
 							<tr>
426 426
 								<?php
427
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
427
+									if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
428 428
 								?>
429 429
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
430 430
 								<td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td>
431 431
 								<?php
432
-								    } else {
432
+									} else {
433 433
 									$hostport = explode(':',$source['host']);
434 434
 									if (isset($hostport[1])) {
435 435
 										$host = $hostport[0];
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 								<td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td>
443 443
 								<td><input type="number" name="port[]" id="port" value="<?php print $port; ?>" /></td>
444 444
 								<?php
445
-								    }
445
+									}
446 446
 								?>
447 447
 								<td>
448 448
 									<select name="format[]" id="format">
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 			<br />
759 759
 			<p>
760 760
 			<?php 
761
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
761
+				if (extension_loaded('gd') && function_exists('gd_info')) {
762 762
 			?>
763 763
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
764 764
 				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
@@ -768,11 +768,11 @@  discard block
 block discarded – undo
768 768
 				<b>The directory cache is not writable, aircraft icon will not be cached</b>
769 769
 			<?php
770 770
 				}
771
-			    } else {
771
+				} else {
772 772
 			?>
773 773
 				<b>PHP GD is not installed, you can t change color of aircraft icon on map</b>
774 774
 			<?php
775
-			    }
775
+				}
776 776
 			?>
777 777
 			</p>
778 778
 			<br />
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	</p>
792 792
 <?php
793 793
 	require('../footer.php');
794
-        exit;
794
+		exit;
795 795
 }
796 796
 	
797 797
 $settings = array();
@@ -881,8 +881,8 @@  discard block
 block discarded – undo
881 881
 	
882 882
 	$sources = array();
883 883
 	foreach ($source_name as $keys => $name) {
884
-	    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]);
885
-	    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]);
884
+		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]);
885
+		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]);
886 886
 	}
887 887
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
888 888
 
@@ -1176,14 +1176,14 @@  discard block
 block discarded – undo
1176 1176
 
1177 1177
 	// Set some defaults values...
1178 1178
 	if (!isset($globalAircraftImageSources)) {
1179
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1180
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1179
+		$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1180
+		$settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1181 1181
 	}
1182 1182
 
1183 1183
 	if (!isset($globalSchedulesSources)) {
1184
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1185
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1186
-    	}
1184
+		$globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1185
+			$settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1186
+		}
1187 1187
 
1188 1188
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1189 1189
 
@@ -1235,21 +1235,21 @@  discard block
 block discarded – undo
1235 1235
 	$popi = false;
1236 1236
 	$popw = false;
1237 1237
 	foreach ($_SESSION['done'] as $done) {
1238
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1239
-	    if ($done == 'Create database') $pop = true;
1240
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1241
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1242
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1238
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1239
+		if ($done == 'Create database') $pop = true;
1240
+		if ($_SESSION['install'] == 'database_create') $pop = true;
1241
+		if ($_SESSION['install'] == 'database_import') $popi = true;
1242
+		if ($_SESSION['install'] == 'waypoints') $popw = true;
1243 1243
 	}
1244 1244
 	if ($pop) {
1245
-	    sleep(5);
1246
-	    print '<li>Create database....<img src="../images/loading.gif" /></li>';
1245
+		sleep(5);
1246
+		print '<li>Create database....<img src="../images/loading.gif" /></li>';
1247 1247
 	} else if ($popi) {
1248
-	    sleep(5);
1249
-	    print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1248
+		sleep(5);
1249
+		print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1250 1250
 	} else if ($popw) {
1251
-	    sleep(5);
1252
-	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1251
+		sleep(5);
1252
+		print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1253 1253
 	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1254 1254
 	print '</div></ul>';
1255 1255
 	print '<div id="error"></div>';
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 	unset($_COOKIE['install']);
1313 1313
 	print '<div class="info column"><ul>';
1314 1314
 	foreach ($_SESSION['done'] as $done) {
1315
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1315
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1316 1316
 	}
1317 1317
 	print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>';
1318 1318
 	print '</ul></div>';
Please login to merge, or discard this patch.
require/class.ATC.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -10,100 +10,100 @@
 block discarded – undo
10 10
 	}
11 11
 	
12 12
 	
13
-    /**
14
-    * Get SQL query part for filter used
15
-    * @param Array $filter the filter
16
-    * @return Array the SQL part
17
-    */
18
-    public function getFilter($filter = array(),$where = false,$and = false) {
13
+	/**
14
+	 * Get SQL query part for filter used
15
+	 * @param Array $filter the filter
16
+	 * @return Array the SQL part
17
+	 */
18
+	public function getFilter($filter = array(),$where = false,$and = false) {
19 19
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
20 20
 	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
21
-	    if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21
+		if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
22 22
 		foreach($globalStatsFilters[$globalFilterName] as $source) {
23 23
 			if (isset($source['source'])) $filter['source'][] = $source['source'];
24 24
 		}
25
-	    } else {
25
+		} else {
26 26
 		$filter = $globalStatsFilters[$globalFilterName];
27
-	    }
27
+		}
28 28
 	}
29 29
 	if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30 30
 	$filter_query_join = '';
31 31
 	$filter_query_where = '';
32 32
 	if (isset($filter['source']) && !empty($filter['source'])) {
33
-	    $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
33
+		$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
34 34
 	}
35 35
 	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
36 36
 	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
37 37
 	$filter_query = $filter_query_join.$filter_query_where;
38 38
 	return $filter_query;
39
-    }
39
+	}
40 40
 
41
-       public function getAll() {
42
-    		$filter_query = $this->getFilter(array());
43
-                $query = "SELECT * FROM atc".$filter_query;
44
-                $query_values = array();
45
-                 try {
46
-                        $sth = $this->db->prepare($query);
47
-                        $sth->execute($query_values);
48
-                } catch(PDOException $e) {
49
-                        return "error : ".$e->getMessage();
50
-                }
51
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
52
-                return $all;
53
-        }
41
+	   public function getAll() {
42
+			$filter_query = $this->getFilter(array());
43
+				$query = "SELECT * FROM atc".$filter_query;
44
+				$query_values = array();
45
+				 try {
46
+						$sth = $this->db->prepare($query);
47
+						$sth->execute($query_values);
48
+				} catch(PDOException $e) {
49
+						return "error : ".$e->getMessage();
50
+				}
51
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
52
+				return $all;
53
+		}
54 54
 
55
-       public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
56
-    		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
57
-    		$info = str_replace('^','<br />',$info);
58
-    		$info = str_replace('&amp;sect;','',$info);
59
-    		$info = str_replace('"','',$info);
60
-    		if ($type == '') $type = NULL;
61
-                $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
62
-                $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
63
-                 try {
64
-                        $sth = $this->db->prepare($query);
65
-                        $sth->execute($query_values);
66
-                } catch(PDOException $e) {
67
-                        return "error : ".$e->getMessage();
68
-                }
69
-        }
55
+	   public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
56
+			$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
57
+			$info = str_replace('^','<br />',$info);
58
+			$info = str_replace('&amp;sect;','',$info);
59
+			$info = str_replace('"','',$info);
60
+			if ($type == '') $type = NULL;
61
+				$query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
62
+				$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
63
+				 try {
64
+						$sth = $this->db->prepare($query);
65
+						$sth->execute($query_values);
66
+				} catch(PDOException $e) {
67
+						return "error : ".$e->getMessage();
68
+				}
69
+		}
70 70
 
71
-       public function deleteById($id) {
72
-                $query = "DELETE FROM atc WHERE atc_id = :id";
73
-                $query_values = array(':id' => $id);
74
-                 try {
75
-                        $sth = $this->db->prepare($query);
76
-                        $sth->execute($query_values);
77
-                } catch(PDOException $e) {
78
-                        return "error : ".$e->getMessage();
79
-                }
80
-        }
71
+	   public function deleteById($id) {
72
+				$query = "DELETE FROM atc WHERE atc_id = :id";
73
+				$query_values = array(':id' => $id);
74
+				 try {
75
+						$sth = $this->db->prepare($query);
76
+						$sth->execute($query_values);
77
+				} catch(PDOException $e) {
78
+						return "error : ".$e->getMessage();
79
+				}
80
+		}
81 81
 
82
-       public function deleteAll() {
83
-                $query = "DELETE FROM atc";
84
-                $query_values = array();
85
-                 try {
86
-                        $sth = $this->db->prepare($query);
87
-                        $sth->execute($query_values);
88
-                } catch(PDOException $e) {
89
-                        return "error : ".$e->getMessage();
90
-                }
91
-        }
82
+	   public function deleteAll() {
83
+				$query = "DELETE FROM atc";
84
+				$query_values = array();
85
+				 try {
86
+						$sth = $this->db->prepare($query);
87
+						$sth->execute($query_values);
88
+				} catch(PDOException $e) {
89
+						return "error : ".$e->getMessage();
90
+				}
91
+		}
92 92
 
93 93
 	public function deleteOldATC() {
94
-                global $globalDBdriver;
95
-                if ($globalDBdriver == 'mysql') {
96
-                        $query  = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen";
97
-                } else {
98
-                        $query  = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen";
99
-                }
100
-                try {
101
-                        $sth = $this->db->prepare($query);
102
-                        $sth->execute();
103
-                } catch(PDOException $e) {
104
-                        return "error";
105
-                }
106
-                return "success";
107
-        }
94
+				global $globalDBdriver;
95
+				if ($globalDBdriver == 'mysql') {
96
+						$query  = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen";
97
+				} else {
98
+						$query  = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen";
99
+				}
100
+				try {
101
+						$sth = $this->db->prepare($query);
102
+						$sth->execute();
103
+				} catch(PDOException $e) {
104
+						return "error";
105
+				}
106
+				return "success";
107
+		}
108 108
 }
109 109
 ?>
110 110
\ No newline at end of file
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 FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND 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 FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND 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 FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND 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 FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND 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);
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
 
129 129
 	public function checkSchedule($ident) {
130 130
 		global $globalDBdriver;
131
-	        //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
132
-	        if ($globalDBdriver == 'mysql') {
131
+			//$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
132
+			if ($globalDBdriver == 'mysql') {
133 133
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident AND ((date_added BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND DATE(NOW()) and date_modified IS NULL) OR (date_modified BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()))) LIMIT 1";
134 134
 		} else {
135 135
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident 
136 136
 			AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL)
137 137
 			     OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1";
138 138
 		}
139
-	        $query_values = array(':ident' => $ident);
139
+			$query_values = array(':ident' => $ident);
140 140
 		 try {
141 141
 			$sth = $this->db->prepare($query);
142 142
 			$sth->execute($query_values);
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 	}
150 150
 
151 151
 	/**
152
-	* Get flight info from Air France
153
-	* @param String $callsign The callsign
154
-	* @param String $date date we want flight number info
155
-	* @param String $carrier IATA code
156
-	* @return Flight departure and arrival airports and time
157
-	*/
152
+	 * Get flight info from Air France
153
+	 * @param String $callsign The callsign
154
+	 * @param String $date date we want flight number info
155
+	 * @param String $carrier IATA code
156
+	 * @return Flight departure and arrival airports and time
157
+	 */
158 158
 	private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
159 159
 		$Common = new Common();
160 160
 		$check_date = new Datetime($date);
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 	}
191 191
 
192 192
 	/**
193
-	* Get flight info from EasyJet
194
-	* @param String $callsign The callsign
195
-	* @param String $date date we want flight number info
196
-	* @return Flight departure and arrival airports and time
197
-	*/
193
+	 * Get flight info from EasyJet
194
+	 * @param String $callsign The callsign
195
+	 * @param String $date date we want flight number info
196
+	 * @return Flight departure and arrival airports and time
197
+	 */
198 198
 	private function getEasyJet($callsign, $date = 'NOW') {
199 199
 		global $globalTimezone;
200 200
 		$Common = new Common();
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	}
219 219
 
220 220
 	/**
221
-	* Get flight info from Ryanair
222
-	* @param String $callsign The callsign
223
-	* @return Flight departure and arrival airports and time
224
-	*/
221
+	 * Get flight info from Ryanair
222
+	 * @param String $callsign The callsign
223
+	 * @return Flight departure and arrival airports and time
224
+	 */
225 225
 	private function getRyanair($callsign) {
226 226
 		$Common = new Common();
227 227
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 	}
245 245
 
246 246
 	/**
247
-	* Get flight info from Swiss
248
-	* @param String $callsign The callsign
249
-	* @return Flight departure and arrival airports and time
250
-	*/
247
+	 * Get flight info from Swiss
248
+	 * @param String $callsign The callsign
249
+	 * @return Flight departure and arrival airports and time
250
+	 */
251 251
 	private function getSwiss($callsign) {
252 252
 		$Common = new Common();
253 253
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	}
277 277
 	
278 278
 	/**
279
-	* Get flight info from British Airways API
280
-	* @param String $callsign The callsign
281
-	* @param String $date date we want flight number info
282
-	* @return Flight departure and arrival airports and time
283
-	*/
279
+	 * Get flight info from British Airways API
280
+	 * @param String $callsign The callsign
281
+	 * @param String $date date we want flight number info
282
+	 * @return Flight departure and arrival airports and time
283
+	 */
284 284
 	public function getBritishAirways($callsign, $date = 'NOW') {
285 285
 		global $globalBritishAirwaysKey;
286 286
 		$Common = new Common();
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
 	}
305 305
 
306 306
 	/**
307
-	* Get flight info from Lutfhansa API
308
-	* @param String $callsign The callsign
309
-	* @param String $date date we want flight number info
310
-	* @return Flight departure and arrival airports and time
311
-	*/
307
+	 * Get flight info from Lutfhansa API
308
+	 * @param String $callsign The callsign
309
+	 * @param String $date date we want flight number info
310
+	 * @return Flight departure and arrival airports and time
311
+	 */
312 312
 	public function getLufthansa($callsign, $date = 'NOW') {
313 313
 		global $globalLufthansaKey;
314 314
 		$Common = new Common();
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 	}
339 339
 
340 340
 	/**
341
-	* Get flight info from Transavia API
342
-	* @param String $callsign The callsign
343
-	* @param String $date date we want flight number info
344
-	* @return Flight departure and arrival airports and time
345
-	*/
341
+	 * Get flight info from Transavia API
342
+	 * @param String $callsign The callsign
343
+	 * @param String $date date we want flight number info
344
+	 * @return Flight departure and arrival airports and time
345
+	 */
346 346
 	public function getTransavia($callsign, $date = 'NOW') {
347 347
 		global $globalTransaviaKey;
348 348
 		$Common = new Common();
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 	}
369 369
 
370 370
 	/**
371
-	* Get flight info from Tunisair
372
-	* @param String $callsign The callsign
373
-	* @return Flight departure and arrival airports and time
374
-	*/
371
+	 * Get flight info from Tunisair
372
+	 * @param String $callsign The callsign
373
+	 * @return Flight departure and arrival airports and time
374
+	 */
375 375
 	public function getTunisair($callsign) {
376 376
 		$Common = new Common();
377 377
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 	}
389 389
 
390 390
 	/**
391
-	* Get flight info from Vueling
392
-	* @param String $callsign The callsign
393
-	* @return Flight departure and arrival airports and time
394
-	*/
391
+	 * Get flight info from Vueling
392
+	 * @param String $callsign The callsign
393
+	 * @return Flight departure and arrival airports and time
394
+	 */
395 395
 	public function getVueling($callsign,$date = 'NOW') {
396 396
 		$Common = new Common();
397 397
 		$check_date = new Datetime($date);
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	}
414 414
 
415 415
 	/**
416
-	* Get flight info from Iberia
417
-	* @param String $callsign The callsign
418
-	* @param String $date date we want flight number info
419
-	* @return Flight departure and arrival airports and time
420
-	*/
416
+	 * Get flight info from Iberia
417
+	 * @param String $callsign The callsign
418
+	 * @param String $date date we want flight number info
419
+	 * @return Flight departure and arrival airports and time
420
+	 */
421 421
 	public function getIberia($callsign, $date = 'NOW') {
422 422
 		$Common = new Common();
423 423
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -447,11 +447,11 @@  discard block
 block discarded – undo
447 447
 	}
448 448
 
449 449
 	/**
450
-	* Get flight info from Star Alliance
451
-	* @param String $callsign The callsign
452
-	* @param String $date date we want flight number info
453
-	* @return Flight departure and arrival airports and time
454
-	*/
450
+	 * Get flight info from Star Alliance
451
+	 * @param String $callsign The callsign
452
+	 * @param String $date date we want flight number info
453
+	 * @return Flight departure and arrival airports and time
454
+	 */
455 455
 
456 456
 	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
457 457
 		$Common = new Common();
@@ -483,11 +483,11 @@  discard block
 block discarded – undo
483 483
 
484 484
 
485 485
 	/**
486
-	* Get flight info from Alitalia
487
-	* @param String $callsign The callsign
488
-	* @param String $date date we want flight number info
489
-	* @return Flight departure and arrival airports and time
490
-	*/
486
+	 * Get flight info from Alitalia
487
+	 * @param String $callsign The callsign
488
+	 * @param String $date date we want flight number info
489
+	 * @return Flight departure and arrival airports and time
490
+	 */
491 491
 	private function getAlitalia($callsign, $date = 'NOW') {
492 492
 		$Common = new Common();
493 493
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -506,11 +506,11 @@  discard block
 block discarded – undo
506 506
 	}
507 507
 
508 508
 	/**
509
-	* Get flight info from Brussels airlines
510
-	* @param String $callsign The callsign
511
-	* @param String $date date we want flight number info
512
-	* @return Flight departure and arrival airports and time
513
-	*/
509
+	 * Get flight info from Brussels airlines
510
+	 * @param String $callsign The callsign
511
+	 * @param String $date date we want flight number info
512
+	 * @return Flight departure and arrival airports and time
513
+	 */
514 514
 	private function getBrussels($callsign, $date = 'NOW') {
515 515
 		$Common = new Common();
516 516
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -520,24 +520,24 @@  discard block
 block discarded – undo
520 520
 		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
521 521
 		$data = $Common->getData($url);
522 522
 		if ($data != '') {
523
-		    //echo $data;
524
-		    $parsed_json = json_decode($data,true);
525
-		    if (isset($parsed_json[0]['FromAirportCode'])) {
523
+			//echo $data;
524
+			$parsed_json = json_decode($data,true);
525
+			if (isset($parsed_json[0]['FromAirportCode'])) {
526 526
 			$DepartureAirportIata = $parsed_json[0]['FromAirportCode'];
527 527
 			$ArrivalAirportIata = $parsed_json[0]['ToAirportCode'];
528 528
 			$departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate']));
529 529
 			$arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate']));
530 530
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
531
-		    }
531
+			}
532 532
 		}
533 533
 	}
534 534
 
535 535
 	/**
536
-	* Get flight info from FlightRadar24
537
-	* @param String $callsign The callsign
538
-	* @param String $date date we want flight number info
539
-	* @return Flight departure and arrival airports and time
540
-	*/
536
+	 * Get flight info from FlightRadar24
537
+	 * @param String $callsign The callsign
538
+	 * @param String $date date we want flight number info
539
+	 * @return Flight departure and arrival airports and time
540
+	 */
541 541
 /*
542 542
 	public function getFlightRadar24($callsign, $date = 'NOW') {
543 543
 		$Common = new Common();
@@ -566,11 +566,11 @@  discard block
 block discarded – undo
566 566
 	}
567 567
   */
568 568
 	/**
569
-	* Get flight info from Lufthansa
570
-	* @param String $callsign The callsign
571
-	* @param String $date date we want flight number info
572
-	* @return Flight departure and arrival airports and time
573
-	*/
569
+	 * Get flight info from Lufthansa
570
+	 * @param String $callsign The callsign
571
+	 * @param String $date date we want flight number info
572
+	 * @return Flight departure and arrival airports and time
573
+	 */
574 574
 
575 575
 /*	private function getLufthansa($callsign, $date = 'NOW') {
576 576
 		$Common = new Common();
@@ -598,10 +598,10 @@  discard block
 block discarded – undo
598 598
 	}
599 599
   */
600 600
 	/**
601
-	* Get flight info from flytap
602
-	* @param String $callsign The callsign
603
-	* @return Flight departure and arrival airports and time
604
-	*/
601
+	 * Get flight info from flytap
602
+	 * @param String $callsign The callsign
603
+	 * @return Flight departure and arrival airports and time
604
+	 */
605 605
 	private function getFlyTap($callsign) {
606 606
 		$Common = new Common();
607 607
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -624,10 +624,10 @@  discard block
 block discarded – undo
624 624
 	}
625 625
 
626 626
 	/**
627
-	* Get flight info from flightmapper
628
-	* @param String $callsign The callsign
629
-	* @return Flight departure and arrival airports and time
630
-	*/
627
+	 * Get flight info from flightmapper
628
+	 * @param String $callsign The callsign
629
+	 * @return Flight departure and arrival airports and time
630
+	 */
631 631
 	public function getFlightMapper($callsign) {
632 632
 		$Common = new Common();
633 633
 		$airline_icao = '';
@@ -655,11 +655,11 @@  discard block
 block discarded – undo
655 655
 				$aarr = '';
656 656
 				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
657 657
 				if ($n == 7) {
658
-				    $departureTime = $dhour;
659
-				    $arrivalTime = $ahour;
660
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
661
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
662
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
658
+					$departureTime = $dhour;
659
+					$arrivalTime = $ahour;
660
+					$DepartureAirportIata = str_replace(array('(',')'),'',$darr);
661
+					$ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
662
+					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
663 663
 				}
664 664
 			}
665 665
 		}
@@ -667,10 +667,10 @@  discard block
 block discarded – undo
667 667
 	}
668 668
 
669 669
 	/**
670
-	* Get flight info from flightaware
671
-	* @param String $callsign The callsign
672
-	* @return Flight departure and arrival airports and time
673
-	*/
670
+	 * Get flight info from flightaware
671
+	 * @param String $callsign The callsign
672
+	 * @return Flight departure and arrival airports and time
673
+	 */
674 674
 	public function getFlightAware($callsign) {
675 675
 		$Common = new Common();
676 676
 		/*
@@ -703,10 +703,10 @@  discard block
 block discarded – undo
703 703
 	}
704 704
 
705 705
 	/**
706
-	* Get flight info from CostToTravel
707
-	* @param String $callsign The callsign
708
-	* @return Flight departure and arrival airports and time
709
-	*/
706
+	 * Get flight info from CostToTravel
707
+	 * @param String $callsign The callsign
708
+	 * @return Flight departure and arrival airports and time
709
+	 */
710 710
 	public function getCostToTravel($callsign) {
711 711
 		$Common = new Common();
712 712
 		$url= "http://www.costtotravel.com/flight-number/".$callsign;
@@ -728,11 +728,11 @@  discard block
 block discarded – undo
728 728
 	}
729 729
 
730 730
 	/**
731
-	* Get flight info from Air Canada
732
-	* @param String $callsign The callsign
733
-	* @param String $date date we want flight number info
734
-	* @return Flight departure and arrival airports and time
735
-	*/
731
+	 * Get flight info from Air Canada
732
+	 * @param String $callsign The callsign
733
+	 * @param String $date date we want flight number info
734
+	 * @return Flight departure and arrival airports and time
735
+	 */
736 736
 	private function getAirCanada($callsign,$date = 'NOW') {
737 737
 		$Common = new Common();
738 738
 		date_default_timezone_set('UTC');
@@ -756,11 +756,11 @@  discard block
 block discarded – undo
756 756
 	}
757 757
 
758 758
 	/**
759
-	* Get flight info from Vietnam Airlines
760
-	* @param String $callsign The callsign
761
-	* @param String $date date we want flight number info
762
-	* @return Flight departure and arrival airports and time
763
-	*/
759
+	 * Get flight info from Vietnam Airlines
760
+	 * @param String $callsign The callsign
761
+	 * @param String $date date we want flight number info
762
+	 * @return Flight departure and arrival airports and time
763
+	 */
764 764
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
765 765
 		$Common = new Common();
766 766
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -782,12 +782,12 @@  discard block
 block discarded – undo
782 782
 	}
783 783
 
784 784
 	/**
785
-	* Get flight info from Air Berlin
786
-	* @param String $callsign The callsign
787
-	* @param String $date date we want flight number info
788
-	* @param String $carrier airline code
789
-	* @return Flight departure and arrival airports and time
790
-	*/
785
+	 * Get flight info from Air Berlin
786
+	 * @param String $callsign The callsign
787
+	 * @param String $date date we want flight number info
788
+	 * @param String $carrier airline code
789
+	 * @return Flight departure and arrival airports and time
790
+	 */
791 791
 	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
792 792
 		$Common = new Common();
793 793
 		date_default_timezone_set('UTC');
@@ -816,11 +816,11 @@  discard block
 block discarded – undo
816 816
 			$table = $Common->table2array($data);
817 817
 			$flight = $table;
818 818
 			if (isset($flight[5][4])) {
819
-			    $arrivalTime = $flight[5][4];
820
-			    $arrivalAirport = $flight[5][3];
819
+				$arrivalTime = $flight[5][4];
820
+				$arrivalAirport = $flight[5][3];
821 821
 			} else {
822
-			    $arrivalTime = '';
823
-			    $arrivalAirport = '';
822
+				$arrivalTime = '';
823
+				$arrivalAirport = '';
824 824
 			}
825 825
 		} else return array();
826 826
 		$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';
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
 					}
1089 1089
 			}
1090 1090
 		}
1091
-	        return array();
1091
+			return array();
1092 1092
 	}
1093 1093
 }
1094 1094
 
Please login to merge, or discard this patch.
airline-statistics-manufacturer.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airline'])) {
7
-        header('Location: '.$globalURL.'/airline');
8
-        die();
7
+		header('Location: '.$globalURL.'/airline');
8
+		die();
9 9
 }
10 10
 $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
manufacturer-statistics-registration.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['aircraft_manufacturer'])) {
7
-        header('Location: '.$globalURL.'/manufacturer');
8
-        die();
7
+		header('Location: '.$globalURL.'/manufacturer');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
Please login to merge, or discard this patch.