@@ -15,8 +15,12 @@ discard block |
||
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")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00: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 |
||
30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
32 | 36 | $sql_altitude = $start_altitude; |
33 | - } else $sql_altitude = ''; |
|
34 | -} else $sql_altitude = ''; |
|
37 | + } else { |
|
38 | + $sql_altitude = ''; |
|
39 | + } |
|
40 | + } else { |
|
41 | + $sql_altitude = ''; |
|
42 | +} |
|
35 | 43 | |
36 | 44 | //calculuation for the pagination |
37 | 45 | if(!isset($_GET['limit'])) { |
@@ -47,7 +55,7 @@ discard block |
||
47 | 55 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
48 | 56 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
49 | 57 | } |
50 | -} else { |
|
58 | +} else { |
|
51 | 59 | $limit_explode = explode(",", $_GET['limit']); |
52 | 60 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
53 | 61 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -65,8 +73,11 @@ discard block |
||
65 | 73 | |
66 | 74 | header("Content-type: text/yaml"); |
67 | 75 | |
68 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
69 | -else $sort = ''; |
|
76 | +if (isset($_GET['sort'])) { |
|
77 | + $sort = $_GET['sort']; |
|
78 | +} else { |
|
79 | + $sort = ''; |
|
80 | +} |
|
70 | 81 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
71 | 82 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
72 | 83 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -15,8 +15,12 @@ discard block |
||
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")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00: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 |
||
30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
32 | 36 | $sql_altitude = $start_altitude; |
33 | - } else $sql_altitude = ''; |
|
34 | -} else $sql_altitude = ''; |
|
37 | + } else { |
|
38 | + $sql_altitude = ''; |
|
39 | + } |
|
40 | + } else { |
|
41 | + $sql_altitude = ''; |
|
42 | +} |
|
35 | 43 | |
36 | 44 | //calculuation for the pagination |
37 | 45 | if(!isset($_GET['limit'])) |
@@ -48,7 +56,7 @@ discard block |
||
48 | 56 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
49 | 57 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
50 | 58 | } |
51 | -} else { |
|
59 | +} else { |
|
52 | 60 | $limit_explode = explode(",", $_GET['limit']); |
53 | 61 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
54 | 62 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -66,8 +74,11 @@ discard block |
||
66 | 74 | |
67 | 75 | header("Content-type: text/plain"); |
68 | 76 | |
69 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
70 | -else $sort = ''; |
|
77 | +if (isset($_GET['sort'])) { |
|
78 | + $sort = $_GET['sort']; |
|
79 | +} else { |
|
80 | + $sort = ''; |
|
81 | +} |
|
71 | 82 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
72 | 83 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
73 | 84 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -16,8 +16,12 @@ discard block |
||
16 | 16 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
17 | 17 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
18 | 18 | $sql_date = $end_date; |
19 | - } else $sql_date = ''; |
|
20 | -} else $sql_date = ''; |
|
19 | + } else { |
|
20 | + $sql_date = ''; |
|
21 | + } |
|
22 | + } else { |
|
23 | + $sql_date = ''; |
|
24 | +} |
|
21 | 25 | |
22 | 26 | if (isset($_GET['highest_altitude'])) { |
23 | 27 | //for altitude manipulation |
@@ -31,8 +35,12 @@ discard block |
||
31 | 35 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
32 | 36 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
33 | 37 | $sql_altitude = $start_altitude; |
34 | - } else $sql_altitude = ''; |
|
35 | -} else $sql_altitude = ''; |
|
38 | + } else { |
|
39 | + $sql_altitude = ''; |
|
40 | + } |
|
41 | + } else { |
|
42 | + $sql_altitude = ''; |
|
43 | +} |
|
36 | 44 | |
37 | 45 | //calculuation for the pagination |
38 | 46 | if(!isset($_GET['limit'])) |
@@ -50,7 +58,7 @@ discard block |
||
50 | 58 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
51 | 59 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
52 | 60 | } |
53 | -} else { |
|
61 | +} else { |
|
54 | 62 | $limit_explode = explode(",", $_GET['limit']); |
55 | 63 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
56 | 64 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -71,8 +79,11 @@ discard block |
||
71 | 79 | |
72 | 80 | $date = date("c", time()); |
73 | 81 | |
74 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
75 | -else $sort = ''; |
|
82 | +if (isset($_GET['sort'])) { |
|
83 | + $sort = $_GET['sort']; |
|
84 | +} else { |
|
85 | + $sort = ''; |
|
86 | +} |
|
76 | 87 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
77 | 88 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING); |
78 | 89 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -15,8 +15,12 @@ discard block |
||
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")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00: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 |
||
30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
32 | 36 | $sql_altitude = $start_altitude; |
33 | - } else $sql_altitude = ''; |
|
34 | -} else $sql_altitude = ''; |
|
37 | + } else { |
|
38 | + $sql_altitude = ''; |
|
39 | + } |
|
40 | + } else { |
|
41 | + $sql_altitude = ''; |
|
42 | +} |
|
35 | 43 | |
36 | 44 | //calculuation for the pagination |
37 | 45 | if(!isset($_GET['limit'])) { |
@@ -47,7 +55,7 @@ discard block |
||
47 | 55 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
48 | 56 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
49 | 57 | } |
50 | -} else { |
|
58 | +} else { |
|
51 | 59 | $limit_explode = explode(",", $_GET['limit']); |
52 | 60 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
53 | 61 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -65,8 +73,11 @@ discard block |
||
65 | 73 | |
66 | 74 | header("Content-type: text/csv"); |
67 | 75 | |
68 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
69 | -else $sort = ''; |
|
76 | +if (isset($_GET['sort'])) { |
|
77 | + $sort = $_GET['sort']; |
|
78 | +} else { |
|
79 | + $sort = ''; |
|
80 | +} |
|
70 | 81 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
71 | 82 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
72 | 83 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -16,8 +16,12 @@ discard block |
||
16 | 16 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
17 | 17 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
18 | 18 | $sql_date = $end_date; |
19 | - } else $sql_date = ''; |
|
20 | -} else $sql_date = ''; |
|
19 | + } else { |
|
20 | + $sql_date = ''; |
|
21 | + } |
|
22 | + } else { |
|
23 | + $sql_date = ''; |
|
24 | +} |
|
21 | 25 | |
22 | 26 | if (isset($_GET['highest_altitude'])) { |
23 | 27 | //for altitude manipulation |
@@ -31,8 +35,12 @@ discard block |
||
31 | 35 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
32 | 36 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
33 | 37 | $sql_altitude = $start_altitude; |
34 | - } else $sql_altitude = ''; |
|
35 | -} else $sql_altitude = ''; |
|
38 | + } else { |
|
39 | + $sql_altitude = ''; |
|
40 | + } |
|
41 | + } else { |
|
42 | + $sql_altitude = ''; |
|
43 | +} |
|
36 | 44 | |
37 | 45 | //calculuation for the pagination |
38 | 46 | if(!isset($_GET['limit'])) |
@@ -49,7 +57,7 @@ discard block |
||
49 | 57 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
50 | 58 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
51 | 59 | } |
52 | -} else { |
|
60 | +} else { |
|
53 | 61 | $limit_explode = explode(",", $_GET['limit']); |
54 | 62 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
55 | 63 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -66,8 +74,11 @@ discard block |
||
66 | 74 | |
67 | 75 | header("Content-type: text/csv"); |
68 | 76 | |
69 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
70 | -else $sort = ''; |
|
77 | +if (isset($_GET['sort'])) { |
|
78 | + $sort = $_GET['sort']; |
|
79 | +} else { |
|
80 | + $sort = ''; |
|
81 | +} |
|
71 | 82 | |
72 | 83 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
73 | 84 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
@@ -16,8 +16,12 @@ discard block |
||
16 | 16 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
17 | 17 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
18 | 18 | $sql_date = $end_date; |
19 | - } else $sql_date = ''; |
|
20 | -} else $sql_date = ''; |
|
19 | + } else { |
|
20 | + $sql_date = ''; |
|
21 | + } |
|
22 | + } else { |
|
23 | + $sql_date = ''; |
|
24 | +} |
|
21 | 25 | |
22 | 26 | if (isset($_GET['highest_altitude'])) { |
23 | 27 | //for altitude manipulation |
@@ -31,8 +35,12 @@ discard block |
||
31 | 35 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
32 | 36 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
33 | 37 | $sql_altitude = $start_altitude; |
34 | - } else $sql_altitude = ''; |
|
35 | -} else $sql_altitude = ''; |
|
38 | + } else { |
|
39 | + $sql_altitude = ''; |
|
40 | + } |
|
41 | + } else { |
|
42 | + $sql_altitude = ''; |
|
43 | +} |
|
36 | 44 | |
37 | 45 | //calculuation for the pagination |
38 | 46 | if(!isset($_GET['limit'])) |
@@ -50,7 +58,7 @@ discard block |
||
50 | 58 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
51 | 59 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
52 | 60 | } |
53 | -} else { |
|
61 | +} else { |
|
54 | 62 | $limit_explode = explode(",", $_GET['limit']); |
55 | 63 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
56 | 64 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -68,8 +76,11 @@ discard block |
||
68 | 76 | |
69 | 77 | header('Content-Type: application/json'); |
70 | 78 | |
71 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
72 | -else $sort = ''; |
|
79 | +if (isset($_GET['sort'])) { |
|
80 | + $sort = $_GET['sort']; |
|
81 | +} else { |
|
82 | + $sort = ''; |
|
83 | +} |
|
73 | 84 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
74 | 85 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
75 | 86 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | $tracker = false; |
13 | 13 | $marine = false; |
14 | 14 | $usecoord = false; |
15 | -if (isset($_GET['test'])) exit(); |
|
15 | +if (isset($_GET['test'])) { |
|
16 | + exit(); |
|
17 | +} |
|
16 | 18 | if (isset($_GET['tracker'])) { |
17 | 19 | $tracker = true; |
18 | 20 | } |
@@ -57,31 +59,62 @@ discard block |
||
57 | 59 | } |
58 | 60 | header('Content-Type: text/javascript'); |
59 | 61 | |
60 | -if (!isset($globalJsonCompress)) $compress = true; |
|
61 | -else $compress = $globalJsonCompress; |
|
62 | +if (!isset($globalJsonCompress)) { |
|
63 | + $compress = true; |
|
64 | +} else { |
|
65 | + $compress = $globalJsonCompress; |
|
66 | +} |
|
62 | 67 | |
63 | 68 | $limit = 0; |
64 | 69 | $from_archive = false; |
65 | 70 | $min = true; |
66 | 71 | $allhistory = false; |
67 | 72 | $filter['source'] = array(); |
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
70 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
72 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
73 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
78 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
79 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
80 | -if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true; |
|
73 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
74 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
75 | +} |
|
76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
77 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | +} |
|
79 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
80 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
81 | +} |
|
82 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
83 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
84 | +} |
|
85 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
86 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
87 | +} |
|
88 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
89 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
90 | +} |
|
91 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
92 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
93 | +} |
|
94 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
95 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
96 | +} |
|
97 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
98 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
99 | +} |
|
100 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
101 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
102 | +} |
|
103 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
104 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
105 | +} |
|
106 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') { |
|
107 | + $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
108 | +} |
|
109 | +if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') { |
|
110 | + $filter['blocked'] = true; |
|
111 | +} |
|
81 | 112 | |
82 | 113 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
83 | 114 | $min = true; |
84 | -} else $min = false; |
|
115 | +} else { |
|
116 | + $min = false; |
|
117 | +} |
|
85 | 118 | |
86 | 119 | |
87 | 120 | if (isset($_COOKIE['map_2d_limit'])) { |
@@ -197,24 +230,38 @@ discard block |
||
197 | 230 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
198 | 231 | } |
199 | 232 | } |
200 | - if ($flightcnt == '') $flightcnt = 0; |
|
201 | -} else $flightcnt = 0; |
|
233 | + if ($flightcnt == '') { |
|
234 | + $flightcnt = 0; |
|
235 | + } |
|
236 | + } else { |
|
237 | + $flightcnt = 0; |
|
238 | +} |
|
202 | 239 | |
203 | 240 | $sqltime = round(microtime(true)-$begintime,2); |
204 | 241 | |
205 | 242 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
206 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
243 | +if ($currenttime != '') { |
|
244 | + $currenttime = round($currenttime/1000); |
|
245 | +} |
|
207 | 246 | |
208 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
209 | -else $usenextlatlon = true; |
|
210 | -if ($usenextlatlon === false) $currenttime = ''; |
|
247 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation === FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
248 | + $usenextlatlon = false; |
|
249 | +} else { |
|
250 | + $usenextlatlon = true; |
|
251 | +} |
|
252 | +if ($usenextlatlon === false) { |
|
253 | + $currenttime = ''; |
|
254 | +} |
|
211 | 255 | $j = 0; |
212 | 256 | $prev_flightaware_id = ''; |
213 | 257 | $aircrafts_shadow = array(); |
214 | 258 | $output = '{'; |
215 | 259 | $output .= '"type": "FeatureCollection",'; |
216 | - if ($min) $output .= '"minimal": "true",'; |
|
217 | - else $output .= '"minimal": "false",'; |
|
260 | + if ($min) { |
|
261 | + $output .= '"minimal": "true",'; |
|
262 | + } else { |
|
263 | + $output .= '"minimal": "false",'; |
|
264 | + } |
|
218 | 265 | //$output .= '"fc": "'.$flightcnt.'",'; |
219 | 266 | $output .= '"sqt": "'.$sqltime.'",'; |
220 | 267 | |
@@ -259,18 +306,29 @@ discard block |
||
259 | 306 | } |
260 | 307 | $output .= '"properties": {'; |
261 | 308 | if (isset($spotter_item['flightaware_id'])) { |
262 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
263 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
309 | + if ($compress) { |
|
310 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
311 | + } else { |
|
312 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
313 | + } |
|
264 | 314 | } elseif (isset($spotter_item['famtrackid'])) { |
265 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
266 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
315 | + if ($compress) { |
|
316 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
317 | + } else { |
|
318 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
319 | + } |
|
267 | 320 | } elseif (isset($spotter_item['fammarine_id'])) { |
268 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
269 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
321 | + if ($compress) { |
|
322 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
323 | + } else { |
|
324 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
325 | + } |
|
270 | 326 | } |
271 | 327 | $output .= '"fc": "'.$flightcnt.'",'; |
272 | 328 | $output .= '"sqt": "'.$sqltime.'",'; |
273 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
329 | + if (isset($begindate)) { |
|
330 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
331 | + } |
|
274 | 332 | |
275 | 333 | /* |
276 | 334 | if ($min) $output .= '"minimal": "true",'; |
@@ -278,16 +336,25 @@ discard block |
||
278 | 336 | */ |
279 | 337 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
280 | 338 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
281 | - if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
282 | - else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
339 | + if ($compress) { |
|
340 | + $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
341 | + } else { |
|
342 | + $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
343 | + } |
|
283 | 344 | //' |
284 | 345 | } else { |
285 | - if ($compress) $output .= '"c": "NA",'; |
|
286 | - else $output .= '"callsign": "NA",'; |
|
346 | + if ($compress) { |
|
347 | + $output .= '"c": "NA",'; |
|
348 | + } else { |
|
349 | + $output .= '"callsign": "NA",'; |
|
350 | + } |
|
287 | 351 | } |
288 | 352 | if (isset($spotter_item['registration'])) { |
289 | - if ($compress) $output .= '"reg": '.json_encode($spotter_item['registration']).','; |
|
290 | - else $output .= '"registration": '.json_encode($spotter_item['registration']).','; |
|
353 | + if ($compress) { |
|
354 | + $output .= '"reg": '.json_encode($spotter_item['registration']).','; |
|
355 | + } else { |
|
356 | + $output .= '"registration": '.json_encode($spotter_item['registration']).','; |
|
357 | + } |
|
291 | 358 | } |
292 | 359 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
293 | 360 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
@@ -298,20 +365,30 @@ discard block |
||
298 | 365 | $output .= '"aircraft_name": "NA",'; |
299 | 366 | } |
300 | 367 | if (isset($spotter_item['aircraft_icao'])) { |
301 | - if ($compress) $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",'; |
|
302 | - else $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
368 | + if ($compress) { |
|
369 | + $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",'; |
|
370 | + } else { |
|
371 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
372 | + } |
|
303 | 373 | } |
304 | 374 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
305 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
306 | - else { |
|
375 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
376 | + $spotter_item['aircraft_shadow'] = ''; |
|
377 | + } else { |
|
307 | 378 | $aircraft_icao = $spotter_item['aircraft_icao']; |
308 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
309 | - else { |
|
379 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
380 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
381 | + } else { |
|
310 | 382 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
311 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
312 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
313 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
314 | - else $spotter_item['aircraft_shadow'] = ''; |
|
383 | + if (count($aircraft_info) > 0) { |
|
384 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
385 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
386 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
387 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
388 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
389 | + } else { |
|
390 | + $spotter_item['aircraft_shadow'] = ''; |
|
391 | + } |
|
315 | 392 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
316 | 393 | } |
317 | 394 | } |
@@ -319,96 +396,183 @@ discard block |
||
319 | 396 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
320 | 397 | if ($tracker) { |
321 | 398 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
322 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
323 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
399 | + if ($compress) { |
|
400 | + $output .= '"as": "ambulance.png",'; |
|
401 | + } else { |
|
402 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
403 | + } |
|
324 | 404 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
325 | - if ($compress) $output .= '"as": "police.png",'; |
|
326 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
405 | + if ($compress) { |
|
406 | + $output .= '"as": "police.png",'; |
|
407 | + } else { |
|
408 | + $output .= '"aircraft_shadow": "police.png",'; |
|
409 | + } |
|
327 | 410 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
328 | - if ($compress) $output .= '"as": "ship.png",'; |
|
329 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
411 | + if ($compress) { |
|
412 | + $output .= '"as": "ship.png",'; |
|
413 | + } else { |
|
414 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
415 | + } |
|
330 | 416 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
331 | - if ($compress) $output .= '"as": "ship.png",'; |
|
332 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
417 | + if ($compress) { |
|
418 | + $output .= '"as": "ship.png",'; |
|
419 | + } else { |
|
420 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
421 | + } |
|
333 | 422 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
334 | - if ($compress) $output .= '"as": "ship.png",'; |
|
335 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
423 | + if ($compress) { |
|
424 | + $output .= '"as": "ship.png",'; |
|
425 | + } else { |
|
426 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
427 | + } |
|
336 | 428 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
337 | - if ($compress) $output .= '"as": "truck.png",'; |
|
338 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
429 | + if ($compress) { |
|
430 | + $output .= '"as": "truck.png",'; |
|
431 | + } else { |
|
432 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
433 | + } |
|
339 | 434 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
340 | - if ($compress) $output .= '"as": "truck.png",'; |
|
341 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
435 | + if ($compress) { |
|
436 | + $output .= '"as": "truck.png",'; |
|
437 | + } else { |
|
438 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
439 | + } |
|
342 | 440 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
343 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
344 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
441 | + if ($compress) { |
|
442 | + $output .= '"as": "aircraft.png",'; |
|
443 | + } else { |
|
444 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
445 | + } |
|
345 | 446 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
346 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
347 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
447 | + if ($compress) { |
|
448 | + $output .= '"as": "aircraft.png",'; |
|
449 | + } else { |
|
450 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
451 | + } |
|
348 | 452 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
349 | - if ($compress) $output .= '"as": "helico.png",'; |
|
350 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
453 | + if ($compress) { |
|
454 | + $output .= '"as": "helico.png",'; |
|
455 | + } else { |
|
456 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
457 | + } |
|
351 | 458 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
352 | - if ($compress) $output .= '"as": "rail.png",'; |
|
353 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
459 | + if ($compress) { |
|
460 | + $output .= '"as": "rail.png",'; |
|
461 | + } else { |
|
462 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
463 | + } |
|
354 | 464 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
355 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
356 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
465 | + if ($compress) { |
|
466 | + $output .= '"as": "firetruck.png",'; |
|
467 | + } else { |
|
468 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
469 | + } |
|
357 | 470 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
358 | - if ($compress) $output .= '"as": "bus.png",'; |
|
359 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
471 | + if ($compress) { |
|
472 | + $output .= '"as": "bus.png",'; |
|
473 | + } else { |
|
474 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
475 | + } |
|
360 | 476 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
361 | - if ($compress) $output .= '"as": "phone.png",'; |
|
362 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
477 | + if ($compress) { |
|
478 | + $output .= '"as": "phone.png",'; |
|
479 | + } else { |
|
480 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
481 | + } |
|
363 | 482 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
364 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
365 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
483 | + if ($compress) { |
|
484 | + $output .= '"as": "jogger.png",'; |
|
485 | + } else { |
|
486 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
487 | + } |
|
366 | 488 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
367 | - if ($compress) $output .= '"as": "bike.png",'; |
|
368 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
489 | + if ($compress) { |
|
490 | + $output .= '"as": "bike.png",'; |
|
491 | + } else { |
|
492 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
493 | + } |
|
369 | 494 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
370 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
371 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
495 | + if ($compress) { |
|
496 | + $output .= '"as": "motorcycle.png",'; |
|
497 | + } else { |
|
498 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
499 | + } |
|
372 | 500 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
373 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
374 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
501 | + if ($compress) { |
|
502 | + $output .= '"as": "balloon.png",'; |
|
503 | + } else { |
|
504 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
505 | + } |
|
375 | 506 | } else { |
376 | - if ($compress) $output .= '"as": "car.png",'; |
|
377 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
507 | + if ($compress) { |
|
508 | + $output .= '"as": "car.png",'; |
|
509 | + } else { |
|
510 | + $output .= '"aircraft_shadow": "car.png",'; |
|
511 | + } |
|
378 | 512 | } |
379 | 513 | } elseif ($marine) { |
380 | 514 | if (isset($spotter_item['type']) && ($spotter_item['type'] == '50' Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) { |
381 | - if ($compress) $output .= '"as": "50perfcruiser.png",'; |
|
382 | - else $output .= '"aircraft_shadow": "50perfcruiser.png",'; |
|
515 | + if ($compress) { |
|
516 | + $output .= '"as": "50perfcruiser.png",'; |
|
517 | + } else { |
|
518 | + $output .= '"aircraft_shadow": "50perfcruiser.png",'; |
|
519 | + } |
|
383 | 520 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') { |
384 | - if ($compress) $output .= '"as": "cruiser38.png",'; |
|
385 | - else $output .= '"aircraft_shadow": "cruiser38.png",'; |
|
521 | + if ($compress) { |
|
522 | + $output .= '"as": "cruiser38.png",'; |
|
523 | + } else { |
|
524 | + $output .= '"aircraft_shadow": "cruiser38.png",'; |
|
525 | + } |
|
386 | 526 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') { |
387 | - if ($compress) $output .= '"as": "transat.png",'; |
|
388 | - else $output .= '"aircraft_shadow": "transat.png",'; |
|
527 | + if ($compress) { |
|
528 | + $output .= '"as": "transat.png",'; |
|
529 | + } else { |
|
530 | + $output .= '"aircraft_shadow": "transat.png",'; |
|
531 | + } |
|
389 | 532 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52' Cruising Cat') { |
390 | - if ($compress) $output .= '"as": "catamaran.png",'; |
|
391 | - else $output .= '"aircraft_shadow": "catamaran.png",'; |
|
533 | + if ($compress) { |
|
534 | + $output .= '"as": "catamaran.png",'; |
|
535 | + } else { |
|
536 | + $output .= '"aircraft_shadow": "catamaran.png",'; |
|
537 | + } |
|
392 | 538 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') { |
393 | - if ($compress) $output .= '"as": "carib.png",'; |
|
394 | - else $output .= '"aircraft_shadow": "carib.png",'; |
|
539 | + if ($compress) { |
|
540 | + $output .= '"as": "carib.png",'; |
|
541 | + } else { |
|
542 | + $output .= '"aircraft_shadow": "carib.png",'; |
|
543 | + } |
|
395 | 544 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Nordic Folkboat') { |
396 | - if ($compress) $output .= '"as": "nordic.png",'; |
|
397 | - else $output .= '"aircraft_shadow": "nordic.png",'; |
|
545 | + if ($compress) { |
|
546 | + $output .= '"as": "nordic.png",'; |
|
547 | + } else { |
|
548 | + $output .= '"aircraft_shadow": "nordic.png",'; |
|
549 | + } |
|
398 | 550 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == '32' Offshore Racer') { |
399 | - if ($compress) $output .= '"as": "nordic.png",'; |
|
400 | - else $output .= '"aircraft_shadow": "50perfcruiser.png",'; |
|
551 | + if ($compress) { |
|
552 | + $output .= '"as": "nordic.png",'; |
|
553 | + } else { |
|
554 | + $output .= '"aircraft_shadow": "50perfcruiser.png",'; |
|
555 | + } |
|
401 | 556 | } else { |
402 | - if ($compress) $output .= '"as": "ship.png",'; |
|
403 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
557 | + if ($compress) { |
|
558 | + $output .= '"as": "ship.png",'; |
|
559 | + } else { |
|
560 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
561 | + } |
|
404 | 562 | } |
405 | 563 | } else { |
406 | - if ($compress) $output .= '"as": "default.png",'; |
|
407 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
564 | + if ($compress) { |
|
565 | + $output .= '"as": "default.png",'; |
|
566 | + } else { |
|
567 | + $output .= '"aircraft_shadow": "default.png",'; |
|
568 | + } |
|
408 | 569 | } |
409 | 570 | } else { |
410 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
411 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
571 | + if ($compress) { |
|
572 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
573 | + } else { |
|
574 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
575 | + } |
|
412 | 576 | } |
413 | 577 | if (isset($spotter_item['airline_name'])) { |
414 | 578 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -416,8 +580,11 @@ discard block |
||
416 | 580 | $output .= '"airline_name": "NA",'; |
417 | 581 | } |
418 | 582 | if (isset($spotter_item['departure_airport'])) { |
419 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
420 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
583 | + if ($compress) { |
|
584 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
585 | + } else { |
|
586 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
587 | + } |
|
421 | 588 | } |
422 | 589 | if (isset($spotter_item['departure_airport_city'])) { |
423 | 590 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -429,8 +596,11 @@ discard block |
||
429 | 596 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
430 | 597 | } |
431 | 598 | if (isset($spotter_item['arrival_airport'])) { |
432 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
433 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
599 | + if ($compress) { |
|
600 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
601 | + } else { |
|
602 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
603 | + } |
|
434 | 604 | } |
435 | 605 | if (isset($spotter_item['arrival_airport_city'])) { |
436 | 606 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -449,11 +619,17 @@ discard block |
||
449 | 619 | } |
450 | 620 | |
451 | 621 | if (isset($spotter_item['real_altitude'])) { |
452 | - if ($compress) $output .= '"a": "'.($spotter_item['real_altitude']/100).'",'; |
|
453 | - else $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",'; |
|
622 | + if ($compress) { |
|
623 | + $output .= '"a": "'.($spotter_item['real_altitude']/100).'",'; |
|
624 | + } else { |
|
625 | + $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",'; |
|
626 | + } |
|
454 | 627 | } elseif (isset($spotter_item['altitude'])) { |
455 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
456 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
628 | + if ($compress) { |
|
629 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
630 | + } else { |
|
631 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
632 | + } |
|
457 | 633 | } |
458 | 634 | |
459 | 635 | $heading = $spotter_item['heading']; |
@@ -477,19 +653,24 @@ discard block |
||
477 | 653 | } |
478 | 654 | } |
479 | 655 | |
480 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
481 | - else $output .= '"heading": "'.$heading.'",'; |
|
656 | + if ($compress) { |
|
657 | + $output .= '"h": "'.$heading.'",'; |
|
658 | + } else { |
|
659 | + $output .= '"heading": "'.$heading.'",'; |
|
660 | + } |
|
482 | 661 | if ($currenttime != '') { |
483 | 662 | if (strtotime($spotter_item['date']) < $currenttime) { |
484 | 663 | if (isset($archivespeed)) { |
485 | 664 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
486 | 665 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
487 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
488 | - else { |
|
666 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
667 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
668 | + } else { |
|
489 | 669 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
490 | 670 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
491 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
492 | - else { |
|
671 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
672 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
673 | + } else { |
|
493 | 674 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
494 | 675 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
495 | 676 | } |
@@ -497,12 +678,14 @@ discard block |
||
497 | 678 | } elseif ($usenextlatlon) { |
498 | 679 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
499 | 680 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
500 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
501 | - else { |
|
681 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
682 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
683 | + } else { |
|
502 | 684 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
503 | 685 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
504 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
505 | - else { |
|
686 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
687 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
688 | + } else { |
|
506 | 689 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
507 | 690 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
508 | 691 | } |
@@ -541,7 +724,9 @@ discard block |
||
541 | 724 | } |
542 | 725 | } |
543 | 726 | |
544 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
727 | + if (!$min) { |
|
728 | + $output .= '"image": "'.$image.'",'; |
|
729 | + } |
|
545 | 730 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
546 | 731 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
547 | 732 | } |
@@ -549,8 +734,11 @@ discard block |
||
549 | 734 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
550 | 735 | } |
551 | 736 | if (isset($spotter_item['squawk'])) { |
552 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
553 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
737 | + if ($compress) { |
|
738 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
739 | + } else { |
|
740 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
741 | + } |
|
554 | 742 | } |
555 | 743 | if (isset($spotter_item['squawk_usage'])) { |
556 | 744 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -581,14 +769,23 @@ discard block |
||
581 | 769 | } |
582 | 770 | // type when not aircraft ? |
583 | 771 | if (isset($spotter_item['type'])) { |
584 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
585 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
772 | + if ($compress) { |
|
773 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
774 | + } else { |
|
775 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
776 | + } |
|
586 | 777 | } elseif ($marine) { |
587 | - if ($compress) $output .= '"t": "ship"'; |
|
588 | - else $output .= '"type": "ship"'; |
|
778 | + if ($compress) { |
|
779 | + $output .= '"t": "ship"'; |
|
780 | + } else { |
|
781 | + $output .= '"type": "ship"'; |
|
782 | + } |
|
589 | 783 | } else { |
590 | - if ($compress) $output .= '"t": "aircraft"'; |
|
591 | - else $output .= '"type": "aircraft"'; |
|
784 | + if ($compress) { |
|
785 | + $output .= '"t": "aircraft"'; |
|
786 | + } else { |
|
787 | + $output .= '"type": "aircraft"'; |
|
788 | + } |
|
592 | 789 | } |
593 | 790 | $output .= '},'; |
594 | 791 | $output .= '"geometry": {'; |
@@ -596,15 +793,19 @@ discard block |
||
596 | 793 | $output .= '"coordinates": ['; |
597 | 794 | if ($currenttime != '') { |
598 | 795 | if (strtotime($spotter_item['date']) < $currenttime) { |
599 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
796 | + if (!isset($archivespeed)) { |
|
797 | + $archivespeed = 1; |
|
798 | + } |
|
600 | 799 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
601 | 800 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
602 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
603 | - else { |
|
801 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
802 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
803 | + } else { |
|
604 | 804 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
605 | 805 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
606 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
607 | - else { |
|
806 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
807 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
808 | + } else { |
|
608 | 809 | $output .= $spotter_item['longitude'].', '; |
609 | 810 | $output .= $spotter_item['latitude']; |
610 | 811 | } |
@@ -682,7 +883,9 @@ discard block |
||
682 | 883 | } |
683 | 884 | */ |
684 | 885 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
685 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
886 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
887 | + $history = $_COOKIE['history']; |
|
888 | + } |
|
686 | 889 | |
687 | 890 | if ( |
688 | 891 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -753,8 +956,11 @@ discard block |
||
753 | 956 | $output_history .= ']}},'; |
754 | 957 | $output .= $output_history; |
755 | 958 | } |
756 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
757 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
959 | + if ($compress) { |
|
960 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
961 | + } else { |
|
962 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
963 | + } |
|
758 | 964 | } |
759 | 965 | $output_history .= '['; |
760 | 966 | $output_history .= $spotter_history['longitude'].', '; |
@@ -775,10 +981,15 @@ discard block |
||
775 | 981 | if ($d === false) { |
776 | 982 | if ($compress) { |
777 | 983 | $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",'; |
778 | - if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
779 | - elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
984 | + if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') { |
|
985 | + $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
986 | + } elseif (isset($spotter_history_array[0]['mapmatching_engine'])) { |
|
987 | + $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
988 | + } |
|
780 | 989 | $output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
781 | - } else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
990 | + } else { |
|
991 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
992 | + } |
|
782 | 993 | $d = true; |
783 | 994 | } |
784 | 995 | $output_history .= '['; |
@@ -801,7 +1012,9 @@ discard block |
||
801 | 1012 | $output_historyd = '['; |
802 | 1013 | $output_historyd .= $spotter_item['longitude'].', '; |
803 | 1014 | $output_historyd .= $spotter_item['latitude']; |
804 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
1015 | + if (isset($spotter_history['altitude'])) { |
|
1016 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
1017 | + } |
|
805 | 1018 | $output_historyd .= '],'; |
806 | 1019 | //$output_history = $output_historyd.$output_history; |
807 | 1020 | $output_history = $output_history.$output_historyd; |
@@ -829,8 +1042,11 @@ discard block |
||
829 | 1042 | && $spotter_item['arrival_airport'] != 'NA' |
830 | 1043 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
831 | 1044 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
832 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
833 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
1045 | + if ($compress) { |
|
1046 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
1047 | + } else { |
|
1048 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
1049 | + } |
|
834 | 1050 | if (isset($spotter_item['departure_airport_latitude'])) { |
835 | 1051 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
836 | 1052 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -863,8 +1079,11 @@ discard block |
||
863 | 1079 | || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
864 | 1080 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
865 | 1081 | $havedata = false; |
866 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
867 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1082 | + if ($compress) { |
|
1083 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1084 | + } else { |
|
1085 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
1086 | + } |
|
868 | 1087 | |
869 | 1088 | //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
870 | 1089 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -889,7 +1108,9 @@ discard block |
||
889 | 1108 | $output_dest = substr($output_dest, 0, -1); |
890 | 1109 | } |
891 | 1110 | $output_dest .= ']}},'; |
892 | - if ($havedata) $output .= $output_dest; |
|
1111 | + if ($havedata) { |
|
1112 | + $output .= $output_dest; |
|
1113 | + } |
|
893 | 1114 | unset($output_dest); |
894 | 1115 | } |
895 | 1116 | } |
@@ -897,7 +1118,9 @@ discard block |
||
897 | 1118 | $output .= ']'; |
898 | 1119 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
899 | 1120 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
900 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
1121 | + if (isset($begindate)) { |
|
1122 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
1123 | + } |
|
901 | 1124 | $output .= '"fc": "'.$j.'"'; |
902 | 1125 | } else { |
903 | 1126 | $output .= '"features": '; |
@@ -59,7 +59,9 @@ discard block |
||
59 | 59 | try { |
60 | 60 | $GeoidClass = new GeoidHeight(); |
61 | 61 | } catch(Exception $e) { |
62 | - if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
|
62 | + if ($globalDebug) { |
|
63 | + echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
|
64 | + } |
|
63 | 65 | $GeoidClass = FALSE; |
64 | 66 | } |
65 | 67 | } |
@@ -78,7 +80,9 @@ discard block |
||
78 | 80 | $dbc = $this->db; |
79 | 81 | $this->all_flights[$id]['schedule_check'] = true; |
80 | 82 | if ($globalSchedulesFetch) { |
81 | - if ($globalDebug) echo 'Getting schedule info...'."\n"; |
|
83 | + if ($globalDebug) { |
|
84 | + echo 'Getting schedule info...'."\n"; |
|
85 | + } |
|
82 | 86 | $Spotter = new Spotter($dbc); |
83 | 87 | $Schedule = new Schedule($dbc); |
84 | 88 | $Translation = new Translation($dbc); |
@@ -89,7 +93,9 @@ discard block |
||
89 | 93 | if ($Schedule->checkSchedule($operator) == 0) { |
90 | 94 | $schedule = $Schedule->fetchSchedule($operator); |
91 | 95 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
92 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
96 | + if ($globalDebug) { |
|
97 | + echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
98 | + } |
|
93 | 99 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
94 | 100 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
95 | 101 | // Should also check if route schedule = route from DB |
@@ -98,7 +104,9 @@ discard block |
||
98 | 104 | $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
99 | 105 | if (trim($airport_icao) != '') { |
100 | 106 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
101 | - if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
107 | + if ($globalDebug) { |
|
108 | + echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
109 | + } |
|
102 | 110 | } |
103 | 111 | } |
104 | 112 | } |
@@ -107,20 +115,30 @@ discard block |
||
107 | 115 | $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
108 | 116 | if (trim($airport_icao) != '') { |
109 | 117 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
110 | - if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
118 | + if ($globalDebug) { |
|
119 | + echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
120 | + } |
|
111 | 121 | } |
112 | 122 | } |
113 | 123 | } |
114 | 124 | $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
115 | 125 | } |
116 | - } else $scheduleexist = true; |
|
117 | - } else $scheduleexist = true; |
|
126 | + } else { |
|
127 | + $scheduleexist = true; |
|
128 | + } |
|
129 | + } else { |
|
130 | + $scheduleexist = true; |
|
131 | + } |
|
118 | 132 | // close connection, at least one way will work ? |
119 | 133 | if ($scheduleexist) { |
120 | - if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
134 | + if ($globalDebug) { |
|
135 | + echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
136 | + } |
|
121 | 137 | $sch = $Schedule->getSchedule($operator); |
122 | 138 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
123 | - if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']); |
|
139 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
140 | + $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']); |
|
141 | + } |
|
124 | 142 | } |
125 | 143 | $Spotter->db = null; |
126 | 144 | $Schedule->db = null; |
@@ -140,14 +158,18 @@ discard block |
||
140 | 158 | |
141 | 159 | public function checkAll() { |
142 | 160 | global $globalDebug, $globalNoImport; |
143 | - if ($globalDebug) echo "Update last seen flights data...\n"; |
|
161 | + if ($globalDebug) { |
|
162 | + echo "Update last seen flights data...\n"; |
|
163 | + } |
|
144 | 164 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
145 | 165 | foreach ($this->all_flights as $key => $flight) { |
146 | 166 | if (isset($this->all_flights[$key]['id'])) { |
147 | 167 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
148 | 168 | $Spotter = new Spotter($this->db); |
149 | 169 | $real_arrival = $this->arrival($key); |
150 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],'',$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
170 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) { |
|
171 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],'',$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
172 | + } |
|
151 | 173 | } |
152 | 174 | } |
153 | 175 | } |
@@ -155,24 +177,32 @@ discard block |
||
155 | 177 | |
156 | 178 | public function arrival($key) { |
157 | 179 | global $globalClosestMinDist, $globalDebug; |
158 | - if ($globalDebug) echo 'Update arrival...'."\n"; |
|
180 | + if ($globalDebug) { |
|
181 | + echo 'Update arrival...'."\n"; |
|
182 | + } |
|
159 | 183 | $Spotter = new Spotter($this->db); |
160 | 184 | $airport_icao = ''; |
161 | 185 | $airport_time = ''; |
162 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
186 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') { |
|
187 | + $globalClosestMinDist = 50; |
|
188 | + } |
|
163 | 189 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
164 | 190 | $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
165 | 191 | if (isset($closestAirports[0])) { |
166 | 192 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
167 | 193 | $airport_icao = $closestAirports[0]['icao']; |
168 | 194 | $airport_time = $this->all_flights[$key]['datetime']; |
169 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
195 | + if ($globalDebug) { |
|
196 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
197 | + } |
|
170 | 198 | } elseif (count($closestAirports) > 1 && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
171 | 199 | foreach ($closestAirports as $airport) { |
172 | 200 | if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
173 | 201 | $airport_icao = $airport['icao']; |
174 | 202 | $airport_time = $this->all_flights[$key]['datetime']; |
175 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
203 | + if ($globalDebug) { |
|
204 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
205 | + } |
|
176 | 206 | break; |
177 | 207 | } |
178 | 208 | } |
@@ -180,14 +210,20 @@ discard block |
||
180 | 210 | $airport_icao = $closestAirports[0]['icao']; |
181 | 211 | $airport_time = $this->all_flights[$key]['datetime']; |
182 | 212 | } else { |
183 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
213 | + if ($globalDebug) { |
|
214 | + echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
215 | + } |
|
184 | 216 | } |
185 | 217 | } else { |
186 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
218 | + if ($globalDebug) { |
|
219 | + echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
220 | + } |
|
187 | 221 | } |
188 | 222 | |
189 | 223 | } else { |
190 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
224 | + if ($globalDebug) { |
|
225 | + echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
226 | + } |
|
191 | 227 | } |
192 | 228 | return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
193 | 229 | } |
@@ -197,7 +233,9 @@ discard block |
||
197 | 233 | public function del() { |
198 | 234 | global $globalDebug, $globalNoImport, $globalNoDB; |
199 | 235 | // Delete old infos |
200 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
236 | + if ($globalDebug) { |
|
237 | + echo 'Delete old values and update latest data...'."\n"; |
|
238 | + } |
|
201 | 239 | |
202 | 240 | foreach ($this->all_flights as $key => $flight) { |
203 | 241 | if (isset($flight['lastupdate'])) { |
@@ -212,22 +250,30 @@ discard block |
||
212 | 250 | global $globalDebug, $globalNoImport, $globalNoDB; |
213 | 251 | // Delete old infos |
214 | 252 | if (isset($this->all_flights[$key]['id'])) { |
215 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
253 | + if ($globalDebug) { |
|
254 | + echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
255 | + } |
|
216 | 256 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
217 | 257 | $real_arrival = $this->arrival($key); |
218 | 258 | $Spotter = new Spotter($this->db); |
219 | 259 | $SpotterLive = new SpotterLive($this->db); |
220 | 260 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
221 | 261 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],'',$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
222 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
262 | + if ($globalDebug && $result != 'success') { |
|
263 | + echo '!!! ERROR : '.$result."\n"; |
|
264 | + } |
|
223 | 265 | $this->all_flights[$key]['putinarchive'] = true; |
224 | 266 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['aircraft_icao'], $this->all_flights[$key]['departure_airport'], $this->all_flights[$key]['arrival_airport'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['waypoints'], $this->all_flights[$key]['altitude'],$this->all_flights[$key]['altitude_real'], $this->all_flights[$key]['heading'], $this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'], $this->all_flights[$key]['departure_airport_time'], $this->all_flights[$key]['arrival_airport_time'], $this->all_flights[$key]['squawk'],$this->all_flights[$key]['route_stop'],$this->all_flights[$key]['hex'],$this->all_flights[$key]['putinarchive'],$this->all_flights[$key]['registration'],$this->all_flights[$key]['pilot_id'],$this->all_flights[$key]['pilot_name'], $this->all_flights[$key]['verticalrate'], $this->all_flights[$key]['noarchive'], $this->all_flights[$key]['ground'],$this->all_flights[$key]['format_source'],$this->all_flights[$key]['source_name'],$this->all_flights[$key]['over_country']); |
225 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
267 | + if ($globalDebug && $result != 'success') { |
|
268 | + echo '!!! ERROR : '.$result."\n"; |
|
269 | + } |
|
226 | 270 | } |
227 | 271 | $Spotter->db = null; |
228 | 272 | $SpotterLive->db = null; |
229 | 273 | } |
230 | - if ($globalDebug) echo "\n"; |
|
274 | + if ($globalDebug) { |
|
275 | + echo "\n"; |
|
276 | + } |
|
231 | 277 | } |
232 | 278 | unset($this->all_flights[$key]); |
233 | 279 | } |
@@ -235,9 +281,13 @@ discard block |
||
235 | 281 | public function add($line) { |
236 | 282 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass, $globalArchive, $globalAPRSdelete; |
237 | 283 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
238 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01'; |
|
239 | - if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') $globalAircraftMaxUpdate = 3000; |
|
240 | -/* |
|
284 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
285 | + $globalCoordMinChange = '0.01'; |
|
286 | + } |
|
287 | + if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') { |
|
288 | + $globalAircraftMaxUpdate = 3000; |
|
289 | + } |
|
290 | + /* |
|
241 | 291 | $Spotter = new Spotter(); |
242 | 292 | $dbc = $Spotter->db; |
243 | 293 | $SpotterLive = new SpotterLive($dbc); |
@@ -259,19 +309,28 @@ discard block |
||
259 | 309 | // SBS format is CSV format |
260 | 310 | if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
261 | 311 | //print_r($line); |
262 | - if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
312 | + if (isset($line['hex'])) { |
|
313 | + $line['hex'] = strtoupper($line['hex']); |
|
314 | + } |
|
263 | 315 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
264 | 316 | |
265 | 317 | // Increment message number |
266 | 318 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
267 | 319 | $current_date = date('Y-m-d'); |
268 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
269 | - else $source = ''; |
|
270 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
320 | + if (isset($line['source_name'])) { |
|
321 | + $source = $line['source_name']; |
|
322 | + } else { |
|
323 | + $source = ''; |
|
324 | + } |
|
325 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
326 | + $source = $line['format_source']; |
|
327 | + } |
|
271 | 328 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
272 | 329 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
273 | 330 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
274 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
331 | + } else { |
|
332 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
333 | + } |
|
275 | 334 | } |
276 | 335 | |
277 | 336 | /* |
@@ -287,23 +346,38 @@ discard block |
||
287 | 346 | //$this->db = $dbc; |
288 | 347 | |
289 | 348 | //$hex = trim($line['hex']); |
290 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
291 | - else $id = trim($line['id']); |
|
349 | + if (!isset($line['id'])) { |
|
350 | + $id = trim($line['hex']); |
|
351 | + } else { |
|
352 | + $id = trim($line['id']); |
|
353 | + } |
|
292 | 354 | |
293 | 355 | if (!isset($this->all_flights[$id])) { |
294 | - if ($globalDebug) echo 'New flight...'."\n"; |
|
356 | + if ($globalDebug) { |
|
357 | + echo 'New flight...'."\n"; |
|
358 | + } |
|
295 | 359 | $this->all_flights[$id] = array(); |
296 | 360 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
297 | 361 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '','coordinates' => 0)); |
298 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
362 | + if (isset($globalDaemon) && $globalDaemon === FALSE) { |
|
363 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
364 | + } |
|
299 | 365 | if (!isset($line['id'])) { |
300 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
301 | -// if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
366 | + if (!isset($globalDaemon)) { |
|
367 | + $globalDaemon = TRUE; |
|
368 | + } |
|
369 | + // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
302 | 370 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
303 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
371 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
372 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
373 | + } |
|
304 | 374 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
305 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
306 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
375 | + } else { |
|
376 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
377 | + } |
|
378 | + if ($globalAllFlights !== FALSE) { |
|
379 | + $dataFound = true; |
|
380 | + } |
|
307 | 381 | } |
308 | 382 | if (isset($line['source_type']) && $line['source_type'] != '') { |
309 | 383 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
@@ -325,12 +399,20 @@ discard block |
||
325 | 399 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
326 | 400 | } |
327 | 401 | $Spotter->db = null; |
328 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
329 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
402 | + if ($globalDebugTimeElapsed) { |
|
403 | + echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
404 | + } |
|
405 | + if ($aircraft_icao != '') { |
|
406 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
407 | + } |
|
330 | 408 | } |
331 | 409 | } |
332 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
333 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
410 | + if ($globalAllFlights !== FALSE) { |
|
411 | + $dataFound = true; |
|
412 | + } |
|
413 | + if ($globalDebug) { |
|
414 | + echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
415 | + } |
|
334 | 416 | } |
335 | 417 | if (isset($line['id']) && !isset($line['hex'])) { |
336 | 418 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
@@ -339,7 +421,9 @@ discard block |
||
339 | 421 | $icao = $line['aircraft_icao']; |
340 | 422 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
341 | 423 | $Spotter = new Spotter($this->db); |
342 | - if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
|
424 | + if (isset($Spotter->aircraft_correct_icaotype[$icao])) { |
|
425 | + $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
|
426 | + } |
|
343 | 427 | $Spotter->db = null; |
344 | 428 | } |
345 | 429 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
@@ -349,15 +433,24 @@ discard block |
||
349 | 433 | $Spotter = new Spotter($this->db); |
350 | 434 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
351 | 435 | $Spotter->db = null; |
352 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
436 | + if ($aircraft_icao != '') { |
|
437 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
438 | + } |
|
353 | 439 | } |
354 | 440 | } |
355 | 441 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
356 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
357 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
358 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
359 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
360 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
442 | + if ($line['aircraft_type'] == 'PARA_GLIDER') { |
|
443 | + $aircraft_icao = 'GLID'; |
|
444 | + } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') { |
|
445 | + $aircraft_icao = 'UHEL'; |
|
446 | + } elseif ($line['aircraft_type'] == 'TOW_PLANE') { |
|
447 | + $aircraft_icao = 'TOWPLANE'; |
|
448 | + } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') { |
|
449 | + $aircraft_icao = 'POWAIRC'; |
|
450 | + } |
|
451 | + if (isset($aircraft_icao)) { |
|
452 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
453 | + } |
|
361 | 454 | } |
362 | 455 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
363 | 456 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
@@ -367,8 +460,11 @@ discard block |
||
367 | 460 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
368 | 461 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
369 | 462 | } else { |
370 | - if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
371 | - elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
463 | + if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
464 | + echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
465 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
466 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
467 | + } |
|
372 | 468 | /* |
373 | 469 | echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']); |
374 | 470 | print_r($this->all_flights[$id]); |
@@ -377,16 +473,22 @@ discard block |
||
377 | 473 | return ''; |
378 | 474 | } |
379 | 475 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
380 | - if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
476 | + if ($globalDebug) { |
|
477 | + echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
478 | + } |
|
381 | 479 | return ''; |
382 | 480 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
383 | - if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
481 | + if ($globalDebug) { |
|
482 | + echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
483 | + } |
|
384 | 484 | return ''; |
385 | 485 | } elseif (!isset($line['datetime'])) { |
386 | 486 | date_default_timezone_set('UTC'); |
387 | 487 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
388 | 488 | } else { |
389 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
489 | + if ($globalDebug) { |
|
490 | + echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
491 | + } |
|
390 | 492 | return ''; |
391 | 493 | } |
392 | 494 | |
@@ -407,30 +509,48 @@ discard block |
||
407 | 509 | |
408 | 510 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
409 | 511 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 800) { |
410 | - if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
|
512 | + if ($globalDebug) { |
|
513 | + echo '---!!!! New ident, reset aircraft data...'."\n"; |
|
514 | + } |
|
411 | 515 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
412 | 516 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
413 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
414 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
415 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
517 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
518 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
519 | + } elseif (isset($line['id'])) { |
|
520 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
521 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
522 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
523 | + } |
|
416 | 524 | } else { |
417 | 525 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
418 | 526 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
419 | 527 | $timeelapsed = microtime(true); |
420 | 528 | $Spotter = new Spotter($this->db); |
421 | 529 | $fromsource = NULL; |
422 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
423 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
424 | - elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
425 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
426 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
530 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
531 | + $fromsource = $globalAirlinesSource; |
|
532 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') { |
|
533 | + $fromsource = 'vatsim'; |
|
534 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') { |
|
535 | + $fromsource = 'ivao'; |
|
536 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
537 | + $fromsource = 'vatsim'; |
|
538 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
539 | + $fromsource = 'ivao'; |
|
540 | + } |
|
427 | 541 | $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource,$this->all_flights[$id]['source_type']); |
428 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
542 | + if ($globalDebug && $result != 'success') { |
|
543 | + echo '!!! ERROR : '.$result."\n"; |
|
544 | + } |
|
429 | 545 | $Spotter->db = null; |
430 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
546 | + if ($globalDebugTimeElapsed) { |
|
547 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
548 | + } |
|
431 | 549 | } |
432 | 550 | } |
433 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
551 | + } else { |
|
552 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
553 | + } |
|
434 | 554 | |
435 | 555 | /* |
436 | 556 | if (!isset($line['id'])) { |
@@ -440,7 +560,9 @@ discard block |
||
440 | 560 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
441 | 561 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
442 | 562 | */ |
443 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
563 | + if (!isset($this->all_flights[$id]['id'])) { |
|
564 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
565 | + } |
|
444 | 566 | |
445 | 567 | //$putinarchive = true; |
446 | 568 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
@@ -458,7 +580,9 @@ discard block |
||
458 | 580 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
459 | 581 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
460 | 582 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
461 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
583 | + if ($globalDebugTimeElapsed) { |
|
584 | + echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
585 | + } |
|
462 | 586 | } |
463 | 587 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
464 | 588 | $timeelapsed = microtime(true); |
@@ -472,7 +596,9 @@ discard block |
||
472 | 596 | $Translation->db = null; |
473 | 597 | } |
474 | 598 | $Spotter->db = null; |
475 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
599 | + if ($globalDebugTimeElapsed) { |
|
600 | + echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
601 | + } |
|
476 | 602 | } |
477 | 603 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
478 | 604 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
@@ -481,9 +607,13 @@ discard block |
||
481 | 607 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
482 | 608 | } |
483 | 609 | } |
484 | - if (!isset($globalFork)) $globalFork = TRUE; |
|
610 | + if (!isset($globalFork)) { |
|
611 | + $globalFork = TRUE; |
|
612 | + } |
|
485 | 613 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
486 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
614 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) { |
|
615 | + $this->get_Schedule($id,trim($line['ident'])); |
|
616 | + } |
|
487 | 617 | } |
488 | 618 | } |
489 | 619 | } |
@@ -501,9 +631,13 @@ discard block |
||
501 | 631 | $speed = $speed*3.6; |
502 | 632 | if ($speed < 1000) { |
503 | 633 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
504 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
634 | + if ($globalDebug) { |
|
635 | + echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
636 | + } |
|
505 | 637 | } else { |
506 | - if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
638 | + if ($globalDebug) { |
|
639 | + echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
640 | + } |
|
507 | 641 | } |
508 | 642 | } |
509 | 643 | } |
@@ -512,13 +646,21 @@ discard block |
||
512 | 646 | |
513 | 647 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
514 | 648 | if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
515 | - if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
649 | + if ($globalDebug) { |
|
650 | + echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
651 | + } |
|
516 | 652 | return false; |
517 | 653 | } |
518 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
519 | - else unset($timediff); |
|
520 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
521 | - else unset($timediff_archive); |
|
654 | + if (isset($this->all_flights[$id]['time_last_coord'])) { |
|
655 | + $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
656 | + } else { |
|
657 | + unset($timediff); |
|
658 | + } |
|
659 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) { |
|
660 | + $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
661 | + } else { |
|
662 | + unset($timediff_archive); |
|
663 | + } |
|
522 | 664 | if ($this->tmd > 5 |
523 | 665 | || (isset($line['format_source']) |
524 | 666 | && $line['format_source'] == 'airwhere' |
@@ -561,21 +703,32 @@ discard block |
||
561 | 703 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
562 | 704 | $this->all_flights[$id]['putinarchive'] = true; |
563 | 705 | if ($this->tmd > 5 && $this->all_flights[$id]['putinarchive'] == true) { |
564 | - if ($globalDebug) echo "\n".' Update Initial data ! '."\n"; |
|
706 | + if ($globalDebug) { |
|
707 | + echo "\n".' Update Initial data ! '."\n"; |
|
708 | + } |
|
565 | 709 | $updateinitial = true; |
566 | 710 | } |
567 | 711 | $this->tmd = 0; |
568 | 712 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
569 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
713 | + if ($globalDebug) { |
|
714 | + echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
715 | + } |
|
570 | 716 | $timeelapsed = microtime(true); |
571 | 717 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
572 | 718 | $Spotter = new Spotter($this->db); |
573 | 719 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
574 | - if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
575 | - else $this->all_flights[$id]['over_country'] = ''; |
|
720 | + if (!empty($all_country)) { |
|
721 | + $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
722 | + } else { |
|
723 | + $this->all_flights[$id]['over_country'] = ''; |
|
724 | + } |
|
576 | 725 | $Spotter->db = null; |
577 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
578 | - if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
726 | + if ($globalDebugTimeElapsed) { |
|
727 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
728 | + } |
|
729 | + if ($globalDebug) { |
|
730 | + echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
731 | + } |
|
579 | 732 | } |
580 | 733 | } |
581 | 734 | $this->all_flights[$id]['time_last_archive_coord'] = time(); |
@@ -621,7 +774,9 @@ discard block |
||
621 | 774 | */ |
622 | 775 | } |
623 | 776 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
624 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
777 | + if ($line['longitude'] > 180) { |
|
778 | + $line['longitude'] = $line['longitude'] - 360; |
|
779 | + } |
|
625 | 780 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
626 | 781 | if (!isset($this->all_flights[$id]['archive_longitude'])) { |
627 | 782 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -650,7 +805,9 @@ discard block |
||
650 | 805 | */ |
651 | 806 | } |
652 | 807 | if ($globalDaemon === TRUE && isset($updateinitial) && $updateinitial && $this->all_flights[$id]['addedSpotter'] == 1) { |
653 | - if ($globalDebug) echo "\n".'>>> Update initial data !'."\n"; |
|
808 | + if ($globalDebug) { |
|
809 | + echo "\n".'>>> Update initial data !'."\n"; |
|
810 | + } |
|
654 | 811 | unset($updateinitial); |
655 | 812 | $SpotterArchive = new SpotterArchive(); |
656 | 813 | $SpotterArchive->deleteSpotterArchiveTrackDataByID($this->all_flights[$id]['id']); |
@@ -668,7 +825,9 @@ discard block |
||
668 | 825 | } |
669 | 826 | } |
670 | 827 | if (isset($line['last_update']) && $line['last_update'] != '') { |
671 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
828 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) { |
|
829 | + $dataFound = true; |
|
830 | + } |
|
672 | 831 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
673 | 832 | } |
674 | 833 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
@@ -690,35 +849,53 @@ discard block |
||
690 | 849 | // Here we force archive of flight because after ground it's a new one (or should be) |
691 | 850 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
692 | 851 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
693 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
694 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
695 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
852 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
853 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
854 | + } elseif (isset($line['id'])) { |
|
855 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
856 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
857 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
858 | + } |
|
859 | + } |
|
860 | + if ($line['ground'] != 1) { |
|
861 | + $line['ground'] = 0; |
|
696 | 862 | } |
697 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
698 | 863 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
699 | 864 | //$dataFound = true; |
700 | 865 | } |
701 | 866 | if (isset($line['squawk']) && $line['squawk'] != '') { |
702 | 867 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
703 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
868 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) { |
|
869 | + $this->all_flights[$id]['putinarchive'] = true; |
|
870 | + } |
|
704 | 871 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
705 | 872 | $highlight = ''; |
706 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
707 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
708 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
873 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
874 | + $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
875 | + } |
|
876 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
877 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
878 | + } |
|
879 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
880 | + $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
881 | + } |
|
709 | 882 | if ($highlight != '') { |
710 | 883 | $timeelapsed = microtime(true); |
711 | 884 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
712 | 885 | $Spotter = new Spotter($this->db); |
713 | 886 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
714 | 887 | $Spotter->db = null; |
715 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
888 | + if ($globalDebugTimeElapsed) { |
|
889 | + echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
890 | + } |
|
716 | 891 | } |
717 | 892 | //$putinarchive = true; |
718 | 893 | //$highlight = ''; |
719 | 894 | } |
720 | 895 | |
721 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
896 | + } else { |
|
897 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
898 | + } |
|
722 | 899 | //$dataFound = true; |
723 | 900 | } |
724 | 901 | |
@@ -731,19 +908,27 @@ discard block |
||
731 | 908 | } |
732 | 909 | } |
733 | 910 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
734 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
911 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) { |
|
912 | + $this->all_flights[$id]['putinarchive'] = true; |
|
913 | + } |
|
735 | 914 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
736 | 915 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
737 | 916 | //$dataFound = true; |
738 | 917 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
739 | 918 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
740 | 919 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
741 | - if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
|
920 | + if ($globalDebug) { |
|
921 | + echo '--- Reset because of altitude'."\n"; |
|
922 | + } |
|
742 | 923 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
743 | 924 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
744 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
745 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
746 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
925 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
926 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
927 | + } elseif (isset($line['id'])) { |
|
928 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
929 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
930 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
931 | + } |
|
747 | 932 | } |
748 | 933 | } |
749 | 934 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
@@ -754,22 +939,32 @@ discard block |
||
754 | 939 | } |
755 | 940 | |
756 | 941 | if (isset($line['heading']) && $line['heading'] != '') { |
757 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
942 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) { |
|
943 | + $this->all_flights[$id]['putinarchive'] = true; |
|
944 | + } |
|
758 | 945 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
759 | 946 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
760 | 947 | //$dataFound = true; |
761 | 948 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
762 | 949 | $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
763 | 950 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
764 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
765 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
951 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) { |
|
952 | + $this->all_flights[$id]['putinarchive'] = true; |
|
953 | + } |
|
954 | + if ($globalDebug) { |
|
955 | + echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
956 | + } |
|
766 | 957 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
767 | 958 | // If not enough messages and ACARS set heading to 0 |
768 | 959 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
769 | 960 | } |
770 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
771 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
772 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinUpdate) $dataFound = false; |
|
961 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) { |
|
962 | + $dataFound = false; |
|
963 | + } elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) { |
|
964 | + $dataFound = false; |
|
965 | + } elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinUpdate) { |
|
966 | + $dataFound = false; |
|
967 | + } |
|
773 | 968 | |
774 | 969 | // print_r($this->all_flights[$id]); |
775 | 970 | //gets the callsign from the last hour |
@@ -786,23 +981,38 @@ discard block |
||
786 | 981 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
787 | 982 | if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
788 | 983 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
789 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
984 | + if ($globalDebug) { |
|
985 | + echo "Check if aircraft is already in DB..."; |
|
986 | + } |
|
790 | 987 | $timeelapsed = microtime(true); |
791 | 988 | $SpotterLive = new SpotterLive($this->db); |
792 | 989 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
793 | 990 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
794 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
991 | + if ($globalDebugTimeElapsed) { |
|
992 | + echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
993 | + } |
|
795 | 994 | } elseif (isset($line['id'])) { |
796 | 995 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
797 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
996 | + if ($globalDebugTimeElapsed) { |
|
997 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
998 | + } |
|
798 | 999 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
799 | 1000 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
800 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
801 | - } else $recent_ident = ''; |
|
1001 | + if ($globalDebugTimeElapsed) { |
|
1002 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
1003 | + } |
|
1004 | + } else { |
|
1005 | + $recent_ident = ''; |
|
1006 | + } |
|
802 | 1007 | $SpotterLive->db=null; |
803 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
804 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
805 | - } else $recent_ident = ''; |
|
1008 | + if ($globalDebug && $recent_ident == '') { |
|
1009 | + echo " Not in DB.\n"; |
|
1010 | + } elseif ($globalDebug && $recent_ident != '') { |
|
1011 | + echo " Already in DB.\n"; |
|
1012 | + } |
|
1013 | + } else { |
|
1014 | + $recent_ident = ''; |
|
1015 | + } |
|
806 | 1016 | } else { |
807 | 1017 | $recent_ident = ''; |
808 | 1018 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
@@ -810,7 +1020,9 @@ discard block |
||
810 | 1020 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
811 | 1021 | if($recent_ident == "") |
812 | 1022 | { |
813 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
1023 | + if ($globalDebug) { |
|
1024 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
1025 | + } |
|
814 | 1026 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
815 | 1027 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
816 | 1028 | //adds the spotter data for the archive |
@@ -854,10 +1066,18 @@ discard block |
||
854 | 1066 | |
855 | 1067 | if (!$ignoreImport) { |
856 | 1068 | $highlight = ''; |
857 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
858 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
859 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
860 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
1069 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
1070 | + $highlight = 'Squawk 7500 : Hijack'; |
|
1071 | + } |
|
1072 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
1073 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
1074 | + } |
|
1075 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
1076 | + $highlight = 'Squawk 7700 : Emergency'; |
|
1077 | + } |
|
1078 | + if (!isset($this->all_flights[$id]['id'])) { |
|
1079 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
1080 | + } |
|
861 | 1081 | $timeelapsed = microtime(true); |
862 | 1082 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
863 | 1083 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -865,28 +1085,43 @@ discard block |
||
865 | 1085 | $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
866 | 1086 | $Spotter->db = null; |
867 | 1087 | if ($globalDebug) { |
868 | - if (isset($result['error'])) echo 'Error: '.$result['error']."\n"; |
|
869 | - else echo 'Success'; |
|
1088 | + if (isset($result['error'])) { |
|
1089 | + echo 'Error: '.$result['error']."\n"; |
|
1090 | + } else { |
|
1091 | + echo 'Success'; |
|
1092 | + } |
|
870 | 1093 | } |
871 | 1094 | if (count($result) > 1) { |
872 | 1095 | // ':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type, |
873 | - if ($this->all_flights[$id]['aircraft_icao'] == '') $this->all_flights[$id]['aircraft_icao'] = $result[':aircraft_icao']; |
|
874 | - if ($this->all_flights[$id]['registration'] == '') $this->all_flights[$id]['registration'] = $result[':registration']; |
|
1096 | + if ($this->all_flights[$id]['aircraft_icao'] == '') { |
|
1097 | + $this->all_flights[$id]['aircraft_icao'] = $result[':aircraft_icao']; |
|
1098 | + } |
|
1099 | + if ($this->all_flights[$id]['registration'] == '') { |
|
1100 | + $this->all_flights[$id]['registration'] = $result[':registration']; |
|
1101 | + } |
|
875 | 1102 | } |
876 | 1103 | } |
877 | 1104 | } |
878 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
1105 | + if ($globalDebugTimeElapsed) { |
|
1106 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
1107 | + } |
|
879 | 1108 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
880 | 1109 | |
881 | 1110 | // Add source stat in DB |
882 | 1111 | $Stats = new Stats($this->db); |
883 | 1112 | if (!empty($this->stats)) { |
884 | - if ($globalDebug) echo 'Add source stats : '; |
|
1113 | + if ($globalDebug) { |
|
1114 | + echo 'Add source stats : '; |
|
1115 | + } |
|
885 | 1116 | foreach($this->stats as $date => $data) { |
886 | 1117 | foreach($data as $source => $sourced) { |
887 | 1118 | //print_r($sourced); |
888 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
889 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
1119 | + if (isset($sourced['polar'])) { |
|
1120 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
1121 | + } |
|
1122 | + if (isset($sourced['hist'])) { |
|
1123 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
1124 | + } |
|
890 | 1125 | if (isset($sourced['msg'])) { |
891 | 1126 | if (time() - $sourced['msg']['date'] > 10) { |
892 | 1127 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -899,13 +1134,17 @@ discard block |
||
899 | 1134 | unset($this->stats[$date]); |
900 | 1135 | } |
901 | 1136 | } |
902 | - if ($globalDebug) echo 'Done'."\n"; |
|
1137 | + if ($globalDebug) { |
|
1138 | + echo 'Done'."\n"; |
|
1139 | + } |
|
903 | 1140 | |
904 | 1141 | } |
905 | 1142 | $Stats->db = null; |
906 | 1143 | } |
907 | 1144 | $this->del(); |
908 | - } elseif ($globalDebug) echo 'Ignore data'."\n"; |
|
1145 | + } elseif ($globalDebug) { |
|
1146 | + echo 'Ignore data'."\n"; |
|
1147 | + } |
|
909 | 1148 | //$ignoreImport = false; |
910 | 1149 | $this->all_flights[$id]['addedSpotter'] = 1; |
911 | 1150 | //print_r($this->all_flights[$id]); |
@@ -922,7 +1161,9 @@ discard block |
||
922 | 1161 | */ |
923 | 1162 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
924 | 1163 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
925 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
1164 | + if ($globalDebug) { |
|
1165 | + echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
1166 | + } |
|
926 | 1167 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
927 | 1168 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
928 | 1169 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -931,7 +1172,9 @@ discard block |
||
931 | 1172 | $SpotterLive->db=null; |
932 | 1173 | } |
933 | 1174 | } |
934 | - if ($globalDebug) echo " Done\n"; |
|
1175 | + if ($globalDebug) { |
|
1176 | + echo " Done\n"; |
|
1177 | + } |
|
935 | 1178 | $this->last_delete = time(); |
936 | 1179 | } |
937 | 1180 | } else { |
@@ -958,11 +1201,17 @@ discard block |
||
958 | 1201 | //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
959 | 1202 | if ($globalDebug) { |
960 | 1203 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
961 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
962 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
1204 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
1205 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
1206 | + } else { |
|
1207 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
1208 | + } |
|
963 | 1209 | } else { |
964 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
965 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
1210 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
1211 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
1212 | + } else { |
|
1213 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
1214 | + } |
|
966 | 1215 | } |
967 | 1216 | } |
968 | 1217 | $ignoreImport = false; |
@@ -1008,23 +1257,31 @@ discard block |
||
1008 | 1257 | |
1009 | 1258 | if (!$ignoreImport) { |
1010 | 1259 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
1011 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
1260 | + if (!isset($this->all_flights[$id]['id'])) { |
|
1261 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
1262 | + } |
|
1012 | 1263 | $timeelapsed = microtime(true); |
1013 | 1264 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
1014 | 1265 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
1015 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
1266 | + if ($globalDebug) { |
|
1267 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
1268 | + } |
|
1016 | 1269 | $SpotterLive = new SpotterLive($this->db); |
1017 | 1270 | //var_dump($this->all_flights[$id]); |
1018 | 1271 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
1019 | 1272 | $SpotterLive->db = null; |
1020 | - if ($globalDebug) echo $result."\n"; |
|
1273 | + if ($globalDebug) { |
|
1274 | + echo $result."\n"; |
|
1275 | + } |
|
1021 | 1276 | } |
1022 | 1277 | } |
1023 | 1278 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
1024 | 1279 | $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
1025 | 1280 | } |
1026 | 1281 | $this->all_flights[$id]['putinarchive'] = false; |
1027 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
1282 | + if ($globalDebugTimeElapsed) { |
|
1283 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
1284 | + } |
|
1028 | 1285 | |
1029 | 1286 | // Put statistics in $this->stats variable |
1030 | 1287 | //if ($line['format_source'] != 'aprs') { |
@@ -1032,7 +1289,9 @@ discard block |
||
1032 | 1289 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
1033 | 1290 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
1034 | 1291 | $source = $this->all_flights[$id]['source_name']; |
1035 | - if ($source == '') $source = $this->all_flights[$id]['format_source']; |
|
1292 | + if ($source == '') { |
|
1293 | + $source = $this->all_flights[$id]['format_source']; |
|
1294 | + } |
|
1036 | 1295 | if (!isset($this->source_location[$source])) { |
1037 | 1296 | $Location = new Source($this->db); |
1038 | 1297 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -1053,7 +1312,9 @@ discard block |
||
1053 | 1312 | $stats_heading = round($stats_heading/22.5); |
1054 | 1313 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
1055 | 1314 | $current_date = date('Y-m-d'); |
1056 | - if ($stats_heading == 16) $stats_heading = 0; |
|
1315 | + if ($stats_heading == 16) { |
|
1316 | + $stats_heading = 0; |
|
1317 | + } |
|
1057 | 1318 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
1058 | 1319 | for ($i=0;$i<=15;$i++) { |
1059 | 1320 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -1071,7 +1332,9 @@ discard block |
||
1071 | 1332 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
1072 | 1333 | end($this->stats[$current_date][$source]['hist']); |
1073 | 1334 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
1074 | - } else $mini = 0; |
|
1335 | + } else { |
|
1336 | + $mini = 0; |
|
1337 | + } |
|
1075 | 1338 | for ($i=$mini;$i<=$distance;$i+=10) { |
1076 | 1339 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
1077 | 1340 | } |
@@ -1083,25 +1346,37 @@ discard block |
||
1083 | 1346 | } |
1084 | 1347 | |
1085 | 1348 | $this->all_flights[$id]['lastupdate'] = time(); |
1086 | - if ($this->all_flights[$id]['putinarchive']) $send = true; |
|
1349 | + if ($this->all_flights[$id]['putinarchive']) { |
|
1350 | + $send = true; |
|
1351 | + } |
|
1087 | 1352 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
1088 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
1353 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
1354 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
1355 | + } |
|
1089 | 1356 | //$this->del(); |
1090 | 1357 | |
1091 | 1358 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
1092 | 1359 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
1093 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
1360 | + if ($globalDebug) { |
|
1361 | + echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
1362 | + } |
|
1094 | 1363 | $SpotterLive = new SpotterLive($this->db); |
1095 | 1364 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
1096 | 1365 | $SpotterLive->db = null; |
1097 | 1366 | //SpotterLive->deleteLiveSpotterData(); |
1098 | - if ($globalDebug) echo " Done\n"; |
|
1367 | + if ($globalDebug) { |
|
1368 | + echo " Done\n"; |
|
1369 | + } |
|
1099 | 1370 | if (isset($globalAPRSdelete) && $globalAPRSdelete) { |
1100 | - if ($globalDebug) echo "---- Deleting old APRS data..."; |
|
1371 | + if ($globalDebug) { |
|
1372 | + echo "---- Deleting old APRS data..."; |
|
1373 | + } |
|
1101 | 1374 | $Spotter = new Spotter($this->db); |
1102 | 1375 | $Spotter->deleteOldAPRSData(); |
1103 | 1376 | $Spotter->db = null; |
1104 | - if ($globalDebug) echo " Done\n"; |
|
1377 | + if ($globalDebug) { |
|
1378 | + echo " Done\n"; |
|
1379 | + } |
|
1105 | 1380 | } |
1106 | 1381 | $this->last_delete_hourly = time(); |
1107 | 1382 | } else { |
@@ -1114,7 +1389,9 @@ discard block |
||
1114 | 1389 | //$ignoreImport = false; |
1115 | 1390 | } |
1116 | 1391 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
1117 | - if ($send) return $this->all_flights[$id]; |
|
1392 | + if ($send) { |
|
1393 | + return $this->all_flights[$id]; |
|
1394 | + } |
|
1118 | 1395 | } |
1119 | 1396 | } |
1120 | 1397 | } |
@@ -6,12 +6,19 @@ discard block |
||
6 | 6 | //gets the page file and stores it in a variable |
7 | 7 | $file_path = pathinfo($_SERVER['SCRIPT_NAME']); |
8 | 8 | $current_page = $file_path['filename']; |
9 | -if ($globalTimezone == '') $globalTimezone = 'UTC'; |
|
9 | +if ($globalTimezone == '') { |
|
10 | + $globalTimezone = 'UTC'; |
|
11 | +} |
|
10 | 12 | date_default_timezone_set($globalTimezone); |
11 | -if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType']; |
|
12 | -else $MapType = $globalMapProvider; |
|
13 | +if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') { |
|
14 | + $MapType = $_COOKIE['MapType']; |
|
15 | +} else { |
|
16 | + $MapType = $globalMapProvider; |
|
17 | +} |
|
13 | 18 | |
14 | -if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline'; |
|
19 | +if (isset($globalMapOffline) && $globalMapOffline) { |
|
20 | + $MapType = 'offline'; |
|
21 | +} |
|
15 | 22 | |
16 | 23 | if (isset($_GET['3d'])) { |
17 | 24 | setcookie('MapFormat','3d'); |
@@ -210,7 +217,10 @@ discard block |
||
210 | 217 | <?php |
211 | 218 | } else { |
212 | 219 | ?> |
213 | -<script type="text/javascript" src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) print '&tsk='.$tsk; ?>"></script> |
|
220 | +<script type="text/javascript" src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) { |
|
221 | + print '&tsk='.$tsk; |
|
222 | +} |
|
223 | +?>"></script> |
|
214 | 224 | <?php |
215 | 225 | } |
216 | 226 | if (!isset($globalAircraft) || $globalAircraft) { |
@@ -250,7 +260,13 @@ discard block |
||
250 | 260 | <script type="text/javascript" src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
251 | 261 | <script type="text/javascript" src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
252 | 262 | <script type="text/javascript" src="<?php print $globalURL; ?>/js/map.common.js"></script> |
253 | -<script type="text/javascript" src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
263 | +<script type="text/javascript" src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) { |
|
264 | + print '&latitude='.$latitude; |
|
265 | +} |
|
266 | +?><?php if(isset($longitude)) { |
|
267 | + print '&longitude='.$longitude; |
|
268 | +} |
|
269 | +?>&<?php print time(); ?>"></script> |
|
254 | 270 | <?php |
255 | 271 | if (!isset($type) || $type == 'aircraft') { |
256 | 272 | ?> |
@@ -323,7 +339,13 @@ discard block |
||
323 | 339 | <script type="text/javascript" src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
324 | 340 | <script type="text/javascript" src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
325 | 341 | <script type="text/javascript" src="<?php print $globalURL; ?>/js/map.common.js"></script> |
326 | -<script type="text/javascript" src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
342 | +<script type="text/javascript" src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) { |
|
343 | + print '&latitude='.$latitude; |
|
344 | +} |
|
345 | +?><?php if(isset($longitude)) { |
|
346 | + print '&longitude='.$longitude; |
|
347 | +} |
|
348 | +?>&<?php print time(); ?>"></script> |
|
327 | 349 | <script type="text/javascript" src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
328 | 350 | <?php |
329 | 351 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -389,7 +411,9 @@ discard block |
||
389 | 411 | } |
390 | 412 | ?> |
391 | 413 | <?php |
392 | -if (isset($globalPubHeader)) print $globalPubHeader; |
|
414 | +if (isset($globalPubHeader)) { |
|
415 | + print $globalPubHeader; |
|
416 | +} |
|
393 | 417 | ?> |
394 | 418 | |
395 | 419 | <meta property="og:title" content="<?php print $title; ?> | <?php print $globalName; ?>"/> |
@@ -407,7 +431,12 @@ discard block |
||
407 | 431 | <span class="icon-bar"></span> |
408 | 432 | </button> |
409 | 433 | <a href="<?php print $globalURL; ?>/search" class="navbar-toggle search"><i class="fa fa-search"></i></a> |
410 | - <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
434 | + <a class="navbar-brand" href="<?php if ($globalURL == '') { |
|
435 | + print '/'; |
|
436 | +} else { |
|
437 | + print $globalURL; |
|
438 | +} |
|
439 | +?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
411 | 440 | </div> |
412 | 441 | <div class="collapse navbar-collapse"> |
413 | 442 | |
@@ -462,7 +491,10 @@ discard block |
||
462 | 491 | } |
463 | 492 | ?> |
464 | 493 | |
465 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
494 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
495 | + echo 'right-'; |
|
496 | +} |
|
497 | +?>caret"></b></a> |
|
466 | 498 | <ul class="dropdown-menu"> |
467 | 499 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li> |
468 | 500 | <?php |
@@ -533,8 +565,14 @@ discard block |
||
533 | 565 | </li> |
534 | 566 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
535 | 567 | <li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li> |
536 | - <li class="dropdown<?php if ($sub) echo '-submenu'; ?>"> |
|
537 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
568 | + <li class="dropdown<?php if ($sub) { |
|
569 | + echo '-submenu'; |
|
570 | +} |
|
571 | +?>"> |
|
572 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) { |
|
573 | + echo 'right-'; |
|
574 | +} |
|
575 | +?>caret"></b></a> |
|
538 | 576 | <ul class="dropdown-menu"> |
539 | 577 | <li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li> |
540 | 578 | <li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li> |
@@ -578,7 +616,10 @@ discard block |
||
578 | 616 | <?php |
579 | 617 | } |
580 | 618 | ?> |
581 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
619 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
620 | + echo 'right-'; |
|
621 | +} |
|
622 | +?>caret"></b></a> |
|
582 | 623 | <ul class="dropdown-menu"> |
583 | 624 | <?php |
584 | 625 | if (isset($globalVM) && $globalVM) { |
@@ -628,7 +669,10 @@ discard block |
||
628 | 669 | <?php |
629 | 670 | } |
630 | 671 | ?> |
631 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
672 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
673 | + echo 'right-'; |
|
674 | +} |
|
675 | +?>caret"></b></a> |
|
632 | 676 | <ul class="dropdown-menu"> |
633 | 677 | <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li> |
634 | 678 | <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -671,7 +715,10 @@ discard block |
||
671 | 715 | ?> |
672 | 716 | |
673 | 717 | <!-- |
674 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
718 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
719 | + echo 'right-'; |
|
720 | +} |
|
721 | +?>caret"></b></a> |
|
675 | 722 | <ul class="dropdown-menu"> |
676 | 723 | <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li> |
677 | 724 | <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -729,9 +776,14 @@ discard block |
||
729 | 776 | <?php |
730 | 777 | foreach ($alllang as $key => $lang) { |
731 | 778 | print '<option value="'.$key.'"'; |
732 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
733 | - if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (βeta)</option>'; |
|
734 | - else print '>'.$lang[0].'</option>'; |
|
779 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) { |
|
780 | + print ' selected '; |
|
781 | + } |
|
782 | + if ($lang[0] == 'Deutsch') { |
|
783 | + print '>'.$lang[0].' (βeta)</option>'; |
|
784 | + } else { |
|
785 | + print '>'.$lang[0].'</option>'; |
|
786 | + } |
|
735 | 787 | } |
736 | 788 | ?> |
737 | 789 | </select> |
@@ -879,9 +931,24 @@ discard block |
||
879 | 931 | $customid = $globalMapProvider; |
880 | 932 | ?> |
881 | 933 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
882 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
883 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
884 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
934 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
935 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
936 | +} else { |
|
937 | + print '18'; |
|
938 | +} |
|
939 | +?>, |
|
940 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
941 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
942 | +} else { |
|
943 | + print '0'; |
|
944 | +} |
|
945 | +?>, |
|
946 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
947 | + print 'false'; |
|
948 | +} else { |
|
949 | + print 'true'; |
|
950 | +} |
|
951 | +?>, |
|
885 | 952 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
886 | 953 | }).addTo(map); |
887 | 954 | <?php |
@@ -896,7 +963,12 @@ discard block |
||
896 | 963 | maxZoom: 5, |
897 | 964 | tms : true, |
898 | 965 | zindex : 3, |
899 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
966 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
967 | + print 'false'; |
|
968 | +} else { |
|
969 | + print 'true'; |
|
970 | +} |
|
971 | +?>, |
|
900 | 972 | attribution: 'Natural Earth' |
901 | 973 | }).addTo(map); |
902 | 974 | <?php |
@@ -919,4 +991,7 @@ discard block |
||
919 | 991 | |
920 | 992 | ?> |
921 | 993 | |
922 | -<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear"> |
|
994 | +<section class="container main-content <?php if (strtolower($current_page) == 'index') { |
|
995 | + print 'index '; |
|
996 | +} |
|
997 | +?>clear"> |