Completed
Push — master ( d53e0e...462fd9 )
by Yannick
06:21
created
pilot.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	header('Location: '.$globalURL.'/pilot/'.$_POST['pilot']);
10 10
 //} else if (isset($_GET['airport'])){
11 11
 } else {
12
-	$Spotter= new Spotter();
12
+	$Spotter = new Spotter();
13 13
 	$Stats = new Stats();
14 14
 	$title = _("Pilots");
15 15
 	require_once('header.php');
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	//ksort($pilot_names);
23 23
 	$previous = null;
24 24
 	print '<div class="alphabet-legend">';
25
-	foreach($pilot_names as $value) {
25
+	foreach ($pilot_names as $value) {
26 26
 		$firstLetter = mb_strtoupper(mb_substr($value['pilot_name'], 0, 1));
27
-		if($previous !== $firstLetter && $firstLetter != "'")
27
+		if ($previous !== $firstLetter && $firstLetter != "'")
28 28
 		{
29
-			if ($previous !== null){
29
+			if ($previous !== null) {
30 30
 				print ' | ';
31 31
 			}
32 32
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 	}
36 36
 	print '</div>';
37 37
 	$previous = null;
38
-	foreach($pilot_names as $value) {
38
+	foreach ($pilot_names as $value) {
39 39
 		$firstLetter = mb_strtoupper(mb_substr($value['pilot_name'], 0, 1));
40 40
 		if ($firstLetter != "")
41 41
 		{
42
-			if($previous !== $firstLetter && $firstLetter != "'")
42
+			if ($previous !== $firstLetter && $firstLetter != "'")
43 43
 			{
44
-				if ($previous !== null){
44
+				if ($previous !== null) {
45 45
 					print '</div>';
46 46
 				}
47 47
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@  discard block
 block discarded – undo
31 31
 			}
32 32
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
33 33
 		}
34
-		if ($firstLetter != "'") $previous = $firstLetter;
34
+		if ($firstLetter != "'") {
35
+			$previous = $firstLetter;
36
+		}
35 37
 	}
36 38
 	print '</div>';
37 39
 	$previous = null;
@@ -46,10 +48,15 @@  discard block
 block discarded – undo
46 48
 				}
47 49
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
48 50
 			}
49
-			if ($firstLetter != "'") $previous = $firstLetter;
51
+			if ($firstLetter != "'") {
52
+				$previous = $firstLetter;
53
+			}
50 54
 			print '<div class="alphabet-item">';
51
-			if (isset($value['pilot_id']) && $value['pilot_id'] != '') print '<a href="'.$globalURL.'/pilot/'.$value['pilot_id'].'">'.$value['pilot_name'].' ('.$value['pilot_id'].')';
52
-			else print '<a href="'.$globalURL.'/pilot/'.$value['pilot_name'].'">'.$value['pilot_name'];
55
+			if (isset($value['pilot_id']) && $value['pilot_id'] != '') {
56
+				print '<a href="'.$globalURL.'/pilot/'.$value['pilot_id'].'">'.$value['pilot_name'].' ('.$value['pilot_id'].')';
57
+			} else {
58
+				print '<a href="'.$globalURL.'/pilot/'.$value['pilot_name'].'">'.$value['pilot_name'];
59
+			}
53 60
 			print '</a>';
54 61
 			print '</div>';
55 62
 		}
Please login to merge, or discard this patch.
owner-detailed.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,12 @@
 block discarded – undo
53 53
 	{
54 54
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
55 55
 		//$ident = $spotter_array[0]['ident'];
56
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
57
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
56
+		if (isset($spotter_array[0]['latitude'])) {
57
+			$latitude = $spotter_array[0]['latitude'];
58
+		}
59
+		if (isset($spotter_array[0]['longitude'])) {
60
+			$longitude = $spotter_array[0]['longitude'];
61
+		}
58 62
 		require_once('header.php');
59 63
 		/*
60 64
 		if (isset($globalArchive) && $globalArchive) {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
 //require_once('require/class.SpotterLive.php');
8 8
 require_once('require/class.SpotterArchive.php');
9 9
 
10
-if (!isset($_GET['owner'])){
10
+if (!isset($_GET['owner'])) {
11 11
 	header('Location: '.$globalURL.'');
12 12
 } else {
13 13
 	$Spotter = new Spotter();
14 14
 	$SpotterArchive = new SpotterArchive();
15 15
 	//$Translation = new Translation();
16 16
 	//calculuation for the pagination
17
-	if(!isset($_GET['limit']))
17
+	if (!isset($_GET['limit']))
18 18
 	{
19 19
 		$limit_start = 0;
20 20
 		$limit_end = 25;
@@ -35,24 +35,24 @@  discard block
 block discarded – undo
35 35
 	
36 36
 	$page_url = $globalURL.'/owner/'.$_GET['owner'];
37 37
 	
38
-	$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
39
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
38
+	$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
39
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
40 40
 	if ($sort != '') 
41 41
 	{
42
-		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort);
42
+		$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort);
43 43
 		if (empty($spotter_array)) {
44
-			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort);
44
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort);
45 45
 		}
46 46
 	} else {
47
-		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference);
47
+		$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference);
48 48
 		if (empty($spotter_array)) {
49
-			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference);
49
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference);
50 50
 		}
51 51
 	}
52 52
 
53 53
 	if (!empty($spotter_array))
54 54
 	{
55
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
55
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']);
56 56
 		//$ident = $spotter_array[0]['ident'];
57 57
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
58 58
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	
127 127
 		include('owner-sub-menu.php');
128 128
 		print '<div class="table column">';
129
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
129
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
130 130
 
131 131
 		include('table-output.php'); 
132 132
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
owner.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	header('Location: '.$globalURL.'/owner/'.$_POST['owner']);
11 11
 //} else if (isset($_GET['airport'])){
12 12
 } else {
13
-	$Spotter= new Spotter();
13
+	$Spotter = new Spotter();
14 14
 	$Stats = new Stats();
15 15
 	$Common = new Common();
16 16
 	$title = _("Owners");
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 	ksort($owner_names);
25 25
 	$previous = null;
26 26
 	print '<div class="alphabet-legend">';
27
-	foreach($owner_names as $value) {
27
+	foreach ($owner_names as $value) {
28 28
 		$firstLetter = $Common->remove_accents(mb_strtoupper(mb_substr($value['owner_name'], 0, 1)));
29
-		if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
29
+		if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
30 30
 		{
31
-			if ($previous !== null){
31
+			if ($previous !== null) {
32 32
 				print ' | ';
33 33
 			}
34 34
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 	print '</div>';
39 39
 	$previous = null;
40
-	foreach($owner_names as $value) {
40
+	foreach ($owner_names as $value) {
41 41
 		$firstLetter = $Common->remove_accents(mb_strtoupper(mb_substr($value['owner_name'], 0, 1)));
42 42
 		if ($firstLetter != "")
43 43
 		{
44
-			if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
44
+			if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
45 45
 			{
46
-				if ($previous !== null){
46
+				if ($previous !== null) {
47 47
 					print '</div>';
48 48
 				}
49 49
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
 			}
34 34
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
35 35
 		}
36
-		if ($firstLetter != "'" && $firstLetter != '"') $previous = $firstLetter;
36
+		if ($firstLetter != "'" && $firstLetter != '"') {
37
+			$previous = $firstLetter;
38
+		}
37 39
 	}
38 40
 	print '</div>';
39 41
 	$previous = null;
@@ -48,7 +50,9 @@  discard block
 block discarded – undo
48 50
 				}
49 51
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
50 52
 			}
51
-			if ($firstLetter != "'" && $firstLetter != '"') $previous = $firstLetter;
53
+			if ($firstLetter != "'" && $firstLetter != '"') {
54
+				$previous = $firstLetter;
55
+			}
52 56
 			print '<div class="alphabet-item">';
53 57
 			print '<a href="'.$globalURL.'/owner/'.$value['owner_name'].'">';
54 58
 			print $value['owner_name'];
Please login to merge, or discard this patch.
require/class.Connection.php 4 patches
Braces   +77 added lines, -30 removed lines patch added patch discarded remove patch
@@ -64,8 +64,11 @@  discard block
 block discarded – undo
64 64
 				$globalDBSname = $globalDBname;
65 65
 				$globalDBSuser = $globalDBuser;
66 66
 				$globalDBSpass = $globalDBpass;
67
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
68
-				else $globalDBSport = $globalDBport;
67
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
68
+					$globalDBSport = 3306;
69
+				} else {
70
+					$globalDBSport = $globalDBport;
71
+				}
69 72
 			} else {
70 73
 				$DBname = 'default';
71 74
 				$globalDBSdriver = $globalDBdriver;
@@ -73,8 +76,11 @@  discard block
 block discarded – undo
73 76
 				$globalDBSname = $globalDBname;
74 77
 				$globalDBSuser = $user;
75 78
 				$globalDBSpass = $pass;
76
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
77
-				else $globalDBSport = $globalDBport;
79
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
80
+					$globalDBSport = 3306;
81
+				} else {
82
+					$globalDBSport = $globalDBport;
83
+				}
78 84
 			}
79 85
 		} else {
80 86
 			$globalDBSdriver = $globalDB[$DBname]['driver'];
@@ -82,11 +88,16 @@  discard block
 block discarded – undo
82 88
 			$globalDBSname = $globalDB[$DBname]['name'];
83 89
 			$globalDBSuser = $globalDB[$DBname]['user'];
84 90
 			$globalDBSpass = $globalDB[$DBname]['pass'];
85
-			if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port'];
86
-			else $globalDBSport = 3306;
91
+			if (isset($globalDB[$DBname]['port'])) {
92
+				$globalDBSport = $globalDB[$DBname]['port'];
93
+			} else {
94
+				$globalDBSport = 3306;
95
+			}
87 96
 		}
88 97
 		// Set number of try to connect to DB
89
-		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5;
98
+		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) {
99
+			$globalDBretry = 5;
100
+		}
90 101
 		$i = 0;
91 102
 		while (true) {
92 103
 			try {
@@ -95,10 +106,16 @@  discard block
 block discarded – undo
95 106
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
96 107
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
97 108
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
98
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
99
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
100
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
101
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
109
+					if (!isset($globalDBTimeOut)) {
110
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
111
+					} else {
112
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
113
+					}
114
+					if (!isset($globalDBPersistent)) {
115
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
116
+					} else {
117
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
118
+					}
102 119
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
103 120
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
104 121
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -112,23 +129,35 @@  discard block
 block discarded – undo
112 129
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
113 130
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
114 131
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
115
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
116
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
117
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
118
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
132
+					if (!isset($globalDBTimeOut)) {
133
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
134
+					} else {
135
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
136
+					}
137
+					if (!isset($globalDBPersistent)) {
138
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
139
+					} else {
140
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
141
+					}
119 142
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
120 143
 					$this->dbs[$DBname]->exec('SET timezone="UTC"');
121 144
 				}
122 145
 				break;
123 146
 			} catch(PDOException $e) {
124 147
 				$i++;
125
-				if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
148
+				if (isset($globalDebug) && $globalDebug) {
149
+					echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
150
+				}
126 151
 				//exit;
127
-				if ($i > $globalDBretry) return false;
152
+				if ($i > $globalDBretry) {
153
+					return false;
154
+				}
128 155
 				//return false;
129 156
 			}
130 157
 		}
131
-		if ($DBname === 'default') $this->db = $this->dbs['default'];
158
+		if ($DBname === 'default') {
159
+			$this->db = $this->dbs['default'];
160
+		}
132 161
 		return true;
133 162
 	}
134 163
 
@@ -140,7 +169,9 @@  discard block
 block discarded – undo
140 169
 		} else {
141 170
 			$query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'";
142 171
 		}
143
-		if ($this->db == NULL) return false;
172
+		if ($this->db == NULL) {
173
+			return false;
174
+		}
144 175
 		try {
145 176
 			//$Connection = new Connection();
146 177
 			$results = $this->db->query($query);
@@ -149,21 +180,28 @@  discard block
 block discarded – undo
149 180
 		}
150 181
 		if($results->rowCount()>0) {
151 182
 		    return true; 
183
+		} else {
184
+			return false;
152 185
 		}
153
-		else return false;
154 186
 	}
155 187
 
156 188
 	public function connectionExists()
157 189
 	{
158 190
 		global $globalDBdriver, $globalDBCheckConnection;
159
-		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true;
191
+		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) {
192
+			return true;
193
+		}
160 194
 		$query = "SELECT 1 + 1";
161
-		if ($this->db === null) return false;
195
+		if ($this->db === null) {
196
+			return false;
197
+		}
162 198
 		try {
163 199
 			$sum = @$this->db->query($query);
164 200
 			if ($sum instanceof \PDOStatement) {
165 201
 				$sum = $sum->fetchColumn(0);
166
-			} else $sum = 0;
202
+			} else {
203
+				$sum = 0;
204
+			}
167 205
 			if (intval($sum) !== 2) {
168 206
 			     return false;
169 207
 			}
@@ -198,8 +236,9 @@  discard block
 block discarded – undo
198 236
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
199 237
 		if($nb[0]['nb'] > 0) {
200 238
 			return true; 
239
+		} else {
240
+			return false;
201 241
 		}
202
-		else return false;
203 242
 	}
204 243
 
205 244
 	/*
@@ -243,9 +282,12 @@  discard block
 block discarded – undo
243 282
 			}
244 283
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
245 284
 			$sth->closeCursor();
246
-			if ($result['nb'] > 0) return true;
247
-			else return false;
248
-/*		} else {
285
+			if ($result['nb'] > 0) {
286
+				return true;
287
+			} else {
288
+				return false;
289
+			}
290
+			/*		} else {
249 291
 			$query = "SELECT * FROM ".$table." LIMIT 0";
250 292
 			try {
251 293
 				$results = $this->db->query($query);
@@ -284,7 +326,9 @@  discard block
 block discarded – undo
284 326
 				$sth->closeCursor();
285 327
 				return $result['value'];
286 328
 			}
287
-		} else return $version;
329
+		} else {
330
+			return $version;
331
+		}
288 332
 	}
289 333
 	
290 334
 	/*
@@ -292,8 +336,11 @@  discard block
 block discarded – undo
292 336
 	* @return Boolean if latest version or not
293 337
 	*/
294 338
 	public function latest() {
295
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
296
-	    else return false;
339
+	    if ($this->check_schema_version() == $this->latest_schema) {
340
+	    	return true;
341
+	    } else {
342
+	    	return false;
343
+	    }
297 344
 	}
298 345
 
299 346
 }
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
 	public $latest_schema = 35;
8 8
 	
9 9
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10
-	    global $globalDBdriver;
11
-	    if ($dbc === null) {
10
+		global $globalDBdriver;
11
+		if ($dbc === null) {
12 12
 		if ($this->db === null && $dbname === null) {
13
-		    if ($user === null && $pass === null) {
13
+			if ($user === null && $pass === null) {
14 14
 			$this->createDBConnection();
15
-		    } else {
15
+			} else {
16 16
 			$this->createDBConnection(null,$user,$pass);
17
-		    }
17
+			}
18 18
 		} else {
19
-		    $this->createDBConnection($dbname);
19
+			$this->createDBConnection($dbname);
20 20
 		}
21
-	    } elseif ($dbname === null || $dbname === 'default') {
21
+		} elseif ($dbname === null || $dbname === 'default') {
22 22
 		$this->db = $dbc;
23 23
 		if ($this->connectionExists() === false) {
24 24
 			/*
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 			*/
29 29
 			$this->createDBConnection();
30 30
 		}
31
-	    } else {
31
+		} else {
32 32
 		//$this->connectionExists();
33 33
 		$this->dbs[$dbname] = $dbc;
34
-	    }
34
+		}
35 35
 	}
36 36
 
37 37
 	public function db() {
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 
49 49
 	/**
50
-	* Creates the database connection
51
-	*
52
-	* @return Boolean of the database connection
53
-	*
54
-	*/
50
+	 * Creates the database connection
51
+	 *
52
+	 * @return Boolean of the database connection
53
+	 *
54
+	 */
55 55
 
56 56
 	public function createDBConnection($DBname = null, $user = null, $pass = null)
57 57
 	{
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			return false;
149 149
 		}
150 150
 		if($results->rowCount()>0) {
151
-		    return true; 
151
+			return true; 
152 152
 		}
153 153
 		else return false;
154 154
 	}
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
 				$sum = $sum->fetchColumn(0);
166 166
 			} else $sum = 0;
167 167
 			if (intval($sum) !== 2) {
168
-			     return false;
168
+				 return false;
169 169
 			}
170 170
 			
171 171
 		} catch(PDOException $e) {
172 172
 			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
173
-            			throw $e;
174
-	                }
175
-	                //echo 'error ! '.$e->getMessage();
173
+						throw $e;
174
+					}
175
+					//echo 'error ! '.$e->getMessage();
176 176
 			return false;
177 177
 		}
178 178
 		return true; 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 		$version = 0;
271 271
 		if ($this->tableExists('aircraft')) {
272 272
 			if (!$this->tableExists('config')) {
273
-	    			$version = '1';
274
-	    			return $version;
273
+					$version = '1';
274
+					return $version;
275 275
 			} else {
276 276
 				$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
277 277
 				try {
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	* @return Boolean if latest version or not
293 293
 	*/
294 294
 	public function latest() {
295
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
296
-	    else return false;
295
+		if ($this->check_schema_version() == $this->latest_schema) return true;
296
+		else return false;
297 297
 	}
298 298
 
299 299
 }
Please login to merge, or discard this patch.
Doc Comments   +20 added lines patch added patch discarded remove patch
@@ -6,6 +6,9 @@  discard block
 block discarded – undo
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 35;
8 8
 	
9
+	/**
10
+	 * @param string $dbname
11
+	 */
9 12
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10 13
 	    global $globalDBdriver;
11 14
 	    if ($dbc === null) {
@@ -132,6 +135,9 @@  discard block
 block discarded – undo
132 135
 		return true;
133 136
 	}
134 137
 
138
+	/**
139
+	 * @param string $table
140
+	 */
135 141
 	public function tableExists($table)
136 142
 	{
137 143
 		global $globalDBdriver, $globalDBname;
@@ -181,6 +187,11 @@  discard block
 block discarded – undo
181 187
 	/*
182 188
 	* Check if index exist
183 189
 	*/
190
+
191
+	/**
192
+	 * @param string $table
193
+	 * @param string $index
194
+	 */
184 195
 	public function indexExists($table,$index)
185 196
 	{
186 197
 		global $globalDBdriver, $globalDBname;
@@ -223,6 +234,10 @@  discard block
 block discarded – undo
223 234
 		return $columns;
224 235
 	}
225 236
 
237
+	/**
238
+	 * @param string $table
239
+	 * @param string $column
240
+	 */
226 241
 	public function getColumnType($table,$column) {
227 242
 		$select = $this->db->query('SELECT '.$column.' FROM '.$table);
228 243
 		$tomet = $select->getColumnMeta(0);
@@ -233,6 +248,11 @@  discard block
 block discarded – undo
233 248
 	* Check if a column name exist in a table
234 249
 	* @return Boolean column exist or not
235 250
 	*/
251
+
252
+	/**
253
+	 * @param string $table
254
+	 * @param string $name
255
+	 */
236 256
 	public function checkColumnName($table,$name)
237 257
 	{
238 258
 		global $globalDBdriver, $globalDBname;
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/settings.php');
3 3
 
4
-class Connection{
4
+class Connection {
5 5
 	public $db = null;
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 35;
8 8
 	
9
-	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
9
+	public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) {
10 10
 	    global $globalDBdriver;
11 11
 	    if ($dbc === null) {
12 12
 		if ($this->db === null && $dbname === null) {
13 13
 		    if ($user === null && $pass === null) {
14 14
 			$this->createDBConnection();
15 15
 		    } else {
16
-			$this->createDBConnection(null,$user,$pass);
16
+			$this->createDBConnection(null, $user, $pass);
17 17
 		    }
18 18
 		} else {
19 19
 		    $this->createDBConnection($dbname);
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 		while (true) {
92 92
 			try {
93 93
 				if ($globalDBSdriver == 'mysql') {
94
-					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser,  $globalDBSpass);
94
+					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass);
95 95
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
96 96
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
97
-					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
98
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
99
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
100
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
101
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
97
+					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
98
+					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500);
99
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut);
100
+					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true);
101
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent);
102 102
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
103 103
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
104 104
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 					$this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"');
109 109
 					//$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"');
110 110
 				} else {
111
-					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser,  $globalDBSpass);
111
+					$this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass);
112 112
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
113 113
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
114
-					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
115
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
116
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
117
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
118
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
114
+					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
115
+					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200);
116
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut);
117
+					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true);
118
+					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent);
119 119
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
120 120
 					$this->dbs[$DBname]->exec('SET timezone="UTC"');
121 121
 				}
122 122
 				break;
123
-			} catch(PDOException $e) {
123
+			} catch (PDOException $e) {
124 124
 				$i++;
125 125
 				if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
126 126
 				//exit;
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 		try {
145 145
 			//$Connection = new Connection();
146 146
 			$results = $this->db->query($query);
147
-		} catch(PDOException $e) {
147
+		} catch (PDOException $e) {
148 148
 			return false;
149 149
 		}
150
-		if($results->rowCount()>0) {
150
+		if ($results->rowCount() > 0) {
151 151
 		    return true; 
152 152
 		}
153 153
 		else return false;
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 			     return false;
169 169
 			}
170 170
 			
171
-		} catch(PDOException $e) {
172
-			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
171
+		} catch (PDOException $e) {
172
+			if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
173 173
             			throw $e;
174 174
 	                }
175 175
 	                //echo 'error ! '.$e->getMessage();
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	/*
182 182
 	* Check if index exist
183 183
 	*/
184
-	public function indexExists($table,$index)
184
+	public function indexExists($table, $index)
185 185
 	{
186 186
 		global $globalDBdriver, $globalDBname;
187 187
 		if ($globalDBdriver == 'mysql') {
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 		try {
193 193
 			//$Connection = new Connection();
194 194
 			$results = $this->db->query($query);
195
-		} catch(PDOException $e) {
195
+		} catch (PDOException $e) {
196 196
 			return false;
197 197
 		}
198 198
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
199
-		if($nb[0]['nb'] > 0) {
199
+		if ($nb[0]['nb'] > 0) {
200 200
 			return true; 
201 201
 		}
202 202
 		else return false;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		$query = "SELECT * FROM ".$table." LIMIT 0";
212 212
 		try {
213 213
 			$results = $this->db->query($query);
214
-		} catch(PDOException $e) {
214
+		} catch (PDOException $e) {
215 215
 			return "error : ".$e->getMessage()."\n";
216 216
 		}
217 217
 		$columns = array();
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 		return $columns;
224 224
 	}
225 225
 
226
-	public function getColumnType($table,$column) {
226
+	public function getColumnType($table, $column) {
227 227
 		$select = $this->db->query('SELECT '.$column.' FROM '.$table);
228 228
 		$tomet = $select->getColumnMeta(0);
229 229
 		return $tomet['native_type'];
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	* Check if a column name exist in a table
234 234
 	* @return Boolean column exist or not
235 235
 	*/
236
-	public function checkColumnName($table,$name)
236
+	public function checkColumnName($table, $name)
237 237
 	{
238 238
 		global $globalDBdriver, $globalDBname;
239 239
 		if ($globalDBdriver == 'mysql') {
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 		}
244 244
 			try {
245 245
 				$sth = $this->db()->prepare($query);
246
-				$sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name));
247
-			} catch(PDOException $e) {
246
+				$sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name));
247
+			} catch (PDOException $e) {
248 248
 				echo "error : ".$e->getMessage()."\n";
249 249
 			}
250 250
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 				try {
284 284
 					$sth = $this->db->prepare($query);
285 285
 					$sth->execute();
286
-				} catch(PDOException $e) {
286
+				} catch (PDOException $e) {
287 287
 					return "error : ".$e->getMessage()."\n";
288 288
 				}
289 289
 				$result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
statistics-fatalities-month.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
             	["'._("Month").'", "'._("# of Fatalities").'"], ';
24 24
 
25 25
 $date_data = '';
26
-foreach($date_array as $date_item)
26
+foreach ($date_array as $date_item)
27 27
 {
28
-	$date_data .= '[ "'.date('F, Y',strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'",'.$date_item['count'].'],';
28
+	$date_data .= '[ "'.date('F, Y', strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'",'.$date_item['count'].'],';
29 29
 }
30 30
 $date_data = substr($date_data, 0, -1);
31 31
 print $date_data;
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
 if (!empty($date_array))
52 52
 {
53
-	foreach($date_array as $key => $row) {
53
+	foreach ($date_array as $key => $row) {
54 54
 		$years[$key] = $row['year'];
55 55
 		$months[$key] = $row['month'];
56 56
 		$counts[$key] = $row['count'];
57 57
 	}
58 58
 //	array_multisort($years,SORT_DESC,$months,SORT_DESC,$date_array);
59
-	array_multisort($counts,SORT_DESC,$date_array);
59
+	array_multisort($counts, SORT_DESC, $date_array);
60 60
 	print '<div class="table-responsive">';
61 61
 	print '<table class="common-date table-striped">';
62 62
 	print '<thead>';
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 	print '</thead>';
67 67
 	print '<tbody>';
68 68
 	$i = 1;
69
-	foreach($date_array as $date_item)
69
+	foreach ($date_array as $date_item)
70 70
 	{
71 71
 		print '<tr>';
72 72
 		print '<td><strong>'.$i.'</strong></td>';
73 73
 		print '<td>';
74 74
 		if ($date_item['month'] < 10) $month = '0'.$date_item['month'];
75 75
 		else $month = $date_item['month'];
76
-		print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$month.'">'.date('F, Y',strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>';
76
+		print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$month.'">'.date('F, Y', strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>';
77 77
 		print '</td>';
78 78
 		print '<td>';
79 79
 		print $date_item['count'];
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,8 +71,11 @@
 block discarded – undo
71 71
 		print '<tr>';
72 72
 		print '<td><strong>'.$i.'</strong></td>';
73 73
 		print '<td>';
74
-		if ($date_item['month'] < 10) $month = '0'.$date_item['month'];
75
-		else $month = $date_item['month'];
74
+		if ($date_item['month'] < 10) {
75
+			$month = '0'.$date_item['month'];
76
+		} else {
77
+			$month = $date_item['month'];
78
+		}
76 79
 		print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$month.'">'.date('F, Y',strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>';
77 80
 		print '</td>';
78 81
 		print '<td>';
Please login to merge, or discard this patch.
statistics-registration.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/');
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
           function drawChart() {
32 32
             var data = google.visualization.arrayToDataTable([
33 33
             	["'._("Aircraft Manufacturer").'", "'._("# of times").'"], ';
34
-            	$registration_data = '';
34
+				$registration_data = '';
35 35
 foreach($registration_array as $registration_item)
36 36
 {
37 37
 	$registration_data .= '[ "'.$registration_item['registration'].' - '.$registration_item['aircraft_name'].' ('.$registration_item['aircraft_icao'].')",'.$registration_item['aircraft_registration_count'].'],';
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Aircraft Registrations");
7 7
 
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11 11
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13
-setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/');
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
13
+setcookie('stats_airline_icao', $airline_icao, time() + 60*60*24, '/');
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 
17 17
 require_once('header.php');
18 18
 include('statistics-sub-menu.php'); 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	</div>
24 24
     	<p>'._("Below are the <strong>Top 10</strong> most common aircraft registrations.").'</p>';
25 25
   
26
-$registration_array = $Stats->countAllAircraftRegistrations(true,$airline_icao,$filter_name,$year,$month);
26
+$registration_array = $Stats->countAllAircraftRegistrations(true, $airline_icao, $filter_name, $year, $month);
27 27
 print '<div id="chart" class="chart" width="100%"></div>
28 28
       	    <script> 
29 29
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             var data = google.visualization.arrayToDataTable([
33 33
             	["'._("Aircraft Manufacturer").'", "'._("# of times").'"], ';
34 34
             	$registration_data = '';
35
-foreach($registration_array as $registration_item)
35
+foreach ($registration_array as $registration_item)
36 36
 {
37 37
 	$registration_data .= '[ "'.$registration_item['registration'].' - '.$registration_item['aircraft_name'].' ('.$registration_item['aircraft_icao'].')",'.$registration_item['aircraft_registration_count'].'],';
38 38
 }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	print '</thead>';
68 68
 	print '<tbody>';
69 69
 	$i = 1;
70
-	foreach($registration_array as $registration_item)
70
+	foreach ($registration_array as $registration_item)
71 71
 	{
72 72
 		print '<tr>';
73 73
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,11 +5,15 @@
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Aircraft Registrations");
7 7
 
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 12
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
-}
13
+    if (isset($globalFilter['airline'])) {
14
+    	$airline_icao = $globalFilter['airline'][0];
15
+    }
16
+    }
13 17
 setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/');
14 18
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 19
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
statistics-aircraft.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
14 14
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Aircraft");
7 7
 
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11 11
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
14
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
13
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
14
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
15 15
 
16 16
 require_once('header.php');
17 17
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	</div>
23 23
 	<p>'._("Below are the <strong>Top 10</strong> most common aircraft types.").'</p>';
24 24
 	  
25
-$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
25
+$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
26 26
 print '<div id="chart" class="chart" width="100%"></div>
27 27
       	<script> 
28 28
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             var data = google.visualization.arrayToDataTable([
32 32
             	["'._("Aircraft").'", "'._("# of times").'"], ';
33 33
 $aircraft_data = '';
34
-foreach($aircraft_array as $aircraft_item)
34
+foreach ($aircraft_array as $aircraft_item)
35 35
 {
36 36
 	$aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
37 37
 }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	print '</thead>';
65 65
 	print '<tbody>';
66 66
 	$i = 1;
67
-	foreach($aircraft_array as $aircraft_item)
67
+	foreach ($aircraft_array as $aircraft_item)
68 68
 	{
69 69
 		print '<tr>';
70 70
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,11 +5,15 @@
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Aircraft");
7 7
 
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 12
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
-}
13
+    if (isset($globalFilter['airline'])) {
14
+    	$airline_icao = $globalFilter['airline'][0];
15
+    }
16
+    }
13 17
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
14 18
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
15 19
 
Please login to merge, or discard this patch.
statistics-month.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 
14 14
 require_once('header.php');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Busiest Month of Last Year");
7 7
 
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11 11
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	  </div>
21 21
       <p>'._("Below is a chart that plots the busiest day during the <strong>last month</strong>.").'</p>';
22 22
 
23
-$date_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
23
+$date_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
24 24
 print '<div id="chart" class="chart" width="100%"></div>
25 25
       	<script> 
26 26
       		google.load("visualization", "1", {packages:["corechart"]});
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             	["'._("Month").'", "'._("# of Flights").'"], ';
31 31
 
32 32
 $date_data = '';
33
-foreach($date_array as $date_item)
33
+foreach ($date_array as $date_item)
34 34
 {
35 35
 	$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
36 36
 }
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 	print '</thead>';
68 68
 	print '<tbody>';
69 69
 	$i = 1;
70
-	foreach($date_array as $date_item)
70
+	foreach ($date_array as $date_item)
71 71
 	{
72 72
 		print '<tr>';
73 73
 		print '<td><strong>'.$i.'</strong></td>';
74 74
 		print '<td>';
75
-		print '<a href="'.$globalURL.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>';
75
+		print '<a href="'.$globalURL.'/date/'.date('Y-m-d', strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>';
76 76
 		print '</td>';
77 77
 		print '<td>';
78 78
 		print $date_item['date_count'];
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,11 +5,15 @@
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Busiest Month of Last Year");
7 7
 
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 12
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
-}
13
+    if (isset($globalFilter['airline'])) {
14
+    	$airline_icao = $globalFilter['airline'][0];
15
+    }
16
+    }
13 17
 
14 18
 require_once('header.php');
15 19
 include('statistics-sub-menu.php'); 
Please login to merge, or discard this patch.
statistics-date.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Busiest Day");
7 7
 
8 8
 if (!isset($filter_name)) $filter_name = '';
9
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11 11
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	  </div>
21 21
       <p>'._("Below is a chart that plots the busiest day during the <strong>last 7 days</strong>.").'</p>';
22 22
 
23
-$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
23
+$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
24 24
 if (count($date_array) == 0) {
25 25
 	print _("No data available");
26 26
 } else {
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             	["'._("Date").'", "'._("# of Flights").'"], ';
34 34
 
35 35
 $date_data = '';
36
-foreach($date_array as $date_item)
36
+foreach ($date_array as $date_item)
37 37
 {
38 38
 	$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
39 39
 }
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
       </script>';
60 60
 }
61 61
 if (isset($globalDBArchiveMonths) && $globalDBArchiveMonths > 0) {
62
-	print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."),$globalDBArchiveMonths).'</p>';
62
+	print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."), $globalDBArchiveMonths).'</p>';
63 63
 } else {
64 64
 	print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>';
65 65
 }
66
-$date_array = $Stats->countAllDates($airline_icao,$filter_name);
66
+$date_array = $Stats->countAllDates($airline_icao, $filter_name);
67 67
 if (!empty($date_array))
68 68
 {
69 69
 	print '<div class="table-responsive">';
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	print '</thead>';
76 76
 	print '<tbody>';
77 77
 	$i = 1;
78
-	foreach($date_array as $date_item)
78
+	foreach ($date_array as $date_item)
79 79
 	{
80 80
 		print '<tr>';
81 81
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,11 +5,15 @@
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Busiest Day");
7 7
 
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 12
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12
-}
13
+    if (isset($globalFilter['airline'])) {
14
+    	$airline_icao = $globalFilter['airline'][0];
15
+    }
16
+    }
13 17
 
14 18
 require_once('header.php');
15 19
 include('statistics-sub-menu.php'); 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == '' && isset($globalFilter)) {
11
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
11
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
12 12
 }
13 13
 
14 14
 require_once('header.php');
Please login to merge, or discard this patch.