Completed
Push — master ( 73f088...7f17b6 )
by Yannick
07:13
created
airline-statistics-departure-airport-country.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@
 block discarded – undo
40 40
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
41 41
 			{
42 42
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
43
-			}
44
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
43
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
45 44
 			{
46 45
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
47 46
 			}
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,10 +16,17 @@  discard block
 block discarded – undo
16 16
         if ($over_country == '') {
17 17
 	        $Spotter = new Spotter($this->db);
18 18
 	        $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
19
-		if (!empty($data_country)) $country = $data_country['iso2'];
20
-		else $country = '';
21
-	} else $country = $over_country;
22
-	if ($airline_type === NULL) $airline_type ='';
19
+		if (!empty($data_country)) {
20
+			$country = $data_country['iso2'];
21
+		} else {
22
+			$country = '';
23
+		}
24
+	} else {
25
+		$country = $over_country;
26
+	}
27
+	if ($airline_type === NULL) {
28
+		$airline_type ='';
29
+	}
23 30
 	
24 31
 	//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
25 32
 	//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -495,7 +502,9 @@  discard block
 block discarded – undo
495 502
 		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
496 503
 		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
497 504
 		    $translate = $Translation->ident2icao($q_item);
498
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
505
+		    if ($translate != $q_item) {
506
+		    	$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
507
+		    }
499 508
 		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
500 509
 		    $additional_query .= ")";
501 510
 		}
@@ -713,7 +722,9 @@  discard block
 block discarded – undo
713 722
 		date_default_timezone_set($globalTimezone);
714 723
 		$datetime = new DateTime();
715 724
 		$offset = $datetime->format('P');
716
-	    } else $offset = '+00:00';
725
+	    } else {
726
+	    	$offset = '+00:00';
727
+	    }
717 728
 
718 729
 
719 730
 	    if ($date_array[1] != "")
@@ -876,9 +887,13 @@  discard block
 block discarded – undo
876 887
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
877 888
 			}
878 889
 		}
879
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
890
+                if ($sincedate != '') {
891
+                	$query .= "AND date > '".$sincedate."' ";
892
+                }
880 893
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
881
-	if ($limit) $query .= " LIMIT 0,10";
894
+	if ($limit) {
895
+		$query .= " LIMIT 0,10";
896
+	}
882 897
       
883 898
 	
884 899
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
install/libs/simple_html_dom.php 1 patch
Braces   +193 added lines, -101 removed lines patch added patch discarded remove patch
@@ -159,8 +159,9 @@  discard block
 block discarded – undo
159 159
 		if ($show_attr && count($this->attr)>0)
160 160
 		{
161 161
 			echo '(';
162
-			foreach ($this->attr as $k=>$v)
163
-				echo "[$k]=>\"".$this->$k.'", ';
162
+			foreach ($this->attr as $k=>$v) {
163
+							echo "[$k]=>\"".$this->$k.'", ';
164
+			}
164 165
 			echo ')';
165 166
 		}
166 167
 		echo "\n";
@@ -218,8 +219,7 @@  discard block
 block discarded – undo
218 219
 		if (isset($node->_[HDOM_INFO_INNER]))
219 220
 		{
220 221
 			$string .= $node->_[HDOM_INFO_INNER] . "'";
221
-		}
222
-		else
222
+		} else
223 223
 		{
224 224
 			$string .= ' NULL ';
225 225
 		}
@@ -233,8 +233,7 @@  discard block
 block discarded – undo
233 233
 		{
234 234
 			echo $string;
235 235
 			return;
236
-		}
237
-		else
236
+		} else
238 237
 		{
239 238
 			return $string;
240 239
 		}
@@ -320,12 +319,17 @@  discard block
 block discarded – undo
320 319
 	// returns the previous sibling of node
321 320
 	function prev_sibling()
322 321
 	{
323
-		if ($this->parent===null) return null;
322
+		if ($this->parent===null) {
323
+			return null;
324
+		}
324 325
 		$idx = 0;
325 326
 		$count = count($this->parent->children);
326
-		while ($idx<$count && $this!==$this->parent->children[$idx])
327
-			++$idx;
328
-		if (--$idx<0) return null;
327
+		while ($idx<$count && $this!==$this->parent->children[$idx]) {
328
+					++$idx;
329
+		}
330
+		if (--$idx<0) {
331
+			return null;
332
+		}
329 333
 		return $this->parent->children[$idx];
330 334
 	}
331 335
 
@@ -354,12 +358,17 @@  discard block
 block discarded – undo
354 358
 	// get dom node's inner html
355 359
 	function innertext()
356 360
 	{
357
-		if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
358
-		if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
361
+		if (isset($this->_[HDOM_INFO_INNER])) {
362
+			return $this->_[HDOM_INFO_INNER];
363
+		}
364
+		if (isset($this->_[HDOM_INFO_TEXT])) {
365
+			return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
366
+		}
359 367
 
360 368
 		$ret = '';
361
-		foreach ($this->nodes as $n)
362
-			$ret .= $n->outertext();
369
+		foreach ($this->nodes as $n) {
370
+					$ret .= $n->outertext();
371
+		}
363 372
 		return $ret;
364 373
 	}
365 374
 
@@ -380,7 +389,9 @@  discard block
 block discarded – undo
380 389
 			$debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text);
381 390
 		}
382 391
 
383
-		if ($this->tag==='root') return $this->innertext();
392
+		if ($this->tag==='root') {
393
+			return $this->innertext();
394
+		}
384 395
 
385 396
 		// trigger callback
386 397
 		if ($this->dom && $this->dom->callback!==null)
@@ -388,8 +399,12 @@  discard block
 block discarded – undo
388 399
 			call_user_func_array($this->dom->callback, array($this));
389 400
 		}
390 401
 
391
-		if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER];
392
-		if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
402
+		if (isset($this->_[HDOM_INFO_OUTER])) {
403
+			return $this->_[HDOM_INFO_OUTER];
404
+		}
405
+		if (isset($this->_[HDOM_INFO_TEXT])) {
406
+			return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
407
+		}
393 408
 
394 409
 		// render begin tag
395 410
 		if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]])
@@ -418,23 +433,30 @@  discard block
 block discarded – undo
418 433
 		}
419 434
 
420 435
 		// render end tag
421
-		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0)
422
-			$ret .= '</'.$this->tag.'>';
436
+		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) {
437
+					$ret .= '</'.$this->tag.'>';
438
+		}
423 439
 		return $ret;
424 440
 	}
425 441
 
426 442
 	// get dom node's plain text
427 443
 	function text()
428 444
 	{
429
-		if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER];
445
+		if (isset($this->_[HDOM_INFO_INNER])) {
446
+			return $this->_[HDOM_INFO_INNER];
447
+		}
430 448
 		switch ($this->nodetype)
431 449
 		{
432 450
 			case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
433 451
 			case HDOM_TYPE_COMMENT: return '';
434 452
 			case HDOM_TYPE_UNKNOWN: return '';
435 453
 		}
436
-		if (strcasecmp($this->tag, 'script')===0) return '';
437
-		if (strcasecmp($this->tag, 'style')===0) return '';
454
+		if (strcasecmp($this->tag, 'script')===0) {
455
+			return '';
456
+		}
457
+		if (strcasecmp($this->tag, 'style')===0) {
458
+			return '';
459
+		}
438 460
 
439 461
 		$ret = '';
440 462
 		// In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL.
@@ -470,7 +492,9 @@  discard block
 block discarded – undo
470 492
 	function makeup()
471 493
 	{
472 494
 		// text, comment, unknown
473
-		if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
495
+		if (isset($this->_[HDOM_INFO_TEXT])) {
496
+			return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
497
+		}
474 498
 
475 499
 		$ret = '<'.$this->tag;
476 500
 		$i = -1;
@@ -480,14 +504,15 @@  discard block
 block discarded – undo
480 504
 			++$i;
481 505
 
482 506
 			// skip removed attribute
483
-			if ($val===null || $val===false)
484
-				continue;
507
+			if ($val===null || $val===false) {
508
+							continue;
509
+			}
485 510
 
486 511
 			$ret .= $this->_[HDOM_INFO_SPACE][$i][0];
487 512
 			//no value attr: nowrap, checked selected...
488
-			if ($val===true)
489
-				$ret .= $key;
490
-			else {
513
+			if ($val===true) {
514
+							$ret .= $key;
515
+			} else {
491 516
 				switch ($this->_[HDOM_INFO_QUOTE][$i])
492 517
 				{
493 518
 					case HDOM_QUOTE_DOUBLE: $quote = '"'; break;
@@ -506,7 +531,9 @@  discard block
 block discarded – undo
506 531
 	function find($selector, $idx=null, $lowercase=false)
507 532
 	{
508 533
 		$selectors = $this->parse_selector($selector);
509
-		if (($count=count($selectors))===0) return array();
534
+		if (($count=count($selectors))===0) {
535
+			return array();
536
+		}
510 537
 		$found_keys = array();
511 538
 
512 539
 		// find each selector
@@ -514,8 +541,12 @@  discard block
 block discarded – undo
514 541
 		{
515 542
 			// The change on the below line was documented on the sourceforge code tracker id 2788009
516 543
 			// used to be: if (($levle=count($selectors[0]))===0) return array();
517
-			if (($levle=count($selectors[$c]))===0) return array();
518
-			if (!isset($this->_[HDOM_INFO_BEGIN])) return array();
544
+			if (($levle=count($selectors[$c]))===0) {
545
+				return array();
546
+			}
547
+			if (!isset($this->_[HDOM_INFO_BEGIN])) {
548
+				return array();
549
+			}
519 550
 
520 551
 			$head = array($this->_[HDOM_INFO_BEGIN]=>1);
521 552
 
@@ -545,12 +576,16 @@  discard block
 block discarded – undo
545 576
 		ksort($found_keys);
546 577
 
547 578
 		$found = array();
548
-		foreach ($found_keys as $k=>$v)
549
-			$found[] = $this->dom->nodes[$k];
579
+		foreach ($found_keys as $k=>$v) {
580
+					$found[] = $this->dom->nodes[$k];
581
+		}
550 582
 
551 583
 		// return nth-element or array
552
-		if (is_null($idx)) return $found;
553
-		else if ($idx<0) $idx = count($found) + $idx;
584
+		if (is_null($idx)) {
585
+			return $found;
586
+		} else if ($idx<0) {
587
+			$idx = count($found) + $idx;
588
+		}
554 589
 		return (isset($found[$idx])) ? $found[$idx] : null;
555 590
 	}
556 591
 
@@ -595,8 +630,9 @@  discard block
 block discarded – undo
595 630
 			$pass = true;
596 631
 
597 632
 			if ($tag==='*' && !$key) {
598
-				if (in_array($node, $this->children, true))
599
-					$ret[$i] = 1;
633
+				if (in_array($node, $this->children, true)) {
634
+									$ret[$i] = 1;
635
+				}
600 636
 				continue;
601 637
 			}
602 638
 
@@ -605,9 +641,13 @@  discard block
 block discarded – undo
605 641
 			// compare key
606 642
 			if ($pass && $key) {
607 643
 				if ($no_key) {
608
-					if (isset($node->attr[$key])) $pass=false;
644
+					if (isset($node->attr[$key])) {
645
+						$pass=false;
646
+					}
609 647
 				} else {
610
-					if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false;
648
+					if (($key != "plaintext") && !isset($node->attr[$key])) {
649
+						$pass=false;
650
+					}
611 651
 				}
612 652
 			}
613 653
 			// compare value
@@ -640,13 +680,19 @@  discard block
 block discarded – undo
640 680
 							} else {
641 681
 								$check = $this->match($exp, $val, $k);
642 682
 							}
643
-							if ($check) break;
683
+							if ($check) {
684
+								break;
685
+							}
644 686
 						}
645 687
 					}
646 688
 				}
647
-				if (!$check) $pass = false;
689
+				if (!$check) {
690
+					$pass = false;
691
+				}
692
+			}
693
+			if ($pass) {
694
+				$ret[$i] = 1;
648 695
 			}
649
-			if ($pass) $ret[$i] = 1;
650 696
 			unset($node);
651 697
 		}
652 698
 		// It's passed by reference so this is actually what this function returns.
@@ -696,9 +742,13 @@  discard block
 block discarded – undo
696 742
 
697 743
 		foreach ($matches as $m) {
698 744
 			$m[0] = trim($m[0]);
699
-			if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue;
745
+			if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') {
746
+				continue;
747
+			}
700 748
 			// for browser generated xpath
701
-			if ($m[1]==='tbody') continue;
749
+			if ($m[1]==='tbody') {
750
+				continue;
751
+			}
702 752
 
703 753
 			list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false);
704 754
 			if (!empty($m[2])) {$key='id'; $val=$m[2];}
@@ -718,8 +768,9 @@  discard block
 block discarded – undo
718 768
 				$result = array();
719 769
 			}
720 770
 		}
721
-		if (count($result)>0)
722
-			$selectors[] = $result;
771
+		if (count($result)>0) {
772
+					$selectors[] = $result;
773
+		}
723 774
 		return $selectors;
724 775
 	}
725 776
 
@@ -748,7 +799,9 @@  discard block
 block discarded – undo
748 799
 		{
749 800
 			case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value;
750 801
 			case 'innertext':
751
-				if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value;
802
+				if (isset($this->_[HDOM_INFO_TEXT])) {
803
+					return $this->_[HDOM_INFO_TEXT] = $value;
804
+				}
752 805
 				return $this->_[HDOM_INFO_INNER] = $value;
753 806
 		}
754 807
 		if (!isset($this->attr[$name]))
@@ -772,8 +825,9 @@  discard block
 block discarded – undo
772 825
 	}
773 826
 
774 827
 	function __unset($name) {
775
-		if (isset($this->attr[$name]))
776
-			unset($this->attr[$name]);
828
+		if (isset($this->attr[$name])) {
829
+					unset($this->attr[$name]);
830
+		}
777 831
 	}
778 832
 
779 833
 	// PaperG - Function to convert the text from one character set to another if the two sets are not the same.
@@ -800,8 +854,7 @@  discard block
 block discarded – undo
800 854
 			if ((strcasecmp($targetCharset, 'UTF-8') == 0) && ($this->is_utf8($text)))
801 855
 			{
802 856
 				$converted_text = $text;
803
-			}
804
-			else
857
+			} else
805 858
 			{
806 859
 				$converted_text = iconv($sourceCharset, $targetCharset, $text);
807 860
 			}
@@ -839,19 +892,31 @@  discard block
 block discarded – undo
839 892
 			$c=ord($str[$i]);
840 893
 			if($c > 128)
841 894
 			{
842
-				if(($c >= 254)) return false;
843
-				elseif($c >= 252) $bits=6;
844
-				elseif($c >= 248) $bits=5;
845
-				elseif($c >= 240) $bits=4;
846
-				elseif($c >= 224) $bits=3;
847
-				elseif($c >= 192) $bits=2;
848
-				else return false;
849
-				if(($i+$bits) > $len) return false;
895
+				if(($c >= 254)) {
896
+					return false;
897
+				} elseif($c >= 252) {
898
+					$bits=6;
899
+				} elseif($c >= 248) {
900
+					$bits=5;
901
+				} elseif($c >= 240) {
902
+					$bits=4;
903
+				} elseif($c >= 224) {
904
+					$bits=3;
905
+				} elseif($c >= 192) {
906
+					$bits=2;
907
+				} else {
908
+					return false;
909
+				}
910
+				if(($i+$bits) > $len) {
911
+					return false;
912
+				}
850 913
 				while($bits > 1)
851 914
 				{
852 915
 					$i++;
853 916
 					$b=ord($str[$i]);
854
-					if($b < 128 || $b > 191) return false;
917
+					if($b < 128 || $b > 191) {
918
+						return false;
919
+					}
855 920
 					$bits--;
856 921
 				}
857 922
 			}
@@ -1035,8 +1100,7 @@  discard block
 block discarded – undo
1035 1100
 			if (preg_match("/^http:\/\//i",$str) || is_file($str))
1036 1101
 			{
1037 1102
 				$this->load_file($str);
1038
-			}
1039
-			else
1103
+			} else
1040 1104
 			{
1041 1105
 				$this->load($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText);
1042 1106
 			}
@@ -1118,7 +1182,9 @@  discard block
 block discarded – undo
1118 1182
 	function save($filepath='')
1119 1183
 	{
1120 1184
 		$ret = $this->root->innertext();
1121
-		if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX);
1185
+		if ($filepath!=='') {
1186
+			file_put_contents($filepath, $ret, LOCK_EX);
1187
+		}
1122 1188
 		return $ret;
1123 1189
 	}
1124 1190
 
@@ -1134,7 +1200,10 @@  discard block
 block discarded – undo
1134 1200
 	{
1135 1201
 		foreach ($this->nodes as $n) {$n->clear(); $n = null;}
1136 1202
 		// This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear.
1137
-		if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;}
1203
+		if (isset($this->children)) {
1204
+			foreach ($this->children as $n) {$n->clear();
1205
+		}
1206
+		$n = null;}
1138 1207
 		if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);}
1139 1208
 		if (isset($this->root)) {$this->root->clear(); unset($this->root);}
1140 1209
 		unset($this->doc);
@@ -1178,7 +1247,9 @@  discard block
 block discarded – undo
1178 1247
 		$this->root->_[HDOM_INFO_BEGIN] = -1;
1179 1248
 		$this->root->nodetype = HDOM_TYPE_ROOT;
1180 1249
 		$this->parent = $this->root;
1181
-		if ($this->size>0) $this->char = $this->doc[0];
1250
+		if ($this->size>0) {
1251
+			$this->char = $this->doc[0];
1252
+		}
1182 1253
 	}
1183 1254
 
1184 1255
 	// parse html content
@@ -1232,8 +1303,7 @@  discard block
 block discarded – undo
1232 1303
 					if ($success)
1233 1304
 					{
1234 1305
 						$charset = $matches[1];
1235
-					}
1236
-					else
1306
+					} else
1237 1307
 					{
1238 1308
 						// If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1
1239 1309
 						if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}
@@ -1296,8 +1366,9 @@  discard block
 block discarded – undo
1296 1366
 			$tag = $this->copy_until_char('>');
1297 1367
 
1298 1368
 			// skip attributes in end tag
1299
-			if (($pos = strpos($tag, ' '))!==false)
1300
-				$tag = substr($tag, 0, $pos);
1369
+			if (($pos = strpos($tag, ' '))!==false) {
1370
+							$tag = substr($tag, 0, $pos);
1371
+			}
1301 1372
 
1302 1373
 			$parent_lower = strtolower($this->parent->tag);
1303 1374
 			$tag_lower = strtolower($tag);
@@ -1309,23 +1380,26 @@  discard block
 block discarded – undo
1309 1380
 					$this->parent->_[HDOM_INFO_END] = 0;
1310 1381
 					$org_parent = $this->parent;
1311 1382
 
1312
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1313
-						$this->parent = $this->parent->parent;
1383
+					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) {
1384
+											$this->parent = $this->parent->parent;
1385
+					}
1314 1386
 
1315 1387
 					if (strtolower($this->parent->tag)!==$tag_lower) {
1316 1388
 						$this->parent = $org_parent; // restore origonal parent
1317
-						if ($this->parent->parent) $this->parent = $this->parent->parent;
1389
+						if ($this->parent->parent) {
1390
+							$this->parent = $this->parent->parent;
1391
+						}
1318 1392
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
1319 1393
 						return $this->as_text_node($tag);
1320 1394
 					}
1321
-				}
1322
-				else if (($this->parent->parent) && isset($this->block_tags[$tag_lower]))
1395
+				} else if (($this->parent->parent) && isset($this->block_tags[$tag_lower]))
1323 1396
 				{
1324 1397
 					$this->parent->_[HDOM_INFO_END] = 0;
1325 1398
 					$org_parent = $this->parent;
1326 1399
 
1327
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1328
-						$this->parent = $this->parent->parent;
1400
+					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) {
1401
+											$this->parent = $this->parent->parent;
1402
+					}
1329 1403
 
1330 1404
 					if (strtolower($this->parent->tag)!==$tag_lower)
1331 1405
 					{
@@ -1333,18 +1407,19 @@  discard block
 block discarded – undo
1333 1407
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
1334 1408
 						return $this->as_text_node($tag);
1335 1409
 					}
1336
-				}
1337
-				else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1410
+				} else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1338 1411
 				{
1339 1412
 					$this->parent->_[HDOM_INFO_END] = 0;
1340 1413
 					$this->parent = $this->parent->parent;
1414
+				} else {
1415
+									return $this->as_text_node($tag);
1341 1416
 				}
1342
-				else
1343
-					return $this->as_text_node($tag);
1344 1417
 			}
1345 1418
 
1346 1419
 			$this->parent->_[HDOM_INFO_END] = $this->cursor;
1347
-			if ($this->parent->parent) $this->parent = $this->parent->parent;
1420
+			if ($this->parent->parent) {
1421
+				$this->parent = $this->parent->parent;
1422
+			}
1348 1423
 
1349 1424
 			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1350 1425
 			return true;
@@ -1367,7 +1442,9 @@  discard block
 block discarded – undo
1367 1442
 				$node->nodetype = HDOM_TYPE_UNKNOWN;
1368 1443
 				$node->tag = 'unknown';
1369 1444
 			}
1370
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1445
+			if ($this->char==='>') {
1446
+				$node->_[HDOM_INFO_TEXT].='>';
1447
+			}
1371 1448
 			$this->link_nodes($node, true);
1372 1449
 			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1373 1450
 			return true;
@@ -1389,7 +1466,9 @@  discard block
 block discarded – undo
1389 1466
 				return true;
1390 1467
 			}
1391 1468
 
1392
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1469
+			if ($this->char==='>') {
1470
+				$node->_[HDOM_INFO_TEXT].='>';
1471
+			}
1393 1472
 			$this->link_nodes($node, false);
1394 1473
 			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1395 1474
 			return true;
@@ -1455,22 +1534,26 @@  discard block
 block discarded – undo
1455 1534
 			if ($name!=='/' && $name!=='') {
1456 1535
 				$space[1] = $this->copy_skip($this->token_blank);
1457 1536
 				$name = $this->restore_noise($name);
1458
-				if ($this->lowercase) $name = strtolower($name);
1537
+				if ($this->lowercase) {
1538
+					$name = strtolower($name);
1539
+				}
1459 1540
 				if ($this->char==='=') {
1460 1541
 					$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1461 1542
 					$this->parse_attr($node, $name, $space);
1462
-				}
1463
-				else {
1543
+				} else {
1464 1544
 					//no value attr: nowrap, checked selected...
1465 1545
 					$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
1466 1546
 					$node->attr[$name] = true;
1467
-					if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev
1547
+					if ($this->char!='>') {
1548
+						$this->char = $this->doc[--$this->pos];
1549
+					}
1550
+					// prev
1468 1551
 				}
1469 1552
 				$node->_[HDOM_INFO_SPACE][] = $space;
1470 1553
 				$space = array($this->copy_skip($this->token_blank), '', '');
1554
+			} else {
1555
+							break;
1471 1556
 			}
1472
-			else
1473
-				break;
1474 1557
 		} while ($this->char!=='>' && $this->char!=='/');
1475 1558
 
1476 1559
 		$this->link_nodes($node, true);
@@ -1481,11 +1564,12 @@  discard block
 block discarded – undo
1481 1564
 		{
1482 1565
 			$node->_[HDOM_INFO_ENDSPACE] .= '/';
1483 1566
 			$node->_[HDOM_INFO_END] = 0;
1484
-		}
1485
-		else
1567
+		} else
1486 1568
 		{
1487 1569
 			// reset parent
1488
-			if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node;
1570
+			if (!isset($this->self_closing_tags[strtolower($node->tag)])) {
1571
+				$this->parent = $node;
1572
+			}
1489 1573
 		}
1490 1574
 		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1491 1575
 
@@ -1571,7 +1655,9 @@  discard block
 block discarded – undo
1571 1655
 		$len = strspn($this->doc, $chars, $pos);
1572 1656
 		$this->pos += $len;
1573 1657
 		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1574
-		if ($len===0) return '';
1658
+		if ($len===0) {
1659
+			return '';
1660
+		}
1575 1661
 		return substr($this->doc, $pos, $len);
1576 1662
 	}
1577 1663
 
@@ -1586,7 +1672,9 @@  discard block
 block discarded – undo
1586 1672
 
1587 1673
 	protected function copy_until_char($char)
1588 1674
 	{
1589
-		if ($this->char===null) return '';
1675
+		if ($this->char===null) {
1676
+			return '';
1677
+		}
1590 1678
 
1591 1679
 		if (($pos = strpos($this->doc, $char, $this->pos))===false) {
1592 1680
 			$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
@@ -1595,7 +1683,9 @@  discard block
 block discarded – undo
1595 1683
 			return $ret;
1596 1684
 		}
1597 1685
 
1598
-		if ($pos===$this->pos) return '';
1686
+		if ($pos===$this->pos) {
1687
+			return '';
1688
+		}
1599 1689
 		$pos_old = $this->pos;
1600 1690
 		$this->char = $this->doc[$pos];
1601 1691
 		$this->pos = $pos;
@@ -1604,7 +1694,9 @@  discard block
 block discarded – undo
1604 1694
 
1605 1695
 	protected function copy_until_char_escape($char)
1606 1696
 	{
1607
-		if ($this->char===null) return '';
1697
+		if ($this->char===null) {
1698
+			return '';
1699
+		}
1608 1700
 
1609 1701
 		$start = $this->pos;
1610 1702
 		while (1)
@@ -1617,7 +1709,9 @@  discard block
 block discarded – undo
1617 1709
 				return $ret;
1618 1710
 			}
1619 1711
 
1620
-			if ($pos===$this->pos) return '';
1712
+			if ($pos===$this->pos) {
1713
+				return '';
1714
+			}
1621 1715
 
1622 1716
 			if ($this->doc[$pos-1]==='\\') {
1623 1717
 				$start = $pos+1;
@@ -1674,14 +1768,12 @@  discard block
 block discarded – undo
1674 1768
 				if (isset($this->noise[$key]))
1675 1769
 				{
1676 1770
 					$text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16);
1677
-				}
1678
-				else
1771
+				} else
1679 1772
 				{
1680 1773
 					// do this to prevent an infinite loop.
1681 1774
 					$text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16);
1682 1775
 				}
1683
-			}
1684
-			else
1776
+			} else
1685 1777
 			{
1686 1778
 				// There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem.
1687 1779
 				$text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11);
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 = $_GET['lowest_altitude'].",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 = $_GET['number_results'];
50 58
                 $absolute_difference = $_GET['number_results'];
51 59
         }
52
-}  else {
60
+} else {
53 61
         $limit_explode = explode(",", $_GET['limit']);
54 62
         $limit_start = $limit_explode[0];
55 63
         $limit_end = $limit_explode[1];
@@ -67,8 +75,11 @@  discard block
 block discarded – undo
67 75
 
68 76
 header("Content-type: text/yaml");
69 77
 
70
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
71
-else $sort = '';
78
+if (isset($_GET['sort'])) {
79
+	$sort = $_GET['sort'];
80
+} else {
81
+	$sort = '';
82
+}
72 83
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73 84
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
74 85
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
registration-statistics-departure-airport-country.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@
 block discarded – undo
12 12
 $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13 13
 if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) {
14 14
 	$spotter_array = $Spotter->getSpotterDataByRoute($_GET['departure_airport'], $_GET['arrival_airport'], "0,1", $sort);
15
-} else $spotter_array = array();
15
+} else {
16
+	$spotter_array = array();
17
+}
16 18
   
17 19
 if (!empty($spotter_array))
18 20
 {
Please login to merge, or discard this patch.
acars-latest.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,12 @@
 block discarded – undo
36 36
 if (!empty($spotter_array)) {
37 37
 	include('table-output.php');
38 38
 	print '<div class="pagination">';
39
-	if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$_GET['sort'].'">&laquo;'._("Previous Page").'</a>';
40
-	if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$_GET['sort'].'">'._("Next Page").'&raquo;</a>';
39
+	if ($limit_previous_1 >= 0) {
40
+		print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$_GET['sort'].'">&laquo;'._("Previous Page").'</a>';
41
+	}
42
+	if ($spotter_array[0]['query_number_rows'] == $absolute_difference) {
43
+		print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$_GET['sort'].'">'._("Next Page").'&raquo;</a>';
44
+	}
41 45
 	print '</div>';
42 46
 }
43 47
 print '</div>';
Please login to merge, or discard this patch.
require/class.Connection.php 1 patch
Braces   +74 added lines, -28 removed lines patch added patch discarded remove patch
@@ -53,8 +53,11 @@  discard block
 block discarded – undo
53 53
 				$globalDBSname = $globalDBname;
54 54
 				$globalDBSuser = $globalDBuser;
55 55
 				$globalDBSpass = $globalDBpass;
56
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
57
-				else $globalDBSport = $globalDBport;
56
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
57
+					$globalDBSport = 3306;
58
+				} else {
59
+					$globalDBSport = $globalDBport;
60
+				}
58 61
 			} else {
59 62
 				$DBname = 'default';
60 63
 				$globalDBSdriver = $globalDBdriver;
@@ -62,8 +65,11 @@  discard block
 block discarded – undo
62 65
 				$globalDBSname = $globalDBname;
63 66
 				$globalDBSuser = $user;
64 67
 				$globalDBSpass = $pass;
65
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
66
-				else $globalDBSport = $globalDBport;
68
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
69
+					$globalDBSport = 3306;
70
+				} else {
71
+					$globalDBSport = $globalDBport;
72
+				}
67 73
 			}
68 74
 		} else {
69 75
 			$globalDBSdriver = $globalDB[$DBname]['driver'];
@@ -71,11 +77,16 @@  discard block
 block discarded – undo
71 77
 			$globalDBSname = $globalDB[$DBname]['name'];
72 78
 			$globalDBSuser = $globalDB[$DBname]['user'];
73 79
 			$globalDBSpass = $globalDB[$DBname]['pass'];
74
-			if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port'];
75
-			else $globalDBSport = 3306;
80
+			if (isset($globalDB[$DBname]['port'])) {
81
+				$globalDBSport = $globalDB[$DBname]['port'];
82
+			} else {
83
+				$globalDBSport = 3306;
84
+			}
76 85
 		}
77 86
 		// Set number of try to connect to DB
78
-		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5;
87
+		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) {
88
+			$globalDBretry = 5;
89
+		}
79 90
 		$i = 0;
80 91
 		while (true) {
81 92
 			try {
@@ -84,10 +95,16 @@  discard block
 block discarded – undo
84 95
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
85 96
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
86 97
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
87
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
88
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
89
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
90
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
98
+					if (!isset($globalDBTimeOut)) {
99
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
100
+					} else {
101
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
102
+					}
103
+					if (!isset($globalDBPersistent)) {
104
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
105
+					} else {
106
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
107
+					}
91 108
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
92 109
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
93 110
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -98,22 +115,34 @@  discard block
 block discarded – undo
98 115
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
99 116
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
100 117
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
101
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
102
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
103
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
104
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
118
+					if (!isset($globalDBTimeOut)) {
119
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
120
+					} else {
121
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
122
+					}
123
+					if (!isset($globalDBPersistent)) {
124
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
125
+					} else {
126
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
127
+					}
105 128
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
106 129
 				}
107 130
 				break;
108 131
 			} catch(PDOException $e) {
109 132
 				$i++;
110
-				if (isset($globalDebug) && $globalDebug) echo $e->getMessage()."\n";
133
+				if (isset($globalDebug) && $globalDebug) {
134
+					echo $e->getMessage()."\n";
135
+				}
111 136
 				//exit;
112
-				if ($i > $globalDBretry) return false;
137
+				if ($i > $globalDBretry) {
138
+					return false;
139
+				}
113 140
 				//return false;
114 141
 			}
115 142
 		}
116
-		if ($DBname === 'default') $this->db = $this->dbs['default'];
143
+		if ($DBname === 'default') {
144
+			$this->db = $this->dbs['default'];
145
+		}
117 146
 		return true;
118 147
 	}
119 148
 
@@ -125,7 +154,9 @@  discard block
 block discarded – undo
125 154
 		} elseif ($globalDBdriver == 'pgsql') {
126 155
 			$query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'";
127 156
 		}
128
-		if ($this->db == NULL) return false;
157
+		if ($this->db == NULL) {
158
+			return false;
159
+		}
129 160
 		try {
130 161
 			//$Connection = new Connection();
131 162
 			$results = $this->db->query($query);
@@ -134,21 +165,28 @@  discard block
 block discarded – undo
134 165
 		}
135 166
 		if($results->rowCount()>0) {
136 167
 		    return true; 
168
+		} else {
169
+			return false;
137 170
 		}
138
-		else return false;
139 171
 	}
140 172
 
141 173
 	public function connectionExists()
142 174
 	{
143 175
 		global $globalDBdriver, $globalDBCheckConnection;
144
-		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true;
176
+		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) {
177
+			return true;
178
+		}
145 179
 		$query = "SELECT 1 + 1";
146
-		if ($this->db == NULL) return false;
180
+		if ($this->db == NULL) {
181
+			return false;
182
+		}
147 183
 		try {
148 184
 			$sum = @$this->db->query($query);
149 185
 			if ($sum instanceof \PDOStatement) {
150 186
 				$sum = $sum->fetchColumn(0);
151
-			} else $sum = 0;
187
+			} else {
188
+				$sum = 0;
189
+			}
152 190
 			if (intval($sum) !== 2) {
153 191
 			     return false;
154 192
 			}
@@ -182,8 +220,9 @@  discard block
 block discarded – undo
182 220
 		}
183 221
 		if($results->rowCount()>0) {
184 222
 		    return true; 
223
+		} else {
224
+			return false;
185 225
 		}
186
-		else return false;
187 226
 	}
188 227
 
189 228
 	/*
@@ -222,7 +261,9 @@  discard block
 block discarded – undo
222 261
 		$colcnt = $results->columnCount();
223 262
 		for ($i = 0; $i < $colcnt; $i++) {
224 263
 			$col = $results->getColumnMeta($i);
225
-			if ($name == $col['name']) return true;
264
+			if ($name == $col['name']) {
265
+				return true;
266
+			}
226 267
 		}
227 268
 		return false;
228 269
 	}
@@ -249,7 +290,9 @@  discard block
 block discarded – undo
249 290
 				$result = $sth->fetch(PDO::FETCH_ASSOC);
250 291
 				return $result['value'];
251 292
 			}
252
-		} else return $version;
293
+		} else {
294
+			return $version;
295
+		}
253 296
 	}
254 297
 	
255 298
 	/*
@@ -257,8 +300,11 @@  discard block
 block discarded – undo
257 300
 	* @return Boolean if latest version or not
258 301
 	*/
259 302
 	public function latest() {
260
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
261
-	    else return false;
303
+	    if ($this->check_schema_version() == $this->latest_schema) {
304
+	    	return true;
305
+	    } else {
306
+	    	return false;
307
+	    }
262 308
 	}
263 309
 
264 310
 }
Please login to merge, or discard this patch.
install/class.update_db.php 1 patch
Braces   +563 added lines, -195 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 		curl_setopt($ch, CURLOPT_URL, $url);
17 17
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
18 18
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
19
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
19
+		if ($referer != '') {
20
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
21
+		}
20 22
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
21 23
 		curl_setopt($ch, CURLOPT_FILE, $fp);
22 24
 		$data = curl_exec($ch);
@@ -26,11 +28,16 @@  discard block
 block discarded – undo
26 28
 	public static function gunzip($in_file,$out_file_name = '') {
27 29
 		//echo $in_file.' -> '.$out_file_name."\n";
28 30
 		$buffer_size = 4096; // read 4kb at a time
29
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
31
+		if ($out_file_name == '') {
32
+			$out_file_name = str_replace('.gz', '', $in_file);
33
+		}
30 34
 		if ($in_file != '' && file_exists($in_file)) {
31 35
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
32
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
33
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
36
+			if (function_exists('gzopen')) {
37
+				$file = gzopen($in_file,'rb');
38
+			} elseif (function_exists('gzopen64')) {
39
+				$file = gzopen64($in_file,'rb');
40
+			}
34 41
 			$out_file = fopen($out_file_name, 'wb'); 
35 42
 			while(!gzeof($file)) {
36 43
 				fwrite($out_file, gzread($file, $buffer_size));
@@ -48,8 +55,12 @@  discard block
 block discarded – undo
48 55
 			if ($res === TRUE) {
49 56
 				$zip->extractTo($path);
50 57
 				$zip->close();
51
-			} else return false;
52
-		} else return false;
58
+			} else {
59
+				return false;
60
+			}
61
+		} else {
62
+			return false;
63
+		}
53 64
 	}
54 65
 	
55 66
 	public static function connect_sqlite($database) {
@@ -64,7 +75,9 @@  discard block
 block discarded – undo
64 75
 	public static function retrieve_route_sqlite_to_dest($database_file) {
65 76
 		global $globalDebug, $globalTransaction;
66 77
 		//$query = 'TRUNCATE TABLE routes';
67
-		if ($globalDebug) echo " - Delete previous routes from DB -";
78
+		if ($globalDebug) {
79
+			echo " - Delete previous routes from DB -";
80
+		}
68 81
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
69 82
 		$Connection = new Connection();
70 83
 		try {
@@ -75,7 +88,9 @@  discard block
 block discarded – undo
75 88
                         return "error : ".$e->getMessage();
76 89
                 }
77 90
 
78
-    		if ($globalDebug) echo " - Add routes to DB -";
91
+    		if ($globalDebug) {
92
+    			echo " - Add routes to DB -";
93
+    		}
79 94
     		update_db::connect_sqlite($database_file);
80 95
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
81 96
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
@@ -90,15 +105,21 @@  discard block
 block discarded – undo
90 105
 		$Connection = new Connection();
91 106
 		$sth_dest = $Connection->db->prepare($query_dest);
92 107
 		try {
93
-			if ($globalTransaction) $Connection->db->beginTransaction();
108
+			if ($globalTransaction) {
109
+				$Connection->db->beginTransaction();
110
+			}
94 111
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
95 112
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
96 113
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
97 114
 				$sth_dest->execute($query_dest_values);
98 115
             		}
99
-			if ($globalTransaction) $Connection->db->commit();
116
+			if ($globalTransaction) {
117
+				$Connection->db->commit();
118
+			}
100 119
 		} catch(PDOException $e) {
101
-			if ($globalTransaction) $Connection->db->rollBack(); 
120
+			if ($globalTransaction) {
121
+				$Connection->db->rollBack();
122
+			}
102 123
 			return "error : ".$e->getMessage();
103 124
 		}
104 125
                 return '';
@@ -140,11 +161,16 @@  discard block
 block discarded – undo
140 161
 		$sth_dest = $Connection->db->prepare($query_dest);
141 162
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
142 163
 		try {
143
-			if ($globalTransaction) $Connection->db->beginTransaction();
164
+			if ($globalTransaction) {
165
+				$Connection->db->beginTransaction();
166
+			}
144 167
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
145 168
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
146
-				if ($values['UserString4'] == 'M') $type = 'military';
147
-				else $type = null;
169
+				if ($values['UserString4'] == 'M') {
170
+					$type = 'military';
171
+				} else {
172
+					$type = null;
173
+				}
148 174
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
149 175
 				$sth_dest->execute($query_dest_values);
150 176
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
@@ -152,7 +178,9 @@  discard block
 block discarded – undo
152 178
 				    $sth_dest_owner->execute($query_dest_owner_values);
153 179
 				}
154 180
             		}
155
-			if ($globalTransaction) $Connection->db->commit();
181
+			if ($globalTransaction) {
182
+				$Connection->db->commit();
183
+			}
156 184
 		} catch(PDOException $e) {
157 185
 			return "error : ".$e->getMessage();
158 186
 		}
@@ -188,7 +216,9 @@  discard block
 block discarded – undo
188 216
 			$Connection = new Connection();
189 217
 			$sth_dest = $Connection->db->prepare($query_dest);
190 218
 			try {
191
-				if ($globalTransaction) $Connection->db->beginTransaction();
219
+				if ($globalTransaction) {
220
+					$Connection->db->beginTransaction();
221
+				}
192 222
             			while (!feof($fh)) {
193 223
             				$line = $Common->hex2str(fgets($fh,9999));
194 224
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
@@ -198,7 +228,9 @@  discard block
 block discarded – undo
198 228
             				// Check if we can find ICAO, else set it to GLID
199 229
             				$aircraft_name_split = explode(' ',$aircraft_name);
200 230
             				$search_more = '';
201
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
231
+            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) {
232
+            					$search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
233
+            				}
202 234
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
203 235
             				$sth_search = $Connection->db->prepare($query_search);
204 236
 					try {
@@ -211,7 +243,9 @@  discard block
 block discarded – undo
211 243
 					} catch(PDOException $e) {
212 244
 						return "error : ".$e->getMessage();
213 245
 					}
214
-					if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
246
+					if (!isset($values['ICAOTypeCode'])) {
247
+						$values['ICAOTypeCode'] = 'GLID';
248
+					}
215 249
 					// Add data to db
216 250
 					if ($values['ModeS'] != '' && $values['Registration'] != '' && $values['Registration'] != '0000') {
217 251
 						//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
@@ -220,7 +254,9 @@  discard block
 block discarded – undo
220 254
 						$sth_dest->execute($query_dest_values);
221 255
 					}
222 256
 				}
223
-				if ($globalTransaction) $Connection->db->commit();
257
+				if ($globalTransaction) {
258
+					$Connection->db->commit();
259
+				}
224 260
 			} catch(PDOException $e) {
225 261
 				return "error : ".$e->getMessage();
226 262
 			}
@@ -256,7 +292,9 @@  discard block
 block discarded – undo
256 292
 			$Connection = new Connection();
257 293
 			$sth_dest = $Connection->db->prepare($query_dest);
258 294
 			try {
259
-				if ($globalTransaction) $Connection->db->beginTransaction();
295
+				if ($globalTransaction) {
296
+					$Connection->db->beginTransaction();
297
+				}
260 298
 				$tmp = fgetcsv($fh,9999,',',"'");
261 299
             			while (!feof($fh)) {
262 300
             				$line = fgetcsv($fh,9999,',',"'");
@@ -269,13 +307,17 @@  discard block
 block discarded – undo
269 307
             				// Check if we can find ICAO, else set it to GLID
270 308
             				$aircraft_name_split = explode(' ',$aircraft_name);
271 309
             				$search_more = '';
272
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
310
+            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) {
311
+            					$search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
312
+            				}
273 313
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
274 314
             				$sth_search = $Connection->db->prepare($query_search);
275 315
 					try {
276 316
                                     		$sth_search->execute();
277 317
 	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
278
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
318
+	            				if (isset($result['icao']) && $result['icao'] != '') {
319
+	            					$values['ICAOTypeCode'] = $result['icao'];
320
+	            				}
279 321
 					} catch(PDOException $e) {
280 322
 						return "error : ".$e->getMessage();
281 323
 					}
@@ -288,7 +330,9 @@  discard block
 block discarded – undo
288 330
 						$sth_dest->execute($query_dest_values);
289 331
 					}
290 332
 				}
291
-				if ($globalTransaction) $Connection->db->commit();
333
+				if ($globalTransaction) {
334
+					$Connection->db->commit();
335
+				}
292 336
 			} catch(PDOException $e) {
293 337
 				return "error : ".$e->getMessage();
294 338
 			}
@@ -324,7 +368,9 @@  discard block
 block discarded – undo
324 368
 			$Connection = new Connection();
325 369
 			$sth_dest = $Connection->db->prepare($query_dest);
326 370
 			try {
327
-				if ($globalTransaction) $Connection->db->beginTransaction();
371
+				if ($globalTransaction) {
372
+					$Connection->db->beginTransaction();
373
+				}
328 374
 				$tmp = fgetcsv($fh,9999,',','"');
329 375
             			while (!feof($fh)) {
330 376
             				$line = fgetcsv($fh,9999,',','"');
@@ -333,16 +379,22 @@  discard block
 block discarded – undo
333 379
             				    $values['registration'] = $line[0];
334 380
             				    $values['base'] = $line[4];
335 381
             				    $values['owner'] = $line[5];
336
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
337
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
382
+            				    if ($line[6] == '') {
383
+            				    	$values['date_first_reg'] = null;
384
+            				    } else {
385
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
386
+					    }
338 387
 					    $values['cancel'] = $line[7];
339 388
 					} elseif ($country == 'EI') {
340 389
 					    // TODO : add modeS & reg to aircraft_modes
341 390
             				    $values['registration'] = $line[0];
342 391
             				    $values['base'] = $line[3];
343 392
             				    $values['owner'] = $line[2];
344
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
345
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
393
+            				    if ($line[1] == '') {
394
+            				    	$values['date_first_reg'] = null;
395
+            				    } else {
396
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
397
+					    }
346 398
 					    $values['cancel'] = '';
347 399
 					} elseif ($country == 'HB') {
348 400
 					    // TODO : add modeS & reg to aircraft_modes
@@ -356,16 +408,22 @@  discard block
 block discarded – undo
356 408
             				    $values['registration'] = $line[3];
357 409
             				    $values['base'] = null;
358 410
             				    $values['owner'] = $line[5];
359
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
360
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
411
+            				    if ($line[18] == '') {
412
+            				    	$values['date_first_reg'] = null;
413
+            				    } else {
414
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
415
+					    }
361 416
 					    $values['cancel'] = '';
362 417
 					} elseif ($country == 'VH') {
363 418
 					    // TODO : add modeS & reg to aircraft_modes
364 419
             				    $values['registration'] = $line[0];
365 420
             				    $values['base'] = null;
366 421
             				    $values['owner'] = $line[12];
367
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
368
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
422
+            				    if ($line[28] == '') {
423
+            				    	$values['date_first_reg'] = null;
424
+            				    } else {
425
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
426
+					    }
369 427
 
370 428
 					    $values['cancel'] = $line[39];
371 429
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
@@ -384,29 +442,41 @@  discard block
 block discarded – undo
384 442
             				    $values['registration'] = $line[0];
385 443
             				    $values['base'] = null;
386 444
             				    $values['owner'] = $line[8];
387
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
388
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
445
+            				    if ($line[7] == '') {
446
+            				    	$values['date_first_reg'] = null;
447
+            				    } else {
448
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
449
+					    }
389 450
 					    $values['cancel'] = '';
390 451
 					} elseif ($country == 'PP') {
391 452
             				    $values['registration'] = $line[0];
392 453
             				    $values['base'] = null;
393 454
             				    $values['owner'] = $line[4];
394
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
395
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
455
+            				    if ($line[6] == '') {
456
+            				    	$values['date_first_reg'] = null;
457
+            				    } else {
458
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
459
+					    }
396 460
 					    $values['cancel'] = $line[7];
397 461
 					} elseif ($country == 'E7') {
398 462
             				    $values['registration'] = $line[0];
399 463
             				    $values['base'] = null;
400 464
             				    $values['owner'] = $line[4];
401
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
402
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
465
+            				    if ($line[5] == '') {
466
+            				    	$values['date_first_reg'] = null;
467
+            				    } else {
468
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
469
+					    }
403 470
 					    $values['cancel'] = '';
404 471
 					} elseif ($country == '8Q') {
405 472
             				    $values['registration'] = $line[0];
406 473
             				    $values['base'] = null;
407 474
             				    $values['owner'] = $line[3];
408
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
409
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
475
+            				    if ($line[7] == '') {
476
+            				    	$values['date_first_reg'] = null;
477
+            				    } else {
478
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
479
+					    }
410 480
 					    $values['cancel'] = '';
411 481
 					} elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') {
412 482
             				    $values['registration'] = $line[0];
@@ -420,7 +490,9 @@  discard block
 block discarded – undo
420 490
 						$sth_dest->execute($query_dest_values);
421 491
 					}
422 492
 				}
423
-				if ($globalTransaction) $Connection->db->commit();
493
+				if ($globalTransaction) {
494
+					$Connection->db->commit();
495
+				}
424 496
 			} catch(PDOException $e) {
425 497
 				return "error : ".$e->getMessage();
426 498
 			}
@@ -554,25 +626,45 @@  discard block
 block discarded – undo
554 626
 		    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)";
555 627
 		$Connection = new Connection();
556 628
 		$sth_dest = $Connection->db->prepare($query_dest);
557
-		if ($globalTransaction) $Connection->db->beginTransaction();
629
+		if ($globalTransaction) {
630
+			$Connection->db->beginTransaction();
631
+		}
558 632
   
559 633
 		$i = 0;
560 634
 		while($row = sparql_fetch_array($result))
561 635
 		{
562 636
 			if ($i >= 1) {
563 637
 			//print_r($row);
564
-			if (!isset($row['iata'])) $row['iata'] = '';
565
-			if (!isset($row['icao'])) $row['icao'] = '';
566
-			if (!isset($row['type'])) $row['type'] = '';
567
-			if (!isset($row['altitude'])) $row['altitude'] = '';
638
+			if (!isset($row['iata'])) {
639
+				$row['iata'] = '';
640
+			}
641
+			if (!isset($row['icao'])) {
642
+				$row['icao'] = '';
643
+			}
644
+			if (!isset($row['type'])) {
645
+				$row['type'] = '';
646
+			}
647
+			if (!isset($row['altitude'])) {
648
+				$row['altitude'] = '';
649
+			}
568 650
 			if (isset($row['city_bis'])) {
569 651
 				$row['city'] = $row['city_bis'];
570 652
 			}
571
-			if (!isset($row['city'])) $row['city'] = '';
572
-			if (!isset($row['country'])) $row['country'] = '';
573
-			if (!isset($row['homepage'])) $row['homepage'] = '';
574
-			if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = '';
575
-			if (!isset($row['name'])) continue;
653
+			if (!isset($row['city'])) {
654
+				$row['city'] = '';
655
+			}
656
+			if (!isset($row['country'])) {
657
+				$row['country'] = '';
658
+			}
659
+			if (!isset($row['homepage'])) {
660
+				$row['homepage'] = '';
661
+			}
662
+			if (!isset($row['wikipedia_page'])) {
663
+				$row['wikipedia_page'] = '';
664
+			}
665
+			if (!isset($row['name'])) {
666
+				continue;
667
+			}
576 668
 			if (!isset($row['image'])) {
577 669
 				$row['image'] = '';
578 670
 				$row['image_thumb'] = '';
@@ -608,7 +700,9 @@  discard block
 block discarded – undo
608 700
 
609 701
 			$i++;
610 702
 		}
611
-		if ($globalTransaction) $Connection->db->commit();
703
+		if ($globalTransaction) {
704
+			$Connection->db->commit();
705
+		}
612 706
 		echo "Delete duplicate rows...\n";
613 707
 		$query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)';
614 708
 		try {
@@ -620,7 +714,9 @@  discard block
 block discarded – undo
620 714
                 }
621 715
 
622 716
 
623
-		if ($globalDebug) echo "Insert Not available Airport...\n";
717
+		if ($globalDebug) {
718
+			echo "Insert Not available Airport...\n";
719
+		}
624 720
 		$query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`)
625 721
 		    VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)";
626 722
 		$query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => '');
@@ -647,7 +743,9 @@  discard block
 block discarded – undo
647 743
 		$delimiter = ',';
648 744
 		$out_file = $tmp_dir.'airports.csv';
649 745
 		update_db::download('http://ourairports.com/data/airports.csv',$out_file);
650
-		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
746
+		if (!file_exists($out_file) || !is_readable($out_file)) {
747
+			return FALSE;
748
+		}
651 749
 		echo "Add data from ourairports.com...\n";
652 750
 
653 751
 		$header = NULL;
@@ -657,8 +755,9 @@  discard block
 block discarded – undo
657 755
 			//$Connection->db->beginTransaction();
658 756
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
659 757
 			{
660
-				if(!$header) $header = $row;
661
-				else {
758
+				if(!$header) {
759
+					$header = $row;
760
+				} else {
662 761
 					$data = array();
663 762
 					$data = array_combine($header, $row);
664 763
 					try {
@@ -696,7 +795,9 @@  discard block
 block discarded – undo
696 795
 		echo "Download data from another free database...\n";
697 796
 		$out_file = $tmp_dir.'GlobalAirportDatabase.zip';
698 797
 		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file);
699
-		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
798
+		if (!file_exists($out_file) || !is_readable($out_file)) {
799
+			return FALSE;
800
+		}
700 801
 		update_db::unzip($out_file);
701 802
 		$header = NULL;
702 803
 		echo "Add data from another free database...\n";
@@ -707,8 +808,9 @@  discard block
 block discarded – undo
707 808
 			//$Connection->db->beginTransaction();
708 809
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
709 810
 			{
710
-				if(!$header) $header = $row;
711
-				else {
811
+				if(!$header) {
812
+					$header = $row;
813
+				} else {
712 814
 					$data = $row;
713 815
 
714 816
 					$query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao';
@@ -962,7 +1064,9 @@  discard block
 block discarded – undo
962 1064
 		if (($handle = fopen($filename, 'r')) !== FALSE)
963 1065
 		{
964 1066
 			$i = 0;
965
-			if ($globalTransaction) $Connection->db->beginTransaction();
1067
+			if ($globalTransaction) {
1068
+				$Connection->db->beginTransaction();
1069
+			}
966 1070
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
967 1071
 			{
968 1072
 				$i++;
@@ -990,7 +1094,9 @@  discard block
 block discarded – undo
990 1094
 				}
991 1095
 			}
992 1096
 			fclose($handle);
993
-			if ($globalTransaction) $Connection->db->commit();
1097
+			if ($globalTransaction) {
1098
+				$Connection->db->commit();
1099
+			}
994 1100
 		}
995 1101
 		return '';
996 1102
         }
@@ -1012,7 +1118,9 @@  discard block
 block discarded – undo
1012 1118
 		$Connection = new Connection();
1013 1119
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1014 1120
 		{
1015
-			if ($globalTransaction) $Connection->db->beginTransaction();
1121
+			if ($globalTransaction) {
1122
+				$Connection->db->beginTransaction();
1123
+			}
1016 1124
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1017 1125
 			{
1018 1126
 				if(count($row) > 1) {
@@ -1026,7 +1134,9 @@  discard block
 block discarded – undo
1026 1134
 				}
1027 1135
 			}
1028 1136
 			fclose($handle);
1029
-			if ($globalTransaction) $Connection->db->commit();
1137
+			if ($globalTransaction) {
1138
+				$Connection->db->commit();
1139
+			}
1030 1140
 		}
1031 1141
 		return '';
1032 1142
         }
@@ -1034,8 +1144,9 @@  discard block
 block discarded – undo
1034 1144
 	public static function update_airspace() {
1035 1145
 		global $tmp_dir, $globalDBdriver;
1036 1146
 		include_once('class.create_db.php');
1037
-		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
1038
-		else {
1147
+		if ($globalDBdriver == 'mysql') {
1148
+			update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
1149
+		} else {
1039 1150
 			update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql');
1040 1151
 			$query = "CREATE EXTENSION postgis";
1041 1152
 			$Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']);
@@ -1100,35 +1211,59 @@  discard block
 block discarded – undo
1100 1211
 		//if ($globalDebug) echo "IVAO : Download...";
1101 1212
 		//update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip');
1102 1213
 		if (file_exists($tmp_dir.'ivae_feb2013.zip')) {
1103
-			if ($globalDebug) echo "Unzip...";
1214
+			if ($globalDebug) {
1215
+				echo "Unzip...";
1216
+			}
1104 1217
 			update_db::unzip($tmp_dir.'ivae_feb2013.zip');
1105
-			if ($globalDebug) echo "Add to DB...";
1218
+			if ($globalDebug) {
1219
+				echo "Add to DB...";
1220
+			}
1106 1221
 			update_db::ivao_airlines($tmp_dir.'data/airlines.dat');
1107
-			if ($globalDebug) echo "Copy airlines logos to airlines images directory...";
1222
+			if ($globalDebug) {
1223
+				echo "Copy airlines logos to airlines images directory...";
1224
+			}
1108 1225
 			if (is_writable(dirname(__FILE__).'/../images/airlines')) {
1109
-				if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
1110
-			} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
1111
-		} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
1226
+				if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) {
1227
+					$error = "Failed to copy airlines logo.";
1228
+				}
1229
+			} else {
1230
+				$error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
1231
+			}
1232
+		} else {
1233
+			$error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
1234
+		}
1112 1235
 		if ($error != '') {
1113 1236
 			return $error;
1114
-		} elseif ($globalDebug) echo "Done\n";
1237
+		} elseif ($globalDebug) {
1238
+			echo "Done\n";
1239
+		}
1115 1240
 		return '';
1116 1241
 	}
1117 1242
 
1118 1243
 	public static function update_routes() {
1119 1244
 		global $tmp_dir, $globalDebug;
1120 1245
 		$error = '';
1121
-		if ($globalDebug) echo "Routes : Download...";
1246
+		if ($globalDebug) {
1247
+			echo "Routes : Download...";
1248
+		}
1122 1249
 		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
1123 1250
 		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
1124
-			if ($globalDebug) echo "Gunzip...";
1251
+			if ($globalDebug) {
1252
+				echo "Gunzip...";
1253
+			}
1125 1254
 			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
1126
-			if ($globalDebug) echo "Add to DB...";
1255
+			if ($globalDebug) {
1256
+				echo "Add to DB...";
1257
+			}
1127 1258
 			$error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb');
1128
-		} else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
1259
+		} else {
1260
+			$error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
1261
+		}
1129 1262
 		if ($error != '') {
1130 1263
 			return $error;
1131
-		} elseif ($globalDebug) echo "Done\n";
1264
+		} elseif ($globalDebug) {
1265
+			echo "Done\n";
1266
+		}
1132 1267
 		return '';
1133 1268
 	}
1134 1269
 	public static function update_ModeS() {
@@ -1145,257 +1280,455 @@  discard block
 block discarded – undo
1145 1280
 			exit;
1146 1281
 		} elseif ($globalDebug) echo "Done\n";
1147 1282
 */
1148
-		if ($globalDebug) echo "Modes : Download...";
1283
+		if ($globalDebug) {
1284
+			echo "Modes : Download...";
1285
+		}
1149 1286
 		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
1150 1287
 		if (file_exists($tmp_dir.'basestation_latest.zip')) {
1151
-			if ($globalDebug) echo "Unzip...";
1288
+			if ($globalDebug) {
1289
+				echo "Unzip...";
1290
+			}
1152 1291
 			update_db::unzip($tmp_dir.'basestation_latest.zip');
1153
-			if ($globalDebug) echo "Add to DB...";
1292
+			if ($globalDebug) {
1293
+				echo "Add to DB...";
1294
+			}
1154 1295
 			$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb');
1155
-		} else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
1296
+		} else {
1297
+			$error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
1298
+		}
1156 1299
 		if ($error != '') {
1157 1300
 			return $error;
1158
-		} elseif ($globalDebug) echo "Done\n";
1301
+		} elseif ($globalDebug) {
1302
+			echo "Done\n";
1303
+		}
1159 1304
 		return '';
1160 1305
 	}
1161 1306
 
1162 1307
 	public static function update_ModeS_flarm() {
1163 1308
 		global $tmp_dir, $globalDebug;
1164
-		if ($globalDebug) echo "Modes Flarmnet: Download...";
1309
+		if ($globalDebug) {
1310
+			echo "Modes Flarmnet: Download...";
1311
+		}
1165 1312
 		update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln');
1166 1313
 		if (file_exists($tmp_dir.'data.fln')) {
1167
-			if ($globalDebug) echo "Add to DB...";
1314
+			if ($globalDebug) {
1315
+				echo "Add to DB...";
1316
+			}
1168 1317
 			$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln');
1169
-		} else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed.";
1318
+		} else {
1319
+			$error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed.";
1320
+		}
1170 1321
 		if ($error != '') {
1171 1322
 			return $error;
1172
-		} elseif ($globalDebug) echo "Done\n";
1323
+		} elseif ($globalDebug) {
1324
+			echo "Done\n";
1325
+		}
1173 1326
 		return '';
1174 1327
 	}
1175 1328
 
1176 1329
 	public static function update_ModeS_ogn() {
1177 1330
 		global $tmp_dir, $globalDebug;
1178
-		if ($globalDebug) echo "Modes OGN: Download...";
1331
+		if ($globalDebug) {
1332
+			echo "Modes OGN: Download...";
1333
+		}
1179 1334
 		update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv');
1180 1335
 		if (file_exists($tmp_dir.'ogn.csv')) {
1181
-			if ($globalDebug) echo "Add to DB...";
1336
+			if ($globalDebug) {
1337
+				echo "Add to DB...";
1338
+			}
1182 1339
 			$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv');
1183
-		} else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed.";
1340
+		} else {
1341
+			$error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed.";
1342
+		}
1184 1343
 		if ($error != '') {
1185 1344
 			return $error;
1186
-		} elseif ($globalDebug) echo "Done\n";
1345
+		} elseif ($globalDebug) {
1346
+			echo "Done\n";
1347
+		}
1187 1348
 		return '';
1188 1349
 	}
1189 1350
 
1190 1351
 	public static function update_owner() {
1191 1352
 		global $tmp_dir, $globalDebug;
1192 1353
 		
1193
-		if ($globalDebug) echo "Owner France: Download...";
1354
+		if ($globalDebug) {
1355
+			echo "Owner France: Download...";
1356
+		}
1194 1357
 		update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv');
1195 1358
 		if (file_exists($tmp_dir.'owner_f.csv')) {
1196
-			if ($globalDebug) echo "Add to DB...";
1359
+			if ($globalDebug) {
1360
+				echo "Add to DB...";
1361
+			}
1197 1362
 			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F');
1198
-		} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
1363
+		} else {
1364
+			$error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
1365
+		}
1199 1366
 		if ($error != '') {
1200 1367
 			return $error;
1201
-		} elseif ($globalDebug) echo "Done\n";
1368
+		} elseif ($globalDebug) {
1369
+			echo "Done\n";
1370
+		}
1202 1371
 		
1203
-		if ($globalDebug) echo "Owner Ireland: Download...";
1372
+		if ($globalDebug) {
1373
+			echo "Owner Ireland: Download...";
1374
+		}
1204 1375
 		update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv');
1205 1376
 		if (file_exists($tmp_dir.'owner_ei.csv')) {
1206
-			if ($globalDebug) echo "Add to DB...";
1377
+			if ($globalDebug) {
1378
+				echo "Add to DB...";
1379
+			}
1207 1380
 			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI');
1208
-		} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
1381
+		} else {
1382
+			$error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
1383
+		}
1209 1384
 		if ($error != '') {
1210 1385
 			return $error;
1211
-		} elseif ($globalDebug) echo "Done\n";
1212
-		if ($globalDebug) echo "Owner Switzerland: Download...";
1386
+		} elseif ($globalDebug) {
1387
+			echo "Done\n";
1388
+		}
1389
+		if ($globalDebug) {
1390
+			echo "Owner Switzerland: Download...";
1391
+		}
1213 1392
 		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv');
1214 1393
 		if (file_exists($tmp_dir.'owner_hb.csv')) {
1215
-			if ($globalDebug) echo "Add to DB...";
1394
+			if ($globalDebug) {
1395
+				echo "Add to DB...";
1396
+			}
1216 1397
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB');
1217
-		} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
1398
+		} else {
1399
+			$error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
1400
+		}
1218 1401
 		if ($error != '') {
1219 1402
 			return $error;
1220
-		} elseif ($globalDebug) echo "Done\n";
1221
-		if ($globalDebug) echo "Owner Czech Republic: Download...";
1403
+		} elseif ($globalDebug) {
1404
+			echo "Done\n";
1405
+		}
1406
+		if ($globalDebug) {
1407
+			echo "Owner Czech Republic: Download...";
1408
+		}
1222 1409
 		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv');
1223 1410
 		if (file_exists($tmp_dir.'owner_ok.csv')) {
1224
-			if ($globalDebug) echo "Add to DB...";
1411
+			if ($globalDebug) {
1412
+				echo "Add to DB...";
1413
+			}
1225 1414
 			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK');
1226
-		} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
1415
+		} else {
1416
+			$error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
1417
+		}
1227 1418
 		if ($error != '') {
1228 1419
 			return $error;
1229
-		} elseif ($globalDebug) echo "Done\n";
1230
-		if ($globalDebug) echo "Owner Australia: Download...";
1420
+		} elseif ($globalDebug) {
1421
+			echo "Done\n";
1422
+		}
1423
+		if ($globalDebug) {
1424
+			echo "Owner Australia: Download...";
1425
+		}
1231 1426
 		update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv');
1232 1427
 		if (file_exists($tmp_dir.'owner_vh.csv')) {
1233
-			if ($globalDebug) echo "Add to DB...";
1428
+			if ($globalDebug) {
1429
+				echo "Add to DB...";
1430
+			}
1234 1431
 			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH');
1235
-		} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
1432
+		} else {
1433
+			$error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
1434
+		}
1236 1435
 		if ($error != '') {
1237 1436
 			return $error;
1238
-		} elseif ($globalDebug) echo "Done\n";
1239
-		if ($globalDebug) echo "Owner Austria: Download...";
1437
+		} elseif ($globalDebug) {
1438
+			echo "Done\n";
1439
+		}
1440
+		if ($globalDebug) {
1441
+			echo "Owner Austria: Download...";
1442
+		}
1240 1443
 		update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv');
1241 1444
 		if (file_exists($tmp_dir.'owner_oe.csv')) {
1242
-			if ($globalDebug) echo "Add to DB...";
1445
+			if ($globalDebug) {
1446
+				echo "Add to DB...";
1447
+			}
1243 1448
 			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE');
1244
-		} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
1449
+		} else {
1450
+			$error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
1451
+		}
1245 1452
 		if ($error != '') {
1246 1453
 			return $error;
1247
-		} elseif ($globalDebug) echo "Done\n";
1248
-		if ($globalDebug) echo "Owner Chile: Download...";
1454
+		} elseif ($globalDebug) {
1455
+			echo "Done\n";
1456
+		}
1457
+		if ($globalDebug) {
1458
+			echo "Owner Chile: Download...";
1459
+		}
1249 1460
 		update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv');
1250 1461
 		if (file_exists($tmp_dir.'owner_cc.csv')) {
1251
-			if ($globalDebug) echo "Add to DB...";
1462
+			if ($globalDebug) {
1463
+				echo "Add to DB...";
1464
+			}
1252 1465
 			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC');
1253
-		} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
1466
+		} else {
1467
+			$error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
1468
+		}
1254 1469
 		if ($error != '') {
1255 1470
 			return $error;
1256
-		} elseif ($globalDebug) echo "Done\n";
1257
-		if ($globalDebug) echo "Owner Colombia: Download...";
1471
+		} elseif ($globalDebug) {
1472
+			echo "Done\n";
1473
+		}
1474
+		if ($globalDebug) {
1475
+			echo "Owner Colombia: Download...";
1476
+		}
1258 1477
 		update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv');
1259 1478
 		if (file_exists($tmp_dir.'owner_hj.csv')) {
1260
-			if ($globalDebug) echo "Add to DB...";
1479
+			if ($globalDebug) {
1480
+				echo "Add to DB...";
1481
+			}
1261 1482
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ');
1262
-		} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
1483
+		} else {
1484
+			$error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
1485
+		}
1263 1486
 		if ($error != '') {
1264 1487
 			return $error;
1265
-		} elseif ($globalDebug) echo "Done\n";
1266
-		if ($globalDebug) echo "Owner Bosnia Herzegobina: Download...";
1488
+		} elseif ($globalDebug) {
1489
+			echo "Done\n";
1490
+		}
1491
+		if ($globalDebug) {
1492
+			echo "Owner Bosnia Herzegobina: Download...";
1493
+		}
1267 1494
 		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv');
1268 1495
 		if (file_exists($tmp_dir.'owner_e7.csv')) {
1269
-			if ($globalDebug) echo "Add to DB...";
1496
+			if ($globalDebug) {
1497
+				echo "Add to DB...";
1498
+			}
1270 1499
 			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7');
1271
-		} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
1500
+		} else {
1501
+			$error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
1502
+		}
1272 1503
 		if ($error != '') {
1273 1504
 			return $error;
1274
-		} elseif ($globalDebug) echo "Done\n";
1275
-		if ($globalDebug) echo "Owner Brazil: Download...";
1505
+		} elseif ($globalDebug) {
1506
+			echo "Done\n";
1507
+		}
1508
+		if ($globalDebug) {
1509
+			echo "Owner Brazil: Download...";
1510
+		}
1276 1511
 		update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv');
1277 1512
 		if (file_exists($tmp_dir.'owner_pp.csv')) {
1278
-			if ($globalDebug) echo "Add to DB...";
1513
+			if ($globalDebug) {
1514
+				echo "Add to DB...";
1515
+			}
1279 1516
 			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP');
1280
-		} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
1517
+		} else {
1518
+			$error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
1519
+		}
1281 1520
 		if ($error != '') {
1282 1521
 			return $error;
1283
-		} elseif ($globalDebug) echo "Done\n";
1284
-		if ($globalDebug) echo "Owner Cayman Islands: Download...";
1522
+		} elseif ($globalDebug) {
1523
+			echo "Done\n";
1524
+		}
1525
+		if ($globalDebug) {
1526
+			echo "Owner Cayman Islands: Download...";
1527
+		}
1285 1528
 		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv');
1286 1529
 		if (file_exists($tmp_dir.'owner_vp.csv')) {
1287
-			if ($globalDebug) echo "Add to DB...";
1530
+			if ($globalDebug) {
1531
+				echo "Add to DB...";
1532
+			}
1288 1533
 			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP');
1289
-		} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
1534
+		} else {
1535
+			$error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
1536
+		}
1290 1537
 		if ($error != '') {
1291 1538
 			return $error;
1292
-		} elseif ($globalDebug) echo "Done\n";
1293
-		if ($globalDebug) echo "Owner Croatia: Download...";
1539
+		} elseif ($globalDebug) {
1540
+			echo "Done\n";
1541
+		}
1542
+		if ($globalDebug) {
1543
+			echo "Owner Croatia: Download...";
1544
+		}
1294 1545
 		update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv');
1295 1546
 		if (file_exists($tmp_dir.'owner_9a.csv')) {
1296
-			if ($globalDebug) echo "Add to DB...";
1547
+			if ($globalDebug) {
1548
+				echo "Add to DB...";
1549
+			}
1297 1550
 			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A');
1298
-		} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
1551
+		} else {
1552
+			$error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
1553
+		}
1299 1554
 		if ($error != '') {
1300 1555
 			return $error;
1301
-		} elseif ($globalDebug) echo "Done\n";
1302
-		if ($globalDebug) echo "Owner Luxembourg: Download...";
1556
+		} elseif ($globalDebug) {
1557
+			echo "Done\n";
1558
+		}
1559
+		if ($globalDebug) {
1560
+			echo "Owner Luxembourg: Download...";
1561
+		}
1303 1562
 		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv');
1304 1563
 		if (file_exists($tmp_dir.'owner_lx.csv')) {
1305
-			if ($globalDebug) echo "Add to DB...";
1564
+			if ($globalDebug) {
1565
+				echo "Add to DB...";
1566
+			}
1306 1567
 			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX');
1307
-		} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
1568
+		} else {
1569
+			$error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
1570
+		}
1308 1571
 		if ($error != '') {
1309 1572
 			return $error;
1310
-		} elseif ($globalDebug) echo "Done\n";
1311
-		if ($globalDebug) echo "Owner Maldives: Download...";
1573
+		} elseif ($globalDebug) {
1574
+			echo "Done\n";
1575
+		}
1576
+		if ($globalDebug) {
1577
+			echo "Owner Maldives: Download...";
1578
+		}
1312 1579
 		update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv');
1313 1580
 		if (file_exists($tmp_dir.'owner_8q.csv')) {
1314
-			if ($globalDebug) echo "Add to DB...";
1581
+			if ($globalDebug) {
1582
+				echo "Add to DB...";
1583
+			}
1315 1584
 			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q');
1316
-		} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
1585
+		} else {
1586
+			$error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
1587
+		}
1317 1588
 		if ($error != '') {
1318 1589
 			return $error;
1319
-		} elseif ($globalDebug) echo "Done\n";
1320
-		if ($globalDebug) echo "Owner New Zealand: Download...";
1590
+		} elseif ($globalDebug) {
1591
+			echo "Done\n";
1592
+		}
1593
+		if ($globalDebug) {
1594
+			echo "Owner New Zealand: Download...";
1595
+		}
1321 1596
 		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv');
1322 1597
 		if (file_exists($tmp_dir.'owner_zk.csv')) {
1323
-			if ($globalDebug) echo "Add to DB...";
1598
+			if ($globalDebug) {
1599
+				echo "Add to DB...";
1600
+			}
1324 1601
 			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK');
1325
-		} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
1602
+		} else {
1603
+			$error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
1604
+		}
1326 1605
 		if ($error != '') {
1327 1606
 			return $error;
1328
-		} elseif ($globalDebug) echo "Done\n";
1329
-		if ($globalDebug) echo "Owner Papua New Guinea: Download...";
1607
+		} elseif ($globalDebug) {
1608
+			echo "Done\n";
1609
+		}
1610
+		if ($globalDebug) {
1611
+			echo "Owner Papua New Guinea: Download...";
1612
+		}
1330 1613
 		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv');
1331 1614
 		if (file_exists($tmp_dir.'owner_p2.csv')) {
1332
-			if ($globalDebug) echo "Add to DB...";
1615
+			if ($globalDebug) {
1616
+				echo "Add to DB...";
1617
+			}
1333 1618
 			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2');
1334
-		} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
1619
+		} else {
1620
+			$error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
1621
+		}
1335 1622
 		if ($error != '') {
1336 1623
 			return $error;
1337
-		} elseif ($globalDebug) echo "Done\n";
1338
-		if ($globalDebug) echo "Owner Slovakia: Download...";
1624
+		} elseif ($globalDebug) {
1625
+			echo "Done\n";
1626
+		}
1627
+		if ($globalDebug) {
1628
+			echo "Owner Slovakia: Download...";
1629
+		}
1339 1630
 		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv');
1340 1631
 		if (file_exists($tmp_dir.'owner_om.csv')) {
1341
-			if ($globalDebug) echo "Add to DB...";
1632
+			if ($globalDebug) {
1633
+				echo "Add to DB...";
1634
+			}
1342 1635
 			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM');
1343
-		} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
1636
+		} else {
1637
+			$error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
1638
+		}
1344 1639
 		if ($error != '') {
1345 1640
 			return $error;
1346
-		} elseif ($globalDebug) echo "Done\n";
1347
-		if ($globalDebug) echo "Owner Ecuador: Download...";
1641
+		} elseif ($globalDebug) {
1642
+			echo "Done\n";
1643
+		}
1644
+		if ($globalDebug) {
1645
+			echo "Owner Ecuador: Download...";
1646
+		}
1348 1647
 		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv');
1349 1648
 		if (file_exists($tmp_dir.'owner_hc.csv')) {
1350
-			if ($globalDebug) echo "Add to DB...";
1649
+			if ($globalDebug) {
1650
+				echo "Add to DB...";
1651
+			}
1351 1652
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC');
1352
-		} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
1653
+		} else {
1654
+			$error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
1655
+		}
1353 1656
 		if ($error != '') {
1354 1657
 			return $error;
1355
-		} elseif ($globalDebug) echo "Done\n";
1356
-		if ($globalDebug) echo "Owner Iceland: Download...";
1658
+		} elseif ($globalDebug) {
1659
+			echo "Done\n";
1660
+		}
1661
+		if ($globalDebug) {
1662
+			echo "Owner Iceland: Download...";
1663
+		}
1357 1664
 		update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv');
1358 1665
 		if (file_exists($tmp_dir.'owner_tf.csv')) {
1359
-			if ($globalDebug) echo "Add to DB...";
1666
+			if ($globalDebug) {
1667
+				echo "Add to DB...";
1668
+			}
1360 1669
 			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF');
1361
-		} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
1670
+		} else {
1671
+			$error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
1672
+		}
1362 1673
 		if ($error != '') {
1363 1674
 			return $error;
1364
-		} elseif ($globalDebug) echo "Done\n";
1675
+		} elseif ($globalDebug) {
1676
+			echo "Done\n";
1677
+		}
1365 1678
 		return '';
1366 1679
 	}
1367 1680
 
1368 1681
 	public static function update_translation() {
1369 1682
 		global $tmp_dir, $globalDebug;
1370 1683
 		$error = '';
1371
-		if ($globalDebug) echo "Translation : Download...";
1684
+		if ($globalDebug) {
1685
+			echo "Translation : Download...";
1686
+		}
1372 1687
 		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
1373 1688
 		if (file_exists($tmp_dir.'translation.zip')) {
1374
-			if ($globalDebug) echo "Unzip...";
1689
+			if ($globalDebug) {
1690
+				echo "Unzip...";
1691
+			}
1375 1692
 			update_db::unzip($tmp_dir.'translation.zip');
1376
-			if ($globalDebug) echo "Add to DB...";
1693
+			if ($globalDebug) {
1694
+				echo "Add to DB...";
1695
+			}
1377 1696
 			$error = update_db::translation();
1378
-		} else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
1697
+		} else {
1698
+			$error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
1699
+		}
1379 1700
 		if ($error != '') {
1380 1701
 			return $error;
1381
-		} elseif ($globalDebug) echo "Done\n";
1702
+		} elseif ($globalDebug) {
1703
+			echo "Done\n";
1704
+		}
1382 1705
 		return '';
1383 1706
 	}
1384 1707
 
1385 1708
 	public static function update_translation_fam() {
1386 1709
 		global $tmp_dir, $globalDebug;
1387 1710
 		$error = '';
1388
-		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
1711
+		if ($globalDebug) {
1712
+			echo "Translation from FlightAirMap website : Download...";
1713
+		}
1389 1714
 		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
1390 1715
 		if (file_exists($tmp_dir.'translation.tsv.gz')) {
1391
-			if ($globalDebug) echo "Gunzip...";
1716
+			if ($globalDebug) {
1717
+				echo "Gunzip...";
1718
+			}
1392 1719
 			update_db::gunzip($tmp_dir.'translation.tsv.gz');
1393
-			if ($globalDebug) echo "Add to DB...";
1720
+			if ($globalDebug) {
1721
+				echo "Add to DB...";
1722
+			}
1394 1723
 			$error = update_db::translation_fam();
1395
-		} else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
1724
+		} else {
1725
+			$error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
1726
+		}
1396 1727
 		if ($error != '') {
1397 1728
 			return $error;
1398
-		} elseif ($globalDebug) echo "Done\n";
1729
+		} elseif ($globalDebug) {
1730
+			echo "Done\n";
1731
+		}
1399 1732
 		return '';
1400 1733
 	}
1401 1734
 
@@ -1438,7 +1771,9 @@  discard block
 block discarded – undo
1438 1771
                 }
1439 1772
 
1440 1773
 		$error = '';
1441
-		if ($globalDebug) echo "Notam : Download...";
1774
+		if ($globalDebug) {
1775
+			echo "Notam : Download...";
1776
+		}
1442 1777
 		update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss');
1443 1778
 		if (file_exists($tmp_dir.'notam.rss')) {
1444 1779
 			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true);
@@ -1453,14 +1788,30 @@  discard block
 block discarded – undo
1453 1788
 				$data['fir'] = $q[0];
1454 1789
 				$data['code'] = $q[1];
1455 1790
 				$ifrvfr = $q[2];
1456
-				if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR';
1457
-				if ($ifrvfr == 'I') $data['rules'] = 'IFR';
1458
-				if ($ifrvfr == 'V') $data['rules'] = 'VFR';
1459
-				if ($q[4] == 'A') $data['scope'] = 'Airport warning';
1460
-				if ($q[4] == 'E') $data['scope'] = 'Enroute warning';
1461
-				if ($q[4] == 'W') $data['scope'] = 'Navigation warning';
1462
-				if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning';
1463
-				if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning';
1791
+				if ($ifrvfr == 'IV') {
1792
+					$data['rules'] = 'IFR/VFR';
1793
+				}
1794
+				if ($ifrvfr == 'I') {
1795
+					$data['rules'] = 'IFR';
1796
+				}
1797
+				if ($ifrvfr == 'V') {
1798
+					$data['rules'] = 'VFR';
1799
+				}
1800
+				if ($q[4] == 'A') {
1801
+					$data['scope'] = 'Airport warning';
1802
+				}
1803
+				if ($q[4] == 'E') {
1804
+					$data['scope'] = 'Enroute warning';
1805
+				}
1806
+				if ($q[4] == 'W') {
1807
+					$data['scope'] = 'Navigation warning';
1808
+				}
1809
+				if ($q[4] == 'AE') {
1810
+					$data['scope'] = 'Airport/Enroute warning';
1811
+				}
1812
+				if ($q[4] == 'AW') {
1813
+					$data['scope'] = 'Airport/Navigation warning';
1814
+				}
1464 1815
 				//$data['scope'] = $q[4];
1465 1816
 				$data['lower_limit'] = $q[5];
1466 1817
 				$data['upper_limit'] = $q[6];
@@ -1468,8 +1819,12 @@  discard block
 block discarded – undo
1468 1819
 				sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius);
1469 1820
 				$latitude = $Common->convertDec($las,'latitude');
1470 1821
 				$longitude = $Common->convertDec($lns,'longitude');
1471
-				if ($lac == 'S') $latitude = '-'.$latitude;
1472
-				if ($lnc == 'W') $longitude = '-'.$longitude;
1822
+				if ($lac == 'S') {
1823
+					$latitude = '-'.$latitude;
1824
+				}
1825
+				if ($lnc == 'W') {
1826
+					$longitude = '-'.$longitude;
1827
+				}
1473 1828
 				$data['center_latitude'] = $latitude;
1474 1829
 				$data['center_longitude'] = $longitude;
1475 1830
 				$data['radius'] = intval($radius);
@@ -1499,10 +1854,14 @@  discard block
 block discarded – undo
1499 1854
 				$NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1500 1855
 				unset($data);
1501 1856
 			} 
1502
-		} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
1857
+		} else {
1858
+			$error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
1859
+		}
1503 1860
 		if ($error != '') {
1504 1861
 			return $error;
1505
-		} elseif ($globalDebug) echo "Done\n";
1862
+		} elseif ($globalDebug) {
1863
+			echo "Done\n";
1864
+		}
1506 1865
 		return '';
1507 1866
 	}
1508 1867
 	
@@ -1521,8 +1880,11 @@  discard block
 block discarded – undo
1521 1880
                         return "error : ".$e->getMessage();
1522 1881
                 }
1523 1882
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
1524
-                if ($row['nb'] > 0) return false;
1525
-                else return true;
1883
+                if ($row['nb'] > 0) {
1884
+                	return false;
1885
+                } else {
1886
+                	return true;
1887
+                }
1526 1888
 	}
1527 1889
 
1528 1890
 	public static function insert_last_update() {
@@ -1552,8 +1914,11 @@  discard block
 block discarded – undo
1552 1914
                         return "error : ".$e->getMessage();
1553 1915
                 }
1554 1916
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
1555
-                if ($row['nb'] > 0) return false;
1556
-                else return true;
1917
+                if ($row['nb'] > 0) {
1918
+                	return false;
1919
+                } else {
1920
+                	return true;
1921
+                }
1557 1922
 	}
1558 1923
 
1559 1924
 	public static function insert_last_notam_update() {
@@ -1583,8 +1948,11 @@  discard block
 block discarded – undo
1583 1948
                         return "error : ".$e->getMessage();
1584 1949
                 }
1585 1950
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
1586
-                if ($row['nb'] > 0) return false;
1587
-                else return true;
1951
+                if ($row['nb'] > 0) {
1952
+                	return false;
1953
+                } else {
1954
+                	return true;
1955
+                }
1588 1956
 	}
1589 1957
 
1590 1958
 	public static function insert_last_owner_update() {
Please login to merge, or discard this patch.
install/index.php 1 patch
Braces   +378 added lines, -97 removed lines patch added patch discarded remove patch
@@ -117,44 +117,71 @@  discard block
 block discarded – undo
117 117
 			</div>
118 118
 			<p>
119 119
 				<label for="dbhost">Database hostname</label>
120
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
120
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
121
+	print $globalDBhost;
122
+}
123
+?>" />
121 124
 			</p>
122 125
 			<p>
123 126
 				<label for="dbport">Database port</label>
124
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
127
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
128
+	print $globalDBport;
129
+}
130
+?>" />
125 131
 			</p>
126 132
 			<p>
127 133
 				<label for="dbname">Database name</label>
128
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
134
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
135
+	print $globalDBname;
136
+}
137
+?>" />
129 138
 			</p>
130 139
 			<p>
131 140
 				<label for="dbuser">Database user</label>
132
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
141
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
142
+	print $globalDBuser;
143
+}
144
+?>" />
133 145
 			</p>
134 146
 			<p>
135 147
 				<label for="dbuserpass">Database user password</label>
136
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
148
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
149
+	print $globalDBpass;
150
+}
151
+?>" />
137 152
 			</p>
138 153
 		</fieldset>
139 154
 		<fieldset>
140 155
 			<legend>Site configuration</legend>
141 156
 			<p>
142 157
 				<label for="sitename">Site name</label>
143
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
158
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
159
+	print $globalName;
160
+}
161
+?>" />
144 162
 			</p>
145 163
 			<p>
146 164
 				<label for="siteurl">Site directory</label>
147
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
165
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
166
+	print $globalURL;
167
+}
168
+?>" />
148 169
 				<p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
149 170
 			</p>
150 171
 			<p>
151 172
 				<label for="timezone">Timezone</label>
152
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
173
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
174
+	print $globalTimezone;
175
+}
176
+?>" />
153 177
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
154 178
 			</p>
155 179
 			<p>
156 180
 				<label for="language">Language</label>
157
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
181
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
182
+	print $globalLanguage;
183
+}
184
+?>" />
158 185
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
159 186
 			</p>
160 187
 		</fieldset>
@@ -175,18 +202,27 @@  discard block
 block discarded – undo
175 202
 			<div id="mapbox_data">
176 203
 				<p>
177 204
 					<label for="mapboxid">Mapbox id</label>
178
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
205
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
206
+	print $globalMapboxId;
207
+}
208
+?>" />
179 209
 				</p>
180 210
 				<p>
181 211
 					<label for="mapboxtoken">Mapbox token</label>
182
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
212
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
213
+	print $globalMapboxToken;
214
+}
215
+?>" />
183 216
 				</p>
184 217
 			</div>
185 218
 			<br />
186 219
 			<div id="google_data">
187 220
 				<p>
188 221
 					<label for="googlekey">Google API key</label>
189
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
222
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
223
+	print $globalGoogleAPIKey;
224
+}
225
+?>" />
190 226
 					<p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
191 227
 				</p>
192 228
 			</div>
@@ -194,7 +230,10 @@  discard block
 block discarded – undo
194 230
 			<div id="bing_data">
195 231
 				<p>
196 232
 					<label for="bingkey">Bing Map key</label>
197
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
233
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
234
+	print $globalBingMapKey;
235
+}
236
+?>" />
198 237
 					<p class="help-block">Get a key <a href="https://msdn.microsoft.com/en-us/library/ff428642.aspx">here</a></p>
199 238
 				</p>
200 239
 			</div>
@@ -202,7 +241,10 @@  discard block
 block discarded – undo
202 241
 			<div id="mapquest_data">
203 242
 				<p>
204 243
 					<label for="mapquestkey">MapQuest key</label>
205
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
244
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
245
+	print $globalMapQuestKey;
246
+}
247
+?>" />
206 248
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
207 249
 				</p>
208 250
 			</div>
@@ -210,11 +252,17 @@  discard block
 block discarded – undo
210 252
 			<div id="here_data">
211 253
 				<p>
212 254
 					<label for="hereappid">Here App_Id</label>
213
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
255
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
256
+	print $globalHereappId;
257
+}
258
+?>" />
214 259
 				</p>
215 260
 				<p>
216 261
 					<label for="hereappcode">Here App_Code</label>
217
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
262
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
263
+	print $globalHereappCode;
264
+}
265
+?>" />
218 266
 				</p>
219 267
 				<p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
220 268
 			</div>
@@ -223,42 +271,86 @@  discard block
 block discarded – undo
223 271
 			<legend>Coverage area</legend>
224 272
 			<p>
225 273
 				<label for="latitudemax">The maximum latitude (north)</label>
226
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
274
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
275
+	print $globalLatitudeMax;
276
+}
277
+?>" />
227 278
 			</p>
228 279
 			<p>
229 280
 				<label for="latitudemin">The minimum latitude (south)</label>
230
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
281
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
282
+	print $globalLatitudeMin;
283
+}
284
+?>" />
231 285
 			</p>
232 286
 			<p>
233 287
 				<label for="longitudemax">The maximum longitude (west)</label>
234
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
288
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
289
+	print $globalLongitudeMax;
290
+}
291
+?>" />
235 292
 			</p>
236 293
 			<p>
237 294
 				<label for="longitudemin">The minimum longitude (east)</label>
238
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
295
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
296
+	print $globalLongitudeMin;
297
+}
298
+?>" />
239 299
 			</p>
240 300
 			<p>
241 301
 				<label for="latitudecenter">The latitude center</label>
242
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
302
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
303
+	print $globalCenterLatitude;
304
+}
305
+?>" />
243 306
 			</p>
244 307
 			<p>
245 308
 				<label for="longitudecenter">The longitude center</label>
246
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
309
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
310
+	print $globalCenterLongitude;
311
+}
312
+?>" />
247 313
 			</p>
248 314
 			<p>
249 315
 				<label for="livezoom">Default Zoom on live map</label>
250
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
316
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
317
+	print $globalLiveZoom;
318
+} else {
319
+	print '9';
320
+}
321
+?>" />
251 322
 			</p>
252 323
 			<p>
253 324
 				<label for="squawk_country">Country for squawk usage</label>
254 325
 				<select name="squawk_country" id="squawk_country">
255
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
256
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
257
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
258
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
259
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
260
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
261
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
326
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
327
+	print ' selected ';
328
+}
329
+?>>UK</option>
330
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
331
+	print ' selected ';
332
+}
333
+?>>NZ</option>
334
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
335
+	print ' selected ';
336
+}
337
+?>>US</option>
338
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
339
+	print ' selected ';
340
+}
341
+?>>AU</option>
342
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
343
+	print ' selected ';
344
+}
345
+?>>NL</option>
346
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
347
+	print ' selected ';
348
+}
349
+?>>FR</option>
350
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
351
+	print ' selected ';
352
+}
353
+?>>TR</option>
262 354
 				</select>
263 355
 			</p>
264 356
 		</fieldset>
@@ -267,15 +359,24 @@  discard block
 block discarded – undo
267 359
 			<p><i>Only put in DB flights that are inside a circle</i></p>
268 360
 			<p>
269 361
 				<label for="latitude">Center latitude</label>
270
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
362
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
363
+	echo $globalDistanceIgnore['latitude'];
364
+}
365
+?>" />
271 366
 			</p>
272 367
 			<p>
273 368
 				<label for="longitude">Center longitude</label>
274
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
369
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
370
+	echo $globalDistanceIgnore['longitude'];
371
+}
372
+?>" />
275 373
 			</p>
276 374
 			<p>
277 375
 				<label for="Distance">Distance (in km)</label>
278
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
376
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
377
+	echo $globalDistanceIgnore['distance'];
378
+}
379
+?>" />
279 380
 			</p>
280 381
 		</fieldset>
281 382
 		<fieldset>
@@ -364,11 +465,17 @@  discard block
 block discarded – undo
364 465
 			<div id="flightaware_data">
365 466
 				<p>
366 467
 					<label for="flightawareusername">FlightAware username</label>
367
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
468
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
469
+	print $globalFlightAwareUsername;
470
+}
471
+?>" />
368 472
 				</p>
369 473
 				<p>
370 474
 					<label for="flightawarepassword">FlightAware password/API key</label>
371
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
475
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
476
+	print $globalFlightAwarePassword;
477
+}
478
+?>" />
372 479
 				</p>
373 480
 			</div>
374 481
 -->
@@ -521,20 +628,56 @@  discard block
 block discarded – undo
521 628
 								?>
522 629
 								<td>
523 630
 									<select name="format[]" id="format">
524
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
525
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
526
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
527
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
528
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
529
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
530
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
531
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server</option>
532
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
533
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
631
+										<option value="auto" <?php if (!isset($source['format'])) {
632
+	print 'selected';
633
+}
634
+?>>Auto</option>
635
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
636
+	print 'selected';
637
+}
638
+?>>SBS</option>
639
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
640
+	print 'selected';
641
+}
642
+?>>TSV</option>
643
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
644
+	print 'selected';
645
+}
646
+?>>Raw</option>
647
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
648
+	print 'selected';
649
+}
650
+?>>APRS</option>
651
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
652
+	print 'selected';
653
+}
654
+?>>Radarcape deltadb.txt</option>
655
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
656
+	print 'selected';
657
+}
658
+?>>Vatsim</option>
659
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
660
+	print 'selected';
661
+}
662
+?>>Virtual Radar Server</option>
663
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
664
+	print 'selected';
665
+}
666
+?>>phpVMS</option>
667
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
668
+	print 'selected';
669
+}
670
+?>>IVAO</option>
534 671
 									</select>
535 672
 								</td>
536
-								<td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /></td>
537
-								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td>
673
+								<td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
674
+	print $source['name'];
675
+}
676
+?>" /></td>
677
+								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) {
678
+	print 'checked';
679
+}
680
+?> /></td>
538 681
 								<td><input type="button" id="delhost" value="Delete" onclick="deleteRow(this)" /> <input type="button" id="addhost" value="Add" onclick="insRow()" /></td>
539 682
 							</tr>
540 683
 <?php
@@ -573,11 +716,17 @@  discard block
 block discarded – undo
573 716
 					<p>Listen UDP server for acarsdec/acarsdeco2/...</p>
574 717
 					<p>
575 718
 						<label for="acarshost">ACARS UDP host</label>
576
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
719
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
720
+	print $globalACARSHost;
721
+}
722
+?>" />
577 723
 					</p>
578 724
 					<p>
579 725
 						<label for="acarsport">ACARS UDP port</label>
580
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
726
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
727
+	print $globalACARSPort;
728
+}
729
+?>" />
581 730
 					</p>
582 731
 				</fieldset>
583 732
 			</div>
@@ -631,12 +780,18 @@  discard block
 block discarded – undo
631 780
 			<div id="schedules_options">
632 781
 				<p>
633 782
 					<label for="britishairways">British Airways API Key</label>
634
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
783
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
784
+	print $globalBritishAirwaysKey;
785
+}
786
+?>" />
635 787
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
636 788
 				</p>
637 789
 				<p>
638 790
 					<label for="transavia">Transavia Test API Consumer Key</label>
639
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
791
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
792
+	print $globalTransaviaKey;
793
+}
794
+?>" />
640 795
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
641 796
 				</p>
642 797
 				<p>
@@ -644,10 +799,16 @@  discard block
 block discarded – undo
644 799
 						<b>Lufthansa API Key</b>
645 800
 						<p>
646 801
 							<label for="lufthansakey">Key</label>
647
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
802
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
803
+	print $globalLufthansaKey['key'];
804
+}
805
+?>" />
648 806
 						</p><p>
649 807
 							<label for="lufthansasecret">Secret</label>
650
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
808
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
809
+	print $globalLufthansaKey['secret'];
810
+}
811
+?>" />
651 812
 						</p>
652 813
 					</div>
653 814
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -667,7 +828,10 @@  discard block
 block discarded – undo
667 828
 			</p>
668 829
 			<p>
669 830
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
670
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
831
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
832
+	print $globalNOTAMSource;
833
+}
834
+?>" />
671 835
 			</p>
672 836
 			<br />
673 837
 			<p>
@@ -682,14 +846,20 @@  discard block
 block discarded – undo
682 846
 			<div id="metarsrc">
683 847
 				<p>
684 848
 					<label for="metarsource">URL of your METAR source</label>
685
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
849
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
850
+	print $globalMETARurl;
851
+}
852
+?>" />
686 853
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
687 854
 				</p>
688 855
 			</div>
689 856
 			<br />
690 857
 			<p>
691 858
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
692
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
859
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
860
+	print $globalBitlyAccessToken;
861
+}
862
+?>" />
693 863
 			</p>
694 864
 			<br />
695 865
 			<p>
@@ -703,7 +873,12 @@  discard block
 block discarded – undo
703 873
 			</p>
704 874
 			<p>
705 875
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
706
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '0'; ?>" />
876
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
877
+	print $globalArchiveMonths;
878
+} else {
879
+	echo '0';
880
+}
881
+?>" />
707 882
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
708 883
 			</p>
709 884
 			<p>
@@ -713,12 +888,22 @@  discard block
 block discarded – undo
713 888
 			</p>
714 889
 			<p>
715 890
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
716
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '0'; ?>" />
891
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
892
+	print $globalArchiveKeepMonths;
893
+} else {
894
+	echo '0';
895
+}
896
+?>" />
717 897
 				<p class="help-block">0 to disable</p>
718 898
 			</p>
719 899
 			<p>
720 900
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
721
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '0'; ?>" />
901
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
902
+	print $globalArchiveKeepTrackMonths;
903
+} else {
904
+	echo '0';
905
+}
906
+?>" />
722 907
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
723 908
 			</p>
724 909
 			<br />
@@ -727,7 +912,12 @@  discard block
 block discarded – undo
727 912
 				<input type="checkbox" name="daemon" id="daemon" value="daemon"<?php if ((isset($globalDaemon) && $globalDaemon) || !isset($globalDaemon)) { ?> checked="checked"<?php } ?> onClick="daemon_js()" />
728 913
 				<div id="cronends"> 
729 914
 					<label for="cronend">Run script for xx seconds</label>
730
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
915
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
916
+	print $globalCronEnd;
917
+} else {
918
+	print '0';
919
+}
920
+?>" />
731 921
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
732 922
 				</div>
733 923
 				<p class="help-block">Uncheck if the script is running as cron job</p>
@@ -768,26 +958,49 @@  discard block
 block discarded – undo
768 958
 			<br />
769 959
 			<p>
770 960
 				<label for="refresh">Show flights detected since xxx seconds</label>
771
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
961
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
962
+	echo $globalLiveInterval;
963
+} else {
964
+	echo '200';
965
+}
966
+?>" />
772 967
 			</p>
773 968
 			<p>
774 969
 				<label for="maprefresh">Live map refresh (in seconds)</label>
775
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
970
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
971
+	echo $globalMapRefresh;
972
+} else {
973
+	echo '30';
974
+}
975
+?>" />
776 976
 			</p>
777 977
 			<p>
778 978
 				<label for="mapidle">Map idle timeout (in minutes)</label>
779
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
979
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
980
+	echo $globalMapIdleTimeout;
981
+} else {
982
+	echo '30';
983
+}
984
+?>" />
780 985
 				<p class="help-block">0 to disable</p>
781 986
 			</p>
782 987
 			<br />
783 988
 			<p>
784 989
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
785
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
990
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
991
+	echo $globalClosestMinDist;
992
+} else {
993
+	echo '50';
994
+}
995
+?>" />
786 996
 			</p>
787 997
 			<br />
788 998
 			<p>
789 999
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
790
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1000
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1001
+	echo $globalAircraftSize;
1002
+}
1003
+?>" />
791 1004
 			</p>
792 1005
 			<br />
793 1006
 			<p>
@@ -795,7 +1008,12 @@  discard block
 block discarded – undo
795 1008
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
796 1009
 			?>
797 1010
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
798
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1011
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1012
+	echo $globalAircraftIconColor;
1013
+} else {
1014
+	echo '1a3151';
1015
+}
1016
+?>" />
799 1017
 			<?php
800 1018
 				if (!is_writable('../cache')) {
801 1019
 			?>
@@ -813,8 +1031,18 @@  discard block
 block discarded – undo
813 1031
 			<p>
814 1032
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
815 1033
 				<div class="range">
816
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
817
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1034
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1035
+	echo $globalAirportZoom;
1036
+} else {
1037
+	echo '7';
1038
+}
1039
+?>" />
1040
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1041
+	echo $globalAirportZoom;
1042
+} else {
1043
+	echo '7';
1044
+}
1045
+?></output>
818 1046
 				</div>
819 1047
 			</p>
820 1048
 		</fieldset>
@@ -842,8 +1070,12 @@  discard block
 block discarded – undo
842 1070
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
843 1071
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
844 1072
 
845
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
846
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1073
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1074
+		$error .= 'Mysql driver for PDO must be loaded';
1075
+	}
1076
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1077
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1078
+	}
847 1079
 	
848 1080
 	$_SESSION['database_root'] = $dbroot;
849 1081
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -910,15 +1142,23 @@  discard block
 block discarded – undo
910 1142
 	$source_city = $_POST['source_city'];
911 1143
 	$source_country = $_POST['source_country'];
912 1144
 	$source_ref = $_POST['source_ref'];
913
-	if (isset($source_id)) $source_id = $_POST['source_id'];
914
-	else $source_id = array();
1145
+	if (isset($source_id)) {
1146
+		$source_id = $_POST['source_id'];
1147
+	} else {
1148
+		$source_id = array();
1149
+	}
915 1150
 	
916 1151
 	$sources = array();
917 1152
 	foreach ($source_name as $keys => $name) {
918
-	    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]);
919
-	    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]);
1153
+	    if (isset($source_id[$keys])) {
1154
+	    	$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]);
1155
+	    } else {
1156
+	    	$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]);
1157
+	    }
1158
+	}
1159
+	if (count($sources) > 0) {
1160
+		$_SESSION['sources'] = $sources;
920 1161
 	}
921
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
922 1162
 
923 1163
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
924 1164
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -958,9 +1198,14 @@  discard block
 block discarded – undo
958 1198
 	$sourcestats = $_POST['sourcestats'];
959 1199
 	$gSources = array();
960 1200
 	foreach ($host as $key => $h) {
961
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
962
-		else $cov = 'FALSE';
963
-		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov);
1201
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1202
+			$cov = 'TRUE';
1203
+		} else {
1204
+			$cov = 'FALSE';
1205
+		}
1206
+		if ($h != '') {
1207
+			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov);
1208
+		}
964 1209
 	}
965 1210
 	$settings = array_merge($settings,array('globalSources' => $gSources));
966 1211
 
@@ -984,7 +1229,9 @@  discard block
 block discarded – undo
984 1229
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
985 1230
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
986 1231
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
987
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1232
+	} else {
1233
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1234
+	}
988 1235
 
989 1236
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
990 1237
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1023,7 +1270,9 @@  discard block
 block discarded – undo
1023 1270
 
1024 1271
 	// Create in settings.php keys not yet configurable if not already here
1025 1272
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1026
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1273
+	if (!isset($globalDebug)) {
1274
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1275
+	}
1027 1276
 
1028 1277
 	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
1029 1278
 	if ($archive == 'archive') {
@@ -1053,24 +1302,38 @@  discard block
 block discarded – undo
1053 1302
 	}
1054 1303
 */
1055 1304
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1056
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1057
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1058
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1059
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1305
+	if ($globalsbs == 'sbs') {
1306
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1307
+	} else {
1308
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1309
+	}
1310
+	if ($globalaprs == 'aprs') {
1311
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1312
+	} else {
1313
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1314
+	}
1060 1315
 	if ($globalivao == 'ivao') {
1061 1316
 		//$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE'));
1062 1317
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1063
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1318
+	} else {
1319
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1320
+	}
1064 1321
 	if ($globalvatsim == 'vatsim') {
1065 1322
 		//$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE'));
1066 1323
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1067
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1324
+	} else {
1325
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1326
+	}
1068 1327
 	if ($globalphpvms == 'phpvms') {
1069 1328
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1070
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1329
+	} else {
1330
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1331
+	}
1071 1332
 	if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') {
1072 1333
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1073
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1334
+	} else {
1335
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1336
+	}
1074 1337
 	
1075 1338
 
1076 1339
 
@@ -1164,7 +1427,9 @@  discard block
 block discarded – undo
1164 1427
 		$settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1165 1428
 	}
1166 1429
 
1167
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1430
+	if (!isset($globalTransaction)) {
1431
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1432
+	}
1168 1433
 
1169 1434
 	// Set some defaults values...
1170 1435
 	if (!isset($globalAircraftImageSources)) {
@@ -1179,15 +1444,23 @@  discard block
 block discarded – undo
1179 1444
 
1180 1445
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1181 1446
 
1182
-	if ($error == '') settings::modify_settings($settings);
1183
-	if ($error == '') settings::comment_settings($settings_comment);
1447
+	if ($error == '') {
1448
+		settings::modify_settings($settings);
1449
+	}
1450
+	if ($error == '') {
1451
+		settings::comment_settings($settings_comment);
1452
+	}
1184 1453
 	if ($error != '') {
1185 1454
 		print '<div class="info column">'.$error.'</div>';
1186 1455
 		require('../footer.php');
1187 1456
 		exit;
1188 1457
 	} else {
1189
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1190
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
1458
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
1459
+			$_SESSION['waypoints'] = 1;
1460
+		}
1461
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
1462
+			$_SESSION['owner'] = 1;
1463
+		}
1191 1464
 		if (isset($_POST['createdb'])) {
1192 1465
 			$_SESSION['install'] = 'database_create';
1193 1466
 		} else {
@@ -1216,9 +1489,15 @@  discard block
 block discarded – undo
1216 1489
 	$pop = false;
1217 1490
 	foreach ($_SESSION['done'] as $done) {
1218 1491
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1219
-	    if ($done == 'Create database') $pop = true;
1220
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1221
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1492
+	    if ($done == 'Create database') {
1493
+	    	$pop = true;
1494
+	    }
1495
+	    if ($_SESSION['install'] == 'database_create') {
1496
+	    	$pop = true;
1497
+	    }
1498
+	    if ($_SESSION['install'] == 'database_import') {
1499
+	    	$popi = true;
1500
+	    }
1222 1501
 	}
1223 1502
 	if ($pop) {
1224 1503
 	    sleep(5);
@@ -1226,7 +1505,9 @@  discard block
 block discarded – undo
1226 1505
 	} else if ($popi) {
1227 1506
 	    sleep(5);
1228 1507
 	    print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1229
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1508
+	} else {
1509
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1510
+	}
1230 1511
 	print '</div></ul>';
1231 1512
 	print '<div id="error"></div>';
1232 1513
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.