@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | <meta property="og:site_name" content="<?php print $globalName; ?>"/> |
40 | 40 | |
41 | 41 | <?php |
42 | - if (!isset($_SESSION['install']) && !$globalInstalled) { |
|
42 | + if (!isset($_SESSION['install']) && !$globalInstalled) { |
|
43 | 43 | ?> |
44 | 44 | <script language="JavaScript" type="text/javascript"> |
45 | 45 | function datasource_js() { |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | } |
121 | 121 | </script> |
122 | 122 | <?php |
123 | - } |
|
123 | + } |
|
124 | 124 | ?> |
125 | 125 | |
126 | 126 | </head> |
127 | 127 | |
128 | 128 | <?php |
129 | - if (!isset($_SESSION['install']) && !$globalInstalled) { |
|
129 | + if (!isset($_SESSION['install']) && !$globalInstalled) { |
|
130 | 130 | ?> |
131 | 131 | |
132 | 132 | <body class="page-<?php print strtolower($current_page); ?>" onload="datasource_js(); metarcycle_js(); create_database_js(); daemon_js(); schedule_js()"> |
133 | 133 | <?php |
134 | - } else { |
|
134 | + } else { |
|
135 | 135 | ?> |
136 | 136 | <body class="page-<?php print strtolower($current_page); ?>"> |
137 | 137 | <?php |
138 | - } |
|
138 | + } |
|
139 | 139 | ?> |
140 | 140 | <div class="navbar navbar-fixed-top" role="navigation"> |
141 | 141 | <div class="container"> |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | |
155 | 155 | <?php |
156 | 156 | if (isset($top_header)) { |
157 | - if ($top_header != "") |
|
158 | - { |
|
157 | + if ($top_header != "") |
|
158 | + { |
|
159 | 159 | print '<div class="top-header container clear" role="main">'; |
160 | 160 | print '<img src="../images/'.$top_header.'" alt="'.$title.'" title="'.$title.'" />'; |
161 | 161 | print '</div>'; |
162 | - } |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | ?> |
165 | 165 |
@@ -6,27 +6,27 @@ discard block |
||
6 | 6 | public static function import_file($filename) { |
7 | 7 | $filename = filter_var($filename,FILTER_SANITIZE_STRING); |
8 | 8 | $Connection = new Connection(); |
9 | - //Connection::$db->beginTransaction(); |
|
10 | - $templine = ''; |
|
11 | - $lines = file($filename); |
|
12 | - foreach ($lines as $line) |
|
13 | - { |
|
14 | - if (substr($line,0,2) == '--' || $line == '') continue; |
|
15 | - $templine .= $line; |
|
16 | - if (substr(trim($line), -1,1) == ';') |
|
17 | - { |
|
18 | - try { |
|
19 | - $sth = $Connection->db->prepare($templine); |
|
9 | + //Connection::$db->beginTransaction(); |
|
10 | + $templine = ''; |
|
11 | + $lines = file($filename); |
|
12 | + foreach ($lines as $line) |
|
13 | + { |
|
14 | + if (substr($line,0,2) == '--' || $line == '') continue; |
|
15 | + $templine .= $line; |
|
16 | + if (substr(trim($line), -1,1) == ';') |
|
17 | + { |
|
18 | + try { |
|
19 | + $sth = $Connection->db->prepare($templine); |
|
20 | 20 | $sth->execute(); |
21 | - } catch(PDOException $e) { |
|
21 | + } catch(PDOException $e) { |
|
22 | 22 | return "error (import ".$filename.") : ".$e->getMessage()."\n"; |
23 | - } |
|
24 | - $templine = ''; |
|
25 | - } |
|
23 | + } |
|
24 | + $templine = ''; |
|
25 | + } |
|
26 | 26 | } |
27 | - //Connection::$db->commit(); |
|
28 | - $Connection->db = null; |
|
29 | - return ''; |
|
27 | + //Connection::$db->commit(); |
|
28 | + $Connection->db = null; |
|
29 | + return ''; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public static function import_all_db($directory) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | //foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename) |
36 | 36 | while(false !== ($filename = readdir($dh))) |
37 | 37 | { |
38 | - if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename); |
|
38 | + if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename); |
|
39 | 39 | } |
40 | 40 | return $error; |
41 | 41 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $host = filter_var($host,FILTER_SANITIZE_STRING); |
51 | 51 | // Dirty hack |
52 | 52 | if ($host != 'localhost' && $host != '127.0.0.1') { |
53 | - $grantright = $_SERVER['SERVER_ADDR']; |
|
53 | + $grantright = $_SERVER['SERVER_ADDR']; |
|
54 | 54 | } else $grantright = 'localhost'; |
55 | 55 | try { |
56 | 56 | $dbh = new PDO($db_type.':host='.$host,$root,$root_pass); |
@@ -68,27 +68,27 @@ discard block |
||
68 | 68 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') { |
69 | 69 | if (update_schema::check_version(false) == '0') { |
70 | 70 | if ($globalDBdriver == 'mysql') { |
71 | - $error .= create_db::import_all_db('../db/'); |
|
71 | + $error .= create_db::import_all_db('../db/'); |
|
72 | 72 | } elseif ($globalDBdriver == 'pgsql') { |
73 | - $error .= create_db::import_all_db('../db/pgsql/'); |
|
73 | + $error .= create_db::import_all_db('../db/pgsql/'); |
|
74 | 74 | } |
75 | 75 | if ($error != '') { |
76 | - $_SESSION['error'] = $error; |
|
76 | + $_SESSION['error'] = $error; |
|
77 | 77 | } |
78 | 78 | $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
79 | 79 | if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
80 | 80 | $_SESSION['install'] = 'populate'; |
81 | 81 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
82 | 82 | } else { |
83 | - $_SESSION['install'] = 'sources'; |
|
84 | - $_SESSION['next'] = 'Insert data in source table'; |
|
83 | + $_SESSION['install'] = 'sources'; |
|
84 | + $_SESSION['next'] = 'Insert data in source table'; |
|
85 | 85 | } |
86 | 86 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
87 | 87 | print json_encode($result); |
88 | 88 | } else { |
89 | 89 | $error .= update_schema::check_version(true); |
90 | 90 | if ($error != '') { |
91 | - $_SESSION['error'] = $error; |
|
91 | + $_SESSION['error'] = $error; |
|
92 | 92 | } |
93 | 93 | $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
94 | 94 | $_SESSION['install'] = 'sources'; |
@@ -118,25 +118,25 @@ discard block |
||
118 | 118 | $error .= update_db::update_countries(); |
119 | 119 | $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
120 | 120 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
121 | - $_SESSION['install'] = 'notam'; |
|
122 | - $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
|
123 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
124 | - print json_encode($result); |
|
121 | + $_SESSION['install'] = 'notam'; |
|
122 | + $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
|
123 | + $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
124 | + print json_encode($result); |
|
125 | 125 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
126 | - $_SESSION['install'] = 'owner'; |
|
127 | - $_SESSION['next'] = 'Populate owner table with externals data'; |
|
128 | - unset($_SESSION['owner']); |
|
129 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
130 | - print json_encode($result); |
|
126 | + $_SESSION['install'] = 'owner'; |
|
127 | + $_SESSION['next'] = 'Populate owner table with externals data'; |
|
128 | + unset($_SESSION['owner']); |
|
129 | + $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
130 | + print json_encode($result); |
|
131 | 131 | } else { |
132 | - $_SESSION['install'] = 'sources'; |
|
133 | - $_SESSION['next'] = 'Insert data in source table'; |
|
134 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
135 | - print json_encode($result); |
|
132 | + $_SESSION['install'] = 'sources'; |
|
133 | + $_SESSION['next'] = 'Insert data in source table'; |
|
134 | + $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
135 | + print json_encode($result); |
|
136 | 136 | } |
137 | 137 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
138 | 138 | if (!is_writable('tmp')) { |
139 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
139 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
140 | 140 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
141 | 141 | print json_encode($result); |
142 | 142 | } else { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') { |
154 | 154 | if (!is_writable('tmp')) { |
155 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
155 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
156 | 156 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
157 | 157 | print json_encode($result); |
158 | 158 | } else { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') { |
187 | 187 | if (!is_writable('tmp')) { |
188 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
188 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
189 | 189 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
190 | 190 | print json_encode($result); |
191 | 191 | } else { |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') { |
202 | 202 | if (!is_writable('tmp')) { |
203 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
203 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
204 | 204 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
205 | 205 | print json_encode($result); |
206 | 206 | } else { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') { |
231 | 231 | if (!is_writable('tmp')) { |
232 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
232 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
233 | 233 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
234 | 234 | print json_encode($result); |
235 | 235 | } else { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') { |
246 | 246 | if (!is_writable('tmp')) { |
247 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
247 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
248 | 248 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
249 | 249 | print json_encode($result); |
250 | 250 | } else { |
@@ -296,17 +296,17 @@ discard block |
||
296 | 296 | */ |
297 | 297 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'sources') { |
298 | 298 | if (isset($_SESSION['sources']) && count($_SESSION['sources']) > 0) { |
299 | - $sources = $_SESSION['sources']; |
|
299 | + $sources = $_SESSION['sources']; |
|
300 | 300 | |
301 | - include_once('../require/class.Source.php'); |
|
302 | - $globalDebug = FALSE; |
|
303 | - $Source = new Source(); |
|
304 | - $Source->deleteAllLocation(); |
|
305 | - foreach ($sources as $src) { |
|
301 | + include_once('../require/class.Source.php'); |
|
302 | + $globalDebug = FALSE; |
|
303 | + $Source = new Source(); |
|
304 | + $Source->deleteAllLocation(); |
|
305 | + foreach ($sources as $src) { |
|
306 | 306 | if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
307 | - } |
|
308 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
309 | - unset($_SESSION['sources']); |
|
307 | + } |
|
308 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
309 | + unset($_SESSION['sources']); |
|
310 | 310 | } |
311 | 311 | /* |
312 | 312 | if (isset($globalIVAO) && $globalIVAO) $_SESSION['install'] = 'ivao'; |
@@ -4,13 +4,13 @@ |
||
4 | 4 | * This Script will try to find all real arrival airports for all flights in DB |
5 | 5 | * |
6 | 6 | */ |
7 | - require_once('../require/settings.php'); |
|
8 | - if ($globalInstalled) { |
|
9 | - echo '$globalInstalled must be set to FALSE in require/settings.php'; |
|
10 | - exit; |
|
11 | - } |
|
12 | - require('../require/class.Spotter.php'); |
|
13 | - $Spotter = new Spotter(); |
|
14 | - $Spotter->updateArrivalAirports(); |
|
7 | + require_once('../require/settings.php'); |
|
8 | + if ($globalInstalled) { |
|
9 | + echo '$globalInstalled must be set to FALSE in require/settings.php'; |
|
10 | + exit; |
|
11 | + } |
|
12 | + require('../require/class.Spotter.php'); |
|
13 | + $Spotter = new Spotter(); |
|
14 | + $Spotter->updateArrivalAirports(); |
|
15 | 15 | |
16 | 16 | ?> |
17 | 17 | \ No newline at end of file |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $metar_info = $METAR->getMETAR($airport_icao); |
47 | 47 | //print_r($metar_info); |
48 | 48 | if (isset($metar_info[0]['metar'])) $metar_parse = $METAR->parse($metar_info[0]['metar']); |
49 | - //print_r($metar_parse); |
|
49 | + //print_r($metar_parse); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $title = sprintf(_("Detailed View for %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | function drawChart6() { |
100 | 100 | var data = google.visualization.arrayToDataTable([ |
101 | 101 | ["'._("Date").'","'._("Departure").'","'._("Arrival").'"], '; |
102 | - $airport_data = ''; |
|
103 | - foreach($all_data as $data) |
|
104 | - { |
|
105 | - $airport_data .= '[ "'.$data['date'].'",'.$data['departure'].','.$data['arrival'].'],'; |
|
106 | - } |
|
107 | - $airport_data = substr($airport_data, 0, -1); |
|
108 | - print $airport_data.']); |
|
102 | + $airport_data = ''; |
|
103 | + foreach($all_data as $data) |
|
104 | + { |
|
105 | + $airport_data .= '[ "'.$data['date'].'",'.$data['departure'].','.$data['arrival'].'],'; |
|
106 | + } |
|
107 | + $airport_data = substr($airport_data, 0, -1); |
|
108 | + print $airport_data.']); |
|
109 | 109 | |
110 | 110 | var options = { |
111 | 111 | legend: {position: "none"}, |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | print '<div class="select-item">'; |
21 | 21 | print '<form action="'.$globalURL.'/aircraft" method="post">'; |
22 | 22 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
23 | - print '<option></option>'; |
|
24 | - $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
25 | - foreach($aircraft_types as $aircrafttype) |
|
26 | - { |
|
27 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
28 | - { |
|
29 | - print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
30 | - } else { |
|
31 | - print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
32 | - } |
|
23 | + print '<option></option>'; |
|
24 | + $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
25 | + foreach($aircraft_types as $aircrafttype) |
|
26 | + { |
|
27 | + if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
28 | + { |
|
29 | + print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
30 | + } else { |
|
31 | + print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | print '</select>'; |
35 | 35 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | function drawChart() { |
62 | 62 | var data = google.visualization.arrayToDataTable([ |
63 | 63 | ["Country", "# of times"], '; |
64 | - $country_data = ''; |
|
64 | + $country_data = ''; |
|
65 | 65 | foreach($airline_array as $airline_item) |
66 | 66 | { |
67 | 67 | $country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],'; |
@@ -4,55 +4,55 @@ |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | - //for the date manipulation into the query |
|
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
9 | - $start_date = $_GET['start_date'].":00"; |
|
10 | - $end_date = $_GET['end_date'].":00"; |
|
11 | - $sql_date = $start_date.",".$end_date; |
|
12 | - } else if($_GET['start_date'] != ""){ |
|
13 | - $start_date = $_GET['start_date'].":00"; |
|
14 | - $sql_date = $start_date; |
|
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
16 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
|
17 | - $sql_date = $end_date; |
|
18 | - } else $sql_date = ''; |
|
7 | + //for the date manipulation into the query |
|
8 | + if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
9 | + $start_date = $_GET['start_date'].":00"; |
|
10 | + $end_date = $_GET['end_date'].":00"; |
|
11 | + $sql_date = $start_date.",".$end_date; |
|
12 | + } else if($_GET['start_date'] != ""){ |
|
13 | + $start_date = $_GET['start_date'].":00"; |
|
14 | + $sql_date = $start_date; |
|
15 | + } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
16 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
|
17 | + $sql_date = $end_date; |
|
18 | + } else $sql_date = ''; |
|
19 | 19 | } else $sql_date = ''; |
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | - //for altitude manipulation |
|
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = $_GET['highest_altitude']; |
|
25 | - $start_altitude = $_GET['lowest_altitude']; |
|
26 | - $sql_altitude = $start_altitude.",".$end_altitude; |
|
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = $_GET['highest_altitude']; |
|
29 | - $sql_altitude = $end_altitude; |
|
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = $_GET['lowest_altitude'].",60000"; |
|
32 | - $sql_altitude = $start_altitude; |
|
33 | - } else $sql_altitude = ''; |
|
22 | + //for altitude manipulation |
|
23 | + if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | + $end_altitude = $_GET['highest_altitude']; |
|
25 | + $start_altitude = $_GET['lowest_altitude']; |
|
26 | + $sql_altitude = $start_altitude.",".$end_altitude; |
|
27 | + } else if($_GET['highest_altitude'] != ""){ |
|
28 | + $end_altitude = $_GET['highest_altitude']; |
|
29 | + $sql_altitude = $end_altitude; |
|
30 | + } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | + $start_altitude = $_GET['lowest_altitude'].",60000"; |
|
32 | + $sql_altitude = $start_altitude; |
|
33 | + } else $sql_altitude = ''; |
|
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | 37 | if(!isset($_GET['limit'])) |
38 | 38 | { |
39 | - if (!isset($_GET['number_results'])) |
|
40 | - { |
|
41 | - $limit_start = 0; |
|
42 | - $limit_end = 25; |
|
43 | - $absolute_difference = 25; |
|
44 | - } else { |
|
45 | - if ($_GET['number_results'] > 1000){ |
|
46 | - $_GET['number_results'] = 1000; |
|
47 | - } |
|
48 | - $limit_start = 0; |
|
49 | - $limit_end = $_GET['number_results']; |
|
50 | - $absolute_difference = $_GET['number_results']; |
|
51 | - } |
|
39 | + if (!isset($_GET['number_results'])) |
|
40 | + { |
|
41 | + $limit_start = 0; |
|
42 | + $limit_end = 25; |
|
43 | + $absolute_difference = 25; |
|
44 | + } else { |
|
45 | + if ($_GET['number_results'] > 1000){ |
|
46 | + $_GET['number_results'] = 1000; |
|
47 | + } |
|
48 | + $limit_start = 0; |
|
49 | + $limit_end = $_GET['number_results']; |
|
50 | + $absolute_difference = $_GET['number_results']; |
|
51 | + } |
|
52 | 52 | } else { |
53 | - $limit_explode = explode(",", $_GET['limit']); |
|
54 | - $limit_start = $limit_explode[0]; |
|
55 | - $limit_end = $limit_explode[1]; |
|
53 | + $limit_explode = explode(",", $_GET['limit']); |
|
54 | + $limit_start = $limit_explode[0]; |
|
55 | + $limit_end = $limit_explode[1]; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (!function_exists("gettext")) { |
4 | - function _($text) { |
|
5 | - return $text; |
|
6 | - } |
|
4 | + function _($text) { |
|
5 | + return $text; |
|
6 | + } |
|
7 | 7 | } else { |
8 | 8 | if (isset($_COOKIE['language']) && $_COOKIE['language'] != 'en_GB' && (isset($globalTranslate) && $globalTranslate)) { |
9 | 9 | $Language = new Language(); |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | ); |
76 | 76 | |
77 | 77 | /** |
78 | - * Returns list of available locales |
|
79 | - * |
|
80 | - * @return array |
|
78 | + * Returns list of available locales |
|
79 | + * |
|
80 | + * @return array |
|
81 | 81 | */ |
82 | 82 | public function listLocaleDir() |
83 | 83 | { |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
106 | - * Returns list of available languages |
|
107 | - * |
|
108 | - * @return array |
|
106 | + * Returns list of available languages |
|
107 | + * |
|
108 | + * @return array |
|
109 | 109 | */ |
110 | 110 | public function getLanguages() |
111 | 111 | { |
@@ -7,73 +7,73 @@ |
||
7 | 7 | function __construct($dbc = null) { |
8 | 8 | $Connection = new Connection($dbc); |
9 | 9 | $this->db = $Connection->db; |
10 | - } |
|
11 | - public function getAllLocationInfo() { |
|
12 | - $query = "SELECT * FROM source_location"; |
|
13 | - $query_values = array(); |
|
14 | - try { |
|
15 | - $sth = $this->db->prepare($query); |
|
16 | - $sth->execute($query_values); |
|
17 | - } catch(PDOException $e) { |
|
18 | - return "error : ".$e->getMessage(); |
|
19 | - } |
|
20 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
21 | - return $all; |
|
22 | - } |
|
23 | - public function getLocationInfobyName($name) { |
|
24 | - $query = "SELECT * FROM source_location WHERE name = :name"; |
|
25 | - $query_values = array(':name' => $name); |
|
26 | - try { |
|
27 | - $sth = $this->db->prepare($query); |
|
28 | - $sth->execute($query_values); |
|
29 | - } catch(PDOException $e) { |
|
30 | - return "error : ".$e->getMessage(); |
|
31 | - } |
|
32 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
33 | - return $all; |
|
34 | - } |
|
35 | - public function getLocationInfobySourceName($name) { |
|
36 | - $query = "SELECT * FROM source_location WHERE source = :name"; |
|
37 | - $query_values = array(':name' => $name); |
|
38 | - try { |
|
39 | - $sth = $this->db->prepare($query); |
|
40 | - $sth->execute($query_values); |
|
41 | - } catch(PDOException $e) { |
|
42 | - return "error : ".$e->getMessage(); |
|
43 | - } |
|
44 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
45 | - return $all; |
|
46 | - } |
|
10 | + } |
|
11 | + public function getAllLocationInfo() { |
|
12 | + $query = "SELECT * FROM source_location"; |
|
13 | + $query_values = array(); |
|
14 | + try { |
|
15 | + $sth = $this->db->prepare($query); |
|
16 | + $sth->execute($query_values); |
|
17 | + } catch(PDOException $e) { |
|
18 | + return "error : ".$e->getMessage(); |
|
19 | + } |
|
20 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
21 | + return $all; |
|
22 | + } |
|
23 | + public function getLocationInfobyName($name) { |
|
24 | + $query = "SELECT * FROM source_location WHERE name = :name"; |
|
25 | + $query_values = array(':name' => $name); |
|
26 | + try { |
|
27 | + $sth = $this->db->prepare($query); |
|
28 | + $sth->execute($query_values); |
|
29 | + } catch(PDOException $e) { |
|
30 | + return "error : ".$e->getMessage(); |
|
31 | + } |
|
32 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
33 | + return $all; |
|
34 | + } |
|
35 | + public function getLocationInfobySourceName($name) { |
|
36 | + $query = "SELECT * FROM source_location WHERE source = :name"; |
|
37 | + $query_values = array(':name' => $name); |
|
38 | + try { |
|
39 | + $sth = $this->db->prepare($query); |
|
40 | + $sth->execute($query_values); |
|
41 | + } catch(PDOException $e) { |
|
42 | + return "error : ".$e->getMessage(); |
|
43 | + } |
|
44 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
45 | + return $all; |
|
46 | + } |
|
47 | 47 | |
48 | - public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png') { |
|
49 | - $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source)"; |
|
50 | - $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source); |
|
51 | - try { |
|
52 | - $sth = $this->db->prepare($query); |
|
53 | - $sth->execute($query_values); |
|
54 | - } catch(PDOException $e) { |
|
55 | - return "error : ".$e->getMessage(); |
|
56 | - } |
|
57 | - } |
|
48 | + public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png') { |
|
49 | + $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source)"; |
|
50 | + $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source); |
|
51 | + try { |
|
52 | + $sth = $this->db->prepare($query); |
|
53 | + $sth->execute($query_values); |
|
54 | + } catch(PDOException $e) { |
|
55 | + return "error : ".$e->getMessage(); |
|
56 | + } |
|
57 | + } |
|
58 | 58 | |
59 | - public function deleteLocation($id) { |
|
60 | - $query = "DELETE FROM source_location WHERE id = :id"; |
|
61 | - $query_values = array(':id' => $id); |
|
62 | - try { |
|
63 | - $sth = $this->db->prepare($query); |
|
64 | - $sth->execute($query_values); |
|
65 | - } catch(PDOException $e) { |
|
66 | - return "error : ".$e->getMessage(); |
|
67 | - } |
|
68 | - } |
|
69 | - public function deleteAllLocation() { |
|
70 | - $query = "DELETE FROM source_location"; |
|
71 | - try { |
|
72 | - $sth = $this->db->prepare($query); |
|
73 | - $sth->execute(); |
|
74 | - } catch(PDOException $e) { |
|
75 | - return "error : ".$e->getMessage(); |
|
76 | - } |
|
77 | - } |
|
59 | + public function deleteLocation($id) { |
|
60 | + $query = "DELETE FROM source_location WHERE id = :id"; |
|
61 | + $query_values = array(':id' => $id); |
|
62 | + try { |
|
63 | + $sth = $this->db->prepare($query); |
|
64 | + $sth->execute($query_values); |
|
65 | + } catch(PDOException $e) { |
|
66 | + return "error : ".$e->getMessage(); |
|
67 | + } |
|
68 | + } |
|
69 | + public function deleteAllLocation() { |
|
70 | + $query = "DELETE FROM source_location"; |
|
71 | + try { |
|
72 | + $sth = $this->db->prepare($query); |
|
73 | + $sth->execute(); |
|
74 | + } catch(PDOException $e) { |
|
75 | + return "error : ".$e->getMessage(); |
|
76 | + } |
|
77 | + } |
|
78 | 78 | } |
79 | 79 | ?> |
80 | 80 | \ No newline at end of file |