Completed
Push — master ( e17801...597a61 )
by Yannick
25:55
created
require/class.Translation.php 1 patch
Braces   +20 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,16 +28,25 @@  discard block
 block discarded – undo
28 28
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
29 29
 				//$airline_icao = substr($ident, 0, 3);
30 30
 				return $ident;
31
-			} else return $ident;
32
-		} else return $ident;
31
+			} else {
32
+				return $ident;
33
+			}
34
+		} else {
35
+			return $ident;
36
+		}
33 37
 		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');
38
+			if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
39
+				$icao = $ident;
40
+			} else {
41
+				$icao = 'AFR'.ltrim(substr($ident,2),'0');
42
+			}
36 43
 		} else {
37 44
 			$identicao = $Spotter->getAllAirlineInfo($airline_icao);
38 45
 			if (isset($identicao[0])) {
39 46
 				$icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0');
40
-			} else $icao = $ident;
47
+			} else {
48
+				$icao = $ident;
49
+			}
41 50
 		}
42 51
 		return $icao;
43 52
 	}
@@ -55,7 +64,9 @@  discard block
 block discarded – undo
55 64
 		$sth->closeCursor();
56 65
 		if (count($row) > 0) {
57 66
 			return $row['operator_correct'];
58
-		} else return $ident;
67
+		} else {
68
+			return $ident;
69
+		}
59 70
 	}
60 71
 
61 72
 	public function addOperator($ident,$correct_ident,$source) {
@@ -84,7 +95,9 @@  discard block
 block discarded – undo
84 95
 		global $globalTranslationSources, $globalTranslationFetch;
85 96
 		//if (!isset($globalTranslationSources)) $globalTranslationSources = array('planefinder');
86 97
 		$globalTranslationSources = array();
87
-		if (!isset($globalTranslationFetch)) $globalTranslationFetch = TRUE;
98
+		if (!isset($globalTranslationFetch)) {
99
+			$globalTranslationFetch = TRUE;
100
+		}
88 101
 		//echo "Check Translation for ".$ident."...";
89 102
 		$correct = $this->getOperator($ident);
90 103
 		if ($correct != '' && $correct != $ident) {
Please login to merge, or discard this patch.
require/class.SpotterServer.php 1 patch
Braces   +72 added lines, -25 removed lines patch added patch discarded remove patch
@@ -36,79 +36,126 @@
 block discarded – undo
36 36
 					$data['hex'] = trim($line['hex']);
37 37
 					if (preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
38 38
 						$data['datetime'] = $line['datetime'];
39
-					} else $data['datetime'] = date('Y-m-d H:i:s');
39
+					} else {
40
+						$data['datetime'] = date('Y-m-d H:i:s');
41
+					}
40 42
 					if (!isset($line['aircraft_icao'])) {
41 43
 						$Spotter = new Spotter();
42 44
 						$aircraft_icao = $Spotter->getAllAircraftType($data['hex']);
43 45
 						$Spotter->db = null;
44 46
 						if ($aircraft_icao == '' && isset($line['aircraft_type'])) {
45
-							if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
46
-							elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
47
-							elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
48
-							elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
47
+							if ($line['aircraft_type'] == 'PARA_GLIDER') {
48
+								$aircraft_icao = 'GLID';
49
+							} elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') {
50
+								$aircraft_icao = 'UHEL';
51
+							} elseif ($line['aircraft_type'] == 'TOW_PLANE') {
52
+								$aircraft_icao = 'TOWPLANE';
53
+							} elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') {
54
+								$aircraft_icao = 'POWAIRC';
55
+							}
49 56
 						}
50 57
 						$data['aircraft_icao'] = $aircraft_icao;
51
-					} else $data['aircraft_icao'] = $line['aircraft_icao'];
58
+					} else {
59
+						$data['aircraft_icao'] = $line['aircraft_icao'];
60
+					}
52 61
 					//if ($globalDebug) echo "*********** New aircraft hex : ".$data['hex']." ***********\n";
53 62
 				}
54 63
 				if (isset($line['registration']) && $line['registration'] != '') {
55 64
 					$data['registration'] = $line['registration'];
56
-				} else $data['registration'] = null;
65
+				} else {
66
+					$data['registration'] = null;
67
+				}
57 68
 				if (isset($line['waypoints']) && $line['waypoints'] != '') {
58 69
 					$data['waypoints'] = $line['waypoints'];
59
-				} else $data['waypoints'] = null;
70
+				} else {
71
+					$data['waypoints'] = null;
72
+				}
60 73
 				if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
61 74
 					$data['ident'] = trim($line['ident']);
62
-				} else $data['ident'] = null;
75
+				} else {
76
+					$data['ident'] = null;
77
+				}
63 78
 				if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '') {
64 79
 					if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
65 80
 						$data['latitude'] = $line['latitude'];
66
-					} else $data['latitude'] = null;
81
+					} else {
82
+						$data['latitude'] = null;
83
+					}
67 84
 					if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
68
-						if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
85
+						if ($line['longitude'] > 180) {
86
+							$line['longitude'] = $line['longitude'] - 360;
87
+						}
69 88
 						$data['longitude'] = $line['longitude'];
70
-					} else $data['longitude'] = null;
89
+					} else {
90
+						$data['longitude'] = null;
91
+					}
71 92
 				} else {
72 93
 					$data['latitude'] = null;
73 94
 					$data['longitude'] = null;
74 95
 				}
75 96
 				if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
76 97
 					$data['verticalrate'] = $line['verticalrate'];
77
-				} else $data['verticalrate'] = null;
98
+				} else {
99
+					$data['verticalrate'] = null;
100
+				}
78 101
 				if (isset($line['emergency']) && $line['emergency'] != '') {
79 102
 					$data['emergency'] = $line['emergency'];
80
-				} else $data['emergency'] = null;
103
+				} else {
104
+					$data['emergency'] = null;
105
+				}
81 106
 				if (isset($line['ground']) && $line['ground'] != '') {
82 107
 					$data['ground'] = $line['ground'];
83
-				} else $data['ground'] = null;
108
+				} else {
109
+					$data['ground'] = null;
110
+				}
84 111
 				if (isset($line['speed']) && $line['speed'] != '') {
85 112
 					$data['speed'] = round($line['speed']);
86
-				} else $data['speed'] = null;
113
+				} else {
114
+					$data['speed'] = null;
115
+				}
87 116
 				if (isset($line['squawk']) && $line['squawk'] != '') {
88 117
 					$data['squawk'] = $line['squawk'];
89
-				} else $data['squawk'] = null;
118
+				} else {
119
+					$data['squawk'] = null;
120
+				}
90 121
 				if (isset($line['altitude']) && $line['altitude'] != '') {
91 122
 					$data['altitude'] = round($line['altitude']);
92
-		  		} else $data['altitude'] = null;
123
+		  		} else {
124
+		  			$data['altitude'] = null;
125
+		  		}
93 126
 				if (isset($line['heading']) && $line['heading'] != '') {
94 127
 					$data['heading'] = round($line['heading']);
95
-		 		} else $data['heading'] = null;
128
+		 		} else {
129
+		 			$data['heading'] = null;
130
+		 		}
96 131
 				if (isset($line['source_name']) && $line['source_name'] != '') {
97 132
 					$data['source_name'] = $line['source_name'];
98
-				} else $data['source_name'] = null;
133
+				} else {
134
+					$data['source_name'] = null;
135
+				}
99 136
 				if (isset($line['over_country']) && $line['over_country'] != '') {
100 137
 					$data['over_country'] = $line['over_country'];
101
-		 		} else $data['over_country'] = null;
138
+		 		} else {
139
+		 			$data['over_country'] = null;
140
+		 		}
102 141
 				if (isset($line['noarchive']) && $line['noarchive']) {
103 142
 					$data['noarchive'] = true;
104
-				} else $data['noarchive'] = false;
143
+				} else {
144
+					$data['noarchive'] = false;
145
+				}
105 146
 				$data['format_source'] = $line['format_source'];
106
-				if (isset($line['id_source'])) $id_source = $line['id_source'];
147
+				if (isset($line['id_source'])) {
148
+					$id_source = $line['id_source'];
149
+				}
107 150
 				if (isset($data['hex'])) {
108 151
 					echo '.';
109 152
 					$id_user = $globalServerUserID;
110
-					if ($id_user == NULL) $id_user = 1;
111
-					if (!isset($id_source)) $id_source = 1;
153
+					if ($id_user == NULL) {
154
+						$id_user = 1;
155
+					}
156
+					if (!isset($id_source)) {
157
+						$id_source = 1;
158
+					}
112 159
 					$query = 'INSERT INTO spotter_temp (id_user,datetime,hex,ident,latitude,longitude,verticalrate,speed,squawk,altitude,heading,registration,aircraft_icao,waypoints,id_source,noarchive,format_source,source_name,over_country) VALUES (:id_user,:datetime,:hex,:ident,:latitude,:longitude,:verticalrate,:speed,:squawk,:altitude,:heading,:registration,:aircraft_icao,:waypoints,:id_source,:noarchive, :format_source, :source_name, :over_country)';
113 160
 					$query_values = array(':id_user' => $id_user,':datetime' => $data['datetime'],':hex' => $data['hex'],':ident' => $data['ident'],':latitude' => $data['latitude'],':longitude' => $data['longitude'],':verticalrate' => $data['verticalrate'],':speed' => $data['speed'],':squawk' => $data['squawk'],':altitude' => $data['altitude'],':heading' => $data['heading'],':registration' => $data['registration'],':aircraft_icao' => $data['aircraft_icao'],':waypoints' => $data['waypoints'],':id_source' => $id_source,':noarchive' => $data['noarchive'], ':format_source' => $data['format_source'], ':source_name' => $data['source_name'],':over_country' => $data['over_country']);
114 161
 					try {
Please login to merge, or discard this patch.
search-json.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -48,7 +56,7 @@  discard block
 block discarded – undo
48 56
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 	}
51
-}  else {
59
+} else {
52 60
 	$limit_explode = explode(",", $_GET['limit']);
53 61
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
54 62
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -66,8 +74,11 @@  discard block
 block discarded – undo
66 74
 
67 75
 header('Content-Type: application/json');
68 76
 
69
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
70
-else $sort = '';
77
+if (isset($_GET['sort'])) {
78
+	$sort = $_GET['sort'];
79
+} else {
80
+	$sort = '';
81
+}
71 82
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72 83
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73 84
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
search-php.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -48,7 +56,7 @@  discard block
 block discarded – undo
48 56
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 	}
51
-}  else {
59
+} else {
52 60
 	$limit_explode = explode(",", $_GET['limit']);
53 61
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
54 62
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -66,8 +74,11 @@  discard block
 block discarded – undo
66 74
 
67 75
 header("Content-type: text/plain");
68 76
 
69
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
70
-else $sort = '';
77
+if (isset($_GET['sort'])) {
78
+	$sort = $_GET['sort'];
79
+} else {
80
+	$sort = '';
81
+}
71 82
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72 83
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73 84
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
search-georss.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -49,7 +57,7 @@  discard block
 block discarded – undo
49 57
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
51 59
 	}
52
-}  else {
60
+} else {
53 61
 	$limit_explode = explode(",", $_GET['limit']);
54 62
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
55 63
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -70,8 +78,11 @@  discard block
 block discarded – undo
70 78
 
71 79
 $date = date("c", time());
72 80
 
73
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
74
-else $sort = '';
81
+if (isset($_GET['sort'])) {
82
+	$sort = $_GET['sort'];
83
+} else {
84
+	$sort = '';
85
+}
75 86
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
76 87
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
77 88
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
search-rss.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit'])) {
@@ -47,7 +55,7 @@  discard block
 block discarded – undo
47 55
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
48 56
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 	}
50
-}  else {
58
+} else {
51 59
 	$limit_explode = explode(",", $_GET['limit']);
52 60
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
53 61
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -66,8 +74,11 @@  discard block
 block discarded – undo
66 74
 header('Content-Type: application/rss+xml; charset=utf-8');
67 75
 
68 76
 $date = date("D, d M Y H:i:s T", time());
69
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
70
-else $sort = '';
77
+if (isset($_GET['sort'])) {
78
+	$sort = $_GET['sort'];
79
+} else {
80
+	$sort = '';
81
+}
71 82
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72 83
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73 84
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
install/class.create_db.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 			//foreach ($lines as $line)
15 15
 			while (($line = fgets($handle,4096)) !== false)
16 16
 			{
17
-				if (substr($line,0,2) == '--' || $line == '') continue;
17
+				if (substr($line,0,2) == '--' || $line == '') {
18
+					continue;
19
+				}
18 20
 				$templine .= $line;
19 21
 				if (substr(trim($line), -1,1) == ';')
20 22
 				{
@@ -40,7 +42,9 @@  discard block
 block discarded – undo
40 42
 		//foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename)
41 43
 		while(false !== ($filename = readdir($dh)))
42 44
 		{
43
-			if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename);
45
+			if (preg_match('/\.sql$/',$filename)) {
46
+				$error .= create_db::import_file($directory.$filename);
47
+			}
44 48
 		}
45 49
 		return $error;
46 50
 	}
@@ -56,13 +60,17 @@  discard block
 block discarded – undo
56 60
 		// Dirty hack
57 61
 		if ($host != 'localhost' && $host != '127.0.0.1') {
58 62
 			$grantright = $_SERVER['SERVER_ADDR'];
59
-		} else $grantright = 'localhost';
63
+		} else {
64
+			$grantright = 'localhost';
65
+		}
60 66
 		try {
61 67
 			$dbh = new PDO($db_type.':host='.$host,$root,$root_pass);
62 68
 			$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
63 69
 			if ($db_type == 'mysql') {
64 70
 				$dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
65
-				if ($grantright == 'localhost') $dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
71
+				if ($grantright == 'localhost') {
72
+					$dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
73
+				}
66 74
 			} else if ($db_type == 'pgsql') {
67 75
 				$dbh->exec("CREATE DATABASE ".$db.";");
68 76
 				$dbh->exec("CREATE USER ".$user." WITH PASSWORD '".$password."';
Please login to merge, or discard this patch.
search-wkt.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit'])) {
@@ -47,7 +55,7 @@  discard block
 block discarded – undo
47 55
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
48 56
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 	}
50
-}  else {
58
+} else {
51 59
 	$limit_explode = explode(",", $_GET['limit']);
52 60
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
53 61
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -65,8 +73,11 @@  discard block
 block discarded – undo
65 73
 
66 74
 header("Content-type: text/csv");
67 75
 
68
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
69
-else $sort = '';
76
+if (isset($_GET['sort'])) {
77
+	$sort = $_GET['sort'];
78
+} else {
79
+	$sort = '';
80
+}
70 81
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
71 82
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
72 83
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
search-gpx.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -48,7 +56,7 @@  discard block
 block discarded – undo
48 56
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 	}
51
-}  else {
59
+} else {
52 60
 	$limit_explode = explode(",", $_GET['limit']);
53 61
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
54 62
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -66,8 +74,11 @@  discard block
 block discarded – undo
66 74
 
67 75
 header('Content-Type: text/xml');
68 76
 
69
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
70
-else $sort = '';
77
+if (isset($_GET['sort'])) {
78
+	$sort = $_GET['sort'];
79
+} else {
80
+	$sort = '';
81
+}
71 82
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72 83
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73 84
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.