Completed
Push — master ( 588050...e5efd9 )
by Yannick
59:17 queued 29:29
created
statistics-type.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 
8 8
 $type = 'marine';
9 9
 if (!isset($filter_name)) $filter_name = '';
10
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
11
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
11
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
12 12
 
13 13
 require_once('header.php');
14 14
 
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 	</div>
21 21
 	<p>'._("Below are the <strong>Top 10</strong> most common vessel types.").'</p>';
22 22
 	  
23
-$type_array = $Marine->countAllMarineTypes(true,0,'',$filter_name,$year,$month);
23
+$type_array = $Marine->countAllMarineTypes(true, 0, '', $filter_name, $year, $month);
24 24
 print '<div id="chart" class="chart" width="100%"></div><script>';
25 25
 $type_data = '';
26
-foreach($type_array as $type_item)
26
+foreach ($type_array as $type_item)
27 27
 {
28 28
 	$type_data .= '["'.$type_item['marine_type'].'",'.$type_item['marine_type_count'].'],';
29 29
 }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	print '</thead>';
49 49
 	print '<tbody>';
50 50
 	$i = 1;
51
-	foreach($type_array as $type_item)
51
+	foreach ($type_array as $type_item)
52 52
 	{
53 53
 		print '<tr>';
54 54
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Vessel Type");
7 7
 
8 8
 $type = 'marine';
9
-if (!isset($filter_name)) $filter_name = '';
9
+if (!isset($filter_name)) {
10
+	$filter_name = '';
11
+}
10 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
11 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
12 14
 
Please login to merge, or discard this patch.
scripts/daemon-spotter.php 3 patches
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 	    die;
51 51
 	}
52 52
 	//$hosts = array($globalSBS1Host.':'.$globalSBS1Port);
53
-	$globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port);
53
+	$globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port);
54 54
     }
55 55
 }
56 56
 
57
-$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver','enable-aircraft','disable-aircraft','enable-tracker','disable-tracker','enable-marine','disable-marine'));
57
+$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver', 'enable-aircraft', 'disable-aircraft', 'enable-tracker', 'disable-tracker', 'enable-marine', 'disable-marine'));
58 58
 //if (isset($options['s'])) $hosts = array($options['s']);
59 59
 //elseif (isset($options['source'])) $hosts = array($options['source']);
60 60
 if (isset($options['s'])) {
61 61
     $globalSources = array();
62
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']);
62
+    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']);
63 63
     else $globalSources[] = array('host' => $options['s']);
64 64
 } elseif (isset($options['source'])) {
65 65
     $globalSources = array();
66
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']);
66
+    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']);
67 67
     else $globalSources[] = array('host' => $options['source']);
68 68
 }
69 69
 if (isset($options['aprsserverhost'])) {
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 else $id_source = 1;
105 105
 if (isset($globalServer) && $globalServer) {
106 106
     if ($globalDebug) echo "Using Server Mode\n";
107
-    $SI=new SpotterServer();
107
+    $SI = new SpotterServer();
108 108
 /*
109 109
     require_once(dirname(__FILE__).'/../require/class.APRS.php');
110 110
     $SI = new adsb2aprs();
111 111
     $SI->connect();
112 112
 */
113
-} else $SI=new SpotterImport($Connection->db);
113
+} else $SI = new SpotterImport($Connection->db);
114 114
 
115 115
 if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
116 116
 if (isset($globalMarine) && $globalMarine) {
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
     $MI = new MarineImport($Connection->db);
125 125
 }
126 126
 //$APRS=new APRS($Connection->db);
127
-$SBS=new SBS();
127
+$SBS = new SBS();
128 128
 if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
129
-	$ACARS=new ACARS($Connection->db,true);
130
-	$Source=new Source($Connection->db);
129
+	$ACARS = new ACARS($Connection->db, true);
130
+	$Source = new Source($Connection->db);
131 131
 }
132
-$Common=new Common();
132
+$Common = new Common();
133 133
 date_default_timezone_set('UTC');
134 134
 //$servertz = system('date +%Z');
135 135
 // signal handler - playing nice with sockets and dump1090
136 136
 if (function_exists('pcntl_fork')) {
137
-    pcntl_signal(SIGINT,  function() {
137
+    pcntl_signal(SIGINT, function() {
138 138
         global $sockets;
139 139
         echo "\n\nctrl-c or kill signal received. Tidying up ... ";
140 140
         die("Bye!\n");
@@ -150,30 +150,30 @@  discard block
 block discarded – undo
150 150
 
151 151
 function connect_all($hosts) {
152 152
     //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
153
-    global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context;
153
+    global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context;
154 154
     $reset++;
155 155
     if ($globalDebug) echo 'Connect to all...'."\n";
156 156
     foreach ($hosts as $id => $value) {
157 157
 	$host = $value['host'];
158 158
 	$globalSources[$id]['last_exec'] = 0;
159 159
 	// Here we check type of source(s)
160
-	if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) {
161
-            if (preg_match('/deltadb.txt$/i',$host)) {
160
+	if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) {
161
+            if (preg_match('/deltadb.txt$/i', $host)) {
162 162
         	//$formats[$id] = 'deltadbtxt';
163 163
         	$globalSources[$id]['format'] = 'deltadbtxt';
164 164
         	//$last_exec['deltadbtxt'] = 0;
165 165
         	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
166
-            } else if (preg_match('/vatsim-data.txt$/i',$host)) {
166
+            } else if (preg_match('/vatsim-data.txt$/i', $host)) {
167 167
         	//$formats[$id] = 'vatsimtxt';
168 168
         	$globalSources[$id]['format'] = 'vatsimtxt';
169 169
         	//$last_exec['vatsimtxt'] = 0;
170 170
         	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
171
-    	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
171
+    	    } else if (preg_match('/aircraftlist.json$/i', $host)) {
172 172
         	//$formats[$id] = 'aircraftlistjson';
173 173
         	$globalSources[$id]['format'] = 'aircraftlistjson';
174 174
         	//$last_exec['aircraftlistjson'] = 0;
175 175
         	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
176
-    	    } else if (preg_match('/opensky/i',$host)) {
176
+    	    } else if (preg_match('/opensky/i', $host)) {
177 177
         	//$formats[$id] = 'aircraftlistjson';
178 178
         	$globalSources[$id]['format'] = 'opensky';
179 179
         	//$last_exec['aircraftlistjson'] = 0;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         	    exit(0);
191 191
         	}
192 192
     	    */
193
-    	    } else if (preg_match('/planeUpdateFAA.php$/i',$host)) {
193
+    	    } else if (preg_match('/planeUpdateFAA.php$/i', $host)) {
194 194
         	//$formats[$id] = 'planeupdatefaa';
195 195
         	$globalSources[$id]['format'] = 'planeupdatefaa';
196 196
         	//$last_exec['planeupdatefaa'] = 0;
@@ -199,37 +199,37 @@  discard block
 block discarded – undo
199 199
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
200 200
         	    exit(0);
201 201
         	}
202
-            } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) {
202
+            } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) {
203 203
         	//$formats[$id] = 'phpvmacars';
204 204
         	$globalSources[$id]['format'] = 'phpvmacars';
205 205
         	//$last_exec['phpvmacars'] = 0;
206 206
         	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
207
-            } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) {
207
+            } else if (preg_match('/\/api\/v1\/acars\/data$/i', $host)) {
208 208
         	//$formats[$id] = 'phpvmacars';
209 209
         	$globalSources[$id]['format'] = 'vaos';
210 210
         	//$last_exec['phpvmacars'] = 0;
211 211
         	if ($globalDebug) echo "Connect to vaos source (".$host.")...\n";
212
-            } else if (preg_match('/VAM-json.php$/i',$host)) {
212
+            } else if (preg_match('/VAM-json.php$/i', $host)) {
213 213
         	//$formats[$id] = 'phpvmacars';
214 214
         	$globalSources[$id]['format'] = 'vam';
215 215
         	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
216
-            } else if (preg_match('/whazzup/i',$host)) {
216
+            } else if (preg_match('/whazzup/i', $host)) {
217 217
         	//$formats[$id] = 'whazzup';
218 218
         	$globalSources[$id]['format'] = 'whazzup';
219 219
         	//$last_exec['whazzup'] = 0;
220 220
         	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
221
-            } else if (preg_match('/blitzortung/i',$host)) {
221
+            } else if (preg_match('/blitzortung/i', $host)) {
222 222
         	$globalSources[$id]['format'] = 'blitzortung';
223 223
         	if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n";
224
-            } else if (preg_match('/airwhere/i',$host)) {
224
+            } else if (preg_match('/airwhere/i', $host)) {
225 225
         	$globalSources[$id]['format'] = 'airwhere';
226 226
         	if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n";
227
-            } else if (preg_match('/recentpireps/i',$host)) {
227
+            } else if (preg_match('/recentpireps/i', $host)) {
228 228
         	//$formats[$id] = 'pirepsjson';
229 229
         	$globalSources[$id]['format'] = 'pirepsjson';
230 230
         	//$last_exec['pirepsjson'] = 0;
231 231
         	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
232
-            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
232
+            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) {
233 233
         	//$formats[$id] = 'fr24json';
234 234
         	$globalSources[$id]['format'] = 'fr24json';
235 235
         	//$last_exec['fr24json'] = 0;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
239 239
         	    exit(0);
240 240
         	}
241
-            } else if (preg_match(':myshiptracking.com/:i',$host)) {
241
+            } else if (preg_match(':myshiptracking.com/:i', $host)) {
242 242
         	//$formats[$id] = 'fr24json';
243 243
         	$globalSources[$id]['format'] = 'myshiptracking';
244 244
         	//$last_exec['fr24json'] = 0;
@@ -248,21 +248,21 @@  discard block
 block discarded – undo
248 248
         	    exit(0);
249 249
         	}
250 250
             //} else if (preg_match('/10001/',$host)) {
251
-            } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
251
+            } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
252 252
         	//$formats[$id] = 'tsv';
253 253
         	$globalSources[$id]['format'] = 'tsv';
254 254
         	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
255 255
             }
256
-        } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
256
+        } elseif (filter_var($host, FILTER_VALIDATE_URL)) {
257 257
     		if ($globalSources[$id]['format'] == 'aisnmeahttp') {
258
-    		    $idf = fopen($globalSources[$id]['host'],'r',false,$context);
258
+    		    $idf = fopen($globalSources[$id]['host'], 'r', false, $context);
259 259
     		    if ($idf !== false) {
260 260
     			$httpfeeds[$id] = $idf;
261 261
         		if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
262 262
     		    } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n";
263 263
     		} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
264
-        } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
265
-	    $hostport = explode(':',$host);
264
+        } elseif (!filter_var($host, FILTER_VALIDATE_URL)) {
265
+	    $hostport = explode(':', $host);
266 266
 	    if (isset($hostport[1])) {
267 267
 		$port = $hostport[1];
268 268
 		$hostn = $hostport[0];
@@ -272,19 +272,19 @@  discard block
 block discarded – undo
272 272
 	    }
273 273
 	    $Common = new Common();
274 274
 	    if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) {
275
-        	$s = $Common->create_socket($hostn,$port, $errno, $errstr);
275
+        	$s = $Common->create_socket($hostn, $port, $errno, $errstr);
276 276
     	    } else {
277
-        	$s = $Common->create_socket_udp($hostn,$port, $errno, $errstr);
277
+        	$s = $Common->create_socket_udp($hostn, $port, $errno, $errstr);
278 278
 	    }
279 279
 	    if ($s) {
280 280
     	        $sockets[$id] = $s;
281 281
     	        if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') {
282
-		    if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') {
282
+		    if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') {
283 283
 			//$formats[$id] = 'aprs';
284 284
 			$globalSources[$id]['format'] = 'aprs';
285 285
 			//$aprs_connect = 0;
286 286
 			//$use_aprs = true;
287
-		    } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') {
287
+		    } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') {
288 288
 			$globalSources[$id]['format'] = 'vrstcp';
289 289
     		    } elseif ($port == '10001') {
290 290
         		//$formats[$id] = 'tsv';
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut;
324 324
 else $timeout = 20;
325 325
 $errno = '';
326
-$errstr='';
326
+$errstr = '';
327 327
 
328 328
 if (!isset($globalDaemon)) $globalDaemon = TRUE;
329 329
 /* Initiate connections to all the hosts simultaneously */
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 //connect_all($globalSources);
332 332
 
333 333
 if (isset($globalProxy) && $globalProxy) {
334
-    $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true)));
334
+    $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true)));
335 335
 } else {
336 336
     $context = stream_context_create(array('http' => array('timeout' => $timeout)));
337 337
 }
@@ -361,16 +361,16 @@  discard block
 block discarded – undo
361 361
 
362 362
 if ($use_aprs) {
363 363
 	require_once(dirname(__FILE__).'/../require/class.APRS.php');
364
-	$APRS=new APRS();
364
+	$APRS = new APRS();
365 365
 	$aprs_connect = 0;
366 366
 	$aprs_keep = 120;
367 367
 	$aprs_last_tx = time();
368 368
 	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
369
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
369
+	else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName);
370 370
 	if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid;
371
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
371
+	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8);
372 372
 	if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter;
373
-	else $aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
373
+	else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
374 374
 	if ($aprs_full) $aprs_filter = '';
375 375
 	if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass;
376 376
 	else $aprs_pass = '-1';
@@ -384,12 +384,12 @@  discard block
 block discarded – undo
384 384
 sleep(1);
385 385
 if ($globalDebug) echo "SCAN MODE \n\n";
386 386
 if (!isset($globalCronEnd)) $globalCronEnd = 60;
387
-$endtime = time()+$globalCronEnd;
387
+$endtime = time() + $globalCronEnd;
388 388
 $i = 1;
389 389
 $tt = array();
390 390
 // Delete all ATC
391 391
 if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
392
-	$ATC=new ATC($Connection->db);
392
+	$ATC = new ATC($Connection->db);
393 393
 }
394 394
 if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
395 395
 	$ATC->deleteAll();
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
399 399
 while ($i > 0) {
400
-    if (!$globalDaemon) $i = $endtime-time();
400
+    if (!$globalDaemon) $i = $endtime - time();
401 401
     // Delete old ATC
402 402
     if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
403 403
 	if ($globalDebug) echo 'Delete old ATC...'."\n";
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 	}
412 412
 	if ($max != $globalMinFetch) {
413 413
 	    if ($globalDebug) echo 'Sleeping...'."\n";
414
-	    sleep($globalMinFetch-$max+2);
414
+	    sleep($globalMinFetch - $max + 2);
415 415
 	}
416 416
     }
417 417
 
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 	    //$buffer = $Common->getData($hosts[$id]);
431 431
 	    $buffer = $Common->getData($value['host']);
432 432
 	    if ($buffer != '') $reset = 0;
433
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
434
-	    $buffer = explode('\n',$buffer);
433
+    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
434
+	    $buffer = explode('\n', $buffer);
435 435
 	    foreach ($buffer as $line) {
436 436
     		if ($line != '' && count($line) > 7) {
437 437
     		    $line = explode(',', $line);
@@ -464,11 +464,11 @@  discard block
 block discarded – undo
464 464
 	    )
465 465
 	) {
466 466
 	    date_default_timezone_set('CET');
467
-	    $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host']));
467
+	    $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host']));
468 468
 	    date_default_timezone_set('UTC');
469 469
 	    if ($buffer != '') $reset = 0;
470
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
471
-	    $buffer = explode('\n',$buffer);
470
+    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
471
+	    $buffer = explode('\n', $buffer);
472 472
 	    foreach ($buffer as $line) {
473 473
 		if ($line != '') {
474 474
 		    //echo "'".$line."'\n";
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		    $ais_data = $AIS->parse_line(trim($line));
477 477
 		    $data = array();
478 478
 		    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
479
-		    if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
479
+		    if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9);
480 480
 		    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
481 481
 		    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
482 482
 		    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
489 489
 		    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
490 490
 		    if (isset($ais_data['timestamp'])) {
491
-			$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
491
+			$data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']);
492 492
 			if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) {
493 493
 			    $last_exec[$id]['timestamp'] = $ais_data['timestamp'];
494 494
 			    $add = true;
@@ -511,21 +511,21 @@  discard block
 block discarded – undo
511 511
 	    $w = $e = null;
512 512
 	    
513 513
 	    if (isset($arr[$id])) {
514
-		$nn = stream_select($arr,$w,$e,$timeout);
514
+		$nn = stream_select($arr, $w, $e, $timeout);
515 515
 		if ($nn > 0) {
516 516
 		    foreach ($httpfeeds as $feed) {
517
-			$buffer = stream_get_line($feed,2000,"\n");
517
+			$buffer = stream_get_line($feed, 2000, "\n");
518 518
 			if ($buffer === FALSE) {
519 519
 			    connect_all($globalSources);
520 520
 			}
521
-			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
522
-			$buffer = explode('\n',$buffer);
521
+			$buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
522
+			$buffer = explode('\n', $buffer);
523 523
 			foreach ($buffer as $line) {
524 524
 			    if ($line != '') {
525 525
 				$ais_data = $AIS->parse_line(trim($line));
526 526
 				$data = array();
527 527
 				if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
528
-				if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
528
+				if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9);
529 529
 				if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
530 530
 				if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
531 531
 				if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
 				if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
538 538
 				if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
539 539
 				if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
540
-				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
540
+				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']);
541 541
 				if (isset($ais_data['timestamp'])) {
542
-				    $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
542
+				    $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']);
543 543
 				} else {
544 544
 				    $data['datetime'] = date('Y-m-d H:i:s');
545 545
 				}
@@ -571,10 +571,10 @@  discard block
 block discarded – undo
571 571
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3))
572 572
 	    )
573 573
 	) {
574
-	    $buffer = $Common->getData($value['host'],'get','','','','','20');
574
+	    $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20');
575 575
 	    if ($buffer != '') {
576 576
 		//echo $buffer;
577
-		$all_data = json_decode($buffer,true);
577
+		$all_data = json_decode($buffer, true);
578 578
 		//print_r($all_data);
579 579
 		if (isset($all_data[0]['DATA'])) {
580 580
 		    foreach ($all_data[0]['DATA'] as $line) {
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 			    $data['ident'] = $line['NAME'];
584 584
 			    $data['mmsi'] = $line['MMSI'];
585 585
 			    if (strlen($data['mmsi']) > 9) {
586
-				$data['mmsi'] = substr($data['mmsi'],-9);
586
+				$data['mmsi'] = substr($data['mmsi'], -9);
587 587
 			    }
588 588
 			    $data['speed'] = $line['SOG'];
589 589
 			    $data['heading'] = $line['COG'];
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
 			    //$data['type_id'] = $line['TYPE'];
594 594
 			    $data['imo'] = $line['IMO'];
595 595
 			    if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST'];
596
-			    if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV']));
597
-			    $data['datetime'] = date('Y-m-d H:i:s',$line['T']);
596
+			    if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s', strtotime($line['ARV']));
597
+			    $data['datetime'] = date('Y-m-d H:i:s', $line['T']);
598 598
 			    $data['format_source'] = 'myshiptracking';
599 599
 			    $data['id_source'] = $id_source;
600 600
 			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
@@ -611,16 +611,16 @@  discard block
 block discarded – undo
611 611
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3))
612 612
 	    )
613 613
 	) {
614
-	    $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host']));
614
+	    $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host']));
615 615
 	    if ($buffer != '') {
616
-		$all_data = json_decode($buffer,true);
616
+		$all_data = json_decode($buffer, true);
617 617
 		if (isset($all_data[0]['mmsi'])) {
618 618
 		    foreach ($all_data as $line) {
619 619
 			if ($line != '') {
620 620
 			    $data = array();
621 621
 			    $data['ident'] = $line['shipname'];
622 622
 			    $data['callsign'] = $line['callsign'];
623
-			    $data['mmsi'] = substr($line['mmsi'],-9);
623
+			    $data['mmsi'] = substr($line['mmsi'], -9);
624 624
 			    $data['speed'] = $line['sog'];
625 625
 			    if ($line['heading'] != '511') $data['heading'] = $line['heading'];
626 626
 			    $data['latitude'] = $line['latitude'];
@@ -647,14 +647,14 @@  discard block
 block discarded – undo
647 647
 	) {
648 648
 	    $buffer = $Common->getData($value['host']);
649 649
 	    if ($buffer != '') {
650
-		$all_data = json_decode($buffer,true);
650
+		$all_data = json_decode($buffer, true);
651 651
 		if (isset($all_data['features'][0]['id'])) {
652 652
 		    foreach ($all_data['features'] as $line) {
653 653
 			print_r($line);
654 654
 			$data = array();
655 655
 			if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name'];
656 656
 			if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign'];
657
-			if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9);
657
+			if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'], -9);
658 658
 			if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo'];
659 659
 			if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed'];
660 660
 			if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading'];
@@ -681,31 +681,31 @@  discard block
 block discarded – undo
681 681
 	    )
682 682
 	) {
683 683
 	    echo 'download...';
684
-	    $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter');
684
+	    $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter');
685 685
 	    echo 'done !'."\n";
686 686
 	    // FIXME: Need more work
687 687
 	    if ($buffer != '') $reset = 0;
688
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
689
-	    $buffer = explode('\n',$buffer);
688
+    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
689
+	    $buffer = explode('\n', $buffer);
690 690
 	    foreach ($buffer as $line) {
691 691
 		if ($line != '') {
692 692
 		    $data = array();
693 693
 		    echo $line."\n";
694
-		    $data['mmsi'] = (int)substr($line,0,9);
695
-		    $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10));
696
-		    $data['status_id'] = substr($line,21,2);
697
-		    $data['type_id'] = substr($line,24,3);
698
-		    $data['latitude'] = substr($line,29,9);
699
-		    $data['longitude'] = substr($line,41,9);
700
-		    $data['speed'] = round(substr($line,51,5));
694
+		    $data['mmsi'] = (int) substr($line, 0, 9);
695
+		    $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10));
696
+		    $data['status_id'] = substr($line, 21, 2);
697
+		    $data['type_id'] = substr($line, 24, 3);
698
+		    $data['latitude'] = substr($line, 29, 9);
699
+		    $data['longitude'] = substr($line, 41, 9);
700
+		    $data['speed'] = round(substr($line, 51, 5));
701 701
 		    //$data['course'] = substr($line,57,5);
702
-		    $data['heading'] = round(substr($line,63,3));
702
+		    $data['heading'] = round(substr($line, 63, 3));
703 703
 		    //$data['draft'] = substr($line,67,4);
704 704
 		    //$data['length'] = substr($line,72,3);
705 705
 		    //$data['beam'] = substr($line,76,2);
706
-		    $data['ident'] = trim(utf8_encode(substr($line,78,20)));
706
+		    $data['ident'] = trim(utf8_encode(substr($line, 78, 20)));
707 707
 		    //$data['callsign'] = trim(substr($line,100,7);
708
-		    $data['arrival_code'] = substr($line,108,20);
708
+		    $data['arrival_code'] = substr($line, 108, 20);
709 709
 		    //$data['etaDate'] = substr($line,129,5);
710 710
 		    //$data['etaTime'] = substr($line,135,5);
711 711
 		    $data['format_source'] = 'shipplotter';
@@ -736,8 +736,8 @@  discard block
 block discarded – undo
736 736
 	) {
737 737
 	    //$buffer = $Common->getData($hosts[$id]);
738 738
 	    $buffer = $Common->getData($value['host']);
739
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
740
-	    $buffer = explode('\n',$buffer);
739
+    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
740
+	    $buffer = explode('\n', $buffer);
741 741
 	    $reset = 0;
742 742
 	    foreach ($buffer as $line) {
743 743
     		if ($line != '') {
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 			else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0];
749 749
 			$data['pilot_id'] = $line[1];
750 750
 			$data['pilot_name'] = $line[2];
751
-			$data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT);
751
+			$data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT);
752 752
 			$data['ident'] = $line[0]; // ident
753 753
 			if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude
754 754
 			$data['speed'] = $line[8]; // speed
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 			//$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37]));
765 765
 			//if (isset($line[37])) $data['last_update'] = $line[37];
766 766
 		        $data['departure_airport_icao'] = $line[11];
767
-		        $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
767
+		        $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':');
768 768
 		        $data['arrival_airport_icao'] = $line[13];
769 769
 			$data['frequency'] = $line[4];
770 770
 			$data['type'] = $line[18];
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     			$data['id_source'] = $id_source;
774 774
 	    		//$data['arrival_airport_time'] = ;
775 775
 	    		if ($line[9] != '') {
776
-	    		    $aircraft_data = explode('/',$line[9]);
776
+	    		    $aircraft_data = explode('/', $line[9]);
777 777
 	    		    if (isset($aircraft_data[1])) {
778 778
 	    			$data['aircraft_icao'] = $aircraft_data[1];
779 779
 	    		    }
@@ -788,9 +788,9 @@  discard block
 block discarded – undo
788 788
     			if ($line[3] == 'PILOT') $SI->add($data);
789 789
 			elseif ($line[3] == 'ATC') {
790 790
 				//print_r($data);
791
-				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
792
-				$data['info'] = str_replace('&amp;sect;','',$data['info']);
793
-				$typec = substr($data['ident'],-3);
791
+				$data['info'] = str_replace('^&sect;', '<br />', $data['info']);
792
+				$data['info'] = str_replace('&amp;sect;', '', $data['info']);
793
+				$typec = substr($data['ident'], -3);
794 794
 				if ($typec == 'APP') $data['type'] = 'Approach';
795 795
 				elseif ($typec == 'TWR') $data['type'] = 'Tower';
796 796
 				elseif ($typec == 'OBS') $data['type'] = 'Observer';
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 				elseif ($data['type'] == '') $data['type'] = 'Observer';
803 803
 				if (!isset($data['source_name'])) $data['source_name'] = '';
804 804
 				if (isset($ATC)) {
805
-					if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
806
-					else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
805
+					if (count($ATC->getByIdent($data['ident'], $data['format_source'])) > 0) echo $ATC->update($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']);
806
+					else echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']);
807 807
 				}
808 808
 			}
809 809
     			unset($data);
@@ -819,24 +819,24 @@  discard block
 block discarded – undo
819 819
     		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
820 820
     	    )
821 821
     	) {
822
-	    $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20');
822
+	    $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20');
823 823
 	    if ($buffer != '') {
824 824
 		$all_data = simplexml_load_string($buffer);
825
-		foreach($all_data->children() as $childdata) {
825
+		foreach ($all_data->children() as $childdata) {
826 826
 			$data = array();
827 827
 			$line = $childdata;
828 828
 			//$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT);
829
-			$data['id'] = date('Ymd').(int)$line['pktPilotID'];
830
-			$data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST'));
831
-			$data['latitude'] = (float)$line['pktLatitude'];
832
-			$data['longitude'] = (float)$line['pktLongitude'];
833
-			if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack'];
834
-			if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed'];
835
-			$data['altitude'] = round((int)$line['pktAltitude']*3.28084);
829
+			$data['id'] = date('Ymd').(int) $line['pktPilotID'];
830
+			$data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST'));
831
+			$data['latitude'] = (float) $line['pktLatitude'];
832
+			$data['longitude'] = (float) $line['pktLongitude'];
833
+			if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack'];
834
+			if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed'];
835
+			$data['altitude'] = round((int) $line['pktAltitude']*3.28084);
836 836
 			$data['altitude_relative'] = 'AMSL';
837
-			$data['pilot_id'] = (int)$line['pktPilotID'];
837
+			$data['pilot_id'] = (int) $line['pktPilotID'];
838 838
 			$data['aircraft_icao'] = 'PARAGLIDER';
839
-			$pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id']));
839
+			$pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id']));
840 840
 			if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4];
841 841
 			$data['format_source'] = $value['format'];
842 842
 			$SI->add($data);
@@ -844,22 +844,22 @@  discard block
 block discarded – undo
844 844
 		}
845 845
 	    }
846 846
 	    $Source->deleteOldLocationByType('gs');
847
-	    $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20');
847
+	    $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20');
848 848
 	    if ($buffer != '') {
849 849
 		$all_data = simplexml_load_string($buffer);
850
-		foreach($all_data->children() as $childdata) {
850
+		foreach ($all_data->children() as $childdata) {
851 851
 			$data = array();
852 852
 			$line = $childdata;
853
-			$data['id'] = (int)$line['gsID'];
854
-			$data['latitude'] = (float)$line['gsLatitude'];
855
-			$data['longitude'] = (float)$line['gsLongitude'];
856
-			$data['altitude'] = round((int)$line['gsHeight']*3.28084);
853
+			$data['id'] = (int) $line['gsID'];
854
+			$data['latitude'] = (float) $line['gsLatitude'];
855
+			$data['longitude'] = (float) $line['gsLongitude'];
856
+			$data['altitude'] = round((int) $line['gsHeight']*3.28084);
857 857
 			$data['altitude_relative'] = 'AMSL';
858
-			$data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST'));
858
+			$data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST'));
859 859
 			if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) {
860
-				$Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']);
860
+				$Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']);
861 861
 			} else {
862
-				$Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']);
862
+				$Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']);
863 863
 			}
864 864
 			unset($data);
865 865
 		}
@@ -877,9 +877,9 @@  discard block
 block discarded – undo
877 877
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
878 878
 	    )
879 879
 	) {
880
-	    $buffer = $Common->getData($value['host'],'get','','','','','20');
880
+	    $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20');
881 881
 	    if ($buffer != '') {
882
-	        $all_data = json_decode($buffer,true);
882
+	        $all_data = json_decode($buffer, true);
883 883
 		if (isset($all_data['acList'])) {
884 884
 		    $reset = 0;
885 885
 		    foreach ($all_data['acList'] as $line) {
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 			if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
896 896
 			$data['emergency'] = ''; // emergency
897 897
 			if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
898
-			if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
898
+			if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000));
899 899
 			else $data['datetime'] = date('Y-m-d H:i:s');
900 900
 			//$data['datetime'] = date('Y-m-d H:i:s');
901 901
 			if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 			$data['verticalrate'] = $line['vrt']; // verticale rate
921 921
 			$data['squawk'] = $line['squawk']; // squawk
922 922
 			$data['emergency'] = ''; // emergency
923
-			if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
923
+			if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000));
924 924
 			else $data['datetime'] = date('Y-m-d H:i:s');
925 925
 			$data['format_source'] = 'aircraftlistjson';
926 926
 			$data['id_source'] = $id_source;
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
     	    )
942 942
     	) {
943 943
 	    $buffer = $Common->getData($value['host']);
944
-	    $all_data = json_decode($buffer,true);
944
+	    $all_data = json_decode($buffer, true);
945 945
 	    if (isset($all_data['planes'])) {
946 946
 		$reset = 0;
947 947
 		foreach ($all_data['planes'] as $key => $line) {
@@ -958,12 +958,12 @@  discard block
 block discarded – undo
958 958
 		    $data['emergency'] = ''; // emergency
959 959
 		    $data['registration'] = $line[2];
960 960
 		    $data['aircraft_icao'] = $line[0];
961
-		    $deparr = explode('-',$line[1]);
961
+		    $deparr = explode('-', $line[1]);
962 962
 		    if (count($deparr) == 2) {
963 963
 			$data['departure_airport_icao'] = $deparr[0];
964 964
 			$data['arrival_airport_icao'] = $deparr[1];
965 965
 		    }
966
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
966
+		    $data['datetime'] = date('Y-m-d H:i:s', $line[9]);
967 967
 	    	    $data['format_source'] = 'planeupdatefaa';
968 968
     		    $data['id_source'] = $id_source;
969 969
 		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 	    )
982 982
 	) {
983 983
 	    $buffer = $Common->getData($value['host']);
984
-	    $all_data = json_decode($buffer,true);
984
+	    $all_data = json_decode($buffer, true);
985 985
 	    if (isset($all_data['states'])) {
986 986
 		$reset = 0;
987 987
 		foreach ($all_data['states'] as $key => $line) {
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 		    //$data['emergency'] = ''; // emergency
999 999
 		    //$data['registration'] = $line[2];
1000 1000
 		    //$data['aircraft_icao'] = $line[0];
1001
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]);
1001
+		    $data['datetime'] = date('Y-m-d H:i:s', $line[3]);
1002 1002
 		    $data['format_source'] = 'opensky';
1003 1003
 		    $data['id_source'] = $id_source;
1004 1004
 		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 	) {
1018 1018
 	    //$buffer = $Common->getData($hosts[$id]);
1019 1019
 	    $buffer = $Common->getData($value['host']);
1020
-	    $all_data = json_decode($buffer,true);
1020
+	    $all_data = json_decode($buffer, true);
1021 1021
 	    if (!empty($all_data)) $reset = 0;
1022 1022
 	    foreach ($all_data as $key => $line) {
1023 1023
 		if ($key != 'full_count' && $key != 'version' && $key != 'stats') {
@@ -1055,11 +1055,11 @@  discard block
 block discarded – undo
1055 1055
 	    )
1056 1056
 	) {
1057 1057
 	    //$buffer = $Common->getData($hosts[$id],'get','','','','','150');
1058
-	    $buffer = $Common->getData($value['host'],'get','','','','','150');
1058
+	    $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150');
1059 1059
 	    //echo $buffer;
1060
-	    $buffer = str_replace(array("\n","\r"),"",$buffer);
1061
-	    $buffer = preg_replace('/,"num":(.+)/','}',$buffer);
1062
-	    $all_data = json_decode($buffer,true);
1060
+	    $buffer = str_replace(array("\n", "\r"), "", $buffer);
1061
+	    $buffer = preg_replace('/,"num":(.+)/', '}', $buffer);
1062
+	    $all_data = json_decode($buffer, true);
1063 1063
 	    if (json_last_error() != JSON_ERROR_NONE) {
1064 1064
 		die(json_last_error_msg());
1065 1065
 	    }
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 			//$data['departure_airport_iata'] = $line[11];
1083 1083
 			//$data['arrival_airport_iata'] = $line[12];
1084 1084
 	    		//$data['emergency'] = ''; // emergency
1085
-			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
1085
+			$data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10]
1086 1086
 	    		$data['format_source'] = 'radarvirtueljson';
1087 1087
     			$data['id_source'] = $id_source;
1088 1088
 			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
@@ -1103,14 +1103,14 @@  discard block
 block discarded – undo
1103 1103
 	) {
1104 1104
 	    //$buffer = $Common->getData($hosts[$id]);
1105 1105
 	    $buffer = $Common->getData($value['host'].'?'.time());
1106
-	    $all_data = json_decode(utf8_encode($buffer),true);
1106
+	    $all_data = json_decode(utf8_encode($buffer), true);
1107 1107
 	    
1108 1108
 	    if (isset($all_data['pireps'])) {
1109 1109
 		$reset = 0;
1110 1110
 	        foreach ($all_data['pireps'] as $line) {
1111 1111
 		    $data = array();
1112 1112
 		    $data['id'] = $line['id'];
1113
-		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
1113
+		    $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6);
1114 1114
 		    $data['ident'] = $line['callsign']; // ident
1115 1115
 		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
1116 1116
 		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
@@ -1140,9 +1140,9 @@  discard block
 block discarded – undo
1140 1140
 			$SI->add($data);
1141 1141
 		    //    print_r($data);
1142 1142
     		    } elseif ($line['icon'] == 'ct') {
1143
-			$data['info'] = str_replace('^&sect;','<br />',$data['info']);
1144
-			$data['info'] = str_replace('&amp;sect;','',$data['info']);
1145
-			$typec = substr($data['ident'],-3);
1143
+			$data['info'] = str_replace('^&sect;', '<br />', $data['info']);
1144
+			$data['info'] = str_replace('&amp;sect;', '', $data['info']);
1145
+			$typec = substr($data['ident'], -3);
1146 1146
 			$data['type'] = '';
1147 1147
 			if ($typec == 'APP') $data['type'] = 'Approach';
1148 1148
 			elseif ($typec == 'TWR') $data['type'] = 'Tower';
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 			elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
1154 1154
 			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
1155 1155
 			else $data['type'] = 'Observer';
1156
-			if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']);
1156
+			if (isset($ATC)) echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']);
1157 1157
 		    }
1158 1158
 		    unset($data);
1159 1159
 		}
@@ -1170,14 +1170,14 @@  discard block
 block discarded – undo
1170 1170
 	    //$buffer = $Common->getData($hosts[$id]);
1171 1171
 	    if ($globalDebug) echo 'Get Data...'."\n";
1172 1172
 	    $buffer = $Common->getData($value['host']);
1173
-	    $all_data = json_decode($buffer,true);
1173
+	    $all_data = json_decode($buffer, true);
1174 1174
 	    if ($buffer != '' && is_array($all_data)) {
1175 1175
 		$reset = 0;
1176 1176
 		foreach ($all_data as $line) {
1177 1177
 	    	    $data = array();
1178 1178
 	    	    //$data['id'] = $line['id']; // id not usable
1179 1179
 	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
1180
-	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1180
+	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex
1181 1181
 	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
1182 1182
 	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
1183 1183
 	    	    $data['ident'] = $line['flightnum']; // ident
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 	    	    //$data['datetime'] = $line['lastupdate'];
1193 1193
 	    	    //$data['last_update'] = $line['lastupdate'];
1194 1194
 	    	    if (isset($value['timezone'])) {
1195
-	    		$datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone']));
1195
+	    		$datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone']));
1196 1196
 	    		$datetime->setTimeZone(new DateTimeZone('UTC'));
1197 1197
 	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1198 1198
 	    	    } else $data['datetime'] = date('Y-m-d H:i:s');
@@ -1208,14 +1208,14 @@  discard block
 block discarded – undo
1208 1208
 		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1209 1209
 		    if (isset($line['aircraftname'])) {
1210 1210
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
1211
-			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
1212
-	    		$aircraft_data = explode('-',$line['aircraftname']);
1211
+			$line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']);
1212
+	    		$aircraft_data = explode('-', $line['aircraftname']);
1213 1213
 	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0];
1214 1214
 	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1];
1215 1215
 	    		else {
1216
-	    		    $aircraft_data = explode(' ',$line['aircraftname']);
1217
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]);
1218
-	    		    else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']);
1216
+	    		    $aircraft_data = explode(' ', $line['aircraftname']);
1217
+	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]);
1218
+	    		    else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']);
1219 1219
 	    		}
1220 1220
 	    	    }
1221 1221
     		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 	    //$buffer = $Common->getData($hosts[$id]);
1241 1241
 	    if ($globalDebug) echo 'Get Data...'."\n";
1242 1242
 	    $buffer = $Common->getData($value['host']);
1243
-	    $all_data = json_decode($buffer,true);
1243
+	    $all_data = json_decode($buffer, true);
1244 1244
 	    if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) {
1245 1245
 		$reset = 0;
1246 1246
 		foreach ($all_data['ACARSData'] as $line) {
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 	    	    //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1252 1252
 	    	    if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username'];
1253 1253
 	    	    if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id'];
1254
-	    	    $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident
1254
+	    	    $data['ident'] = str_replace(' ', '', $line['bid']['flightnum']); // ident
1255 1255
 	    	    if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident'];
1256 1256
 	    	    $data['altitude'] = $line['altitude']; // altitude
1257 1257
 	    	    $data['speed'] = $line['groundspeed']; // speed
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 	    	    //$data['squawk'] = ''; // squawk
1263 1263
 	    	    //$data['emergency'] = ''; // emergency
1264 1264
 	    	    if (isset($value['timezone'])) {
1265
-	    		$datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone']));
1265
+	    		$datetime = new DateTime($line['updated_at'], new DateTimeZone($value['timezone']));
1266 1266
 	    		$datetime->setTimeZone(new DateTimeZone('UTC'));
1267 1267
 	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1268 1268
 	    	    } else $data['datetime'] = date('Y-m-d H:i:s');
@@ -1298,14 +1298,14 @@  discard block
 block discarded – undo
1298 1298
 	    //$buffer = $Common->getData($hosts[$id]);
1299 1299
 	    if ($globalDebug) echo 'Get Data...'."\n";
1300 1300
 	    $buffer = $Common->getData($value['host']);
1301
-	    $all_data = json_decode($buffer,true);
1301
+	    $all_data = json_decode($buffer, true);
1302 1302
 	    if ($buffer != '' && is_array($all_data)) {
1303 1303
 		$reset = 0;
1304 1304
 		foreach ($all_data as $line) {
1305 1305
 	    	    $data = array();
1306 1306
 	    	    //$data['id'] = $line['id']; // id not usable
1307 1307
 	    	    $data['id'] = trim($line['flight_id']);
1308
-	    	    $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex
1308
+	    	    $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex
1309 1309
 	    	    $data['pilot_name'] = $line['pilot_name'];
1310 1310
 	    	    $data['pilot_id'] = $line['pilot_id'];
1311 1311
 	    	    $data['ident'] = trim($line['callsign']); // ident
@@ -1349,24 +1349,24 @@  discard block
 block discarded – undo
1349 1349
 	    //$buffer = $Common->getData($hosts[$id]);
1350 1350
 	    if ($globalDebug) echo 'Get Data...'."\n";
1351 1351
 	    $buffer = $Common->getData($value['host']);
1352
-	    $all_data = json_decode($buffer,true);
1352
+	    $all_data = json_decode($buffer, true);
1353 1353
 	    if ($buffer != '') {
1354 1354
 		$Source->deleteLocationBySource('blitzortung');
1355
-		$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
1356
-		$buffer = explode('\n',$buffer);
1355
+		$buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer));
1356
+		$buffer = explode('\n', $buffer);
1357 1357
 		foreach ($buffer as $buffer_line) {
1358
-		    $line = json_decode($buffer_line,true);
1358
+		    $line = json_decode($buffer_line, true);
1359 1359
 		    if (isset($line['time'])) {
1360 1360
 			$data = array();
1361 1361
 			$data['altitude'] = $line['alt']; // altitude
1362 1362
 			$data['latitude'] = $line['lat']; // lat
1363 1363
 			$data['longitude'] = $line['lon']; // long
1364
-			$data['datetime'] = date('Y-m-d H:i:s',substr($line['time'],0,10));
1364
+			$data['datetime'] = date('Y-m-d H:i:s', substr($line['time'], 0, 10));
1365 1365
 			$data['id_source'] = $id_source;
1366 1366
 			$data['format_source'] = 'blitzortung';
1367 1367
 			$SI->add($data);
1368 1368
 			if ($globalDebug) echo '☈ Lightning added'."\n";
1369
-			$Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']);
1369
+			$Source->addLocation('', $data['latitude'], $data['longitude'], 0, '', '', 'blitzortung', 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime']);
1370 1370
 			unset($data);
1371 1371
 		    }
1372 1372
 		}
@@ -1391,11 +1391,11 @@  discard block
 block discarded – undo
1391 1391
 		    //$value = $formats[$nb];
1392 1392
 		    $format = $globalSources[$nb]['format'];
1393 1393
 		    if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') {
1394
-			$buffer = @socket_read($r, 6000,PHP_NORMAL_READ);
1394
+			$buffer = @socket_read($r, 6000, PHP_NORMAL_READ);
1395 1395
 		    } elseif ($format == 'vrstcp') {
1396 1396
 			$buffer = @socket_read($r, 6000);
1397 1397
 		    } else {
1398
-			$az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port);
1398
+			$az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port);
1399 1399
 		    }
1400 1400
 		    //$buffer = socket_read($r, 60000,PHP_NORMAL_READ);
1401 1401
 		    //echo $buffer."\n";
@@ -1405,8 +1405,8 @@  discard block
 block discarded – undo
1405 1405
 		    //$SI::del();
1406 1406
 		    if ($buffer !== FALSE) {
1407 1407
 			if ($format == 'vrstcp') {
1408
-			    $buffer = explode('},{',$buffer);
1409
-			} else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
1408
+			    $buffer = explode('},{', $buffer);
1409
+			} else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer));
1410 1410
 		    }
1411 1411
 		    // SBS format is CSV format
1412 1412
 		    if ($buffer !== FALSE && $buffer !== '') {
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
 			    $ais_data = $AIS->parse_line(trim($buffer));
1431 1431
 			    $data = array();
1432 1432
 			    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
1433
-			    if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
1433
+			    if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'], -9);
1434 1434
 			    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
1435 1435
 			    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
1436 1436
 			    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
@@ -1441,13 +1441,13 @@  discard block
 block discarded – undo
1441 1441
 			    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
1442 1442
 			    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
1443 1443
 			    if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
1444
-			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1444
+			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']);
1445 1445
 			    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1446 1446
 			    if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1447 1447
 			    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1448 1448
 
1449 1449
 			    if (isset($ais_data['timestamp'])) {
1450
-				$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
1450
+				$data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']);
1451 1451
 			    } else {
1452 1452
 				$data['datetime'] = date('Y-m-d H:i:s');
1453 1453
 			    }
@@ -1458,10 +1458,10 @@  discard block
 block discarded – undo
1458 1458
                         } elseif ($format == 'flightgearsp') {
1459 1459
                     	    //echo $buffer."\n";
1460 1460
                     	    if (strlen($buffer) > 5) {
1461
-				$line = explode(',',$buffer);
1461
+				$line = explode(',', $buffer);
1462 1462
 				$data = array();
1463 1463
 				//XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p
1464
-				$data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6);
1464
+				$data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6);
1465 1465
 				$data['ident'] = $line[6];
1466 1466
 				$data['aircraft_name'] = $line[7];
1467 1467
 				$data['longitude'] = $line[1];
@@ -1478,16 +1478,16 @@  discard block
 block discarded – undo
1478 1478
                         } elseif ($format == 'acars') {
1479 1479
                     	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1480 1480
 			    $ACARS->add(trim($buffer));
1481
-			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
1481
+			    socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port);
1482 1482
 			    $ACARS->deleteLiveAcarsData();
1483 1483
 			} elseif ($format == 'flightgearmp') {
1484
-			    if (substr($buffer,0,1) != '#') {
1484
+			    if (substr($buffer, 0, 1) != '#') {
1485 1485
 				$data = array();
1486 1486
 				//echo $buffer."\n";
1487
-				$line = explode(' ',$buffer);
1487
+				$line = explode(' ', $buffer);
1488 1488
 				if (count($line) == 11) {
1489
-				    $userserver = explode('@',$line[0]);
1490
-				    $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex
1489
+				    $userserver = explode('@', $line[0]);
1490
+				    $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex
1491 1491
 				    $data['ident'] = $userserver[0];
1492 1492
 				    $data['registration'] = $userserver[0];
1493 1493
 				    $data['latitude'] = $line[4];
@@ -1495,8 +1495,8 @@  discard block
 block discarded – undo
1495 1495
 				    $data['altitude'] = $line[6];
1496 1496
 				    $data['datetime'] = date('Y-m-d H:i:s');
1497 1497
 				    $aircraft_type = $line[10];
1498
-				    $aircraft_type = preg_split(':/:',$aircraft_type);
1499
-				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
1498
+				    $aircraft_type = preg_split(':/:', $aircraft_type);
1499
+				    $data['aircraft_name'] = substr(end($aircraft_type), 0, -4);
1500 1500
 				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1501 1501
 				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1502 1502
 				}
@@ -1505,8 +1505,8 @@  discard block
 block discarded – undo
1505 1505
 			    echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n";
1506 1506
 			    die;
1507 1507
 			} elseif ($format == 'vrstcp') {
1508
-			    foreach($buffer as $all_data) {
1509
-				$line = json_decode('{'.$all_data.'}',true);
1508
+			    foreach ($buffer as $all_data) {
1509
+				$line = json_decode('{'.$all_data.'}', true);
1510 1510
 				$data = array();
1511 1511
 				if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex
1512 1512
 				if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
@@ -1532,16 +1532,16 @@  discard block
 block discarded – undo
1532 1532
 				if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data);
1533 1533
 				unset($data);
1534 1534
 			    }
1535
-			} elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') {
1535
+			} elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') {
1536 1536
 			    $line = explode("\t", $buffer);
1537
-			    for($k = 0; $k < count($line); $k=$k+2) {
1537
+			    for ($k = 0; $k < count($line); $k = $k + 2) {
1538 1538
 				$key = $line[$k];
1539
-			        $lined[$key] = $line[$k+1];
1539
+			        $lined[$key] = $line[$k + 1];
1540 1540
 			    }
1541 1541
     			    if (count($lined) > 3) {
1542 1542
     				$data['hex'] = $lined['hexid'];
1543 1543
     				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
1544
-    				$data['datetime'] = date('Y-m-d H:i:s');;
1544
+    				$data['datetime'] = date('Y-m-d H:i:s'); ;
1545 1545
     				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
1546 1546
     				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
1547 1547
     				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
@@ -1560,23 +1560,23 @@  discard block
 block discarded – undo
1560 1560
     			    } else $error = true;
1561 1561
 			} elseif ($format == 'aprs' && $use_aprs) {
1562 1562
 			    if ($aprs_connect == 0) {
1563
-				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
1563
+				$send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0);
1564 1564
 				$aprs_connect = 1;
1565 1565
 			    }
1566 1566
 			    
1567
-			    if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) {
1567
+			    if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) {
1568 1568
 				$aprs_last_tx = time();
1569 1569
 				$data_aprs = "# Keep alive";
1570
-				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
1570
+				$send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0);
1571 1571
 			    }
1572 1572
 			    
1573 1573
 			    //echo 'Connect : '.$aprs_connect.' '.$buffer."\n";
1574 1574
 			    //echo 'APRS data : '.$buffer."\n";
1575
-			    $buffer = str_replace('APRS <- ','',$buffer);
1576
-			    $buffer = str_replace('APRS -> ','',$buffer);
1575
+			    $buffer = str_replace('APRS <- ', '', $buffer);
1576
+			    $buffer = str_replace('APRS -> ', '', $buffer);
1577 1577
 			    //echo $buffer."\n";
1578 1578
 			    date_default_timezone_set('UTC');
1579
-			    if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') {
1579
+			    if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') {
1580 1580
 				$line = $APRS->parse($buffer);
1581 1581
 				//if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) {
1582 1582
 				if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) {
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
 				    if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date'];
1592 1592
 				    if (isset($line['typeid'])) $data['type_id'] = $line['typeid'];
1593 1593
 				    if (isset($line['statusid'])) $data['status_id'] = $line['statusid'];
1594
-				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
1594
+				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']);
1595 1595
 				    else $data['datetime'] = date('Y-m-d H:i:s');
1596 1596
 				    //$data['datetime'] = date('Y-m-d H:i:s');
1597 1597
 				    if (isset($line['ident'])) $data['ident'] = $line['ident'];
@@ -1674,29 +1674,29 @@  discard block
 block discarded – undo
1674 1674
 				    } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) {
1675 1675
 					if (!isset($data['altitude'])) $data['altitude'] = 0;
1676 1676
 					$Source->deleteOldLocationByType('gs');
1677
-					if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) {
1678
-						$Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']);
1677
+					if (count($Source->getLocationInfoByNameType($data['ident'], 'gs')) > 0) {
1678
+						$Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']);
1679 1679
 					} else {
1680
-						$Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']);
1680
+						$Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']);
1681 1681
 					}
1682 1682
 				    } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') {
1683 1683
 					//if ($globalDebug) echo '!! Weather Station not yet supported'."\n";
1684 1684
 					if ($globalDebug) echo '# Weather Station added'."\n";
1685 1685
 					$Source->deleteOldLocationByType('wx');
1686 1686
 					$weather_data = json_encode($line);
1687
-					if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) {
1688
-						$Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data);
1687
+					if (count($Source->getLocationInfoByNameType($data['ident'], 'wx')) > 0) {
1688
+						$Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data);
1689 1689
 					} else {
1690
-						$Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data);
1690
+						$Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data);
1691 1691
 					}
1692 1692
 				    } elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) {
1693 1693
 					//if ($globalDebug) echo '!! Weather Station not yet supported'."\n";
1694 1694
 					if ($globalDebug) echo '☈ Lightning added'."\n";
1695 1695
 					$Source->deleteOldLocationByType('lightning');
1696
-					if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) {
1697
-						$Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']);
1696
+					if (count($Source->getLocationInfoByNameType($data['ident'], 'lightning')) > 0) {
1697
+						$Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']);
1698 1698
 					} else {
1699
-						$Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']);
1699
+						$Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']);
1700 1700
 					}
1701 1701
 				    } elseif ($globalDebug) {
1702 1702
 				    	echo '/!\ Not added: '.$buffer."\n";
@@ -1705,7 +1705,7 @@  discard block
 block discarded – undo
1705 1705
 				    unset($data);
1706 1706
 				}
1707 1707
 				elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') {
1708
-					$Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']);
1708
+					$Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']);
1709 1709
 				}
1710 1710
 				/*
1711 1711
 				elseif (is_array($line) && $globalDebug && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] == 'Car' || $line['symbol'] == 'Ambulance' || $line['symbol'] == 'Van' || $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || $line['symbol'] == 'Motorcycle')) {
@@ -1714,7 +1714,7 @@  discard block
 block discarded – undo
1714 1714
 				*/
1715 1715
 				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n";
1716 1716
 				elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n";
1717
-				if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) {
1717
+				if (isset($globalSources[$nb]['last_weather_clean']) && time() - $globalSources[$nb]['last_weather_clean'] > 60*5) {
1718 1718
 					$Source->deleteOldLocationByType('lightning');
1719 1719
 					$Source->deleteOldLocationByType('wx');
1720 1720
 					$globalSources[$nb]['last_weather_clean'] = time();
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
 				connect_all($sourceee);
1800 1800
 				$sourceee = array();
1801 1801
 				//connect_all($globalSources);
1802
-				$tt[$format]=0;
1802
+				$tt[$format] = 0;
1803 1803
 				break;
1804 1804
 			    } 
1805 1805
 			    //else if ($globalDebug) echo "Trying again (".$tt[$format]."x) ".$format."...";
@@ -1809,14 +1809,14 @@  discard block
 block discarded – undo
1809 1809
 	    } else {
1810 1810
 		$error = socket_strerror(socket_last_error());
1811 1811
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) {
1812
-			if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1812
+			if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n";
1813 1813
 			if (isset($globalDebug)) echo "Restarting...\n";
1814 1814
 			// Restart the script if possible
1815 1815
 			if (is_array($sockets)) {
1816 1816
 			    if ($globalDebug) echo "Shutdown all sockets...";
1817 1817
 			    
1818 1818
 			    foreach ($sockets as $sock) {
1819
-				@socket_shutdown($sock,2);
1819
+				@socket_shutdown($sock, 2);
1820 1820
 				@socket_close($sock);
1821 1821
 			    }
1822 1822
 			    
Please login to merge, or discard this patch.
Indentation   +1022 added lines, -1022 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 require_once(dirname(__FILE__).'/../require/class.Common.php');
17 17
 if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
18 18
 if (isset($globalMarine) && $globalMarine) {
19
-    require_once(dirname(__FILE__).'/../require/class.AIS.php');
20
-    require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
19
+	require_once(dirname(__FILE__).'/../require/class.AIS.php');
20
+	require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
21 21
 }
22 22
 
23 23
 if (!isset($globalDebug)) $globalDebug = FALSE;
@@ -25,46 +25,46 @@  discard block
 block discarded – undo
25 25
 // Check if schema is at latest version
26 26
 $Connection = new Connection();
27 27
 if ($Connection->connectionExists() === false) {
28
-    echo "Can't connect to your database. Check DB is running, user/password and database logs.";
29
-    exit();
28
+	echo "Can't connect to your database. Check DB is running, user/password and database logs.";
29
+	exit();
30 30
 }
31 31
 if ($Connection->latest() === false) {
32
-    echo "You MUST update to latest schema. Run install/index.php";
33
-    exit();
32
+	echo "You MUST update to latest schema. Run install/index.php";
33
+	exit();
34 34
 }
35 35
 if (PHP_SAPI != 'cli') {
36
-    echo "This script MUST be called from console, not a web browser.";
36
+	echo "This script MUST be called from console, not a web browser.";
37 37
 //    exit();
38 38
 }
39 39
 
40 40
 // This is to be compatible with old version of settings.php
41 41
 if (!isset($globalSources)) {
42
-    if (isset($globalSBS1Hosts)) {
43
-        //$hosts = $globalSBS1Hosts;
44
-        foreach ($globalSBS1Hosts as $host) {
45
-	    $globalSources[] = array('host' => $host);
46
-    	}
47
-    } else {
48
-        if (!isset($globalSBS1Host)) {
49
-	    echo '$globalSources MUST be defined !';
50
-	    die;
42
+	if (isset($globalSBS1Hosts)) {
43
+		//$hosts = $globalSBS1Hosts;
44
+		foreach ($globalSBS1Hosts as $host) {
45
+		$globalSources[] = array('host' => $host);
46
+		}
47
+	} else {
48
+		if (!isset($globalSBS1Host)) {
49
+		echo '$globalSources MUST be defined !';
50
+		die;
51 51
 	}
52 52
 	//$hosts = array($globalSBS1Host.':'.$globalSBS1Port);
53 53
 	$globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port);
54
-    }
54
+	}
55 55
 }
56 56
 
57 57
 $options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver','enable-aircraft','disable-aircraft','enable-tracker','disable-tracker','enable-marine','disable-marine'));
58 58
 //if (isset($options['s'])) $hosts = array($options['s']);
59 59
 //elseif (isset($options['source'])) $hosts = array($options['source']);
60 60
 if (isset($options['s'])) {
61
-    $globalSources = array();
62
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']);
63
-    else $globalSources[] = array('host' => $options['s']);
61
+	$globalSources = array();
62
+	if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']);
63
+	else $globalSources[] = array('host' => $options['s']);
64 64
 } elseif (isset($options['source'])) {
65
-    $globalSources = array();
66
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']);
67
-    else $globalSources[] = array('host' => $options['source']);
65
+	$globalSources = array();
66
+	if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']);
67
+	else $globalSources[] = array('host' => $options['source']);
68 68
 }
69 69
 if (isset($options['aprsserverhost'])) {
70 70
 	$globalServerAPRS = TRUE;
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 if (isset($options['idsource'])) $id_source = $options['idsource'];
104 104
 else $id_source = 1;
105 105
 if (isset($globalServer) && $globalServer) {
106
-    if ($globalDebug) echo "Using Server Mode\n";
107
-    $SI=new SpotterServer();
106
+	if ($globalDebug) echo "Using Server Mode\n";
107
+	$SI=new SpotterServer();
108 108
 /*
109 109
     require_once(dirname(__FILE__).'/../require/class.APRS.php');
110 110
     $SI = new adsb2aprs();
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 
115 115
 if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
116 116
 if (isset($globalMarine) && $globalMarine) {
117
-    require_once(dirname(__FILE__).'/../require/class.AIS.php');
118
-    require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
117
+	require_once(dirname(__FILE__).'/../require/class.AIS.php');
118
+	require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
119 119
 }
120 120
 
121 121
 if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
122 122
 if (isset($globalMarine) && $globalMarine) {
123
-    $AIS = new AIS();
124
-    $MI = new MarineImport($Connection->db);
123
+	$AIS = new AIS();
124
+	$MI = new MarineImport($Connection->db);
125 125
 }
126 126
 //$APRS=new APRS($Connection->db);
127 127
 $SBS=new SBS();
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 //$servertz = system('date +%Z');
135 135
 // signal handler - playing nice with sockets and dump1090
136 136
 if (function_exists('pcntl_fork')) {
137
-    pcntl_signal(SIGINT,  function() {
138
-        global $sockets;
139
-        echo "\n\nctrl-c or kill signal received. Tidying up ... ";
140
-        die("Bye!\n");
141
-    });
142
-    pcntl_signal_dispatch();
137
+	pcntl_signal(SIGINT,  function() {
138
+		global $sockets;
139
+		echo "\n\nctrl-c or kill signal received. Tidying up ... ";
140
+		die("Bye!\n");
141
+	});
142
+	pcntl_signal_dispatch();
143 143
 }
144 144
 
145 145
 // let's try and connect
@@ -149,36 +149,36 @@  discard block
 block discarded – undo
149 149
 $reset = 0;
150 150
 
151 151
 function connect_all($hosts) {
152
-    //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
153
-    global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context;
154
-    $reset++;
155
-    if ($globalDebug) echo 'Connect to all...'."\n";
156
-    foreach ($hosts as $id => $value) {
152
+	//global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
153
+	global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context;
154
+	$reset++;
155
+	if ($globalDebug) echo 'Connect to all...'."\n";
156
+	foreach ($hosts as $id => $value) {
157 157
 	$host = $value['host'];
158 158
 	$globalSources[$id]['last_exec'] = 0;
159 159
 	// Here we check type of source(s)
160 160
 	if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) {
161
-            if (preg_match('/deltadb.txt$/i',$host)) {
162
-        	//$formats[$id] = 'deltadbtxt';
163
-        	$globalSources[$id]['format'] = 'deltadbtxt';
164
-        	//$last_exec['deltadbtxt'] = 0;
165
-        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
166
-            } else if (preg_match('/vatsim-data.txt$/i',$host)) {
167
-        	//$formats[$id] = 'vatsimtxt';
168
-        	$globalSources[$id]['format'] = 'vatsimtxt';
169
-        	//$last_exec['vatsimtxt'] = 0;
170
-        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
171
-    	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
172
-        	//$formats[$id] = 'aircraftlistjson';
173
-        	$globalSources[$id]['format'] = 'aircraftlistjson';
174
-        	//$last_exec['aircraftlistjson'] = 0;
175
-        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
176
-    	    } else if (preg_match('/opensky/i',$host)) {
177
-        	//$formats[$id] = 'aircraftlistjson';
178
-        	$globalSources[$id]['format'] = 'opensky';
179
-        	//$last_exec['aircraftlistjson'] = 0;
180
-        	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
181
-    	    /*
161
+			if (preg_match('/deltadb.txt$/i',$host)) {
162
+			//$formats[$id] = 'deltadbtxt';
163
+			$globalSources[$id]['format'] = 'deltadbtxt';
164
+			//$last_exec['deltadbtxt'] = 0;
165
+			if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
166
+			} else if (preg_match('/vatsim-data.txt$/i',$host)) {
167
+			//$formats[$id] = 'vatsimtxt';
168
+			$globalSources[$id]['format'] = 'vatsimtxt';
169
+			//$last_exec['vatsimtxt'] = 0;
170
+			if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
171
+			} else if (preg_match('/aircraftlist.json$/i',$host)) {
172
+			//$formats[$id] = 'aircraftlistjson';
173
+			$globalSources[$id]['format'] = 'aircraftlistjson';
174
+			//$last_exec['aircraftlistjson'] = 0;
175
+			if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
176
+			} else if (preg_match('/opensky/i',$host)) {
177
+			//$formats[$id] = 'aircraftlistjson';
178
+			$globalSources[$id]['format'] = 'opensky';
179
+			//$last_exec['aircraftlistjson'] = 0;
180
+			if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
181
+			/*
182 182
     	    // Disabled for now, site change source format
183 183
     	    } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) {
184 184
         	//$formats[$id] = 'radarvirtueljson';
@@ -190,125 +190,125 @@  discard block
 block discarded – undo
190 190
         	    exit(0);
191 191
         	}
192 192
     	    */
193
-    	    } else if (preg_match('/planeUpdateFAA.php$/i',$host)) {
194
-        	//$formats[$id] = 'planeupdatefaa';
195
-        	$globalSources[$id]['format'] = 'planeupdatefaa';
196
-        	//$last_exec['planeupdatefaa'] = 0;
197
-        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
198
-        	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
199
-        	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
200
-        	    exit(0);
201
-        	}
202
-            } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) {
203
-        	//$formats[$id] = 'phpvmacars';
204
-        	$globalSources[$id]['format'] = 'phpvmacars';
205
-        	//$last_exec['phpvmacars'] = 0;
206
-        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
207
-            } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) {
208
-        	//$formats[$id] = 'phpvmacars';
209
-        	$globalSources[$id]['format'] = 'vaos';
210
-        	//$last_exec['phpvmacars'] = 0;
211
-        	if ($globalDebug) echo "Connect to vaos source (".$host.")...\n";
212
-            } else if (preg_match('/VAM-json.php$/i',$host)) {
213
-        	//$formats[$id] = 'phpvmacars';
214
-        	$globalSources[$id]['format'] = 'vam';
215
-        	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
216
-            } else if (preg_match('/whazzup/i',$host)) {
217
-        	//$formats[$id] = 'whazzup';
218
-        	$globalSources[$id]['format'] = 'whazzup';
219
-        	//$last_exec['whazzup'] = 0;
220
-        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
221
-            } else if (preg_match('/blitzortung/i',$host)) {
222
-        	$globalSources[$id]['format'] = 'blitzortung';
223
-        	if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n";
224
-            } else if (preg_match('/airwhere/i',$host)) {
225
-        	$globalSources[$id]['format'] = 'airwhere';
226
-        	if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n";
227
-            } else if (preg_match('/recentpireps/i',$host)) {
228
-        	//$formats[$id] = 'pirepsjson';
229
-        	$globalSources[$id]['format'] = 'pirepsjson';
230
-        	//$last_exec['pirepsjson'] = 0;
231
-        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
232
-            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
233
-        	//$formats[$id] = 'fr24json';
234
-        	$globalSources[$id]['format'] = 'fr24json';
235
-        	//$last_exec['fr24json'] = 0;
236
-        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
237
-        	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
238
-        	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
239
-        	    exit(0);
240
-        	}
241
-            } else if (preg_match(':myshiptracking.com/:i',$host)) {
242
-        	//$formats[$id] = 'fr24json';
243
-        	$globalSources[$id]['format'] = 'myshiptracking';
244
-        	//$last_exec['fr24json'] = 0;
245
-        	if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n";
246
-        	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
247
-        	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
248
-        	    exit(0);
249
-        	}
250
-            //} else if (preg_match('/10001/',$host)) {
251
-            } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
252
-        	//$formats[$id] = 'tsv';
253
-        	$globalSources[$id]['format'] = 'tsv';
254
-        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
255
-            }
256
-        } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
257
-    		if ($globalSources[$id]['format'] == 'aisnmeahttp') {
258
-    		    $idf = fopen($globalSources[$id]['host'],'r',false,$context);
259
-    		    if ($idf !== false) {
260
-    			$httpfeeds[$id] = $idf;
261
-        		if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
262
-    		    } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n";
263
-    		} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
264
-        } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
265
-	    $hostport = explode(':',$host);
266
-	    if (isset($hostport[1])) {
193
+			} else if (preg_match('/planeUpdateFAA.php$/i',$host)) {
194
+			//$formats[$id] = 'planeupdatefaa';
195
+			$globalSources[$id]['format'] = 'planeupdatefaa';
196
+			//$last_exec['planeupdatefaa'] = 0;
197
+			if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
198
+			if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
199
+				echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
200
+				exit(0);
201
+			}
202
+			} else if (preg_match('/\/action.php\/acars\/data$/i',$host)) {
203
+			//$formats[$id] = 'phpvmacars';
204
+			$globalSources[$id]['format'] = 'phpvmacars';
205
+			//$last_exec['phpvmacars'] = 0;
206
+			if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
207
+			} else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) {
208
+			//$formats[$id] = 'phpvmacars';
209
+			$globalSources[$id]['format'] = 'vaos';
210
+			//$last_exec['phpvmacars'] = 0;
211
+			if ($globalDebug) echo "Connect to vaos source (".$host.")...\n";
212
+			} else if (preg_match('/VAM-json.php$/i',$host)) {
213
+			//$formats[$id] = 'phpvmacars';
214
+			$globalSources[$id]['format'] = 'vam';
215
+			if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
216
+			} else if (preg_match('/whazzup/i',$host)) {
217
+			//$formats[$id] = 'whazzup';
218
+			$globalSources[$id]['format'] = 'whazzup';
219
+			//$last_exec['whazzup'] = 0;
220
+			if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
221
+			} else if (preg_match('/blitzortung/i',$host)) {
222
+			$globalSources[$id]['format'] = 'blitzortung';
223
+			if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n";
224
+			} else if (preg_match('/airwhere/i',$host)) {
225
+			$globalSources[$id]['format'] = 'airwhere';
226
+			if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n";
227
+			} else if (preg_match('/recentpireps/i',$host)) {
228
+			//$formats[$id] = 'pirepsjson';
229
+			$globalSources[$id]['format'] = 'pirepsjson';
230
+			//$last_exec['pirepsjson'] = 0;
231
+			if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
232
+			} else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
233
+			//$formats[$id] = 'fr24json';
234
+			$globalSources[$id]['format'] = 'fr24json';
235
+			//$last_exec['fr24json'] = 0;
236
+			if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
237
+			if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
238
+				echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
239
+				exit(0);
240
+			}
241
+			} else if (preg_match(':myshiptracking.com/:i',$host)) {
242
+			//$formats[$id] = 'fr24json';
243
+			$globalSources[$id]['format'] = 'myshiptracking';
244
+			//$last_exec['fr24json'] = 0;
245
+			if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n";
246
+			if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
247
+				echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
248
+				exit(0);
249
+			}
250
+			//} else if (preg_match('/10001/',$host)) {
251
+			} else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
252
+			//$formats[$id] = 'tsv';
253
+			$globalSources[$id]['format'] = 'tsv';
254
+			if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
255
+			}
256
+		} elseif (filter_var($host,FILTER_VALIDATE_URL)) {
257
+			if ($globalSources[$id]['format'] == 'aisnmeahttp') {
258
+				$idf = fopen($globalSources[$id]['host'],'r',false,$context);
259
+				if ($idf !== false) {
260
+				$httpfeeds[$id] = $idf;
261
+				if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
262
+				} elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n";
263
+			} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
264
+		} elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
265
+		$hostport = explode(':',$host);
266
+		if (isset($hostport[1])) {
267 267
 		$port = $hostport[1];
268 268
 		$hostn = $hostport[0];
269
-	    } else {
269
+		} else {
270 270
 		$port = $globalSources[$id]['port'];
271 271
 		$hostn = $globalSources[$id]['host'];
272
-	    }
273
-	    $Common = new Common();
274
-	    if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) {
275
-        	$s = $Common->create_socket($hostn,$port, $errno, $errstr);
276
-    	    } else {
277
-        	$s = $Common->create_socket_udp($hostn,$port, $errno, $errstr);
278
-	    }
279
-	    if ($s) {
280
-    	        $sockets[$id] = $s;
281
-    	        if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') {
282
-		    if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') {
272
+		}
273
+		$Common = new Common();
274
+		if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) {
275
+			$s = $Common->create_socket($hostn,$port, $errno, $errstr);
276
+			} else {
277
+			$s = $Common->create_socket_udp($hostn,$port, $errno, $errstr);
278
+		}
279
+		if ($s) {
280
+				$sockets[$id] = $s;
281
+				if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') {
282
+			if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') {
283 283
 			//$formats[$id] = 'aprs';
284 284
 			$globalSources[$id]['format'] = 'aprs';
285 285
 			//$aprs_connect = 0;
286 286
 			//$use_aprs = true;
287
-		    } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') {
287
+			} elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') {
288 288
 			$globalSources[$id]['format'] = 'vrstcp';
289
-    		    } elseif ($port == '10001') {
290
-        		//$formats[$id] = 'tsv';
291
-        		$globalSources[$id]['format'] = 'tsv';
292
-		    } elseif ($port == '30002') {
293
-        		//$formats[$id] = 'raw';
294
-        		$globalSources[$id]['format'] = 'raw';
295
-		    } elseif ($port == '5001') {
296
-        		//$formats[$id] = 'raw';
297
-        		$globalSources[$id]['format'] = 'flightgearmp';
298
-		    } elseif ($port == '30005') {
289
+				} elseif ($port == '10001') {
290
+				//$formats[$id] = 'tsv';
291
+				$globalSources[$id]['format'] = 'tsv';
292
+			} elseif ($port == '30002') {
293
+				//$formats[$id] = 'raw';
294
+				$globalSources[$id]['format'] = 'raw';
295
+			} elseif ($port == '5001') {
296
+				//$formats[$id] = 'raw';
297
+				$globalSources[$id]['format'] = 'flightgearmp';
298
+			} elseif ($port == '30005') {
299 299
 			// Not yet supported
300
-        		//$formats[$id] = 'beast';
301
-        		$globalSources[$id]['format'] = 'beast';
302
-		    //} else $formats[$id] = 'sbs';
303
-		    } else $globalSources[$id]['format'] = 'sbs';
304
-		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
300
+				//$formats[$id] = 'beast';
301
+				$globalSources[$id]['format'] = 'beast';
302
+			//} else $formats[$id] = 'sbs';
303
+			} else $globalSources[$id]['format'] = 'sbs';
304
+			//if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
305 305
 		}
306 306
 		if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
307
-            } else {
307
+			} else {
308 308
 		if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
309
-    	    }
310
-        }
311
-    }
309
+			}
310
+		}
311
+	}
312 312
 }
313 313
 if (!isset($globalMinFetch)) $globalMinFetch = 15;
314 314
 
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 //connect_all($globalSources);
332 332
 
333 333
 if (isset($globalProxy) && $globalProxy) {
334
-    $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true)));
334
+	$context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true)));
335 335
 } else {
336
-    $context = stream_context_create(array('http' => array('timeout' => $timeout)));
336
+	$context = stream_context_create(array('http' => array('timeout' => $timeout)));
337 337
 }
338 338
 
339 339
 // APRS Configuration
@@ -342,21 +342,21 @@  discard block
 block discarded – undo
342 342
 	die;
343 343
 }
344 344
 foreach ($globalSources as $key => $source) {
345
-    if (!isset($source['format'])) {
346
-        $globalSources[$key]['format'] = 'auto';
347
-    }
348
-    if (isset($source['callback']) && $source['callback'] === TRUE) {
349
-        unset($globalSources[$key]);
350
-    }
345
+	if (!isset($source['format'])) {
346
+		$globalSources[$key]['format'] = 'auto';
347
+	}
348
+	if (isset($source['callback']) && $source['callback'] === TRUE) {
349
+		unset($globalSources[$key]);
350
+	}
351 351
 }
352 352
 connect_all($globalSources);
353 353
 foreach ($globalSources as $key => $source) {
354
-    if (isset($source['format']) && $source['format'] == 'aprs') {
354
+	if (isset($source['format']) && $source['format'] == 'aprs') {
355 355
 	$aprs_connect = 0;
356 356
 	$use_aprs = true;
357 357
 	if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true;
358 358
 	break;
359
-    }
359
+	}
360 360
 }
361 361
 
362 362
 if ($use_aprs) {
@@ -397,131 +397,131 @@  discard block
 block discarded – undo
397 397
 
398 398
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
399 399
 while ($i > 0) {
400
-    if (!$globalDaemon) $i = $endtime-time();
401
-    // Delete old ATC
402
-    if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
400
+	if (!$globalDaemon) $i = $endtime-time();
401
+	// Delete old ATC
402
+	if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
403 403
 	if ($globalDebug) echo 'Delete old ATC...'."\n";
404
-        $ATC->deleteOldATC();
405
-    }
404
+		$ATC->deleteOldATC();
405
+	}
406 406
     
407
-    if (count($last_exec) == count($globalSources)) {
407
+	if (count($last_exec) == count($globalSources)) {
408 408
 	$max = $globalMinFetch;
409 409
 	foreach ($last_exec as $last) {
410
-	    if ((time() - $last['last']) < $max) $max = time() - $last['last'];
410
+		if ((time() - $last['last']) < $max) $max = time() - $last['last'];
411 411
 	}
412 412
 	if ($max != $globalMinFetch) {
413
-	    if ($globalDebug) echo 'Sleeping...'."\n";
414
-	    sleep($globalMinFetch-$max+2);
413
+		if ($globalDebug) echo 'Sleeping...'."\n";
414
+		sleep($globalMinFetch-$max+2);
415
+	}
415 416
 	}
416
-    }
417 417
 
418 418
     
419
-    //foreach ($formats as $id => $value) {
420
-    foreach ($globalSources as $id => $value) {
419
+	//foreach ($formats as $id => $value) {
420
+	foreach ($globalSources as $id => $value) {
421 421
 	date_default_timezone_set('UTC');
422 422
 	//if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n";
423 423
 	if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0;
424 424
 	if ($value['format'] == 'deltadbtxt' && 
425
-	    (
425
+		(
426 426
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
427 427
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
428
-	    )
428
+		)
429 429
 	) {
430
-	    //$buffer = $Common->getData($hosts[$id]);
431
-	    $buffer = $Common->getData($value['host']);
432
-	    if ($buffer != '') $reset = 0;
433
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
434
-	    $buffer = explode('\n',$buffer);
435
-	    foreach ($buffer as $line) {
436
-    		if ($line != '' && count($line) > 7) {
437
-    		    $line = explode(',', $line);
438
-	            $data = array();
439
-	            $data['hex'] = $line[1]; // hex
440
-	            $data['ident'] = $line[2]; // ident
441
-	            if (isset($line[3])) $data['altitude'] = $line[3]; // altitude
442
-	            if (isset($line[4])) $data['speed'] = $line[4]; // speed
443
-	            if (isset($line[5])) $data['heading'] = $line[5]; // heading
444
-	            if (isset($line[6])) $data['latitude'] = $line[6]; // lat
445
-	            if (isset($line[7])) $data['longitude'] = $line[7]; // long
446
-	            $data['verticalrate'] = ''; // vertical rate
447
-	            //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk
448
-	            $data['emergency'] = ''; // emergency
449
-		    $data['datetime'] = date('Y-m-d H:i:s');
450
-		    $data['format_source'] = 'deltadbtxt';
451
-    		    $data['id_source'] = $id_source;
452
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
453
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
454
-		    if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
455
-    		    $SI->add($data);
456
-		    unset($data);
457
-    		}
458
-    	    }
459
-    	    $last_exec[$id]['last'] = time();
430
+		//$buffer = $Common->getData($hosts[$id]);
431
+		$buffer = $Common->getData($value['host']);
432
+		if ($buffer != '') $reset = 0;
433
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
434
+		$buffer = explode('\n',$buffer);
435
+		foreach ($buffer as $line) {
436
+			if ($line != '' && count($line) > 7) {
437
+				$line = explode(',', $line);
438
+				$data = array();
439
+				$data['hex'] = $line[1]; // hex
440
+				$data['ident'] = $line[2]; // ident
441
+				if (isset($line[3])) $data['altitude'] = $line[3]; // altitude
442
+				if (isset($line[4])) $data['speed'] = $line[4]; // speed
443
+				if (isset($line[5])) $data['heading'] = $line[5]; // heading
444
+				if (isset($line[6])) $data['latitude'] = $line[6]; // lat
445
+				if (isset($line[7])) $data['longitude'] = $line[7]; // long
446
+				$data['verticalrate'] = ''; // vertical rate
447
+				//if (isset($line[9])) $data['squawk'] = $line[9]; // squawk
448
+				$data['emergency'] = ''; // emergency
449
+			$data['datetime'] = date('Y-m-d H:i:s');
450
+			$data['format_source'] = 'deltadbtxt';
451
+				$data['id_source'] = $id_source;
452
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
453
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
454
+			if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
455
+				$SI->add($data);
456
+			unset($data);
457
+			}
458
+			}
459
+			$last_exec[$id]['last'] = time();
460 460
 	} elseif ($value['format'] == 'aisnmeatxt' && 
461
-	    (
461
+		(
462 462
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
463 463
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3))
464
-	    )
464
+		)
465 465
 	) {
466
-	    date_default_timezone_set('CET');
467
-	    $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host']));
468
-	    date_default_timezone_set('UTC');
469
-	    if ($buffer != '') $reset = 0;
470
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
471
-	    $buffer = explode('\n',$buffer);
472
-	    foreach ($buffer as $line) {
466
+		date_default_timezone_set('CET');
467
+		$buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host']));
468
+		date_default_timezone_set('UTC');
469
+		if ($buffer != '') $reset = 0;
470
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
471
+		$buffer = explode('\n',$buffer);
472
+		foreach ($buffer as $line) {
473 473
 		if ($line != '') {
474
-		    //echo "'".$line."'\n";
475
-		    $add = false;
476
-		    $ais_data = $AIS->parse_line(trim($line));
477
-		    $data = array();
478
-		    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
479
-		    if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
480
-		    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
481
-		    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
482
-		    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
483
-		    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
484
-		    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
485
-		    if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
486
-		    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
487
-		    if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid'];
488
-		    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
489
-		    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
490
-		    if (isset($ais_data['timestamp'])) {
474
+			//echo "'".$line."'\n";
475
+			$add = false;
476
+			$ais_data = $AIS->parse_line(trim($line));
477
+			$data = array();
478
+			if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
479
+			if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
480
+			if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
481
+			if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
482
+			if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
483
+			if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
484
+			if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
485
+			if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
486
+			if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
487
+			if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid'];
488
+			if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
489
+			if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
490
+			if (isset($ais_data['timestamp'])) {
491 491
 			$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
492 492
 			if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) {
493
-			    $last_exec[$id]['timestamp'] = $ais_data['timestamp'];
494
-			    $add = true;
493
+				$last_exec[$id]['timestamp'] = $ais_data['timestamp'];
494
+				$add = true;
495 495
 			}
496
-		    } else {
496
+			} else {
497 497
 			$data['datetime'] = date('Y-m-d H:i:s');
498 498
 			$add = true;
499
-		    }
500
-		    $data['format_source'] = 'aisnmeatxt';
501
-    		    $data['id_source'] = $id_source;
502
-		    //print_r($data);
503
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
504
-		    if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
505
-		    unset($data);
499
+			}
500
+			$data['format_source'] = 'aisnmeatxt';
501
+				$data['id_source'] = $id_source;
502
+			//print_r($data);
503
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
504
+			if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
505
+			unset($data);
506 506
 		}
507
-    	    }
508
-    	    $last_exec[$id]['last'] = time();
507
+			}
508
+			$last_exec[$id]['last'] = time();
509 509
 	} elseif ($value['format'] == 'aisnmeahttp') {
510
-	    $arr = $httpfeeds;
511
-	    $w = $e = null;
510
+		$arr = $httpfeeds;
511
+		$w = $e = null;
512 512
 	    
513
-	    if (isset($arr[$id])) {
513
+		if (isset($arr[$id])) {
514 514
 		$nn = stream_select($arr,$w,$e,$timeout);
515 515
 		if ($nn > 0) {
516
-		    foreach ($httpfeeds as $feed) {
516
+			foreach ($httpfeeds as $feed) {
517 517
 			$buffer = stream_get_line($feed,2000,"\n");
518 518
 			if ($buffer === FALSE) {
519
-			    connect_all($globalSources);
519
+				connect_all($globalSources);
520 520
 			}
521 521
 			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
522 522
 			$buffer = explode('\n',$buffer);
523 523
 			foreach ($buffer as $line) {
524
-			    if ($line != '') {
524
+				if ($line != '') {
525 525
 				$ais_data = $AIS->parse_line(trim($line));
526 526
 				$data = array();
527 527
 				if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
@@ -539,117 +539,117 @@  discard block
 block discarded – undo
539 539
 				if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
540 540
 				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
541 541
 				if (isset($ais_data['timestamp'])) {
542
-				    $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
542
+					$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
543 543
 				} else {
544
-				    $data['datetime'] = date('Y-m-d H:i:s');
544
+					$data['datetime'] = date('Y-m-d H:i:s');
545 545
 				}
546 546
 				$data['format_source'] = 'aisnmeahttp';
547 547
 				$data['id_source'] = $id_source;
548 548
 				if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
549 549
 				if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
550 550
 				unset($data);
551
-			    }
551
+				}
552
+			}
552 553
 			}
553
-		    }
554 554
 		} else {
555
-		    $format = $value['format'];
556
-		    if (isset($tt[$format])) $tt[$format]++;
557
-		    else $tt[$format] = 0;
558
-		    if ($tt[$format] > 30) {
555
+			$format = $value['format'];
556
+			if (isset($tt[$format])) $tt[$format]++;
557
+			else $tt[$format] = 0;
558
+			if ($tt[$format] > 30) {
559 559
 			if ($globalDebug) echo 'Reconnect...'."\n";
560 560
 			sleep(2);
561 561
 			//$sourceeen[] = $value;
562 562
 			//connect_all($sourceeen);
563 563
 			//$sourceeen = array();
564 564
 			connect_all($globalSources);
565
-		    }
565
+			}
566
+		}
566 567
 		}
567
-	    }
568 568
 	} elseif ($value['format'] == 'myshiptracking' && 
569
-	    (
569
+		(
570 570
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
571 571
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3))
572
-	    )
572
+		)
573 573
 	) {
574
-	    $buffer = $Common->getData($value['host'],'get','','','','','20');
575
-	    if ($buffer != '') {
574
+		$buffer = $Common->getData($value['host'],'get','','','','','20');
575
+		if ($buffer != '') {
576 576
 		//echo $buffer;
577 577
 		$all_data = json_decode($buffer,true);
578 578
 		//print_r($all_data);
579 579
 		if (isset($all_data[0]['DATA'])) {
580
-		    foreach ($all_data[0]['DATA'] as $line) {
580
+			foreach ($all_data[0]['DATA'] as $line) {
581 581
 			if ($line != '') {
582
-			    $data = array();
583
-			    $data['ident'] = $line['NAME'];
584
-			    $data['mmsi'] = $line['MMSI'];
585
-			    if (strlen($data['mmsi']) > 9) {
582
+				$data = array();
583
+				$data['ident'] = $line['NAME'];
584
+				$data['mmsi'] = $line['MMSI'];
585
+				if (strlen($data['mmsi']) > 9) {
586 586
 				$data['mmsi'] = substr($data['mmsi'],-9);
587
-			    }
588
-			    $data['speed'] = $line['SOG'];
589
-			    $data['heading'] = $line['COG'];
590
-			    $data['latitude'] = $line['LAT'];
591
-			    $data['longitude'] = $line['LNG'];
592
-			    //    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
593
-			    //$data['type_id'] = $line['TYPE'];
594
-			    $data['imo'] = $line['IMO'];
595
-			    if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST'];
596
-			    if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV']));
597
-			    $data['datetime'] = date('Y-m-d H:i:s',$line['T']);
598
-			    $data['format_source'] = 'myshiptracking';
599
-			    $data['id_source'] = $id_source;
600
-			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
601
-			    $MI->add($data);
602
-			    unset($data);
587
+				}
588
+				$data['speed'] = $line['SOG'];
589
+				$data['heading'] = $line['COG'];
590
+				$data['latitude'] = $line['LAT'];
591
+				$data['longitude'] = $line['LNG'];
592
+				//    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
593
+				//$data['type_id'] = $line['TYPE'];
594
+				$data['imo'] = $line['IMO'];
595
+				if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST'];
596
+				if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV']));
597
+				$data['datetime'] = date('Y-m-d H:i:s',$line['T']);
598
+				$data['format_source'] = 'myshiptracking';
599
+				$data['id_source'] = $id_source;
600
+				if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
601
+				$MI->add($data);
602
+				unset($data);
603
+			}
603 604
 			}
604
-		    }
605 605
 		}
606
-	    }
607
-	    $last_exec[$id]['last'] = time();
606
+		}
607
+		$last_exec[$id]['last'] = time();
608 608
 	} elseif ($value['format'] == 'boatbeaconapp' && 
609
-	    (
609
+		(
610 610
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
611 611
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3))
612
-	    )
612
+		)
613 613
 	) {
614
-	    $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host']));
615
-	    if ($buffer != '') {
614
+		$buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host']));
615
+		if ($buffer != '') {
616 616
 		$all_data = json_decode($buffer,true);
617 617
 		if (isset($all_data[0]['mmsi'])) {
618
-		    foreach ($all_data as $line) {
618
+			foreach ($all_data as $line) {
619 619
 			if ($line != '') {
620
-			    $data = array();
621
-			    $data['ident'] = $line['shipname'];
622
-			    $data['callsign'] = $line['callsign'];
623
-			    $data['mmsi'] = substr($line['mmsi'],-9);
624
-			    $data['speed'] = $line['sog'];
625
-			    if ($line['heading'] != '511') $data['heading'] = $line['heading'];
626
-			    $data['latitude'] = $line['latitude'];
627
-			    $data['longitude'] = $line['longitude'];
628
-			    $data['type_id'] = $line['shiptype'];
629
-			    $data['arrival_code'] = $line['destination'];
630
-			    $data['datetime'] = $line['time'];
631
-			    $data['format_source'] = 'boatbeaconapp';
632
-			    $data['id_source'] = $id_source;
633
-			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
634
-			    $MI->add($data);
635
-			    unset($data);
620
+				$data = array();
621
+				$data['ident'] = $line['shipname'];
622
+				$data['callsign'] = $line['callsign'];
623
+				$data['mmsi'] = substr($line['mmsi'],-9);
624
+				$data['speed'] = $line['sog'];
625
+				if ($line['heading'] != '511') $data['heading'] = $line['heading'];
626
+				$data['latitude'] = $line['latitude'];
627
+				$data['longitude'] = $line['longitude'];
628
+				$data['type_id'] = $line['shiptype'];
629
+				$data['arrival_code'] = $line['destination'];
630
+				$data['datetime'] = $line['time'];
631
+				$data['format_source'] = 'boatbeaconapp';
632
+				$data['id_source'] = $id_source;
633
+				if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
634
+				$MI->add($data);
635
+				unset($data);
636
+			}
636 637
 			}
637
-		    }
638 638
 		}
639 639
 		
640
-	    }
641
-    	    $last_exec[$id]['last'] = time();
640
+		}
641
+			$last_exec[$id]['last'] = time();
642 642
 	} elseif ($value['format'] == 'boatnerd' && 
643
-	    (
643
+		(
644 644
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) ||
645 645
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3))
646
-	    )
646
+		)
647 647
 	) {
648
-	    $buffer = $Common->getData($value['host']);
649
-	    if ($buffer != '') {
648
+		$buffer = $Common->getData($value['host']);
649
+		if ($buffer != '') {
650 650
 		$all_data = json_decode($buffer,true);
651 651
 		if (isset($all_data['features'][0]['id'])) {
652
-		    foreach ($all_data['features'] as $line) {
652
+			foreach ($all_data['features'] as $line) {
653 653
 			print_r($line);
654 654
 			$data = array();
655 655
 			if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name'];
@@ -669,80 +669,80 @@  discard block
 block discarded – undo
669 669
 			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
670 670
 			if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data);
671 671
 			unset($data);
672
-		    }
672
+			}
673 673
 		}
674 674
 		
675
-	    }
676
-    	    $last_exec[$id]['last'] = time();
675
+		}
676
+			$last_exec[$id]['last'] = time();
677 677
 	} elseif ($value['format'] == 'shipplotter' && 
678
-	    (
678
+		(
679 679
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
680 680
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3))
681
-	    )
681
+		)
682 682
 	) {
683
-	    echo 'download...';
684
-	    $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter');
685
-	    echo 'done !'."\n";
686
-	    // FIXME: Need more work
687
-	    if ($buffer != '') $reset = 0;
688
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
689
-	    $buffer = explode('\n',$buffer);
690
-	    foreach ($buffer as $line) {
683
+		echo 'download...';
684
+		$buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter');
685
+		echo 'done !'."\n";
686
+		// FIXME: Need more work
687
+		if ($buffer != '') $reset = 0;
688
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
689
+		$buffer = explode('\n',$buffer);
690
+		foreach ($buffer as $line) {
691 691
 		if ($line != '') {
692
-		    $data = array();
693
-		    echo $line."\n";
694
-		    $data['mmsi'] = (int)substr($line,0,9);
695
-		    $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10));
696
-		    $data['status_id'] = substr($line,21,2);
697
-		    $data['type_id'] = substr($line,24,3);
698
-		    $data['latitude'] = substr($line,29,9);
699
-		    $data['longitude'] = substr($line,41,9);
700
-		    $data['speed'] = round(substr($line,51,5));
701
-		    //$data['course'] = substr($line,57,5);
702
-		    $data['heading'] = round(substr($line,63,3));
703
-		    //$data['draft'] = substr($line,67,4);
704
-		    //$data['length'] = substr($line,72,3);
705
-		    //$data['beam'] = substr($line,76,2);
706
-		    $data['ident'] = trim(utf8_encode(substr($line,78,20)));
707
-		    //$data['callsign'] = trim(substr($line,100,7);
708
-		    $data['arrival_code'] = substr($line,108,20);
709
-		    //$data['etaDate'] = substr($line,129,5);
710
-		    //$data['etaTime'] = substr($line,135,5);
711
-		    $data['format_source'] = 'shipplotter';
712
-    		    $data['id_source'] = $id_source;
713
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
714
-		    //print_r($data);
715
-		    echo 'Add...'."\n";
716
-		    $MI->add($data);
717
-		    unset($data);
692
+			$data = array();
693
+			echo $line."\n";
694
+			$data['mmsi'] = (int)substr($line,0,9);
695
+			$data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10));
696
+			$data['status_id'] = substr($line,21,2);
697
+			$data['type_id'] = substr($line,24,3);
698
+			$data['latitude'] = substr($line,29,9);
699
+			$data['longitude'] = substr($line,41,9);
700
+			$data['speed'] = round(substr($line,51,5));
701
+			//$data['course'] = substr($line,57,5);
702
+			$data['heading'] = round(substr($line,63,3));
703
+			//$data['draft'] = substr($line,67,4);
704
+			//$data['length'] = substr($line,72,3);
705
+			//$data['beam'] = substr($line,76,2);
706
+			$data['ident'] = trim(utf8_encode(substr($line,78,20)));
707
+			//$data['callsign'] = trim(substr($line,100,7);
708
+			$data['arrival_code'] = substr($line,108,20);
709
+			//$data['etaDate'] = substr($line,129,5);
710
+			//$data['etaTime'] = substr($line,135,5);
711
+			$data['format_source'] = 'shipplotter';
712
+				$data['id_source'] = $id_source;
713
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
714
+			//print_r($data);
715
+			echo 'Add...'."\n";
716
+			$MI->add($data);
717
+			unset($data);
718 718
 		}
719
-    	    }
720
-    	    $last_exec[$id]['last'] = time();
719
+			}
720
+			$last_exec[$id]['last'] = time();
721 721
 	//} elseif (($value == 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value == 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) {
722 722
 	} elseif (
723
-	    (
723
+		(
724 724
 		$value['format'] == 'whazzup' && 
725 725
 		(
726
-		    (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
727
-		    (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
726
+			(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
727
+			(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
728 728
 		)
729
-	    ) || (
729
+		) || (
730 730
 		$value['format'] == 'vatsimtxt' && 
731 731
 		(
732
-		    (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
733
-		    (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
732
+			(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
733
+			(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
734
+		)
734 735
 		)
735
-	    )
736 736
 	) {
737
-	    //$buffer = $Common->getData($hosts[$id]);
738
-	    $buffer = $Common->getData($value['host']);
739
-    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
740
-	    $buffer = explode('\n',$buffer);
741
-	    $reset = 0;
742
-	    foreach ($buffer as $line) {
743
-    		if ($line != '') {
744
-    		    $line = explode(':', $line);
745
-    		    if (count($line) > 30 && $line[0] != 'callsign') {
737
+		//$buffer = $Common->getData($hosts[$id]);
738
+		$buffer = $Common->getData($value['host']);
739
+			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
740
+		$buffer = explode('\n',$buffer);
741
+		$reset = 0;
742
+		foreach ($buffer as $line) {
743
+			if ($line != '') {
744
+				$line = explode(':', $line);
745
+				if (count($line) > 30 && $line[0] != 'callsign') {
746 746
 			$data = array();
747 747
 			if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37];
748 748
 			else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0];
@@ -755,37 +755,37 @@  discard block
 block discarded – undo
755 755
 			if (isset($line[45])) $data['heading'] = $line[45]; // heading
756 756
 			elseif (isset($line[38])) $data['heading'] = $line[38]; // heading
757 757
 			$data['latitude'] = $line[5]; // lat
758
-	        	$data['longitude'] = $line[6]; // long
759
-	        	$data['verticalrate'] = ''; // vertical rate
760
-	        	$data['squawk'] = ''; // squawk
761
-	        	$data['emergency'] = ''; // emergency
762
-	        	$data['waypoints'] = $line[30];
758
+				$data['longitude'] = $line[6]; // long
759
+				$data['verticalrate'] = ''; // vertical rate
760
+				$data['squawk'] = ''; // squawk
761
+				$data['emergency'] = ''; // emergency
762
+				$data['waypoints'] = $line[30];
763 763
 			$data['datetime'] = date('Y-m-d H:i:s');
764 764
 			//$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37]));
765 765
 			//if (isset($line[37])) $data['last_update'] = $line[37];
766
-		        $data['departure_airport_icao'] = $line[11];
767
-		        $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
768
-		        $data['arrival_airport_icao'] = $line[13];
766
+				$data['departure_airport_icao'] = $line[11];
767
+				$data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
768
+				$data['arrival_airport_icao'] = $line[13];
769 769
 			$data['frequency'] = $line[4];
770 770
 			$data['type'] = $line[18];
771 771
 			$data['range'] = $line[19];
772 772
 			if (isset($line[35])) $data['info'] = $line[35];
773
-    			$data['id_source'] = $id_source;
774
-	    		//$data['arrival_airport_time'] = ;
775
-	    		if ($line[9] != '') {
776
-	    		    $aircraft_data = explode('/',$line[9]);
777
-	    		    if (isset($aircraft_data[1])) {
778
-	    			$data['aircraft_icao'] = $aircraft_data[1];
779
-	    		    }
780
-        		}
781
-	    		/*
773
+				$data['id_source'] = $id_source;
774
+				//$data['arrival_airport_time'] = ;
775
+				if ($line[9] != '') {
776
+					$aircraft_data = explode('/',$line[9]);
777
+					if (isset($aircraft_data[1])) {
778
+					$data['aircraft_icao'] = $aircraft_data[1];
779
+					}
780
+				}
781
+				/*
782 782
 	    		if ($value == 'whazzup') $data['format_source'] = 'whazzup';
783 783
 	    		elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt';
784 784
 	    		*/
785
-	    		$data['format_source'] = $value['format'];
785
+				$data['format_source'] = $value['format'];
786 786
 			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
787 787
 			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
788
-    			if ($line[3] == 'PILOT') $SI->add($data);
788
+				if ($line[3] == 'PILOT') $SI->add($data);
789 789
 			elseif ($line[3] == 'ATC') {
790 790
 				//print_r($data);
791 791
 				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
@@ -806,21 +806,21 @@  discard block
 block discarded – undo
806 806
 					else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
807 807
 				}
808 808
 			}
809
-    			unset($data);
810
-    		    }
811
-    		}
812
-    	    }
813
-    	    //if ($value == 'whazzup') $last_exec['whazzup'] = time();
814
-    	    //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time();
815
-    	    $last_exec[$id]['last'] = time();
816
-    	} elseif ($value['format'] == 'airwhere' && 
817
-    	    (
818
-    		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) ||
819
-    		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
820
-    	    )
821
-    	) {
822
-	    $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20');
823
-	    if ($buffer != '') {
809
+				unset($data);
810
+				}
811
+			}
812
+			}
813
+			//if ($value == 'whazzup') $last_exec['whazzup'] = time();
814
+			//elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time();
815
+			$last_exec[$id]['last'] = time();
816
+		} elseif ($value['format'] == 'airwhere' && 
817
+			(
818
+			(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) ||
819
+			(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
820
+			)
821
+		) {
822
+		$buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20');
823
+		if ($buffer != '') {
824 824
 		$all_data = simplexml_load_string($buffer);
825 825
 		foreach($all_data->children() as $childdata) {
826 826
 			$data = array();
@@ -842,10 +842,10 @@  discard block
 block discarded – undo
842 842
 			$SI->add($data);
843 843
 			unset($data);
844 844
 		}
845
-	    }
846
-	    $Source->deleteOldLocationByType('gs');
847
-	    $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20');
848
-	    if ($buffer != '') {
845
+		}
846
+		$Source->deleteOldLocationByType('gs');
847
+		$buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20');
848
+		if ($buffer != '') {
849 849
 		$all_data = simplexml_load_string($buffer);
850 850
 		foreach($all_data->children() as $childdata) {
851 851
 			$data = array();
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
 			}
864 864
 			unset($data);
865 865
 		}
866
-	    }
867
-	    $last_exec[$id]['last'] = time();
866
+		}
867
+		$last_exec[$id]['last'] = time();
868 868
 	/*
869 869
 	} if ($value['format'] == 'aircraftlistjson') {
870 870
 	    print_r($globalSources);
@@ -872,17 +872,17 @@  discard block
 block discarded – undo
872 872
 	    echo $globalMinFetch;
873 873
 	*/
874 874
 	} elseif ($value['format'] == 'aircraftlistjson' && 
875
-	    (
875
+		(
876 876
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) ||
877 877
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
878
-	    )
878
+		)
879 879
 	) {
880
-	    $buffer = $Common->getData($value['host'],'get','','','','','20');
881
-	    if ($buffer != '') {
882
-	        $all_data = json_decode($buffer,true);
880
+		$buffer = $Common->getData($value['host'],'get','','','','','20');
881
+		if ($buffer != '') {
882
+			$all_data = json_decode($buffer,true);
883 883
 		if (isset($all_data['acList'])) {
884
-		    $reset = 0;
885
-		    foreach ($all_data['acList'] as $line) {
884
+			$reset = 0;
885
+			foreach ($all_data['acList'] as $line) {
886 886
 			$data = array();
887 887
 			$data['hex'] = $line['Icao']; // hex
888 888
 			if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
@@ -905,10 +905,10 @@  discard block
 block discarded – undo
905 905
 			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
906 906
 			if (isset($data['latitude'])) $SI->add($data);
907 907
 			unset($data);
908
-		    }
908
+			}
909 909
 		} elseif (is_array($all_data)) {
910
-		    $reset = 0;
911
-		    foreach ($all_data as $line) {
910
+			$reset = 0;
911
+			foreach ($all_data as $line) {
912 912
 			$data = array();
913 913
 			$data['hex'] = $line['hex']; // hex
914 914
 			$data['ident'] = $line['flight']; // ident
@@ -928,218 +928,218 @@  discard block
 block discarded – undo
928 928
 			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
929 929
 			$SI->add($data);
930 930
 			unset($data);
931
-		    }
931
+			}
932 932
 		}
933
-	    } elseif ($globalDebug) echo 'No data'."\n";
934
-    	    //$last_exec['aircraftlistjson'] = time();
935
-    	    $last_exec[$id]['last'] = time();
936
-    	//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
937
-    	} elseif ($value['format'] == 'planeupdatefaa' && 
938
-    	    (
939
-    		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
940
-    		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
941
-    	    )
942
-    	) {
943
-	    $buffer = $Common->getData($value['host']);
944
-	    $all_data = json_decode($buffer,true);
945
-	    if (isset($all_data['planes'])) {
933
+		} elseif ($globalDebug) echo 'No data'."\n";
934
+			//$last_exec['aircraftlistjson'] = time();
935
+			$last_exec[$id]['last'] = time();
936
+		//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
937
+		} elseif ($value['format'] == 'planeupdatefaa' && 
938
+			(
939
+			(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
940
+			(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
941
+			)
942
+		) {
943
+		$buffer = $Common->getData($value['host']);
944
+		$all_data = json_decode($buffer,true);
945
+		if (isset($all_data['planes'])) {
946 946
 		$reset = 0;
947 947
 		foreach ($all_data['planes'] as $key => $line) {
948
-		    $data = array();
949
-		    $data['hex'] = $key; // hex
950
-		    $data['ident'] = $line[3]; // ident
951
-		    $data['altitude'] = $line[6]; // altitude
952
-		    $data['speed'] = $line[8]; // speed
953
-		    $data['heading'] = $line[7]; // heading
954
-		    $data['latitude'] = $line[4]; // lat
955
-		    $data['longitude'] = $line[5]; // long
956
-		    //$data['verticalrate'] = $line[]; // verticale rate
957
-		    $data['squawk'] = $line[10]; // squawk
958
-		    $data['emergency'] = ''; // emergency
959
-		    $data['registration'] = $line[2];
960
-		    $data['aircraft_icao'] = $line[0];
961
-		    $deparr = explode('-',$line[1]);
962
-		    if (count($deparr) == 2) {
948
+			$data = array();
949
+			$data['hex'] = $key; // hex
950
+			$data['ident'] = $line[3]; // ident
951
+			$data['altitude'] = $line[6]; // altitude
952
+			$data['speed'] = $line[8]; // speed
953
+			$data['heading'] = $line[7]; // heading
954
+			$data['latitude'] = $line[4]; // lat
955
+			$data['longitude'] = $line[5]; // long
956
+			//$data['verticalrate'] = $line[]; // verticale rate
957
+			$data['squawk'] = $line[10]; // squawk
958
+			$data['emergency'] = ''; // emergency
959
+			$data['registration'] = $line[2];
960
+			$data['aircraft_icao'] = $line[0];
961
+			$deparr = explode('-',$line[1]);
962
+			if (count($deparr) == 2) {
963 963
 			$data['departure_airport_icao'] = $deparr[0];
964 964
 			$data['arrival_airport_icao'] = $deparr[1];
965
-		    }
966
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
967
-	    	    $data['format_source'] = 'planeupdatefaa';
968
-    		    $data['id_source'] = $id_source;
969
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
970
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
971
-		    $SI->add($data);
972
-		    unset($data);
965
+			}
966
+			$data['datetime'] = date('Y-m-d H:i:s',$line[9]);
967
+				$data['format_source'] = 'planeupdatefaa';
968
+				$data['id_source'] = $id_source;
969
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
970
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
971
+			$SI->add($data);
972
+			unset($data);
973
+		}
973 974
 		}
974
-	    }
975
-	    //$last_exec['planeupdatefaa'] = time();
976
-	    $last_exec[$id]['last'] = time();
975
+		//$last_exec['planeupdatefaa'] = time();
976
+		$last_exec[$id]['last'] = time();
977 977
 	} elseif ($value['format'] == 'opensky' && 
978
-	    (
978
+		(
979 979
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
980 980
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
981
-	    )
981
+		)
982 982
 	) {
983
-	    $buffer = $Common->getData($value['host']);
984
-	    $all_data = json_decode($buffer,true);
985
-	    if (isset($all_data['states'])) {
983
+		$buffer = $Common->getData($value['host']);
984
+		$all_data = json_decode($buffer,true);
985
+		if (isset($all_data['states'])) {
986 986
 		$reset = 0;
987 987
 		foreach ($all_data['states'] as $key => $line) {
988
-		    $data = array();
989
-		    $data['hex'] = $line[0]; // hex
990
-		    $data['ident'] = trim($line[1]); // ident
991
-		    $data['altitude'] = round($line[7]*3.28084); // altitude
992
-		    $data['speed'] = round($line[9]*1.94384); // speed
993
-		    $data['heading'] = round($line[10]); // heading
994
-		    $data['latitude'] = $line[6]; // lat
995
-		    $data['longitude'] = $line[5]; // long
996
-		    $data['verticalrate'] = $line[11]; // verticale rate
997
-		    //$data['squawk'] = $line[10]; // squawk
998
-		    //$data['emergency'] = ''; // emergency
999
-		    //$data['registration'] = $line[2];
1000
-		    //$data['aircraft_icao'] = $line[0];
1001
-		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]);
1002
-		    $data['format_source'] = 'opensky';
1003
-		    $data['id_source'] = $id_source;
1004
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1005
-		    $SI->add($data);
1006
-		    unset($data);
988
+			$data = array();
989
+			$data['hex'] = $line[0]; // hex
990
+			$data['ident'] = trim($line[1]); // ident
991
+			$data['altitude'] = round($line[7]*3.28084); // altitude
992
+			$data['speed'] = round($line[9]*1.94384); // speed
993
+			$data['heading'] = round($line[10]); // heading
994
+			$data['latitude'] = $line[6]; // lat
995
+			$data['longitude'] = $line[5]; // long
996
+			$data['verticalrate'] = $line[11]; // verticale rate
997
+			//$data['squawk'] = $line[10]; // squawk
998
+			//$data['emergency'] = ''; // emergency
999
+			//$data['registration'] = $line[2];
1000
+			//$data['aircraft_icao'] = $line[0];
1001
+			$data['datetime'] = date('Y-m-d H:i:s',$line[3]);
1002
+			$data['format_source'] = 'opensky';
1003
+			$data['id_source'] = $id_source;
1004
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1005
+			$SI->add($data);
1006
+			unset($data);
1007
+		}
1007 1008
 		}
1008
-	    }
1009
-	    //$last_exec['planeupdatefaa'] = time();
1010
-	    $last_exec[$id]['last'] = time();
1009
+		//$last_exec['planeupdatefaa'] = time();
1010
+		$last_exec[$id]['last'] = time();
1011 1011
 	//} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) {
1012 1012
 	} elseif ($value['format'] == 'fr24json' && 
1013
-	    (
1013
+		(
1014 1014
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) ||
1015 1015
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
1016
-	    )
1016
+		)
1017 1017
 	) {
1018
-	    //$buffer = $Common->getData($hosts[$id]);
1019
-	    $buffer = $Common->getData($value['host']);
1020
-	    $all_data = json_decode($buffer,true);
1021
-	    if (!empty($all_data)) $reset = 0;
1022
-	    foreach ($all_data as $key => $line) {
1018
+		//$buffer = $Common->getData($hosts[$id]);
1019
+		$buffer = $Common->getData($value['host']);
1020
+		$all_data = json_decode($buffer,true);
1021
+		if (!empty($all_data)) $reset = 0;
1022
+		foreach ($all_data as $key => $line) {
1023 1023
 		if ($key != 'full_count' && $key != 'version' && $key != 'stats') {
1024
-		    $data = array();
1025
-		    $data['hex'] = $line[0];
1026
-		    $data['ident'] = $line[16]; //$line[13]
1027
-	    	    $data['altitude'] = $line[4]; // altitude
1028
-	    	    $data['speed'] = $line[5]; // speed
1029
-	    	    $data['heading'] = $line[3]; // heading
1030
-	    	    $data['latitude'] = $line[1]; // lat
1031
-	    	    $data['longitude'] = $line[2]; // long
1032
-	    	    $data['verticalrate'] = $line[15]; // verticale rate
1033
-	    	    $data['squawk'] = $line[6]; // squawk
1034
-	    	    $data['aircraft_icao'] = $line[8];
1035
-	    	    $data['registration'] = $line[9];
1036
-		    $data['departure_airport_iata'] = $line[11];
1037
-		    $data['arrival_airport_iata'] = $line[12];
1038
-	    	    $data['emergency'] = ''; // emergency
1039
-		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
1040
-	    	    $data['format_source'] = 'fr24json';
1041
-    		    $data['id_source'] = $id_source;
1042
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1043
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1044
-		    $SI->add($data);
1045
-		    unset($data);
1024
+			$data = array();
1025
+			$data['hex'] = $line[0];
1026
+			$data['ident'] = $line[16]; //$line[13]
1027
+				$data['altitude'] = $line[4]; // altitude
1028
+				$data['speed'] = $line[5]; // speed
1029
+				$data['heading'] = $line[3]; // heading
1030
+				$data['latitude'] = $line[1]; // lat
1031
+				$data['longitude'] = $line[2]; // long
1032
+				$data['verticalrate'] = $line[15]; // verticale rate
1033
+				$data['squawk'] = $line[6]; // squawk
1034
+				$data['aircraft_icao'] = $line[8];
1035
+				$data['registration'] = $line[9];
1036
+			$data['departure_airport_iata'] = $line[11];
1037
+			$data['arrival_airport_iata'] = $line[12];
1038
+				$data['emergency'] = ''; // emergency
1039
+			$data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
1040
+				$data['format_source'] = 'fr24json';
1041
+				$data['id_source'] = $id_source;
1042
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1043
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1044
+			$SI->add($data);
1045
+			unset($data);
1046 1046
 		}
1047
-	    }
1048
-	    //$last_exec['fr24json'] = time();
1049
-	    $last_exec[$id]['last'] = time();
1047
+		}
1048
+		//$last_exec['fr24json'] = time();
1049
+		$last_exec[$id]['last'] = time();
1050 1050
 	//} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) {
1051 1051
 	} elseif ($value['format'] == 'radarvirtueljson' && 
1052
-	    (
1052
+		(
1053 1053
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) ||
1054 1054
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
1055
-	    )
1055
+		)
1056 1056
 	) {
1057
-	    //$buffer = $Common->getData($hosts[$id],'get','','','','','150');
1058
-	    $buffer = $Common->getData($value['host'],'get','','','','','150');
1059
-	    //echo $buffer;
1060
-	    $buffer = str_replace(array("\n","\r"),"",$buffer);
1061
-	    $buffer = preg_replace('/,"num":(.+)/','}',$buffer);
1062
-	    $all_data = json_decode($buffer,true);
1063
-	    if (json_last_error() != JSON_ERROR_NONE) {
1057
+		//$buffer = $Common->getData($hosts[$id],'get','','','','','150');
1058
+		$buffer = $Common->getData($value['host'],'get','','','','','150');
1059
+		//echo $buffer;
1060
+		$buffer = str_replace(array("\n","\r"),"",$buffer);
1061
+		$buffer = preg_replace('/,"num":(.+)/','}',$buffer);
1062
+		$all_data = json_decode($buffer,true);
1063
+		if (json_last_error() != JSON_ERROR_NONE) {
1064 1064
 		die(json_last_error_msg());
1065
-	    }
1066
-	    if (isset($all_data['mrkrs'])) {
1065
+		}
1066
+		if (isset($all_data['mrkrs'])) {
1067 1067
 		$reset = 0;
1068 1068
 		foreach ($all_data['mrkrs'] as $key => $line) {
1069
-		    if (isset($line['inf'])) {
1069
+			if (isset($line['inf'])) {
1070 1070
 			$data = array();
1071 1071
 			$data['hex'] = $line['inf']['ia'];
1072 1072
 			if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13]
1073
-	    		$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
1074
-	    		if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
1075
-	    		if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
1076
-	    		$data['latitude'] = $line['pt'][0]; // lat
1077
-	    		$data['longitude'] = $line['pt'][1]; // long
1078
-	    		//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
1079
-	    		if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
1080
-	    		//$data['aircraft_icao'] = $line[8];
1081
-	    		if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
1073
+				$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
1074
+				if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
1075
+				if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
1076
+				$data['latitude'] = $line['pt'][0]; // lat
1077
+				$data['longitude'] = $line['pt'][1]; // long
1078
+				//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
1079
+				if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
1080
+				//$data['aircraft_icao'] = $line[8];
1081
+				if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
1082 1082
 			//$data['departure_airport_iata'] = $line[11];
1083 1083
 			//$data['arrival_airport_iata'] = $line[12];
1084
-	    		//$data['emergency'] = ''; // emergency
1084
+				//$data['emergency'] = ''; // emergency
1085 1085
 			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
1086
-	    		$data['format_source'] = 'radarvirtueljson';
1087
-    			$data['id_source'] = $id_source;
1086
+				$data['format_source'] = 'radarvirtueljson';
1087
+				$data['id_source'] = $id_source;
1088 1088
 			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1089 1089
 			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1090 1090
 			$SI->add($data);
1091 1091
 			unset($data);
1092
-		    }
1092
+			}
1093 1093
 		}
1094
-	    }
1095
-	    //$last_exec['radarvirtueljson'] = time();
1096
-	    $last_exec[$id]['last'] = time();
1094
+		}
1095
+		//$last_exec['radarvirtueljson'] = time();
1096
+		$last_exec[$id]['last'] = time();
1097 1097
 	//} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) {
1098 1098
 	} elseif ($value['format'] == 'pirepsjson' && 
1099
-	    (
1099
+		(
1100 1100
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
1101 1101
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
1102
-	    )
1102
+		)
1103 1103
 	) {
1104
-	    //$buffer = $Common->getData($hosts[$id]);
1105
-	    $buffer = $Common->getData($value['host'].'?'.time());
1106
-	    $all_data = json_decode(utf8_encode($buffer),true);
1104
+		//$buffer = $Common->getData($hosts[$id]);
1105
+		$buffer = $Common->getData($value['host'].'?'.time());
1106
+		$all_data = json_decode(utf8_encode($buffer),true);
1107 1107
 	    
1108
-	    if (isset($all_data['pireps'])) {
1108
+		if (isset($all_data['pireps'])) {
1109 1109
 		$reset = 0;
1110
-	        foreach ($all_data['pireps'] as $line) {
1111
-		    $data = array();
1112
-		    $data['id'] = $line['id'];
1113
-		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
1114
-		    $data['ident'] = $line['callsign']; // ident
1115
-		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
1116
-		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
1117
-		    if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
1118
-		    if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
1119
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
1120
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1121
-		    $data['latitude'] = $line['lat']; // lat
1122
-		    $data['longitude'] = $line['lon']; // long
1123
-		    //$data['verticalrate'] = $line['vrt']; // verticale rate
1124
-		    //$data['squawk'] = $line['squawk']; // squawk
1125
-		    //$data['emergency'] = ''; // emergency
1126
-		    if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
1127
-		    if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
1128
-		    if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
1129
-		    //$data['arrival_airport_time'] = $line['arrtime'];
1130
-		    if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
1131
-		    if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
1132
-		    if (isset($line['atis'])) $data['info'] = $line['atis'];
1133
-		    else $data['info'] = '';
1134
-		    $data['format_source'] = 'pireps';
1135
-    		    $data['id_source'] = $id_source;
1136
-		    $data['datetime'] = date('Y-m-d H:i:s');
1137
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1138
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1139
-		    if ($line['icon'] == 'plane') {
1110
+			foreach ($all_data['pireps'] as $line) {
1111
+			$data = array();
1112
+			$data['id'] = $line['id'];
1113
+			$data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
1114
+			$data['ident'] = $line['callsign']; // ident
1115
+			if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
1116
+			if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
1117
+			if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
1118
+			if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
1119
+			if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
1120
+			if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1121
+			$data['latitude'] = $line['lat']; // lat
1122
+			$data['longitude'] = $line['lon']; // long
1123
+			//$data['verticalrate'] = $line['vrt']; // verticale rate
1124
+			//$data['squawk'] = $line['squawk']; // squawk
1125
+			//$data['emergency'] = ''; // emergency
1126
+			if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
1127
+			if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
1128
+			if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
1129
+			//$data['arrival_airport_time'] = $line['arrtime'];
1130
+			if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
1131
+			if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
1132
+			if (isset($line['atis'])) $data['info'] = $line['atis'];
1133
+			else $data['info'] = '';
1134
+			$data['format_source'] = 'pireps';
1135
+				$data['id_source'] = $id_source;
1136
+			$data['datetime'] = date('Y-m-d H:i:s');
1137
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1138
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1139
+			if ($line['icon'] == 'plane') {
1140 1140
 			$SI->add($data);
1141
-		    //    print_r($data);
1142
-    		    } elseif ($line['icon'] == 'ct') {
1141
+			//    print_r($data);
1142
+				} elseif ($line['icon'] == 'ct') {
1143 1143
 			$data['info'] = str_replace('^&sect;','<br />',$data['info']);
1144 1144
 			$data['info'] = str_replace('&amp;sect;','',$data['info']);
1145 1145
 			$typec = substr($data['ident'],-3);
@@ -1154,209 +1154,209 @@  discard block
 block discarded – undo
1154 1154
 			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
1155 1155
 			else $data['type'] = 'Observer';
1156 1156
 			if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']);
1157
-		    }
1158
-		    unset($data);
1157
+			}
1158
+			unset($data);
1159
+		}
1159 1160
 		}
1160
-	    }
1161
-	    //$last_exec['pirepsjson'] = time();
1162
-	    $last_exec[$id]['last'] = time();
1161
+		//$last_exec['pirepsjson'] = time();
1162
+		$last_exec[$id]['last'] = time();
1163 1163
 	//} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) {
1164 1164
 	} elseif ($value['format'] == 'phpvmacars' && 
1165
-	    (
1165
+		(
1166 1166
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) ||
1167 1167
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
1168
-	    )
1168
+		)
1169 1169
 	) {
1170
-	    //$buffer = $Common->getData($hosts[$id]);
1171
-	    if ($globalDebug) echo 'Get Data...'."\n";
1172
-	    $buffer = $Common->getData($value['host']);
1173
-	    $all_data = json_decode($buffer,true);
1174
-	    if ($buffer != '' && is_array($all_data)) {
1170
+		//$buffer = $Common->getData($hosts[$id]);
1171
+		if ($globalDebug) echo 'Get Data...'."\n";
1172
+		$buffer = $Common->getData($value['host']);
1173
+		$all_data = json_decode($buffer,true);
1174
+		if ($buffer != '' && is_array($all_data)) {
1175 1175
 		$reset = 0;
1176 1176
 		foreach ($all_data as $line) {
1177
-	    	    $data = array();
1178
-	    	    //$data['id'] = $line['id']; // id not usable
1179
-	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
1180
-	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1181
-	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
1182
-	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
1183
-	    	    $data['ident'] = $line['flightnum']; // ident
1184
-	    	    $data['altitude'] = $line['alt']; // altitude
1185
-	    	    $data['speed'] = $line['gs']; // speed
1186
-	    	    $data['heading'] = $line['heading']; // heading
1187
-	    	    $data['latitude'] = $line['lat']; // lat
1188
-	    	    $data['longitude'] = $line['lng']; // long
1189
-	    	    $data['verticalrate'] = ''; // verticale rate
1190
-	    	    $data['squawk'] = ''; // squawk
1191
-	    	    $data['emergency'] = ''; // emergency
1192
-	    	    //$data['datetime'] = $line['lastupdate'];
1193
-	    	    //$data['last_update'] = $line['lastupdate'];
1194
-	    	    if (isset($value['timezone'])) {
1195
-	    		$datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone']));
1196
-	    		$datetime->setTimeZone(new DateTimeZone('UTC'));
1197
-	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1198
-	    	    } else $data['datetime'] = date('Y-m-d H:i:s');
1199
-	    	    $data['departure_airport_icao'] = $line['depicao'];
1200
-	    	    $data['departure_airport_time'] = $line['deptime'];
1201
-	    	    $data['arrival_airport_icao'] = $line['arricao'];
1202
-    		    $data['arrival_airport_time'] = $line['arrtime'];
1203
-    		    if (isset($line['registration'])) {
1204
-    			$data['registration'] = $line['registration'];
1205
-    			//if (isset($line['aircraft'])) $data['id'] = $line['aircraft'];
1206
-    		    } else $data['registration'] = $line['aircraft'];
1207
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1208
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1209
-		    if (isset($line['aircraftname'])) {
1177
+				$data = array();
1178
+				//$data['id'] = $line['id']; // id not usable
1179
+				if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
1180
+				$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1181
+				if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
1182
+				if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
1183
+				$data['ident'] = $line['flightnum']; // ident
1184
+				$data['altitude'] = $line['alt']; // altitude
1185
+				$data['speed'] = $line['gs']; // speed
1186
+				$data['heading'] = $line['heading']; // heading
1187
+				$data['latitude'] = $line['lat']; // lat
1188
+				$data['longitude'] = $line['lng']; // long
1189
+				$data['verticalrate'] = ''; // verticale rate
1190
+				$data['squawk'] = ''; // squawk
1191
+				$data['emergency'] = ''; // emergency
1192
+				//$data['datetime'] = $line['lastupdate'];
1193
+				//$data['last_update'] = $line['lastupdate'];
1194
+				if (isset($value['timezone'])) {
1195
+				$datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone']));
1196
+				$datetime->setTimeZone(new DateTimeZone('UTC'));
1197
+				$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1198
+				} else $data['datetime'] = date('Y-m-d H:i:s');
1199
+				$data['departure_airport_icao'] = $line['depicao'];
1200
+				$data['departure_airport_time'] = $line['deptime'];
1201
+				$data['arrival_airport_icao'] = $line['arricao'];
1202
+				$data['arrival_airport_time'] = $line['arrtime'];
1203
+				if (isset($line['registration'])) {
1204
+				$data['registration'] = $line['registration'];
1205
+				//if (isset($line['aircraft'])) $data['id'] = $line['aircraft'];
1206
+				} else $data['registration'] = $line['aircraft'];
1207
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1208
+			if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1209
+			if (isset($line['aircraftname'])) {
1210 1210
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
1211 1211
 			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
1212
-	    		$aircraft_data = explode('-',$line['aircraftname']);
1213
-	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0];
1214
-	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1];
1215
-	    		else {
1216
-	    		    $aircraft_data = explode(' ',$line['aircraftname']);
1217
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]);
1218
-	    		    else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']);
1219
-	    		}
1220
-	    	    }
1221
-    		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
1222
-    		    $data['id_source'] = $id_source;
1223
-	    	    $data['format_source'] = 'phpvmacars';
1224
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1225
-		    $SI->add($data);
1226
-		    unset($data);
1212
+				$aircraft_data = explode('-',$line['aircraftname']);
1213
+				if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0];
1214
+				elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1];
1215
+				else {
1216
+					$aircraft_data = explode(' ',$line['aircraftname']);
1217
+					if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]);
1218
+					else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']);
1219
+				}
1220
+				}
1221
+				if (isset($line['route'])) $data['waypoints'] = $line['route'];
1222
+				$data['id_source'] = $id_source;
1223
+				$data['format_source'] = 'phpvmacars';
1224
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1225
+			$SI->add($data);
1226
+			unset($data);
1227 1227
 		}
1228 1228
 		if ($globalDebug) echo 'No more data...'."\n";
1229 1229
 		unset($buffer);
1230 1230
 		unset($all_data);
1231
-	    }
1232
-	    //$last_exec['phpvmacars'] = time();
1233
-	    $last_exec[$id]['last'] = time();
1231
+		}
1232
+		//$last_exec['phpvmacars'] = time();
1233
+		$last_exec[$id]['last'] = time();
1234 1234
 	} elseif ($value['format'] == 'vaos' && 
1235
-	    (
1235
+		(
1236 1236
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) ||
1237 1237
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
1238
-	    )
1238
+		)
1239 1239
 	) {
1240
-	    //$buffer = $Common->getData($hosts[$id]);
1241
-	    if ($globalDebug) echo 'Get Data...'."\n";
1242
-	    $buffer = $Common->getData($value['host']);
1243
-	    $all_data = json_decode($buffer,true);
1244
-	    if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) {
1240
+		//$buffer = $Common->getData($hosts[$id]);
1241
+		if ($globalDebug) echo 'Get Data...'."\n";
1242
+		$buffer = $Common->getData($value['host']);
1243
+		$all_data = json_decode($buffer,true);
1244
+		if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) {
1245 1245
 		$reset = 0;
1246 1246
 		foreach ($all_data['ACARSData'] as $line) {
1247
-		    //print_r($line);
1248
-	    	    $data = array();
1249
-	    	    //$data['id'] = $line['id']; // id not usable
1250
-	    	    $data['id'] = $line['id'];
1251
-	    	    //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1252
-	    	    if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username'];
1253
-	    	    if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id'];
1254
-	    	    $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident
1255
-	    	    if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident'];
1256
-	    	    $data['altitude'] = $line['altitude']; // altitude
1257
-	    	    $data['speed'] = $line['groundspeed']; // speed
1258
-	    	    $data['heading'] = $line['heading']; // heading
1259
-	    	    $data['latitude'] = $line['lat']; // lat
1260
-	    	    $data['longitude'] = $line['lon']; // long
1261
-	    	    //$data['verticalrate'] = ''; // verticale rate
1262
-	    	    //$data['squawk'] = ''; // squawk
1263
-	    	    //$data['emergency'] = ''; // emergency
1264
-	    	    if (isset($value['timezone'])) {
1265
-	    		$datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone']));
1266
-	    		$datetime->setTimeZone(new DateTimeZone('UTC'));
1267
-	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1268
-	    	    } else $data['datetime'] = date('Y-m-d H:i:s');
1247
+			//print_r($line);
1248
+				$data = array();
1249
+				//$data['id'] = $line['id']; // id not usable
1250
+				$data['id'] = $line['id'];
1251
+				//$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1252
+				if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username'];
1253
+				if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id'];
1254
+				$data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident
1255
+				if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident'];
1256
+				$data['altitude'] = $line['altitude']; // altitude
1257
+				$data['speed'] = $line['groundspeed']; // speed
1258
+				$data['heading'] = $line['heading']; // heading
1259
+				$data['latitude'] = $line['lat']; // lat
1260
+				$data['longitude'] = $line['lon']; // long
1261
+				//$data['verticalrate'] = ''; // verticale rate
1262
+				//$data['squawk'] = ''; // squawk
1263
+				//$data['emergency'] = ''; // emergency
1264
+				if (isset($value['timezone'])) {
1265
+				$datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone']));
1266
+				$datetime->setTimeZone(new DateTimeZone('UTC'));
1267
+				$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1268
+				} else $data['datetime'] = date('Y-m-d H:i:s');
1269 1269
 	    	    
1270
-	    	    $data['departure_airport_icao'] = $line['bid']['depapt']['icao'];
1271
-	    	    $data['departure_airport_time'] = $line['bid']['deptime'];
1272
-	    	    $data['arrival_airport_icao'] = $line['bid']['arrapt']['icao'];
1273
-		    $data['arrival_airport_time'] = $line['bid']['arrtime'];
1274
-		    $data['registration'] = $line['bid']['aircraft']['registration'];
1270
+				$data['departure_airport_icao'] = $line['bid']['depapt']['icao'];
1271
+				$data['departure_airport_time'] = $line['bid']['deptime'];
1272
+				$data['arrival_airport_icao'] = $line['bid']['arrapt']['icao'];
1273
+			$data['arrival_airport_time'] = $line['bid']['arrtime'];
1274
+			$data['registration'] = $line['bid']['aircraft']['registration'];
1275 1275
 
1276
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1277
-		    if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route
1278
-	    	    $data['aircraft_icao'] = $line['bid']['aircraft']['icao'];
1276
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1277
+			if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route
1278
+				$data['aircraft_icao'] = $line['bid']['aircraft']['icao'];
1279 1279
 
1280
-    		    $data['id_source'] = $id_source;
1281
-	    	    $data['format_source'] = 'vaos';
1282
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1283
-		    $SI->add($data);
1284
-		    unset($data);
1280
+				$data['id_source'] = $id_source;
1281
+				$data['format_source'] = 'vaos';
1282
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1283
+			$SI->add($data);
1284
+			unset($data);
1285 1285
 		}
1286 1286
 		if ($globalDebug) echo 'No more data...'."\n";
1287 1287
 		unset($buffer);
1288 1288
 		unset($all_data);
1289
-	    }
1290
-	    //$last_exec['phpvmacars'] = time();
1291
-	    $last_exec[$id]['last'] = time();
1289
+		}
1290
+		//$last_exec['phpvmacars'] = time();
1291
+		$last_exec[$id]['last'] = time();
1292 1292
 	} elseif ($value['format'] == 'vam' && 
1293
-	    (
1293
+		(
1294 1294
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) ||
1295 1295
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
1296
-	    )
1296
+		)
1297 1297
 	) {
1298
-	    //$buffer = $Common->getData($hosts[$id]);
1299
-	    if ($globalDebug) echo 'Get Data...'."\n";
1300
-	    $buffer = $Common->getData($value['host']);
1301
-	    $all_data = json_decode($buffer,true);
1302
-	    if ($buffer != '' && is_array($all_data)) {
1298
+		//$buffer = $Common->getData($hosts[$id]);
1299
+		if ($globalDebug) echo 'Get Data...'."\n";
1300
+		$buffer = $Common->getData($value['host']);
1301
+		$all_data = json_decode($buffer,true);
1302
+		if ($buffer != '' && is_array($all_data)) {
1303 1303
 		$reset = 0;
1304 1304
 		foreach ($all_data as $line) {
1305
-	    	    $data = array();
1306
-	    	    //$data['id'] = $line['id']; // id not usable
1307
-	    	    $data['id'] = trim($line['flight_id']);
1308
-	    	    $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex
1309
-	    	    $data['pilot_name'] = $line['pilot_name'];
1310
-	    	    $data['pilot_id'] = $line['pilot_id'];
1311
-	    	    $data['ident'] = trim($line['callsign']); // ident
1312
-	    	    $data['altitude'] = $line['altitude']; // altitude
1313
-	    	    $data['speed'] = $line['gs']; // speed
1314
-	    	    $data['heading'] = $line['heading']; // heading
1315
-	    	    $data['latitude'] = $line['latitude']; // lat
1316
-	    	    $data['longitude'] = $line['longitude']; // long
1317
-	    	    $data['verticalrate'] = ''; // verticale rate
1318
-	    	    $data['squawk'] = ''; // squawk
1319
-	    	    $data['emergency'] = ''; // emergency
1320
-	    	    //$data['datetime'] = $line['lastupdate'];
1321
-	    	    $data['last_update'] = $line['last_update'];
1322
-		    $data['datetime'] = date('Y-m-d H:i:s');
1323
-	    	    $data['departure_airport_icao'] = $line['departure'];
1324
-	    	    //$data['departure_airport_time'] = $line['departure_time'];
1325
-	    	    $data['arrival_airport_icao'] = $line['arrival'];
1326
-    		    //$data['arrival_airport_time'] = $line['arrival_time'];
1327
-    		    //$data['registration'] = $line['aircraft'];
1328
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1329
-	    	    $data['aircraft_icao'] = $line['plane_type'];
1330
-    		    $data['id_source'] = $id_source;
1331
-	    	    $data['format_source'] = 'vam';
1332
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1333
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1334
-		    $SI->add($data);
1335
-		    unset($data);
1305
+				$data = array();
1306
+				//$data['id'] = $line['id']; // id not usable
1307
+				$data['id'] = trim($line['flight_id']);
1308
+				$data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex
1309
+				$data['pilot_name'] = $line['pilot_name'];
1310
+				$data['pilot_id'] = $line['pilot_id'];
1311
+				$data['ident'] = trim($line['callsign']); // ident
1312
+				$data['altitude'] = $line['altitude']; // altitude
1313
+				$data['speed'] = $line['gs']; // speed
1314
+				$data['heading'] = $line['heading']; // heading
1315
+				$data['latitude'] = $line['latitude']; // lat
1316
+				$data['longitude'] = $line['longitude']; // long
1317
+				$data['verticalrate'] = ''; // verticale rate
1318
+				$data['squawk'] = ''; // squawk
1319
+				$data['emergency'] = ''; // emergency
1320
+				//$data['datetime'] = $line['lastupdate'];
1321
+				$data['last_update'] = $line['last_update'];
1322
+			$data['datetime'] = date('Y-m-d H:i:s');
1323
+				$data['departure_airport_icao'] = $line['departure'];
1324
+				//$data['departure_airport_time'] = $line['departure_time'];
1325
+				$data['arrival_airport_icao'] = $line['arrival'];
1326
+				//$data['arrival_airport_time'] = $line['arrival_time'];
1327
+				//$data['registration'] = $line['aircraft'];
1328
+			if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1329
+				$data['aircraft_icao'] = $line['plane_type'];
1330
+				$data['id_source'] = $id_source;
1331
+				$data['format_source'] = 'vam';
1332
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1333
+			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1334
+			$SI->add($data);
1335
+			unset($data);
1336 1336
 		}
1337 1337
 		if ($globalDebug) echo 'No more data...'."\n";
1338 1338
 		unset($buffer);
1339 1339
 		unset($all_data);
1340
-	    }
1341
-	    //$last_exec['phpvmacars'] = time();
1342
-	    $last_exec[$id]['last'] = time();
1340
+		}
1341
+		//$last_exec['phpvmacars'] = time();
1342
+		$last_exec[$id]['last'] = time();
1343 1343
 	} elseif ($value['format'] == 'blitzortung' && 
1344
-	    (
1344
+		(
1345 1345
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
1346 1346
 		(!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch))
1347
-	    )
1347
+		)
1348 1348
 	) {
1349
-	    //$buffer = $Common->getData($hosts[$id]);
1350
-	    if ($globalDebug) echo 'Get Data...'."\n";
1351
-	    $buffer = $Common->getData($value['host']);
1352
-	    $all_data = json_decode($buffer,true);
1353
-	    if ($buffer != '') {
1349
+		//$buffer = $Common->getData($hosts[$id]);
1350
+		if ($globalDebug) echo 'Get Data...'."\n";
1351
+		$buffer = $Common->getData($value['host']);
1352
+		$all_data = json_decode($buffer,true);
1353
+		if ($buffer != '') {
1354 1354
 		$Source->deleteLocationBySource('blitzortung');
1355 1355
 		$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
1356 1356
 		$buffer = explode('\n',$buffer);
1357 1357
 		foreach ($buffer as $buffer_line) {
1358
-		    $line = json_decode($buffer_line,true);
1359
-		    if (isset($line['time'])) {
1358
+			$line = json_decode($buffer_line,true);
1359
+			if (isset($line['time'])) {
1360 1360
 			$data = array();
1361 1361
 			$data['altitude'] = $line['alt']; // altitude
1362 1362
 			$data['latitude'] = $line['lat']; // lat
@@ -1368,96 +1368,96 @@  discard block
 block discarded – undo
1368 1368
 			if ($globalDebug) echo '☈ Lightning added'."\n";
1369 1369
 			$Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']);
1370 1370
 			unset($data);
1371
-		    }
1371
+			}
1372 1372
 		}
1373 1373
 		if ($globalDebug) echo 'No more data...'."\n";
1374 1374
 		unset($buffer);
1375
-	    }
1376
-	    $last_exec[$id]['last'] = time();
1375
+		}
1376
+		$last_exec[$id]['last'] = time();
1377 1377
 	//} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') {
1378 1378
 	} elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'famaprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3' || $value['format'] == 'ais' || $value['format'] == 'vrstcp') {
1379
-	    if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1380
-    	    //$last_exec[$id]['last'] = time();
1379
+		if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1380
+			//$last_exec[$id]['last'] = time();
1381 1381
 
1382
-	    //$read = array( $sockets[$id] );
1383
-	    $read = $sockets;
1384
-	    $write = NULL;
1385
-	    $e = NULL;
1386
-	    $n = socket_select($read, $write, $e, $timeout);
1387
-	    if ($e != NULL) var_dump($e);
1388
-	    if ($n > 0) {
1382
+		//$read = array( $sockets[$id] );
1383
+		$read = $sockets;
1384
+		$write = NULL;
1385
+		$e = NULL;
1386
+		$n = socket_select($read, $write, $e, $timeout);
1387
+		if ($e != NULL) var_dump($e);
1388
+		if ($n > 0) {
1389 1389
 		$reset = 0;
1390 1390
 		foreach ($read as $nb => $r) {
1391
-		    //$value = $formats[$nb];
1392
-		    $format = $globalSources[$nb]['format'];
1393
-		    if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') {
1391
+			//$value = $formats[$nb];
1392
+			$format = $globalSources[$nb]['format'];
1393
+			if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') {
1394 1394
 			$buffer = @socket_read($r, 6000,PHP_NORMAL_READ);
1395
-		    } elseif ($format == 'vrstcp') {
1395
+			} elseif ($format == 'vrstcp') {
1396 1396
 			$buffer = @socket_read($r, 6000);
1397
-		    } else {
1397
+			} else {
1398 1398
 			$az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port);
1399
-		    }
1400
-		    //$buffer = socket_read($r, 60000,PHP_NORMAL_READ);
1401
-		    //echo $buffer."\n";
1402
-		    // lets play nice and handle signals such as ctrl-c/kill properly
1403
-		    //if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1404
-		    $error = false;
1405
-		    //$SI::del();
1406
-		    if ($buffer !== FALSE) {
1399
+			}
1400
+			//$buffer = socket_read($r, 60000,PHP_NORMAL_READ);
1401
+			//echo $buffer."\n";
1402
+			// lets play nice and handle signals such as ctrl-c/kill properly
1403
+			//if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1404
+			$error = false;
1405
+			//$SI::del();
1406
+			if ($buffer !== FALSE) {
1407 1407
 			if ($format == 'vrstcp') {
1408
-			    $buffer = explode('},{',$buffer);
1408
+				$buffer = explode('},{',$buffer);
1409 1409
 			} else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
1410
-		    }
1411
-		    // SBS format is CSV format
1412
-		    if ($buffer !== FALSE && $buffer !== '') {
1410
+			}
1411
+			// SBS format is CSV format
1412
+			if ($buffer !== FALSE && $buffer !== '') {
1413 1413
 			$tt[$format] = 0;
1414 1414
 			if ($format == 'acarssbs3') {
1415
-			    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1416
-			    $ACARS->add(trim($buffer));
1417
-			    $ACARS->deleteLiveAcarsData();
1415
+				if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1416
+				$ACARS->add(trim($buffer));
1417
+				$ACARS->deleteLiveAcarsData();
1418 1418
 			} elseif ($format == 'raw') {
1419
-			    // AVR format
1420
-			    $data = $SBS->parse($buffer);
1421
-			    if (is_array($data)) {
1419
+				// AVR format
1420
+				$data = $SBS->parse($buffer);
1421
+				if (is_array($data)) {
1422 1422
 				$data['datetime'] = date('Y-m-d H:i:s');
1423 1423
 				$data['format_source'] = 'raw';
1424 1424
 				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1425 1425
 				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1426 1426
 				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1427 1427
 				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1428
-			    }
1428
+				}
1429 1429
 			} elseif ($format == 'ais') {
1430
-			    $ais_data = $AIS->parse_line(trim($buffer));
1431
-			    $data = array();
1432
-			    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
1433
-			    if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
1434
-			    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
1435
-			    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
1436
-			    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
1437
-			    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
1438
-			    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
1439
-			    if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
1440
-			    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
1441
-			    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
1442
-			    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
1443
-			    if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
1444
-			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1445
-			    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1446
-			    if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1447
-			    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1430
+				$ais_data = $AIS->parse_line(trim($buffer));
1431
+				$data = array();
1432
+				if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
1433
+				if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
1434
+				if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
1435
+				if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
1436
+				if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
1437
+				if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
1438
+				if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
1439
+				if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
1440
+				if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
1441
+				if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
1442
+				if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
1443
+				if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
1444
+				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1445
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1446
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1447
+				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1448 1448
 
1449
-			    if (isset($ais_data['timestamp'])) {
1449
+				if (isset($ais_data['timestamp'])) {
1450 1450
 				$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
1451
-			    } else {
1451
+				} else {
1452 1452
 				$data['datetime'] = date('Y-m-d H:i:s');
1453
-			    }
1454
-			    $data['format_source'] = 'aisnmea';
1455
-    			    $data['id_source'] = $id_source;
1456
-			    if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
1457
-			    unset($data);
1458
-                        } elseif ($format == 'flightgearsp') {
1459
-                    	    //echo $buffer."\n";
1460
-                    	    if (strlen($buffer) > 5) {
1453
+				}
1454
+				$data['format_source'] = 'aisnmea';
1455
+					$data['id_source'] = $id_source;
1456
+				if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
1457
+				unset($data);
1458
+						} elseif ($format == 'flightgearsp') {
1459
+							//echo $buffer."\n";
1460
+							if (strlen($buffer) > 5) {
1461 1461
 				$line = explode(',',$buffer);
1462 1462
 				$data = array();
1463 1463
 				//XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p
@@ -1474,38 +1474,38 @@  discard block
 block discarded – undo
1474 1474
 				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1475 1475
 				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1476 1476
 				//$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
1477
-			    }
1478
-                        } elseif ($format == 'acars') {
1479
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1480
-			    $ACARS->add(trim($buffer));
1481
-			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
1482
-			    $ACARS->deleteLiveAcarsData();
1477
+				}
1478
+						} elseif ($format == 'acars') {
1479
+							if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1480
+				$ACARS->add(trim($buffer));
1481
+				socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
1482
+				$ACARS->deleteLiveAcarsData();
1483 1483
 			} elseif ($format == 'flightgearmp') {
1484
-			    if (substr($buffer,0,1) != '#') {
1484
+				if (substr($buffer,0,1) != '#') {
1485 1485
 				$data = array();
1486 1486
 				//echo $buffer."\n";
1487 1487
 				$line = explode(' ',$buffer);
1488 1488
 				if (count($line) == 11) {
1489
-				    $userserver = explode('@',$line[0]);
1490
-				    $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex
1491
-				    $data['ident'] = $userserver[0];
1492
-				    $data['registration'] = $userserver[0];
1493
-				    $data['latitude'] = $line[4];
1494
-				    $data['longitude'] = $line[5];
1495
-				    $data['altitude'] = $line[6];
1496
-				    $data['datetime'] = date('Y-m-d H:i:s');
1497
-				    $aircraft_type = $line[10];
1498
-				    $aircraft_type = preg_split(':/:',$aircraft_type);
1499
-				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
1500
-				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1501
-				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1489
+					$userserver = explode('@',$line[0]);
1490
+					$data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex
1491
+					$data['ident'] = $userserver[0];
1492
+					$data['registration'] = $userserver[0];
1493
+					$data['latitude'] = $line[4];
1494
+					$data['longitude'] = $line[5];
1495
+					$data['altitude'] = $line[6];
1496
+					$data['datetime'] = date('Y-m-d H:i:s');
1497
+					$aircraft_type = $line[10];
1498
+					$aircraft_type = preg_split(':/:',$aircraft_type);
1499
+					$data['aircraft_name'] = substr(end($aircraft_type),0,-4);
1500
+					if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1501
+					if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1502
+				}
1502 1503
 				}
1503
-			    }
1504 1504
 			} elseif ($format == 'beast') {
1505
-			    echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n";
1506
-			    die;
1505
+				echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n";
1506
+				die;
1507 1507
 			} elseif ($format == 'vrstcp') {
1508
-			    foreach($buffer as $all_data) {
1508
+				foreach($buffer as $all_data) {
1509 1509
 				$line = json_decode('{'.$all_data.'}',true);
1510 1510
 				$data = array();
1511 1511
 				if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex
@@ -1525,153 +1525,153 @@  discard block
 block discarded – undo
1525 1525
 				*/
1526 1526
 				$data['datetime'] = date('Y-m-d H:i:s');
1527 1527
 				if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
1528
-		    		$data['format_source'] = 'vrstcp';
1528
+					$data['format_source'] = 'vrstcp';
1529 1529
 				$data['id_source'] = $id_source;
1530 1530
 				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1531 1531
 				if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1532 1532
 				if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data);
1533 1533
 				unset($data);
1534
-			    }
1534
+				}
1535 1535
 			} elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') {
1536
-			    $line = explode("\t", $buffer);
1537
-			    for($k = 0; $k < count($line); $k=$k+2) {
1536
+				$line = explode("\t", $buffer);
1537
+				for($k = 0; $k < count($line); $k=$k+2) {
1538 1538
 				$key = $line[$k];
1539
-			        $lined[$key] = $line[$k+1];
1540
-			    }
1541
-    			    if (count($lined) > 3) {
1542
-    				$data['hex'] = $lined['hexid'];
1543
-    				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
1544
-    				$data['datetime'] = date('Y-m-d H:i:s');;
1545
-    				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
1546
-    				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
1547
-    				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
1548
-    				if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
1549
-    				if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
1550
-    				if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
1551
-    				if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
1552
-    				$data['id_source'] = $id_source;
1553
-    				$data['format_source'] = 'tsv';
1554
-    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1555
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1539
+					$lined[$key] = $line[$k+1];
1540
+				}
1541
+					if (count($lined) > 3) {
1542
+					$data['hex'] = $lined['hexid'];
1543
+					//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
1544
+					$data['datetime'] = date('Y-m-d H:i:s');;
1545
+					if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
1546
+					if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
1547
+					if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
1548
+					if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
1549
+					if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
1550
+					if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
1551
+					if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
1552
+					$data['id_source'] = $id_source;
1553
+					$data['format_source'] = 'tsv';
1554
+					if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1555
+					if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1556 1556
 				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1557
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1558
-    				unset($lined);
1559
-    				unset($data);
1560
-    			    } else $error = true;
1557
+					if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1558
+					unset($lined);
1559
+					unset($data);
1560
+					} else $error = true;
1561 1561
 			} elseif ($format == 'aprs' && $use_aprs) {
1562
-			    if ($aprs_connect == 0) {
1562
+				if ($aprs_connect == 0) {
1563 1563
 				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
1564 1564
 				$aprs_connect = 1;
1565
-			    }
1565
+				}
1566 1566
 			    
1567
-			    if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) {
1567
+				if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) {
1568 1568
 				$aprs_last_tx = time();
1569 1569
 				$data_aprs = "# Keep alive";
1570 1570
 				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
1571
-			    }
1571
+				}
1572 1572
 			    
1573
-			    //echo 'Connect : '.$aprs_connect.' '.$buffer."\n";
1574
-			    //echo 'APRS data : '.$buffer."\n";
1575
-			    $buffer = str_replace('APRS <- ','',$buffer);
1576
-			    $buffer = str_replace('APRS -> ','',$buffer);
1577
-			    //echo $buffer."\n";
1578
-			    date_default_timezone_set('UTC');
1579
-			    if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') {
1573
+				//echo 'Connect : '.$aprs_connect.' '.$buffer."\n";
1574
+				//echo 'APRS data : '.$buffer."\n";
1575
+				$buffer = str_replace('APRS <- ','',$buffer);
1576
+				$buffer = str_replace('APRS -> ','',$buffer);
1577
+				//echo $buffer."\n";
1578
+				date_default_timezone_set('UTC');
1579
+				if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') {
1580 1580
 				$line = $APRS->parse($buffer);
1581 1581
 				//if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) {
1582 1582
 				if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) {
1583
-				    $aprs_last_tx = time();
1584
-				    $data = array();
1585
-				    //print_r($line);
1586
-				    if (isset($line['address'])) $data['hex'] = $line['address'];
1587
-				    if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi'];
1588
-				    if (isset($line['imo'])) $data['imo'] = $line['imo'];
1589
-				    if (isset($line['squawk'])) $data['squawk'] = $line['squawk'];
1590
-				    if (isset($line['arrival_code'])) $data['arrival_code'] = $line['arrival_code'];
1591
-				    if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date'];
1592
-				    if (isset($line['typeid'])) $data['type_id'] = $line['typeid'];
1593
-				    if (isset($line['statusid'])) $data['status_id'] = $line['statusid'];
1594
-				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
1595
-				    else $data['datetime'] = date('Y-m-d H:i:s');
1596
-				    //$data['datetime'] = date('Y-m-d H:i:s');
1597
-				    if (isset($line['ident'])) $data['ident'] = $line['ident'];
1598
-				    $data['latitude'] = $line['latitude'];
1599
-				    $data['longitude'] = $line['longitude'];
1600
-				    //$data['verticalrate'] = $line[16];
1601
-				    if (isset($line['speed'])) $data['speed'] = $line['speed'];
1602
-				    //else $data['speed'] = 0;
1603
-				    if (isset($line['altitude'])) $data['altitude'] = $line['altitude'];
1604
-				    if (isset($line['comment'])) $data['comment'] = $line['comment'];
1605
-				    if (isset($line['symbol'])) $data['type'] = $line['symbol'];
1606
-				    //if (isset($line['heading'])) $data['heading'] = $line['heading'];
1583
+					$aprs_last_tx = time();
1584
+					$data = array();
1585
+					//print_r($line);
1586
+					if (isset($line['address'])) $data['hex'] = $line['address'];
1587
+					if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi'];
1588
+					if (isset($line['imo'])) $data['imo'] = $line['imo'];
1589
+					if (isset($line['squawk'])) $data['squawk'] = $line['squawk'];
1590
+					if (isset($line['arrival_code'])) $data['arrival_code'] = $line['arrival_code'];
1591
+					if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date'];
1592
+					if (isset($line['typeid'])) $data['type_id'] = $line['typeid'];
1593
+					if (isset($line['statusid'])) $data['status_id'] = $line['statusid'];
1594
+					if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
1595
+					else $data['datetime'] = date('Y-m-d H:i:s');
1596
+					//$data['datetime'] = date('Y-m-d H:i:s');
1597
+					if (isset($line['ident'])) $data['ident'] = $line['ident'];
1598
+					$data['latitude'] = $line['latitude'];
1599
+					$data['longitude'] = $line['longitude'];
1600
+					//$data['verticalrate'] = $line[16];
1601
+					if (isset($line['speed'])) $data['speed'] = $line['speed'];
1602
+					//else $data['speed'] = 0;
1603
+					if (isset($line['altitude'])) $data['altitude'] = $line['altitude'];
1604
+					if (isset($line['comment'])) $data['comment'] = $line['comment'];
1605
+					if (isset($line['symbol'])) $data['type'] = $line['symbol'];
1606
+					//if (isset($line['heading'])) $data['heading'] = $line['heading'];
1607 1607
 				    
1608
-				    if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading'];
1609
-				    //else echo 'No heading...'."\n";
1610
-				    //else $data['heading'] = 0;
1611
-				    if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth'];
1612
-				    //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true;
1613
-				    if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true;
1614
-				    elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false;
1615
-				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1616
-				    elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false;
1617
-    				    $data['id_source'] = $id_source;
1618
-    				    if (isset($line['format_source'])) $data['format_source'] = $line['format_source'];
1619
-				    else $data['format_source'] = 'aprs';
1620
-				    $data['source_name'] = $line['source'];
1621
-				    if (isset($line['source_type'])) $data['source_type'] = $line['source_type'];
1622
-				    else $data['source_type'] = 'flarm';
1623
-    				    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1624
-				    $currentdate = date('Y-m-d H:i:s');
1625
-				    $aprsdate = strtotime($data['datetime']);
1626
-				    if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL';
1627
-				    // Accept data if time <= system time + 20s
1628
-				    //if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1629
-				    if (($data['source_type'] == 'modes') || isset($line['stealth']) && (!isset($data['hex']) || $data['hex'] != 'FFFFFF') && ($line['stealth'] == 0 || $line['stealth'] == '') && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1608
+					if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading'];
1609
+					//else echo 'No heading...'."\n";
1610
+					//else $data['heading'] = 0;
1611
+					if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth'];
1612
+					//if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true;
1613
+					if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true;
1614
+					elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false;
1615
+					if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1616
+					elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false;
1617
+						$data['id_source'] = $id_source;
1618
+						if (isset($line['format_source'])) $data['format_source'] = $line['format_source'];
1619
+					else $data['format_source'] = 'aprs';
1620
+					$data['source_name'] = $line['source'];
1621
+					if (isset($line['source_type'])) $data['source_type'] = $line['source_type'];
1622
+					else $data['source_type'] = 'flarm';
1623
+						if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1624
+					$currentdate = date('Y-m-d H:i:s');
1625
+					$aprsdate = strtotime($data['datetime']);
1626
+					if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL';
1627
+					// Accept data if time <= system time + 20s
1628
+					//if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1629
+					if (($data['source_type'] == 'modes') || isset($line['stealth']) && (!isset($data['hex']) || $data['hex'] != 'FFFFFF') && ($line['stealth'] == 0 || $line['stealth'] == '') && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1630 1630
 					$send = $SI->add($data);
1631
-				    } elseif ($data['source_type'] == 'ais') {
1631
+					} elseif ($data['source_type'] == 'ais') {
1632 1632
 					$data['type'] = '';
1633 1633
 					if (isset($globalMarine) && $globalMarine) $send = $MI->add($data);
1634
-				    } elseif (isset($line['stealth'])) {
1634
+					} elseif (isset($line['stealth'])) {
1635 1635
 					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
1636 1636
 					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
1637
-				    } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1638
-					    //$line['symbol'] == 'Balloon' ||
1639
-					    $line['symbol'] == 'Glider' || 
1640
-					    $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) {
1641
-					    if ($line['symbol'] == 'Ballon') $data['aircraft_icao'] = 'BALL';
1642
-					    if ($line['symbol'] == 'Glider') $data['aircraft_icao'] = 'PARAGLIDER';
1643
-					    $send = $SI->add($data);
1644
-				    } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1645
-					    $line['symbol'] == 'Yacht (Sail)' || 
1646
-					    $line['symbol'] == 'Ship (Power Boat)')) {
1647
-					    $send = $MI->add($data);
1648
-				    } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1649
-					    $line['symbol'] == 'Car' || 
1650
-					    $line['symbol'] == 'Ambulance' || 
1651
-					    $line['symbol'] == 'Van' || 
1652
-					    $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || 
1653
-					    $line['symbol'] == 'Motorcycle' || 
1654
-					    $line['symbol'] == 'Tractor' || 
1655
-					    $line['symbol'] == 'Police' || 
1656
-					    $line['symbol'] == 'Bike' || 
1657
-					    $line['symbol'] == 'Jogger' || 
1658
-					    $line['symbol'] == 'Horse' || 
1659
-					    $line['symbol'] == 'Bus' || 
1660
-					    $line['symbol'] == 'Jeep' || 
1661
-					    $line['symbol'] == 'Recreational Vehicle' || 
1662
-					    $line['symbol'] == 'Yacht (Sail)' || 
1663
-					    $line['symbol'] == 'Ship (Power Boat)' || 
1664
-					    $line['symbol'] == 'Firetruck' || 
1665
-					    $line['symbol'] == 'Balloon' || $line['symbol'] == 'Glider' || 
1666
-					    $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter' || 
1667
-					    $line['symbol'] == 'SUV' ||
1668
-					    $line['symbol'] == 'Snowmobile' ||
1669
-					    $line['symbol'] == 'Mobile Satellite Station')) {
1670
-				    //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1637
+					} elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1638
+						//$line['symbol'] == 'Balloon' ||
1639
+						$line['symbol'] == 'Glider' || 
1640
+						$line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) {
1641
+						if ($line['symbol'] == 'Ballon') $data['aircraft_icao'] = 'BALL';
1642
+						if ($line['symbol'] == 'Glider') $data['aircraft_icao'] = 'PARAGLIDER';
1643
+						$send = $SI->add($data);
1644
+					} elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1645
+						$line['symbol'] == 'Yacht (Sail)' || 
1646
+						$line['symbol'] == 'Ship (Power Boat)')) {
1647
+						$send = $MI->add($data);
1648
+					} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1649
+						$line['symbol'] == 'Car' || 
1650
+						$line['symbol'] == 'Ambulance' || 
1651
+						$line['symbol'] == 'Van' || 
1652
+						$line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || 
1653
+						$line['symbol'] == 'Motorcycle' || 
1654
+						$line['symbol'] == 'Tractor' || 
1655
+						$line['symbol'] == 'Police' || 
1656
+						$line['symbol'] == 'Bike' || 
1657
+						$line['symbol'] == 'Jogger' || 
1658
+						$line['symbol'] == 'Horse' || 
1659
+						$line['symbol'] == 'Bus' || 
1660
+						$line['symbol'] == 'Jeep' || 
1661
+						$line['symbol'] == 'Recreational Vehicle' || 
1662
+						$line['symbol'] == 'Yacht (Sail)' || 
1663
+						$line['symbol'] == 'Ship (Power Boat)' || 
1664
+						$line['symbol'] == 'Firetruck' || 
1665
+						$line['symbol'] == 'Balloon' || $line['symbol'] == 'Glider' || 
1666
+						$line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter' || 
1667
+						$line['symbol'] == 'SUV' ||
1668
+						$line['symbol'] == 'Snowmobile' ||
1669
+						$line['symbol'] == 'Mobile Satellite Station')) {
1670
+					//} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1671 1671
 				//    } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1672 1672
 					//echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n";
1673 1673
 					if (isset($globalTracker) && $globalTracker) $send = $TI->add($data);
1674
-				    } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) {
1674
+					} elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) {
1675 1675
 					if (!isset($data['altitude'])) $data['altitude'] = 0;
1676 1676
 					$Source->deleteOldLocationByType('gs');
1677 1677
 					if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) {
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 					} else {
1680 1680
 						$Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']);
1681 1681
 					}
1682
-				    } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') {
1682
+					} elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') {
1683 1683
 					//if ($globalDebug) echo '!! Weather Station not yet supported'."\n";
1684 1684
 					if ($globalDebug) echo '# Weather Station added'."\n";
1685 1685
 					$Source->deleteOldLocationByType('wx');
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
 					} else {
1690 1690
 						$Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data);
1691 1691
 					}
1692
-				    } elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) {
1692
+					} elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) {
1693 1693
 					//if ($globalDebug) echo '!! Weather Station not yet supported'."\n";
1694 1694
 					if ($globalDebug) echo '☈ Lightning added'."\n";
1695 1695
 					$Source->deleteOldLocationByType('lightning');
@@ -1698,11 +1698,11 @@  discard block
 block discarded – undo
1698 1698
 					} else {
1699 1699
 						$Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']);
1700 1700
 					}
1701
-				    } elseif ($globalDebug) {
1702
-				    	echo '/!\ Not added: '.$buffer."\n";
1703
-				    	print_r($line);
1704
-				    }
1705
-				    unset($data);
1701
+					} elseif ($globalDebug) {
1702
+						echo '/!\ Not added: '.$buffer."\n";
1703
+						print_r($line);
1704
+					}
1705
+					unset($data);
1706 1706
 				}
1707 1707
 				elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') {
1708 1708
 					$Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']);
@@ -1721,12 +1721,12 @@  discard block
 block discarded – undo
1721 1721
 				} elseif (!isset($globalSources[$nb]['last_weather_clean'])) {
1722 1722
 					$globalSources[$nb]['last_weather_clean'] = time();
1723 1723
 				}
1724
-			    }
1724
+				}
1725 1725
 			} else {
1726
-			    $line = explode(',', $buffer);
1727
-    			    if (count($line) > 20) {
1728
-    			    	$data['hex'] = $line[4];
1729
-    				/*
1726
+				$line = explode(',', $buffer);
1727
+					if (count($line) > 20) {
1728
+						$data['hex'] = $line[4];
1729
+					/*
1730 1730
     				$data['datetime'] = $line[6].' '.$line[7];
1731 1731
     					date_default_timezone_set($globalTimezone);
1732 1732
     					$datetime = new DateTime($data['datetime']);
@@ -1734,30 +1734,30 @@  discard block
 block discarded – undo
1734 1734
     					$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1735 1735
     					date_default_timezone_set('UTC');
1736 1736
     				*/
1737
-    				// Force datetime to current UTC datetime
1738
-    				date_default_timezone_set('UTC');
1739
-    				$data['datetime'] = date('Y-m-d H:i:s');
1740
-    				$data['ident'] = trim($line[10]);
1741
-    				$data['latitude'] = $line[14];
1742
-    				$data['longitude'] = $line[15];
1743
-    				$data['verticalrate'] = $line[16];
1744
-    				$data['emergency'] = $line[20];
1745
-    				$data['speed'] = $line[12];
1746
-    				$data['squawk'] = $line[17];
1747
-    				$data['altitude'] = $line[11];
1748
-    				$data['heading'] = $line[13];
1749
-    				$data['ground'] = $line[21];
1750
-    				$data['emergency'] = $line[19];
1751
-    				$data['format_source'] = 'sbs';
1737
+					// Force datetime to current UTC datetime
1738
+					date_default_timezone_set('UTC');
1739
+					$data['datetime'] = date('Y-m-d H:i:s');
1740
+					$data['ident'] = trim($line[10]);
1741
+					$data['latitude'] = $line[14];
1742
+					$data['longitude'] = $line[15];
1743
+					$data['verticalrate'] = $line[16];
1744
+					$data['emergency'] = $line[20];
1745
+					$data['speed'] = $line[12];
1746
+					$data['squawk'] = $line[17];
1747
+					$data['altitude'] = $line[11];
1748
+					$data['heading'] = $line[13];
1749
+					$data['ground'] = $line[21];
1750
+					$data['emergency'] = $line[19];
1751
+					$data['format_source'] = 'sbs';
1752 1752
 				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1753
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1753
+					if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1754 1754
 				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1755
-    				$data['id_source'] = $id_source;
1756
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
1757
-    				else $error = true;
1758
-    				unset($data);
1759
-    			    } else $error = true;
1760
-			    if ($error) {
1755
+					$data['id_source'] = $id_source;
1756
+					if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
1757
+					else $error = true;
1758
+					unset($data);
1759
+					} else $error = true;
1760
+				if ($error) {
1761 1761
 				if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { 
1762 1762
 					if ($globalDebug) echo "Not a message. Ignoring... \n";
1763 1763
 				} else {
@@ -1773,13 +1773,13 @@  discard block
 block discarded – undo
1773 1773
 					connect_all($sourceer);
1774 1774
 					$sourceer = array();
1775 1775
 				}
1776
-			    }
1776
+				}
1777 1777
 			}
1778 1778
 			// Sleep for xxx microseconds
1779 1779
 			if (isset($globalSBSSleep)) usleep($globalSBSSleep);
1780
-		    } else {
1780
+			} else {
1781 1781
 			if ($format == 'flightgearmp') {
1782
-			    	if ($globalDebug) echo "Reconnect FlightGear MP...";
1782
+					if ($globalDebug) echo "Reconnect FlightGear MP...";
1783 1783
 				//@socket_close($r);
1784 1784
 				sleep($globalMinFetch);
1785 1785
 				$sourcefg[$nb] = $globalSources[$nb];
@@ -1788,9 +1788,9 @@  discard block
 block discarded – undo
1788 1788
 				break;
1789 1789
 				
1790 1790
 			} elseif ($format != 'acars' && $format != 'flightgearsp') {
1791
-			    if (isset($tt[$format])) $tt[$format]++;
1792
-			    else $tt[$format] = 0;
1793
-			    if ($tt[$format] > 30 || $buffer === FALSE) {
1791
+				if (isset($tt[$format])) $tt[$format]++;
1792
+				else $tt[$format] = 0;
1793
+				if ($tt[$format] > 30 || $buffer === FALSE) {
1794 1794
 				if ($globalDebug) echo "ERROR : Reconnect ".$format."...";
1795 1795
 				//@socket_close($r);
1796 1796
 				sleep(2);
@@ -1801,24 +1801,24 @@  discard block
 block discarded – undo
1801 1801
 				//connect_all($globalSources);
1802 1802
 				$tt[$format]=0;
1803 1803
 				break;
1804
-			    } 
1805
-			    //else if ($globalDebug) echo "Trying again (".$tt[$format]."x) ".$format."...";
1804
+				} 
1805
+				//else if ($globalDebug) echo "Trying again (".$tt[$format]."x) ".$format."...";
1806
+			}
1806 1807
 			}
1807
-		    }
1808 1808
 		}
1809
-	    } else {
1809
+		} else {
1810 1810
 		$error = socket_strerror(socket_last_error());
1811 1811
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) {
1812 1812
 			if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1813 1813
 			if (isset($globalDebug)) echo "Restarting...\n";
1814 1814
 			// Restart the script if possible
1815 1815
 			if (is_array($sockets)) {
1816
-			    if ($globalDebug) echo "Shutdown all sockets...";
1816
+				if ($globalDebug) echo "Shutdown all sockets...";
1817 1817
 			    
1818
-			    foreach ($sockets as $sock) {
1818
+				foreach ($sockets as $sock) {
1819 1819
 				@socket_shutdown($sock,2);
1820 1820
 				@socket_close($sock);
1821
-			    }
1821
+				}
1822 1822
 			    
1823 1823
 			}
1824 1824
 			if ($globalDebug) echo "Waiting...";
@@ -1833,15 +1833,15 @@  discard block
 block discarded – undo
1833 1833
 			if ($globalDebug) echo "Restart all connections...";
1834 1834
 			connect_all($globalSources);
1835 1835
 		}
1836
-	    }
1836
+		}
1837 1837
 	}
1838 1838
 	if ($globalDaemon === false) {
1839
-	    if ($globalDebug) echo 'Check all...'."\n";
1840
-	    if (isset($SI)) $SI->checkAll();
1841
-	    if (isset($TI)) $TI->checkAll();
1842
-	    if (isset($MI)) $MI->checkAll();
1839
+		if ($globalDebug) echo 'Check all...'."\n";
1840
+		if (isset($SI)) $SI->checkAll();
1841
+		if (isset($TI)) $TI->checkAll();
1842
+		if (isset($MI)) $MI->checkAll();
1843
+	}
1843 1844
 	}
1844
-    }
1845 1845
 }
1846 1846
 
1847 1847
 ?>
Please login to merge, or discard this patch.
Braces   +1093 added lines, -372 removed lines patch added patch discarded remove patch
@@ -14,13 +14,17 @@  discard block
 block discarded – undo
14 14
 require_once(dirname(__FILE__).'/../require/class.Source.php');
15 15
 require_once(dirname(__FILE__).'/../require/class.Connection.php');
16 16
 require_once(dirname(__FILE__).'/../require/class.Common.php');
17
-if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
17
+if (isset($globalTracker) && $globalTracker) {
18
+	require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
19
+}
18 20
 if (isset($globalMarine) && $globalMarine) {
19 21
     require_once(dirname(__FILE__).'/../require/class.AIS.php');
20 22
     require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
21 23
 }
22 24
 
23
-if (!isset($globalDebug)) $globalDebug = FALSE;
25
+if (!isset($globalDebug)) {
26
+	$globalDebug = FALSE;
27
+}
24 28
 
25 29
 // Check if schema is at latest version
26 30
 $Connection = new Connection();
@@ -59,66 +63,107 @@  discard block
 block discarded – undo
59 63
 //elseif (isset($options['source'])) $hosts = array($options['source']);
60 64
 if (isset($options['s'])) {
61 65
     $globalSources = array();
62
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']);
63
-    else $globalSources[] = array('host' => $options['s']);
64
-} elseif (isset($options['source'])) {
66
+    if (isset($options['format'])) {
67
+    	$globalSources[] = array('host' => $options['s'],'format' => $options['format']);
68
+    } else {
69
+    	$globalSources[] = array('host' => $options['s']);
70
+    }
71
+    } elseif (isset($options['source'])) {
65 72
     $globalSources = array();
66
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']);
67
-    else $globalSources[] = array('host' => $options['source']);
68
-}
73
+    if (isset($options['format'])) {
74
+    	$globalSources[] = array('host' => $options['source'],'format' => $options['format']);
75
+    } else {
76
+    	$globalSources[] = array('host' => $options['source']);
77
+    }
78
+    }
69 79
 if (isset($options['aprsserverhost'])) {
70 80
 	$globalServerAPRS = TRUE;
71 81
 	$globalServerAPRShost = $options['aprsserverhost'];
72 82
 }
73
-if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport'];
74
-if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid'];
75
-if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass'];
76
-if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; 
83
+if (isset($options['aprsserverport'])) {
84
+	$globalServerAPRSport = $options['aprsserverport'];
85
+}
86
+if (isset($options['aprsserverssid'])) {
87
+	$globalServerAPRSssid = $options['aprsserverssid'];
88
+}
89
+if (isset($options['aprsserverpass'])) {
90
+	$globalServerAPRSpass = $options['aprsserverpass'];
91
+}
92
+if (isset($options['noaprsserver'])) {
93
+	$globalServerAPRS = FALSE;
94
+}
77 95
 if (isset($options['enable-aircraft'])) {
78
-	if ($globalDebug) echo 'Enable Aircraft mode'."\n";
96
+	if ($globalDebug) {
97
+		echo 'Enable Aircraft mode'."\n";
98
+	}
79 99
 	$globalAircraft = TRUE; 
80 100
 }
81 101
 if (isset($options['disable-aircraft'])) {
82
-	if ($globalDebug) echo 'Disable Aircraft mode'."\n";
102
+	if ($globalDebug) {
103
+		echo 'Disable Aircraft mode'."\n";
104
+	}
83 105
 	$globalAircraft = FALSE;
84 106
 }
85 107
 if (isset($options['enable-tracker'])) {
86
-	if ($globalDebug) echo 'Enable Tracker mode'."\n";
108
+	if ($globalDebug) {
109
+		echo 'Enable Tracker mode'."\n";
110
+	}
87 111
 	$globalTracker = TRUE; 
88 112
 }
89 113
 if (isset($options['disable-tracker'])) {
90
-	if ($globalDebug) echo 'Disable Tracker mode'."\n";
114
+	if ($globalDebug) {
115
+		echo 'Disable Tracker mode'."\n";
116
+	}
91 117
 	$globalTracker = FALSE;
92 118
 }
93 119
 if (isset($options['enable-marine'])) {
94
-	if ($globalDebug) echo 'Enable Marine mode'."\n";
120
+	if ($globalDebug) {
121
+		echo 'Enable Marine mode'."\n";
122
+	}
95 123
 	$globalMarine = TRUE;
96 124
 }
97 125
 if (isset($options['disable-marine'])) {
98
-	if ($globalDebug) echo 'Disable Marine mode'."\n";
126
+	if ($globalDebug) {
127
+		echo 'Disable Marine mode'."\n";
128
+	}
99 129
 	$globalMarine = FALSE;
100 130
 }
101
-if (isset($options['nodaemon'])) $globalDaemon = FALSE;
102
-if (isset($options['server'])) $globalServer = TRUE;
103
-if (isset($options['idsource'])) $id_source = $options['idsource'];
104
-else $id_source = 1;
131
+if (isset($options['nodaemon'])) {
132
+	$globalDaemon = FALSE;
133
+}
134
+if (isset($options['server'])) {
135
+	$globalServer = TRUE;
136
+}
137
+if (isset($options['idsource'])) {
138
+	$id_source = $options['idsource'];
139
+} else {
140
+	$id_source = 1;
141
+}
105 142
 if (isset($globalServer) && $globalServer) {
106
-    if ($globalDebug) echo "Using Server Mode\n";
143
+    if ($globalDebug) {
144
+    	echo "Using Server Mode\n";
145
+    }
107 146
     $SI=new SpotterServer();
108 147
 /*
109 148
     require_once(dirname(__FILE__).'/../require/class.APRS.php');
110 149
     $SI = new adsb2aprs();
111 150
     $SI->connect();
112 151
 */
113
-} else $SI=new SpotterImport($Connection->db);
152
+} else {
153
+	$SI=new SpotterImport($Connection->db);
154
+}
114 155
 
115
-if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
156
+if (isset($globalTracker) && $globalTracker) {
157
+	require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
158
+}
116 159
 if (isset($globalMarine) && $globalMarine) {
117 160
     require_once(dirname(__FILE__).'/../require/class.AIS.php');
118 161
     require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
119 162
 }
120 163
 
121
-if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
164
+if (isset($globalTracker) && $globalTracker) {
165
+	$TI = new TrackerImport($Connection->db);
166
+}
122 167
 if (isset($globalMarine) && $globalMarine) {
123 168
     $AIS = new AIS();
124 169
     $MI = new MarineImport($Connection->db);
@@ -143,7 +188,9 @@  discard block
 block discarded – undo
143 188
 }
144 189
 
145 190
 // let's try and connect
146
-if ($globalDebug) echo "Connecting...\n";
191
+if ($globalDebug) {
192
+	echo "Connecting...\n";
193
+}
147 194
 $use_aprs = false;
148 195
 $aprs_full = false;
149 196
 $reset = 0;
@@ -152,7 +199,9 @@  discard block
 block discarded – undo
152 199
     //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
153 200
     global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context;
154 201
     $reset++;
155
-    if ($globalDebug) echo 'Connect to all...'."\n";
202
+    if ($globalDebug) {
203
+    	echo 'Connect to all...'."\n";
204
+    }
156 205
     foreach ($hosts as $id => $value) {
157 206
 	$host = $value['host'];
158 207
 	$globalSources[$id]['last_exec'] = 0;
@@ -162,22 +211,30 @@  discard block
 block discarded – undo
162 211
         	//$formats[$id] = 'deltadbtxt';
163 212
         	$globalSources[$id]['format'] = 'deltadbtxt';
164 213
         	//$last_exec['deltadbtxt'] = 0;
165
-        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
214
+        	if ($globalDebug) {
215
+        		echo "Connect to deltadb source (".$host.")...\n";
216
+        	}
166 217
             } else if (preg_match('/vatsim-data.txt$/i',$host)) {
167 218
         	//$formats[$id] = 'vatsimtxt';
168 219
         	$globalSources[$id]['format'] = 'vatsimtxt';
169 220
         	//$last_exec['vatsimtxt'] = 0;
170
-        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
221
+        	if ($globalDebug) {
222
+        		echo "Connect to vatsim source (".$host.")...\n";
223
+        	}
171 224
     	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
172 225
         	//$formats[$id] = 'aircraftlistjson';
173 226
         	$globalSources[$id]['format'] = 'aircraftlistjson';
174 227
         	//$last_exec['aircraftlistjson'] = 0;
175
-        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
228
+        	if ($globalDebug) {
229
+        		echo "Connect to aircraftlist.json source (".$host.")...\n";
230
+        	}
176 231
     	    } else if (preg_match('/opensky/i',$host)) {
177 232
         	//$formats[$id] = 'aircraftlistjson';
178 233
         	$globalSources[$id]['format'] = 'opensky';
179 234
         	//$last_exec['aircraftlistjson'] = 0;
180
-        	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
235
+        	if ($globalDebug) {
236
+        		echo "Connect to opensky source (".$host.")...\n";
237
+        	}
181 238
     	    /*
182 239
     	    // Disabled for now, site change source format
183 240
     	    } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) {
@@ -194,7 +251,9 @@  discard block
 block discarded – undo
194 251
         	//$formats[$id] = 'planeupdatefaa';
195 252
         	$globalSources[$id]['format'] = 'planeupdatefaa';
196 253
         	//$last_exec['planeupdatefaa'] = 0;
197
-        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
254
+        	if ($globalDebug) {
255
+        		echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
256
+        	}
198 257
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
199 258
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
200 259
         	    exit(0);
@@ -203,37 +262,53 @@  discard block
 block discarded – undo
203 262
         	//$formats[$id] = 'phpvmacars';
204 263
         	$globalSources[$id]['format'] = 'phpvmacars';
205 264
         	//$last_exec['phpvmacars'] = 0;
206
-        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
265
+        	if ($globalDebug) {
266
+        		echo "Connect to phpvmacars source (".$host.")...\n";
267
+        	}
207 268
             } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) {
208 269
         	//$formats[$id] = 'phpvmacars';
209 270
         	$globalSources[$id]['format'] = 'vaos';
210 271
         	//$last_exec['phpvmacars'] = 0;
211
-        	if ($globalDebug) echo "Connect to vaos source (".$host.")...\n";
272
+        	if ($globalDebug) {
273
+        		echo "Connect to vaos source (".$host.")...\n";
274
+        	}
212 275
             } else if (preg_match('/VAM-json.php$/i',$host)) {
213 276
         	//$formats[$id] = 'phpvmacars';
214 277
         	$globalSources[$id]['format'] = 'vam';
215
-        	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
278
+        	if ($globalDebug) {
279
+        		echo "Connect to Vam source (".$host.")...\n";
280
+        	}
216 281
             } else if (preg_match('/whazzup/i',$host)) {
217 282
         	//$formats[$id] = 'whazzup';
218 283
         	$globalSources[$id]['format'] = 'whazzup';
219 284
         	//$last_exec['whazzup'] = 0;
220
-        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
285
+        	if ($globalDebug) {
286
+        		echo "Connect to whazzup source (".$host.")...\n";
287
+        	}
221 288
             } else if (preg_match('/blitzortung/i',$host)) {
222 289
         	$globalSources[$id]['format'] = 'blitzortung';
223
-        	if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n";
290
+        	if ($globalDebug) {
291
+        		echo "Connect to blitzortung source (".$host.")...\n";
292
+        	}
224 293
             } else if (preg_match('/airwhere/i',$host)) {
225 294
         	$globalSources[$id]['format'] = 'airwhere';
226
-        	if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n";
295
+        	if ($globalDebug) {
296
+        		echo "Connect to airwhere source (".$host.")...\n";
297
+        	}
227 298
             } else if (preg_match('/recentpireps/i',$host)) {
228 299
         	//$formats[$id] = 'pirepsjson';
229 300
         	$globalSources[$id]['format'] = 'pirepsjson';
230 301
         	//$last_exec['pirepsjson'] = 0;
231
-        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
302
+        	if ($globalDebug) {
303
+        		echo "Connect to pirepsjson source (".$host.")...\n";
304
+        	}
232 305
             } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
233 306
         	//$formats[$id] = 'fr24json';
234 307
         	$globalSources[$id]['format'] = 'fr24json';
235 308
         	//$last_exec['fr24json'] = 0;
236
-        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
309
+        	if ($globalDebug) {
310
+        		echo "Connect to fr24 source (".$host.")...\n";
311
+        	}
237 312
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
238 313
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
239 314
         	    exit(0);
@@ -242,7 +317,9 @@  discard block
 block discarded – undo
242 317
         	//$formats[$id] = 'fr24json';
243 318
         	$globalSources[$id]['format'] = 'myshiptracking';
244 319
         	//$last_exec['fr24json'] = 0;
245
-        	if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n";
320
+        	if ($globalDebug) {
321
+        		echo "Connect to myshiptracking source (".$host.")...\n";
322
+        	}
246 323
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
247 324
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
248 325
         	    exit(0);
@@ -251,16 +328,24 @@  discard block
 block discarded – undo
251 328
             } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
252 329
         	//$formats[$id] = 'tsv';
253 330
         	$globalSources[$id]['format'] = 'tsv';
254
-        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
331
+        	if ($globalDebug) {
332
+        		echo "Connect to tsv source (".$host.")...\n";
333
+        	}
255 334
             }
256 335
         } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
257 336
     		if ($globalSources[$id]['format'] == 'aisnmeahttp') {
258 337
     		    $idf = fopen($globalSources[$id]['host'],'r',false,$context);
259 338
     		    if ($idf !== false) {
260 339
     			$httpfeeds[$id] = $idf;
261
-        		if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
262
-    		    } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n";
263
-    		} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
340
+        		if ($globalDebug) {
341
+        			echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
342
+        		}
343
+    		    } elseif ($globalDebug) {
344
+    		    	echo "Can't connect to ".$globalSources[$id]['host']."\n";
345
+    		    }
346
+    		} elseif ($globalDebug) {
347
+    			echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
348
+    		}
264 349
         } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
265 350
 	    $hostport = explode(':',$host);
266 351
 	    if (isset($hostport[1])) {
@@ -300,17 +385,25 @@  discard block
 block discarded – undo
300 385
         		//$formats[$id] = 'beast';
301 386
         		$globalSources[$id]['format'] = 'beast';
302 387
 		    //} else $formats[$id] = 'sbs';
303
-		    } else $globalSources[$id]['format'] = 'sbs';
388
+		    } else {
389
+		    	$globalSources[$id]['format'] = 'sbs';
390
+		    }
304 391
 		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
305 392
 		}
306
-		if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
393
+		if ($globalDebug) {
394
+			echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
395
+		}
307 396
             } else {
308
-		if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
397
+		if ($globalDebug) {
398
+			echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
399
+		}
309 400
     	    }
310 401
         }
311 402
     }
312 403
 }
313
-if (!isset($globalMinFetch)) $globalMinFetch = 15;
404
+if (!isset($globalMinFetch)) {
405
+	$globalMinFetch = 15;
406
+}
314 407
 
315 408
 // Initialize all
316 409
 $status = array();
@@ -319,13 +412,19 @@  discard block
 block discarded – undo
319 412
 $formats = array();
320 413
 $last_exec = array();
321 414
 $time = time();
322
-if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut;
323
-else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut;
324
-else $timeout = 20;
415
+if (isset($globalSourcesTimeout)) {
416
+	$timeout = $globalSourcesTimeOut;
417
+} else if (isset($globalSBS1TimeOut)) {
418
+	$timeout = $globalSBS1TimeOut;
419
+} else {
420
+	$timeout = 20;
421
+}
325 422
 $errno = '';
326 423
 $errstr='';
327 424
 
328
-if (!isset($globalDaemon)) $globalDaemon = TRUE;
425
+if (!isset($globalDaemon)) {
426
+	$globalDaemon = TRUE;
427
+}
329 428
 /* Initiate connections to all the hosts simultaneously */
330 429
 //connect_all($hosts);
331 430
 //connect_all($globalSources);
@@ -354,7 +453,9 @@  discard block
 block discarded – undo
354 453
     if (isset($source['format']) && $source['format'] == 'aprs') {
355 454
 	$aprs_connect = 0;
356 455
 	$use_aprs = true;
357
-	if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true;
456
+	if (isset($source['port']) && $source['port'] == '10152') {
457
+		$aprs_full = true;
458
+	}
358 459
 	break;
359 460
     }
360 461
 }
@@ -365,25 +466,46 @@  discard block
 block discarded – undo
365 466
 	$aprs_connect = 0;
366 467
 	$aprs_keep = 120;
367 468
 	$aprs_last_tx = time();
368
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
369
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
370
-	if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid;
371
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
372
-	if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter;
373
-	else $aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
374
-	if ($aprs_full) $aprs_filter = '';
375
-	if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass;
376
-	else $aprs_pass = '-1';
469
+	if (isset($globalAPRSversion)) {
470
+		$aprs_version = $globalAPRSversion;
471
+	} else {
472
+		$aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
473
+	}
474
+	if (isset($globalAPRSssid)) {
475
+		$aprs_ssid = $globalAPRSssid;
476
+	} else {
477
+		$aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
478
+	}
479
+	if (isset($globalAPRSfilter)) {
480
+		$aprs_filter = $globalAPRSfilter;
481
+	} else {
482
+		$aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
483
+	}
484
+	if ($aprs_full) {
485
+		$aprs_filter = '';
486
+	}
487
+	if (isset($globalAPRSpass)) {
488
+		$aprs_pass = $globalAPRSpass;
489
+	} else {
490
+		$aprs_pass = '-1';
491
+	}
377 492
 
378
-	if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n";
379
-	else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
380
-}
493
+	if ($aprs_filter != '') {
494
+		$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n";
495
+	} else {
496
+		$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
497
+	}
498
+	}
381 499
 
382 500
 // connected - lets do some work
383 501
 //if ($globalDebug) echo "Connected!\n";
384 502
 sleep(1);
385
-if ($globalDebug) echo "SCAN MODE \n\n";
386
-if (!isset($globalCronEnd)) $globalCronEnd = 60;
503
+if ($globalDebug) {
504
+	echo "SCAN MODE \n\n";
505
+}
506
+if (!isset($globalCronEnd)) {
507
+	$globalCronEnd = 60;
508
+}
387 509
 $endtime = time()+$globalCronEnd;
388 510
 $i = 1;
389 511
 $tt = array();
@@ -397,20 +519,28 @@  discard block
 block discarded – undo
397 519
 
398 520
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
399 521
 while ($i > 0) {
400
-    if (!$globalDaemon) $i = $endtime-time();
522
+    if (!$globalDaemon) {
523
+    	$i = $endtime-time();
524
+    }
401 525
     // Delete old ATC
402 526
     if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
403
-	if ($globalDebug) echo 'Delete old ATC...'."\n";
527
+	if ($globalDebug) {
528
+		echo 'Delete old ATC...'."\n";
529
+	}
404 530
         $ATC->deleteOldATC();
405 531
     }
406 532
     
407 533
     if (count($last_exec) == count($globalSources)) {
408 534
 	$max = $globalMinFetch;
409 535
 	foreach ($last_exec as $last) {
410
-	    if ((time() - $last['last']) < $max) $max = time() - $last['last'];
536
+	    if ((time() - $last['last']) < $max) {
537
+	    	$max = time() - $last['last'];
538
+	    }
411 539
 	}
412 540
 	if ($max != $globalMinFetch) {
413
-	    if ($globalDebug) echo 'Sleeping...'."\n";
541
+	    if ($globalDebug) {
542
+	    	echo 'Sleeping...'."\n";
543
+	    }
414 544
 	    sleep($globalMinFetch-$max+2);
415 545
 	}
416 546
     }
@@ -420,7 +550,9 @@  discard block
 block discarded – undo
420 550
     foreach ($globalSources as $id => $value) {
421 551
 	date_default_timezone_set('UTC');
422 552
 	//if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n";
423
-	if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0;
553
+	if (!isset($last_exec[$id]['last'])) {
554
+		$last_exec[$id]['last'] = 0;
555
+	}
424 556
 	if ($value['format'] == 'deltadbtxt' && 
425 557
 	    (
426 558
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
@@ -429,7 +561,9 @@  discard block
 block discarded – undo
429 561
 	) {
430 562
 	    //$buffer = $Common->getData($hosts[$id]);
431 563
 	    $buffer = $Common->getData($value['host']);
432
-	    if ($buffer != '') $reset = 0;
564
+	    if ($buffer != '') {
565
+	    	$reset = 0;
566
+	    }
433 567
     	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
434 568
 	    $buffer = explode('\n',$buffer);
435 569
 	    foreach ($buffer as $line) {
@@ -438,20 +572,41 @@  discard block
 block discarded – undo
438 572
 	            $data = array();
439 573
 	            $data['hex'] = $line[1]; // hex
440 574
 	            $data['ident'] = $line[2]; // ident
441
-	            if (isset($line[3])) $data['altitude'] = $line[3]; // altitude
442
-	            if (isset($line[4])) $data['speed'] = $line[4]; // speed
443
-	            if (isset($line[5])) $data['heading'] = $line[5]; // heading
444
-	            if (isset($line[6])) $data['latitude'] = $line[6]; // lat
445
-	            if (isset($line[7])) $data['longitude'] = $line[7]; // long
575
+	            if (isset($line[3])) {
576
+	            	$data['altitude'] = $line[3];
577
+	            }
578
+	            // altitude
579
+	            if (isset($line[4])) {
580
+	            	$data['speed'] = $line[4];
581
+	            }
582
+	            // speed
583
+	            if (isset($line[5])) {
584
+	            	$data['heading'] = $line[5];
585
+	            }
586
+	            // heading
587
+	            if (isset($line[6])) {
588
+	            	$data['latitude'] = $line[6];
589
+	            }
590
+	            // lat
591
+	            if (isset($line[7])) {
592
+	            	$data['longitude'] = $line[7];
593
+	            }
594
+	            // long
446 595
 	            $data['verticalrate'] = ''; // vertical rate
447 596
 	            //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk
448 597
 	            $data['emergency'] = ''; // emergency
449 598
 		    $data['datetime'] = date('Y-m-d H:i:s');
450 599
 		    $data['format_source'] = 'deltadbtxt';
451 600
     		    $data['id_source'] = $id_source;
452
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
453
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
454
-		    if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
601
+		    if (isset($value['name']) && $value['name'] != '') {
602
+		    	$data['source_name'] = $value['name'];
603
+		    }
604
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
605
+		    	$data['noarchive'] = true;
606
+		    }
607
+		    if (isset($value['sourcestats'])) {
608
+		    	$data['sourcestats'] = $value['sourcestats'];
609
+		    }
455 610
     		    $SI->add($data);
456 611
 		    unset($data);
457 612
     		}
@@ -466,7 +621,9 @@  discard block
 block discarded – undo
466 621
 	    date_default_timezone_set('CET');
467 622
 	    $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host']));
468 623
 	    date_default_timezone_set('UTC');
469
-	    if ($buffer != '') $reset = 0;
624
+	    if ($buffer != '') {
625
+	    	$reset = 0;
626
+	    }
470 627
     	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
471 628
 	    $buffer = explode('\n',$buffer);
472 629
 	    foreach ($buffer as $line) {
@@ -475,18 +632,42 @@  discard block
 block discarded – undo
475 632
 		    $add = false;
476 633
 		    $ais_data = $AIS->parse_line(trim($line));
477 634
 		    $data = array();
478
-		    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
479
-		    if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
480
-		    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
481
-		    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
482
-		    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
483
-		    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
484
-		    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
485
-		    if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
486
-		    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
487
-		    if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid'];
488
-		    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
489
-		    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
635
+		    if (isset($ais_data['ident'])) {
636
+		    	$data['ident'] = $ais_data['ident'];
637
+		    }
638
+		    if (isset($ais_data['mmsi'])) {
639
+		    	$data['mmsi'] = substr($ais_data['mmsi'],-9);
640
+		    }
641
+		    if (isset($ais_data['speed'])) {
642
+		    	$data['speed'] = $ais_data['speed'];
643
+		    }
644
+		    if (isset($ais_data['heading'])) {
645
+		    	$data['heading'] = $ais_data['heading'];
646
+		    }
647
+		    if (isset($ais_data['latitude'])) {
648
+		    	$data['latitude'] = $ais_data['latitude'];
649
+		    }
650
+		    if (isset($ais_data['longitude'])) {
651
+		    	$data['longitude'] = $ais_data['longitude'];
652
+		    }
653
+		    if (isset($ais_data['status'])) {
654
+		    	$data['status'] = $ais_data['status'];
655
+		    }
656
+		    if (isset($ais_data['statusid'])) {
657
+		    	$data['status_id'] = $ais_data['statusid'];
658
+		    }
659
+		    if (isset($ais_data['type'])) {
660
+		    	$data['type'] = $ais_data['type'];
661
+		    }
662
+		    if (isset($ais_data['typeid'])) {
663
+		    	$data['type_id'] = $ais_data['typeid'];
664
+		    }
665
+		    if (isset($ais_data['imo'])) {
666
+		    	$data['imo'] = $ais_data['imo'];
667
+		    }
668
+		    if (isset($ais_data['callsign'])) {
669
+		    	$data['callsign'] = $ais_data['callsign'];
670
+		    }
490 671
 		    if (isset($ais_data['timestamp'])) {
491 672
 			$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
492 673
 			if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) {
@@ -500,8 +681,12 @@  discard block
 block discarded – undo
500 681
 		    $data['format_source'] = 'aisnmeatxt';
501 682
     		    $data['id_source'] = $id_source;
502 683
 		    //print_r($data);
503
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
504
-		    if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
684
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
685
+		    	$data['noarchive'] = true;
686
+		    }
687
+		    if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') {
688
+		    	$MI->add($data);
689
+		    }
505 690
 		    unset($data);
506 691
 		}
507 692
     	    }
@@ -524,20 +709,48 @@  discard block
 block discarded – undo
524 709
 			    if ($line != '') {
525 710
 				$ais_data = $AIS->parse_line(trim($line));
526 711
 				$data = array();
527
-				if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
528
-				if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
529
-				if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
530
-				if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
531
-				if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
532
-				if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
533
-				if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
534
-				if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
535
-				if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
536
-				if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid'];
537
-				if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
538
-				if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
539
-				if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
540
-				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
712
+				if (isset($ais_data['ident'])) {
713
+					$data['ident'] = $ais_data['ident'];
714
+				}
715
+				if (isset($ais_data['mmsi'])) {
716
+					$data['mmsi'] = substr($ais_data['mmsi'],-9);
717
+				}
718
+				if (isset($ais_data['speed'])) {
719
+					$data['speed'] = $ais_data['speed'];
720
+				}
721
+				if (isset($ais_data['heading'])) {
722
+					$data['heading'] = $ais_data['heading'];
723
+				}
724
+				if (isset($ais_data['latitude'])) {
725
+					$data['latitude'] = $ais_data['latitude'];
726
+				}
727
+				if (isset($ais_data['longitude'])) {
728
+					$data['longitude'] = $ais_data['longitude'];
729
+				}
730
+				if (isset($ais_data['status'])) {
731
+					$data['status'] = $ais_data['status'];
732
+				}
733
+				if (isset($ais_data['statusid'])) {
734
+					$data['status_id'] = $ais_data['statusid'];
735
+				}
736
+				if (isset($ais_data['type'])) {
737
+					$data['type'] = $ais_data['type'];
738
+				}
739
+				if (isset($ais_data['typeid'])) {
740
+					$data['type_id'] = $ais_data['typeid'];
741
+				}
742
+				if (isset($ais_data['imo'])) {
743
+					$data['imo'] = $ais_data['imo'];
744
+				}
745
+				if (isset($ais_data['callsign'])) {
746
+					$data['callsign'] = $ais_data['callsign'];
747
+				}
748
+				if (isset($ais_data['destination'])) {
749
+					$data['arrival_code'] = $ais_data['destination'];
750
+				}
751
+				if (isset($ais_data['eta_ts'])) {
752
+					$data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
753
+				}
541 754
 				if (isset($ais_data['timestamp'])) {
542 755
 				    $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
543 756
 				} else {
@@ -545,18 +758,27 @@  discard block
 block discarded – undo
545 758
 				}
546 759
 				$data['format_source'] = 'aisnmeahttp';
547 760
 				$data['id_source'] = $id_source;
548
-				if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
549
-				if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
761
+				if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
762
+					$data['noarchive'] = true;
763
+				}
764
+				if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') {
765
+					$MI->add($data);
766
+				}
550 767
 				unset($data);
551 768
 			    }
552 769
 			}
553 770
 		    }
554 771
 		} else {
555 772
 		    $format = $value['format'];
556
-		    if (isset($tt[$format])) $tt[$format]++;
557
-		    else $tt[$format] = 0;
773
+		    if (isset($tt[$format])) {
774
+		    	$tt[$format]++;
775
+		    } else {
776
+		    	$tt[$format] = 0;
777
+		    }
558 778
 		    if ($tt[$format] > 30) {
559
-			if ($globalDebug) echo 'Reconnect...'."\n";
779
+			if ($globalDebug) {
780
+				echo 'Reconnect...'."\n";
781
+			}
560 782
 			sleep(2);
561 783
 			//$sourceeen[] = $value;
562 784
 			//connect_all($sourceeen);
@@ -592,12 +814,18 @@  discard block
 block discarded – undo
592 814
 			    //    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
593 815
 			    //$data['type_id'] = $line['TYPE'];
594 816
 			    $data['imo'] = $line['IMO'];
595
-			    if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST'];
596
-			    if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV']));
817
+			    if ($line['DEST'] != '') {
818
+			    	$data['arrival_code'] = $line['DEST'];
819
+			    }
820
+			    if ($line['ARV'] != '') {
821
+			    	$data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV']));
822
+			    }
597 823
 			    $data['datetime'] = date('Y-m-d H:i:s',$line['T']);
598 824
 			    $data['format_source'] = 'myshiptracking';
599 825
 			    $data['id_source'] = $id_source;
600
-			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
826
+			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
827
+			    	$data['noarchive'] = true;
828
+			    }
601 829
 			    $MI->add($data);
602 830
 			    unset($data);
603 831
 			}
@@ -622,7 +850,9 @@  discard block
 block discarded – undo
622 850
 			    $data['callsign'] = $line['callsign'];
623 851
 			    $data['mmsi'] = substr($line['mmsi'],-9);
624 852
 			    $data['speed'] = $line['sog'];
625
-			    if ($line['heading'] != '511') $data['heading'] = $line['heading'];
853
+			    if ($line['heading'] != '511') {
854
+			    	$data['heading'] = $line['heading'];
855
+			    }
626 856
 			    $data['latitude'] = $line['latitude'];
627 857
 			    $data['longitude'] = $line['longitude'];
628 858
 			    $data['type_id'] = $line['shiptype'];
@@ -630,7 +860,9 @@  discard block
 block discarded – undo
630 860
 			    $data['datetime'] = $line['time'];
631 861
 			    $data['format_source'] = 'boatbeaconapp';
632 862
 			    $data['id_source'] = $id_source;
633
-			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
863
+			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
864
+			    	$data['noarchive'] = true;
865
+			    }
634 866
 			    $MI->add($data);
635 867
 			    unset($data);
636 868
 			}
@@ -652,22 +884,44 @@  discard block
 block discarded – undo
652 884
 		    foreach ($all_data['features'] as $line) {
653 885
 			print_r($line);
654 886
 			$data = array();
655
-			if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name'];
656
-			if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign'];
657
-			if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9);
658
-			if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo'];
659
-			if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed'];
660
-			if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading'];
887
+			if (isset($line['properties']['name'])) {
888
+				$data['ident'] = $line['properties']['name'];
889
+			}
890
+			if (isset($line['properties']['callsign'])) {
891
+				$data['callsign'] = $line['properties']['callsign'];
892
+			}
893
+			if (isset($line['properties']['mmsi'])) {
894
+				$data['mmsi'] = substr($line['properties']['mmsi'],-9);
895
+			}
896
+			if (isset($line['properties']['imo'])) {
897
+				$data['imo'] = $line['properties']['imo'];
898
+			}
899
+			if (isset($line['properties']['speed'])) {
900
+				$data['speed'] = $line['properties']['speed'];
901
+			}
902
+			if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) {
903
+				$data['heading'] = $line['properties']['heading'];
904
+			}
661 905
 			$data['latitude'] = $line['geometry']['coordinates'][1];
662 906
 			$data['longitude'] = $line['geometry']['coordinates'][0];
663
-			if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType'];
664
-			if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination'];
665
-			if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta'];
907
+			if (isset($line['properties']['vesselType'])) {
908
+				$data['type'] = $line['properties']['vesselType'];
909
+			}
910
+			if (isset($line['properties']['destination'])) {
911
+				$data['arrival_code'] = $line['properties']['destination'];
912
+			}
913
+			if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') {
914
+				$data['arrival_date'] = $line['properties']['eta'];
915
+			}
666 916
 			$data['format_source'] = 'boatnerd';
667 917
 			$data['id_source'] = $id_source;
668 918
 			$data['datetime'] = date('Y-m-d H:i:s');
669
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
670
-			if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data);
919
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
920
+				$data['noarchive'] = true;
921
+			}
922
+			if ($line['properties']['vesselType'] != 'Navigation Aid') {
923
+				$MI->add($data);
924
+			}
671 925
 			unset($data);
672 926
 		    }
673 927
 		}
@@ -684,7 +938,9 @@  discard block
 block discarded – undo
684 938
 	    $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter');
685 939
 	    echo 'done !'."\n";
686 940
 	    // FIXME: Need more work
687
-	    if ($buffer != '') $reset = 0;
941
+	    if ($buffer != '') {
942
+	    	$reset = 0;
943
+	    }
688 944
     	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
689 945
 	    $buffer = explode('\n',$buffer);
690 946
 	    foreach ($buffer as $line) {
@@ -710,7 +966,9 @@  discard block
 block discarded – undo
710 966
 		    //$data['etaTime'] = substr($line,135,5);
711 967
 		    $data['format_source'] = 'shipplotter';
712 968
     		    $data['id_source'] = $id_source;
713
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
969
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
970
+		    	$data['noarchive'] = true;
971
+		    }
714 972
 		    //print_r($data);
715 973
 		    echo 'Add...'."\n";
716 974
 		    $MI->add($data);
@@ -744,16 +1002,28 @@  discard block
 block discarded – undo
744 1002
     		    $line = explode(':', $line);
745 1003
     		    if (count($line) > 30 && $line[0] != 'callsign') {
746 1004
 			$data = array();
747
-			if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37];
748
-			else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0];
1005
+			if (isset($line[37]) && $line[37] != '') {
1006
+				$data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37];
1007
+			} else {
1008
+				$data['id'] = $value['format'].'-'.$line[1].'-'.$line[0];
1009
+			}
749 1010
 			$data['pilot_id'] = $line[1];
750 1011
 			$data['pilot_name'] = $line[2];
751 1012
 			$data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT);
752 1013
 			$data['ident'] = $line[0]; // ident
753
-			if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude
1014
+			if ($line[7] != '' && $line[7] != 0) {
1015
+				$data['altitude'] = $line[7];
1016
+			}
1017
+			// altitude
754 1018
 			$data['speed'] = $line[8]; // speed
755
-			if (isset($line[45])) $data['heading'] = $line[45]; // heading
756
-			elseif (isset($line[38])) $data['heading'] = $line[38]; // heading
1019
+			if (isset($line[45])) {
1020
+				$data['heading'] = $line[45];
1021
+			}
1022
+			// heading
1023
+			elseif (isset($line[38])) {
1024
+				$data['heading'] = $line[38];
1025
+			}
1026
+			// heading
757 1027
 			$data['latitude'] = $line[5]; // lat
758 1028
 	        	$data['longitude'] = $line[6]; // long
759 1029
 	        	$data['verticalrate'] = ''; // vertical rate
@@ -769,7 +1039,9 @@  discard block
 block discarded – undo
769 1039
 			$data['frequency'] = $line[4];
770 1040
 			$data['type'] = $line[18];
771 1041
 			$data['range'] = $line[19];
772
-			if (isset($line[35])) $data['info'] = $line[35];
1042
+			if (isset($line[35])) {
1043
+				$data['info'] = $line[35];
1044
+			}
773 1045
     			$data['id_source'] = $id_source;
774 1046
 	    		//$data['arrival_airport_time'] = ;
775 1047
 	    		if ($line[9] != '') {
@@ -783,27 +1055,47 @@  discard block
 block discarded – undo
783 1055
 	    		elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt';
784 1056
 	    		*/
785 1057
 	    		$data['format_source'] = $value['format'];
786
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
787
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
788
-    			if ($line[3] == 'PILOT') $SI->add($data);
789
-			elseif ($line[3] == 'ATC') {
1058
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1059
+				$data['noarchive'] = true;
1060
+			}
1061
+			if (isset($value['name']) && $value['name'] != '') {
1062
+				$data['source_name'] = $value['name'];
1063
+			}
1064
+    			if ($line[3] == 'PILOT') {
1065
+    				$SI->add($data);
1066
+    			} elseif ($line[3] == 'ATC') {
790 1067
 				//print_r($data);
791 1068
 				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
792 1069
 				$data['info'] = str_replace('&amp;sect;','',$data['info']);
793 1070
 				$typec = substr($data['ident'],-3);
794
-				if ($typec == 'APP') $data['type'] = 'Approach';
795
-				elseif ($typec == 'TWR') $data['type'] = 'Tower';
796
-				elseif ($typec == 'OBS') $data['type'] = 'Observer';
797
-				elseif ($typec == 'GND') $data['type'] = 'Ground';
798
-				elseif ($typec == 'DEL') $data['type'] = 'Delivery';
799
-				elseif ($typec == 'DEP') $data['type'] = 'Departure';
800
-				elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
801
-				elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
802
-				elseif ($data['type'] == '') $data['type'] = 'Observer';
803
-				if (!isset($data['source_name'])) $data['source_name'] = '';
1071
+				if ($typec == 'APP') {
1072
+					$data['type'] = 'Approach';
1073
+				} elseif ($typec == 'TWR') {
1074
+					$data['type'] = 'Tower';
1075
+				} elseif ($typec == 'OBS') {
1076
+					$data['type'] = 'Observer';
1077
+				} elseif ($typec == 'GND') {
1078
+					$data['type'] = 'Ground';
1079
+				} elseif ($typec == 'DEL') {
1080
+					$data['type'] = 'Delivery';
1081
+				} elseif ($typec == 'DEP') {
1082
+					$data['type'] = 'Departure';
1083
+				} elseif ($typec == 'FSS') {
1084
+					$data['type'] = 'Flight Service Station';
1085
+				} elseif ($typec == 'CTR') {
1086
+					$data['type'] = 'Control Radar or Centre';
1087
+				} elseif ($data['type'] == '') {
1088
+					$data['type'] = 'Observer';
1089
+				}
1090
+				if (!isset($data['source_name'])) {
1091
+					$data['source_name'] = '';
1092
+				}
804 1093
 				if (isset($ATC)) {
805
-					if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
806
-					else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
1094
+					if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) {
1095
+						echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
1096
+					} else {
1097
+						echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
1098
+					}
807 1099
 				}
808 1100
 			}
809 1101
     			unset($data);
@@ -830,14 +1122,20 @@  discard block
 block discarded – undo
830 1122
 			$data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST'));
831 1123
 			$data['latitude'] = (float)$line['pktLatitude'];
832 1124
 			$data['longitude'] = (float)$line['pktLongitude'];
833
-			if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack'];
834
-			if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed'];
1125
+			if ((float)$line['pktTrack'] != 0) {
1126
+				$data['heading'] = (float)$line['pktTrack'];
1127
+			}
1128
+			if ((int)$line['pktSpeed'] != 0) {
1129
+				$data['speed'] = (int)$line['pktSpeed'];
1130
+			}
835 1131
 			$data['altitude'] = round((int)$line['pktAltitude']*3.28084);
836 1132
 			$data['altitude_relative'] = 'AMSL';
837 1133
 			$data['pilot_id'] = (int)$line['pktPilotID'];
838 1134
 			$data['aircraft_icao'] = 'PARAGLIDER';
839 1135
 			$pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id']));
840
-			if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4];
1136
+			if (isset($pilot_data[4])) {
1137
+				$data['pilot_name'] = $pilot_data[4];
1138
+			}
841 1139
 			$data['format_source'] = $value['format'];
842 1140
 			$SI->add($data);
843 1141
 			unset($data);
@@ -885,25 +1183,59 @@  discard block
 block discarded – undo
885 1183
 		    foreach ($all_data['acList'] as $line) {
886 1184
 			$data = array();
887 1185
 			$data['hex'] = $line['Icao']; // hex
888
-			if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
889
-			if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
890
-			if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
891
-			if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
892
-			if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
893
-			if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
1186
+			if (isset($line['Call'])) {
1187
+				$data['ident'] = $line['Call'];
1188
+			}
1189
+			// ident
1190
+			if (isset($line['Alt'])) {
1191
+				$data['altitude'] = $line['Alt'];
1192
+			}
1193
+			// altitude
1194
+			if (isset($line['Spd'])) {
1195
+				$data['speed'] = $line['Spd'];
1196
+			}
1197
+			// speed
1198
+			if (isset($line['Trak'])) {
1199
+				$data['heading'] = $line['Trak'];
1200
+			}
1201
+			// heading
1202
+			if (isset($line['Lat'])) {
1203
+				$data['latitude'] = $line['Lat'];
1204
+			}
1205
+			// lat
1206
+			if (isset($line['Long'])) {
1207
+				$data['longitude'] = $line['Long'];
1208
+			}
1209
+			// long
894 1210
 			//$data['verticalrate'] = $line['']; // verticale rate
895
-			if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
1211
+			if (isset($line['Sqk'])) {
1212
+				$data['squawk'] = $line['Sqk'];
1213
+			}
1214
+			// squawk
896 1215
 			$data['emergency'] = ''; // emergency
897
-			if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
898
-			if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
899
-			else $data['datetime'] = date('Y-m-d H:i:s');
1216
+			if (isset($line['Reg'])) {
1217
+				$data['registration'] = $line['Reg'];
1218
+			}
1219
+			if (isset($line['PosTime'])) {
1220
+				$data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
1221
+			} else {
1222
+				$data['datetime'] = date('Y-m-d H:i:s');
1223
+			}
900 1224
 			//$data['datetime'] = date('Y-m-d H:i:s');
901
-			if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
1225
+			if (isset($line['Type'])) {
1226
+				$data['aircraft_icao'] = $line['Type'];
1227
+			}
902 1228
 			$data['format_source'] = 'aircraftlistjson';
903 1229
 			$data['id_source'] = $id_source;
904
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
905
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
906
-			if (isset($data['latitude'])) $SI->add($data);
1230
+			if (isset($value['name']) && $value['name'] != '') {
1231
+				$data['source_name'] = $value['name'];
1232
+			}
1233
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1234
+				$data['noarchive'] = true;
1235
+			}
1236
+			if (isset($data['latitude'])) {
1237
+				$SI->add($data);
1238
+			}
907 1239
 			unset($data);
908 1240
 		    }
909 1241
 		} elseif (is_array($all_data)) {
@@ -920,17 +1252,26 @@  discard block
 block discarded – undo
920 1252
 			$data['verticalrate'] = $line['vrt']; // verticale rate
921 1253
 			$data['squawk'] = $line['squawk']; // squawk
922 1254
 			$data['emergency'] = ''; // emergency
923
-			if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
924
-			else $data['datetime'] = date('Y-m-d H:i:s');
1255
+			if (isset($line['PosTime'])) {
1256
+				$data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
1257
+			} else {
1258
+				$data['datetime'] = date('Y-m-d H:i:s');
1259
+			}
925 1260
 			$data['format_source'] = 'aircraftlistjson';
926 1261
 			$data['id_source'] = $id_source;
927
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
928
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1262
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1263
+				$data['noarchive'] = true;
1264
+			}
1265
+			if (isset($value['name']) && $value['name'] != '') {
1266
+				$data['source_name'] = $value['name'];
1267
+			}
929 1268
 			$SI->add($data);
930 1269
 			unset($data);
931 1270
 		    }
932 1271
 		}
933
-	    } elseif ($globalDebug) echo 'No data'."\n";
1272
+	    } elseif ($globalDebug) {
1273
+	    	echo 'No data'."\n";
1274
+	    }
934 1275
     	    //$last_exec['aircraftlistjson'] = time();
935 1276
     	    $last_exec[$id]['last'] = time();
936 1277
     	//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
@@ -966,8 +1307,12 @@  discard block
 block discarded – undo
966 1307
 		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
967 1308
 	    	    $data['format_source'] = 'planeupdatefaa';
968 1309
     		    $data['id_source'] = $id_source;
969
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
970
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1310
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1311
+		    	$data['noarchive'] = true;
1312
+		    }
1313
+		    if (isset($value['name']) && $value['name'] != '') {
1314
+		    	$data['source_name'] = $value['name'];
1315
+		    }
971 1316
 		    $SI->add($data);
972 1317
 		    unset($data);
973 1318
 		}
@@ -1001,7 +1346,9 @@  discard block
 block discarded – undo
1001 1346
 		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]);
1002 1347
 		    $data['format_source'] = 'opensky';
1003 1348
 		    $data['id_source'] = $id_source;
1004
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1349
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1350
+		    	$data['noarchive'] = true;
1351
+		    }
1005 1352
 		    $SI->add($data);
1006 1353
 		    unset($data);
1007 1354
 		}
@@ -1018,7 +1365,9 @@  discard block
 block discarded – undo
1018 1365
 	    //$buffer = $Common->getData($hosts[$id]);
1019 1366
 	    $buffer = $Common->getData($value['host']);
1020 1367
 	    $all_data = json_decode($buffer,true);
1021
-	    if (!empty($all_data)) $reset = 0;
1368
+	    if (!empty($all_data)) {
1369
+	    	$reset = 0;
1370
+	    }
1022 1371
 	    foreach ($all_data as $key => $line) {
1023 1372
 		if ($key != 'full_count' && $key != 'version' && $key != 'stats') {
1024 1373
 		    $data = array();
@@ -1039,8 +1388,12 @@  discard block
 block discarded – undo
1039 1388
 		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
1040 1389
 	    	    $data['format_source'] = 'fr24json';
1041 1390
     		    $data['id_source'] = $id_source;
1042
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1043
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1391
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1392
+		    	$data['noarchive'] = true;
1393
+		    }
1394
+		    if (isset($value['name']) && $value['name'] != '') {
1395
+		    	$data['source_name'] = $value['name'];
1396
+		    }
1044 1397
 		    $SI->add($data);
1045 1398
 		    unset($data);
1046 1399
 		}
@@ -1069,24 +1422,42 @@  discard block
 block discarded – undo
1069 1422
 		    if (isset($line['inf'])) {
1070 1423
 			$data = array();
1071 1424
 			$data['hex'] = $line['inf']['ia'];
1072
-			if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13]
1425
+			if (isset($line['inf']['cs'])) {
1426
+				$data['ident'] = $line['inf']['cs'];
1427
+			}
1428
+			//$line[13]
1073 1429
 	    		$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
1074
-	    		if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
1075
-	    		if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
1430
+	    		if (isset($line['inf']['gs'])) {
1431
+	    			$data['speed'] = round($line['inf']['gs']*0.539957);
1432
+	    		}
1433
+	    		// speed
1434
+	    		if (isset($line['inf']['tr'])) {
1435
+	    			$data['heading'] = $line['inf']['tr'];
1436
+	    		}
1437
+	    		// heading
1076 1438
 	    		$data['latitude'] = $line['pt'][0]; // lat
1077 1439
 	    		$data['longitude'] = $line['pt'][1]; // long
1078 1440
 	    		//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
1079
-	    		if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
1441
+	    		if (isset($line['inf']['sq'])) {
1442
+	    			$data['squawk'] = $line['inf']['sq'];
1443
+	    		}
1444
+	    		// squawk
1080 1445
 	    		//$data['aircraft_icao'] = $line[8];
1081
-	    		if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
1446
+	    		if (isset($line['inf']['rc'])) {
1447
+	    			$data['registration'] = $line['inf']['rc'];
1448
+	    		}
1082 1449
 			//$data['departure_airport_iata'] = $line[11];
1083 1450
 			//$data['arrival_airport_iata'] = $line[12];
1084 1451
 	    		//$data['emergency'] = ''; // emergency
1085 1452
 			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
1086 1453
 	    		$data['format_source'] = 'radarvirtueljson';
1087 1454
     			$data['id_source'] = $id_source;
1088
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1089
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1455
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1456
+				$data['noarchive'] = true;
1457
+			}
1458
+			if (isset($value['name']) && $value['name'] != '') {
1459
+				$data['source_name'] = $value['name'];
1460
+			}
1090 1461
 			$SI->add($data);
1091 1462
 			unset($data);
1092 1463
 		    }
@@ -1112,30 +1483,65 @@  discard block
 block discarded – undo
1112 1483
 		    $data['id'] = $line['id'];
1113 1484
 		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
1114 1485
 		    $data['ident'] = $line['callsign']; // ident
1115
-		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
1116
-		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
1117
-		    if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
1118
-		    if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
1119
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
1120
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1486
+		    if (isset($line['pilotid'])) {
1487
+		    	$data['pilot_id'] = $line['pilotid'];
1488
+		    }
1489
+		    // pilot id
1490
+		    if (isset($line['name'])) {
1491
+		    	$data['pilot_name'] = $line['name'];
1492
+		    }
1493
+		    // pilot name
1494
+		    if (isset($line['alt'])) {
1495
+		    	$data['altitude'] = $line['alt'];
1496
+		    }
1497
+		    // altitude
1498
+		    if (isset($line['gs'])) {
1499
+		    	$data['speed'] = $line['gs'];
1500
+		    }
1501
+		    // speed
1502
+		    if (isset($line['heading'])) {
1503
+		    	$data['heading'] = $line['heading'];
1504
+		    }
1505
+		    // heading
1506
+		    if (isset($line['route'])) {
1507
+		    	$data['waypoints'] = $line['route'];
1508
+		    }
1509
+		    // route
1121 1510
 		    $data['latitude'] = $line['lat']; // lat
1122 1511
 		    $data['longitude'] = $line['lon']; // long
1123 1512
 		    //$data['verticalrate'] = $line['vrt']; // verticale rate
1124 1513
 		    //$data['squawk'] = $line['squawk']; // squawk
1125 1514
 		    //$data['emergency'] = ''; // emergency
1126
-		    if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
1127
-		    if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
1128
-		    if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
1515
+		    if (isset($line['depicao'])) {
1516
+		    	$data['departure_airport_icao'] = $line['depicao'];
1517
+		    }
1518
+		    if (isset($line['deptime'])) {
1519
+		    	$data['departure_airport_time'] = $line['deptime'];
1520
+		    }
1521
+		    if (isset($line['arricao'])) {
1522
+		    	$data['arrival_airport_icao'] = $line['arricao'];
1523
+		    }
1129 1524
 		    //$data['arrival_airport_time'] = $line['arrtime'];
1130
-		    if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
1131
-		    if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
1132
-		    if (isset($line['atis'])) $data['info'] = $line['atis'];
1133
-		    else $data['info'] = '';
1525
+		    if (isset($line['aircraft'])) {
1526
+		    	$data['aircraft_icao'] = $line['aircraft'];
1527
+		    }
1528
+		    if (isset($line['transponder'])) {
1529
+		    	$data['squawk'] = $line['transponder'];
1530
+		    }
1531
+		    if (isset($line['atis'])) {
1532
+		    	$data['info'] = $line['atis'];
1533
+		    } else {
1534
+		    	$data['info'] = '';
1535
+		    }
1134 1536
 		    $data['format_source'] = 'pireps';
1135 1537
     		    $data['id_source'] = $id_source;
1136 1538
 		    $data['datetime'] = date('Y-m-d H:i:s');
1137
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1138
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1539
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1540
+		    	$data['noarchive'] = true;
1541
+		    }
1542
+		    if (isset($value['name']) && $value['name'] != '') {
1543
+		    	$data['source_name'] = $value['name'];
1544
+		    }
1139 1545
 		    if ($line['icon'] == 'plane') {
1140 1546
 			$SI->add($data);
1141 1547
 		    //    print_r($data);
@@ -1144,16 +1550,28 @@  discard block
 block discarded – undo
1144 1550
 			$data['info'] = str_replace('&amp;sect;','',$data['info']);
1145 1551
 			$typec = substr($data['ident'],-3);
1146 1552
 			$data['type'] = '';
1147
-			if ($typec == 'APP') $data['type'] = 'Approach';
1148
-			elseif ($typec == 'TWR') $data['type'] = 'Tower';
1149
-			elseif ($typec == 'OBS') $data['type'] = 'Observer';
1150
-			elseif ($typec == 'GND') $data['type'] = 'Ground';
1151
-			elseif ($typec == 'DEL') $data['type'] = 'Delivery';
1152
-			elseif ($typec == 'DEP') $data['type'] = 'Departure';
1153
-			elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
1154
-			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
1155
-			else $data['type'] = 'Observer';
1156
-			if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']);
1553
+			if ($typec == 'APP') {
1554
+				$data['type'] = 'Approach';
1555
+			} elseif ($typec == 'TWR') {
1556
+				$data['type'] = 'Tower';
1557
+			} elseif ($typec == 'OBS') {
1558
+				$data['type'] = 'Observer';
1559
+			} elseif ($typec == 'GND') {
1560
+				$data['type'] = 'Ground';
1561
+			} elseif ($typec == 'DEL') {
1562
+				$data['type'] = 'Delivery';
1563
+			} elseif ($typec == 'DEP') {
1564
+				$data['type'] = 'Departure';
1565
+			} elseif ($typec == 'FSS') {
1566
+				$data['type'] = 'Flight Service Station';
1567
+			} elseif ($typec == 'CTR') {
1568
+				$data['type'] = 'Control Radar or Centre';
1569
+			} else {
1570
+				$data['type'] = 'Observer';
1571
+			}
1572
+			if (isset($ATC)) {
1573
+				echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']);
1574
+			}
1157 1575
 		    }
1158 1576
 		    unset($data);
1159 1577
 		}
@@ -1168,7 +1586,9 @@  discard block
 block discarded – undo
1168 1586
 	    )
1169 1587
 	) {
1170 1588
 	    //$buffer = $Common->getData($hosts[$id]);
1171
-	    if ($globalDebug) echo 'Get Data...'."\n";
1589
+	    if ($globalDebug) {
1590
+	    	echo 'Get Data...'."\n";
1591
+	    }
1172 1592
 	    $buffer = $Common->getData($value['host']);
1173 1593
 	    $all_data = json_decode($buffer,true);
1174 1594
 	    if ($buffer != '' && is_array($all_data)) {
@@ -1176,10 +1596,16 @@  discard block
 block discarded – undo
1176 1596
 		foreach ($all_data as $line) {
1177 1597
 	    	    $data = array();
1178 1598
 	    	    //$data['id'] = $line['id']; // id not usable
1179
-	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
1599
+	    	    if (isset($line['pilotid'])) {
1600
+	    	    	$data['id'] = $line['pilotid'].$line['flightnum'];
1601
+	    	    }
1180 1602
 	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1181
-	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
1182
-	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
1603
+	    	    if (isset($line['pilotname'])) {
1604
+	    	    	$data['pilot_name'] = $line['pilotname'];
1605
+	    	    }
1606
+	    	    if (isset($line['pilotid'])) {
1607
+	    	    	$data['pilot_id'] = $line['pilotid'];
1608
+	    	    }
1183 1609
 	    	    $data['ident'] = $line['flightnum']; // ident
1184 1610
 	    	    $data['altitude'] = $line['alt']; // altitude
1185 1611
 	    	    $data['speed'] = $line['gs']; // speed
@@ -1195,7 +1621,9 @@  discard block
 block discarded – undo
1195 1621
 	    		$datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone']));
1196 1622
 	    		$datetime->setTimeZone(new DateTimeZone('UTC'));
1197 1623
 	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1198
-	    	    } else $data['datetime'] = date('Y-m-d H:i:s');
1624
+	    	    } else {
1625
+	    	    	$data['datetime'] = date('Y-m-d H:i:s');
1626
+	    	    }
1199 1627
 	    	    $data['departure_airport_icao'] = $line['depicao'];
1200 1628
 	    	    $data['departure_airport_time'] = $line['deptime'];
1201 1629
 	    	    $data['arrival_airport_icao'] = $line['arricao'];
@@ -1203,29 +1631,47 @@  discard block
 block discarded – undo
1203 1631
     		    if (isset($line['registration'])) {
1204 1632
     			$data['registration'] = $line['registration'];
1205 1633
     			//if (isset($line['aircraft'])) $data['id'] = $line['aircraft'];
1206
-    		    } else $data['registration'] = $line['aircraft'];
1207
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1208
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1634
+    		    } else {
1635
+    		    	$data['registration'] = $line['aircraft'];
1636
+    		    }
1637
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1638
+		    	$data['noarchive'] = true;
1639
+		    }
1640
+		    if (isset($line['route'])) {
1641
+		    	$data['waypoints'] = $line['route'];
1642
+		    }
1643
+		    // route
1209 1644
 		    if (isset($line['aircraftname'])) {
1210 1645
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
1211 1646
 			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
1212 1647
 	    		$aircraft_data = explode('-',$line['aircraftname']);
1213
-	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0];
1214
-	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1];
1215
-	    		else {
1648
+	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) {
1649
+	    			$data['aircraft_icao'] = $aircraft_data[0];
1650
+	    		} elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) {
1651
+	    			$data['aircraft_icao'] = $aircraft_data[1];
1652
+	    		} else {
1216 1653
 	    		    $aircraft_data = explode(' ',$line['aircraftname']);
1217
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]);
1218
-	    		    else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']);
1654
+	    		    if (isset($aircraft_data[1])) {
1655
+	    		    	$data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]);
1656
+	    		    } else {
1657
+	    		    	$data['aircraft_icao'] = str_replace('-','',$line['aircraftname']);
1658
+	    		    }
1219 1659
 	    		}
1220 1660
 	    	    }
1221
-    		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
1661
+    		    if (isset($line['route'])) {
1662
+    		    	$data['waypoints'] = $line['route'];
1663
+    		    }
1222 1664
     		    $data['id_source'] = $id_source;
1223 1665
 	    	    $data['format_source'] = 'phpvmacars';
1224
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1666
+		    if (isset($value['name']) && $value['name'] != '') {
1667
+		    	$data['source_name'] = $value['name'];
1668
+		    }
1225 1669
 		    $SI->add($data);
1226 1670
 		    unset($data);
1227 1671
 		}
1228
-		if ($globalDebug) echo 'No more data...'."\n";
1672
+		if ($globalDebug) {
1673
+			echo 'No more data...'."\n";
1674
+		}
1229 1675
 		unset($buffer);
1230 1676
 		unset($all_data);
1231 1677
 	    }
@@ -1238,7 +1684,9 @@  discard block
 block discarded – undo
1238 1684
 	    )
1239 1685
 	) {
1240 1686
 	    //$buffer = $Common->getData($hosts[$id]);
1241
-	    if ($globalDebug) echo 'Get Data...'."\n";
1687
+	    if ($globalDebug) {
1688
+	    	echo 'Get Data...'."\n";
1689
+	    }
1242 1690
 	    $buffer = $Common->getData($value['host']);
1243 1691
 	    $all_data = json_decode($buffer,true);
1244 1692
 	    if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) {
@@ -1249,10 +1697,16 @@  discard block
 block discarded – undo
1249 1697
 	    	    //$data['id'] = $line['id']; // id not usable
1250 1698
 	    	    $data['id'] = $line['id'];
1251 1699
 	    	    //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1252
-	    	    if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username'];
1253
-	    	    if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id'];
1700
+	    	    if (isset($line['user']['username'])) {
1701
+	    	    	$data['pilot_name'] = $line['user']['username'];
1702
+	    	    }
1703
+	    	    if (isset($line['user_id'])) {
1704
+	    	    	$data['pilot_id'] = $line['user_id'];
1705
+	    	    }
1254 1706
 	    	    $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident
1255
-	    	    if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident'];
1707
+	    	    if (is_numeric($data['ident'])) {
1708
+	    	    	$data['ident'] = $line['bid']['airline']['icao'].$data['ident'];
1709
+	    	    }
1256 1710
 	    	    $data['altitude'] = $line['altitude']; // altitude
1257 1711
 	    	    $data['speed'] = $line['groundspeed']; // speed
1258 1712
 	    	    $data['heading'] = $line['heading']; // heading
@@ -1265,7 +1719,9 @@  discard block
 block discarded – undo
1265 1719
 	    		$datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone']));
1266 1720
 	    		$datetime->setTimeZone(new DateTimeZone('UTC'));
1267 1721
 	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1268
-	    	    } else $data['datetime'] = date('Y-m-d H:i:s');
1722
+	    	    } else {
1723
+	    	    	$data['datetime'] = date('Y-m-d H:i:s');
1724
+	    	    }
1269 1725
 	    	    
1270 1726
 	    	    $data['departure_airport_icao'] = $line['bid']['depapt']['icao'];
1271 1727
 	    	    $data['departure_airport_time'] = $line['bid']['deptime'];
@@ -1273,17 +1729,26 @@  discard block
 block discarded – undo
1273 1729
 		    $data['arrival_airport_time'] = $line['bid']['arrtime'];
1274 1730
 		    $data['registration'] = $line['bid']['aircraft']['registration'];
1275 1731
 
1276
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1277
-		    if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route
1732
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1733
+		    	$data['noarchive'] = true;
1734
+		    }
1735
+		    if (isset($line['bid']['route']) && $line['bid']['route'] != '') {
1736
+		    	$data['waypoints'] = $line['bid']['route'];
1737
+		    }
1738
+		    // route
1278 1739
 	    	    $data['aircraft_icao'] = $line['bid']['aircraft']['icao'];
1279 1740
 
1280 1741
     		    $data['id_source'] = $id_source;
1281 1742
 	    	    $data['format_source'] = 'vaos';
1282
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1743
+		    if (isset($value['name']) && $value['name'] != '') {
1744
+		    	$data['source_name'] = $value['name'];
1745
+		    }
1283 1746
 		    $SI->add($data);
1284 1747
 		    unset($data);
1285 1748
 		}
1286
-		if ($globalDebug) echo 'No more data...'."\n";
1749
+		if ($globalDebug) {
1750
+			echo 'No more data...'."\n";
1751
+		}
1287 1752
 		unset($buffer);
1288 1753
 		unset($all_data);
1289 1754
 	    }
@@ -1296,7 +1761,9 @@  discard block
 block discarded – undo
1296 1761
 	    )
1297 1762
 	) {
1298 1763
 	    //$buffer = $Common->getData($hosts[$id]);
1299
-	    if ($globalDebug) echo 'Get Data...'."\n";
1764
+	    if ($globalDebug) {
1765
+	    	echo 'Get Data...'."\n";
1766
+	    }
1300 1767
 	    $buffer = $Common->getData($value['host']);
1301 1768
 	    $all_data = json_decode($buffer,true);
1302 1769
 	    if ($buffer != '' && is_array($all_data)) {
@@ -1325,16 +1792,25 @@  discard block
 block discarded – undo
1325 1792
 	    	    $data['arrival_airport_icao'] = $line['arrival'];
1326 1793
     		    //$data['arrival_airport_time'] = $line['arrival_time'];
1327 1794
     		    //$data['registration'] = $line['aircraft'];
1328
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1795
+		    if (isset($line['route'])) {
1796
+		    	$data['waypoints'] = $line['route'];
1797
+		    }
1798
+		    // route
1329 1799
 	    	    $data['aircraft_icao'] = $line['plane_type'];
1330 1800
     		    $data['id_source'] = $id_source;
1331 1801
 	    	    $data['format_source'] = 'vam';
1332
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1333
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1802
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1803
+		    	$data['noarchive'] = true;
1804
+		    }
1805
+		    if (isset($value['name']) && $value['name'] != '') {
1806
+		    	$data['source_name'] = $value['name'];
1807
+		    }
1334 1808
 		    $SI->add($data);
1335 1809
 		    unset($data);
1336 1810
 		}
1337
-		if ($globalDebug) echo 'No more data...'."\n";
1811
+		if ($globalDebug) {
1812
+			echo 'No more data...'."\n";
1813
+		}
1338 1814
 		unset($buffer);
1339 1815
 		unset($all_data);
1340 1816
 	    }
@@ -1347,7 +1823,9 @@  discard block
 block discarded – undo
1347 1823
 	    )
1348 1824
 	) {
1349 1825
 	    //$buffer = $Common->getData($hosts[$id]);
1350
-	    if ($globalDebug) echo 'Get Data...'."\n";
1826
+	    if ($globalDebug) {
1827
+	    	echo 'Get Data...'."\n";
1828
+	    }
1351 1829
 	    $buffer = $Common->getData($value['host']);
1352 1830
 	    $all_data = json_decode($buffer,true);
1353 1831
 	    if ($buffer != '') {
@@ -1365,18 +1843,24 @@  discard block
 block discarded – undo
1365 1843
 			$data['id_source'] = $id_source;
1366 1844
 			$data['format_source'] = 'blitzortung';
1367 1845
 			$SI->add($data);
1368
-			if ($globalDebug) echo '☈ Lightning added'."\n";
1846
+			if ($globalDebug) {
1847
+				echo '☈ Lightning added'."\n";
1848
+			}
1369 1849
 			$Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']);
1370 1850
 			unset($data);
1371 1851
 		    }
1372 1852
 		}
1373
-		if ($globalDebug) echo 'No more data...'."\n";
1853
+		if ($globalDebug) {
1854
+			echo 'No more data...'."\n";
1855
+		}
1374 1856
 		unset($buffer);
1375 1857
 	    }
1376 1858
 	    $last_exec[$id]['last'] = time();
1377 1859
 	//} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') {
1378 1860
 	} elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'famaprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3' || $value['format'] == 'ais' || $value['format'] == 'vrstcp') {
1379
-	    if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1861
+	    if (function_exists('pcntl_fork')) {
1862
+	    	pcntl_signal_dispatch();
1863
+	    }
1380 1864
     	    //$last_exec[$id]['last'] = time();
1381 1865
 
1382 1866
 	    //$read = array( $sockets[$id] );
@@ -1384,7 +1868,9 @@  discard block
 block discarded – undo
1384 1868
 	    $write = NULL;
1385 1869
 	    $e = NULL;
1386 1870
 	    $n = socket_select($read, $write, $e, $timeout);
1387
-	    if ($e != NULL) var_dump($e);
1871
+	    if ($e != NULL) {
1872
+	    	var_dump($e);
1873
+	    }
1388 1874
 	    if ($n > 0) {
1389 1875
 		$reset = 0;
1390 1876
 		foreach ($read as $nb => $r) {
@@ -1406,13 +1892,17 @@  discard block
 block discarded – undo
1406 1892
 		    if ($buffer !== FALSE) {
1407 1893
 			if ($format == 'vrstcp') {
1408 1894
 			    $buffer = explode('},{',$buffer);
1409
-			} else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
1895
+			} else {
1896
+				$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
1897
+			}
1410 1898
 		    }
1411 1899
 		    // SBS format is CSV format
1412 1900
 		    if ($buffer !== FALSE && $buffer !== '') {
1413 1901
 			$tt[$format] = 0;
1414 1902
 			if ($format == 'acarssbs3') {
1415
-			    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1903
+			    if ($globalDebug) {
1904
+			    	echo 'ACARS : '.$buffer."\n";
1905
+			    }
1416 1906
 			    $ACARS->add(trim($buffer));
1417 1907
 			    $ACARS->deleteLiveAcarsData();
1418 1908
 			} elseif ($format == 'raw') {
@@ -1421,30 +1911,70 @@  discard block
 block discarded – undo
1421 1911
 			    if (is_array($data)) {
1422 1912
 				$data['datetime'] = date('Y-m-d H:i:s');
1423 1913
 				$data['format_source'] = 'raw';
1424
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1425
-				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1426
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1427
-				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1914
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1915
+					$data['source_name'] = $globalSources[$nb]['name'];
1916
+				}
1917
+				if (isset($globalSources[$nb]['sourcestats'])) {
1918
+					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1919
+				}
1920
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
1921
+					$data['noarchive'] = true;
1922
+				}
1923
+				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1924
+					$SI->add($data);
1925
+				}
1428 1926
 			    }
1429 1927
 			} elseif ($format == 'ais') {
1430 1928
 			    $ais_data = $AIS->parse_line(trim($buffer));
1431 1929
 			    $data = array();
1432
-			    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
1433
-			    if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
1434
-			    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
1435
-			    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
1436
-			    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
1437
-			    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
1438
-			    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
1439
-			    if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
1440
-			    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
1441
-			    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
1442
-			    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
1443
-			    if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
1444
-			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1445
-			    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1446
-			    if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1447
-			    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1930
+			    if (isset($ais_data['ident'])) {
1931
+			    	$data['ident'] = $ais_data['ident'];
1932
+			    }
1933
+			    if (isset($ais_data['mmsi'])) {
1934
+			    	$data['mmsi'] = substr($ais_data['mmsi'],-9);
1935
+			    }
1936
+			    if (isset($ais_data['speed'])) {
1937
+			    	$data['speed'] = $ais_data['speed'];
1938
+			    }
1939
+			    if (isset($ais_data['heading'])) {
1940
+			    	$data['heading'] = $ais_data['heading'];
1941
+			    }
1942
+			    if (isset($ais_data['latitude'])) {
1943
+			    	$data['latitude'] = $ais_data['latitude'];
1944
+			    }
1945
+			    if (isset($ais_data['longitude'])) {
1946
+			    	$data['longitude'] = $ais_data['longitude'];
1947
+			    }
1948
+			    if (isset($ais_data['status'])) {
1949
+			    	$data['status'] = $ais_data['status'];
1950
+			    }
1951
+			    if (isset($ais_data['statusid'])) {
1952
+			    	$data['status_id'] = $ais_data['statusid'];
1953
+			    }
1954
+			    if (isset($ais_data['type'])) {
1955
+			    	$data['type'] = $ais_data['type'];
1956
+			    }
1957
+			    if (isset($ais_data['imo'])) {
1958
+			    	$data['imo'] = $ais_data['imo'];
1959
+			    }
1960
+			    if (isset($ais_data['callsign'])) {
1961
+			    	$data['callsign'] = $ais_data['callsign'];
1962
+			    }
1963
+			    if (isset($ais_data['destination'])) {
1964
+			    	$data['arrival_code'] = $ais_data['destination'];
1965
+			    }
1966
+			    if (isset($ais_data['eta_ts'])) {
1967
+			    	$data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1968
+			    }
1969
+			    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
1970
+			    	$data['noarchive'] = true;
1971
+			    }
1972
+			    if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1973
+			    	$data['source_name'] = $globalSources[$nb]['name'];
1974
+			    }
1975
+			    if (isset($globalSources[$nb]['sourcestats'])) {
1976
+			    	$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1977
+			    }
1448 1978
 
1449 1979
 			    if (isset($ais_data['timestamp'])) {
1450 1980
 				$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
@@ -1453,7 +1983,9 @@  discard block
 block discarded – undo
1453 1983
 			    }
1454 1984
 			    $data['format_source'] = 'aisnmea';
1455 1985
     			    $data['id_source'] = $id_source;
1456
-			    if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data);
1986
+			    if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') {
1987
+			    	$MI->add($data);
1988
+			    }
1457 1989
 			    unset($data);
1458 1990
                         } elseif ($format == 'flightgearsp') {
1459 1991
                     	    //echo $buffer."\n";
@@ -1471,12 +2003,18 @@  discard block
 block discarded – undo
1471 2003
 				$data['speed'] = round($line[5]*1.94384);
1472 2004
 				$data['datetime'] = date('Y-m-d H:i:s');
1473 2005
 				$data['format_source'] = 'flightgearsp';
1474
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1475
-				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
2006
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2007
+					$data['noarchive'] = true;
2008
+				}
2009
+				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2010
+					$SI->add($data);
2011
+				}
1476 2012
 				//$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
1477 2013
 			    }
1478 2014
                         } elseif ($format == 'acars') {
1479
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
2015
+                    	    if ($globalDebug) {
2016
+                    	    	echo 'ACARS : '.$buffer."\n";
2017
+                    	    }
1480 2018
 			    $ACARS->add(trim($buffer));
1481 2019
 			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
1482 2020
 			    $ACARS->deleteLiveAcarsData();
@@ -1497,8 +2035,12 @@  discard block
 block discarded – undo
1497 2035
 				    $aircraft_type = $line[10];
1498 2036
 				    $aircraft_type = preg_split(':/:',$aircraft_type);
1499 2037
 				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
1500
-				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1501
-				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
2038
+				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2039
+				    	$data['noarchive'] = true;
2040
+				    }
2041
+				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2042
+				    	$SI->add($data);
2043
+				    }
1502 2044
 				}
1503 2045
 			    }
1504 2046
 			} elseif ($format == 'beast') {
@@ -1508,28 +2050,62 @@  discard block
 block discarded – undo
1508 2050
 			    foreach($buffer as $all_data) {
1509 2051
 				$line = json_decode('{'.$all_data.'}',true);
1510 2052
 				$data = array();
1511
-				if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex
1512
-				if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
1513
-				if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
1514
-				if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
1515
-				if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
1516
-				if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
1517
-				if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
2053
+				if (isset($line['Icao'])) {
2054
+					$data['hex'] = $line['Icao'];
2055
+				}
2056
+				// hex
2057
+				if (isset($line['Call'])) {
2058
+					$data['ident'] = $line['Call'];
2059
+				}
2060
+				// ident
2061
+				if (isset($line['Alt'])) {
2062
+					$data['altitude'] = $line['Alt'];
2063
+				}
2064
+				// altitude
2065
+				if (isset($line['Spd'])) {
2066
+					$data['speed'] = $line['Spd'];
2067
+				}
2068
+				// speed
2069
+				if (isset($line['Trak'])) {
2070
+					$data['heading'] = $line['Trak'];
2071
+				}
2072
+				// heading
2073
+				if (isset($line['Lat'])) {
2074
+					$data['latitude'] = $line['Lat'];
2075
+				}
2076
+				// lat
2077
+				if (isset($line['Long'])) {
2078
+					$data['longitude'] = $line['Long'];
2079
+				}
2080
+				// long
1518 2081
 				//$data['verticalrate'] = $line['']; // verticale rate
1519
-				if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
2082
+				if (isset($line['Sqk'])) {
2083
+					$data['squawk'] = $line['Sqk'];
2084
+				}
2085
+				// squawk
1520 2086
 				$data['emergency'] = ''; // emergency
1521
-				if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
2087
+				if (isset($line['Reg'])) {
2088
+					$data['registration'] = $line['Reg'];
2089
+				}
1522 2090
 				/*
1523 2091
 				if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000);
1524 2092
 				else $data['datetime'] = date('Y-m-d H:i:s');
1525 2093
 				*/
1526 2094
 				$data['datetime'] = date('Y-m-d H:i:s');
1527
-				if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
2095
+				if (isset($line['Type'])) {
2096
+					$data['aircraft_icao'] = $line['Type'];
2097
+				}
1528 2098
 		    		$data['format_source'] = 'vrstcp';
1529 2099
 				$data['id_source'] = $id_source;
1530
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1531
-				if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1532
-				if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data);
2100
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2101
+					$data['noarchive'] = true;
2102
+				}
2103
+				if (isset($value['name']) && $value['name'] != '') {
2104
+					$data['source_name'] = $value['name'];
2105
+				}
2106
+				if (isset($data['latitude']) && isset($data['hex'])) {
2107
+					$SI->add($data);
2108
+				}
1533 2109
 				unset($data);
1534 2110
 			    }
1535 2111
 			} elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') {
@@ -1542,22 +2118,46 @@  discard block
 block discarded – undo
1542 2118
     				$data['hex'] = $lined['hexid'];
1543 2119
     				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
1544 2120
     				$data['datetime'] = date('Y-m-d H:i:s');;
1545
-    				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
1546
-    				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
1547
-    				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
1548
-    				if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
1549
-    				if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
1550
-    				if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
1551
-    				if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
2121
+    				if (isset($lined['ident'])) {
2122
+    					$data['ident'] = $lined['ident'];
2123
+    				}
2124
+    				if (isset($lined['lat'])) {
2125
+    					$data['latitude'] = $lined['lat'];
2126
+    				}
2127
+    				if (isset($lined['lon'])) {
2128
+    					$data['longitude'] = $lined['lon'];
2129
+    				}
2130
+    				if (isset($lined['speed'])) {
2131
+    					$data['speed'] = $lined['speed'];
2132
+    				}
2133
+    				if (isset($lined['squawk'])) {
2134
+    					$data['squawk'] = $lined['squawk'];
2135
+    				}
2136
+    				if (isset($lined['alt'])) {
2137
+    					$data['altitude'] = $lined['alt'];
2138
+    				}
2139
+    				if (isset($lined['heading'])) {
2140
+    					$data['heading'] = $lined['heading'];
2141
+    				}
1552 2142
     				$data['id_source'] = $id_source;
1553 2143
     				$data['format_source'] = 'tsv';
1554
-    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1555
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1556
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1557
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
2144
+    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
2145
+    					$data['source_name'] = $globalSources[$nb]['name'];
2146
+    				}
2147
+    				if (isset($globalSources[$nb]['sourcestats'])) {
2148
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2149
+    				}
2150
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2151
+					$data['noarchive'] = true;
2152
+				}
2153
+    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2154
+    					$SI->add($data);
2155
+    				}
1558 2156
     				unset($lined);
1559 2157
     				unset($data);
1560
-    			    } else $error = true;
2158
+    			    } else {
2159
+    			    	$error = true;
2160
+    			    }
1561 2161
 			} elseif ($format == 'aprs' && $use_aprs) {
1562 2162
 			    if ($aprs_connect == 0) {
1563 2163
 				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
@@ -1583,63 +2183,121 @@  discard block
 block discarded – undo
1583 2183
 				    $aprs_last_tx = time();
1584 2184
 				    $data = array();
1585 2185
 				    //print_r($line);
1586
-				    if (isset($line['address'])) $data['hex'] = $line['address'];
1587
-				    if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi'];
1588
-				    if (isset($line['imo'])) $data['imo'] = $line['imo'];
1589
-				    if (isset($line['squawk'])) $data['squawk'] = $line['squawk'];
1590
-				    if (isset($line['arrival_code'])) $data['arrival_code'] = $line['arrival_code'];
1591
-				    if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date'];
1592
-				    if (isset($line['typeid'])) $data['type_id'] = $line['typeid'];
1593
-				    if (isset($line['statusid'])) $data['status_id'] = $line['statusid'];
1594
-				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
1595
-				    else $data['datetime'] = date('Y-m-d H:i:s');
2186
+				    if (isset($line['address'])) {
2187
+				    	$data['hex'] = $line['address'];
2188
+				    }
2189
+				    if (isset($line['mmsi'])) {
2190
+				    	$data['mmsi'] = $line['mmsi'];
2191
+				    }
2192
+				    if (isset($line['imo'])) {
2193
+				    	$data['imo'] = $line['imo'];
2194
+				    }
2195
+				    if (isset($line['squawk'])) {
2196
+				    	$data['squawk'] = $line['squawk'];
2197
+				    }
2198
+				    if (isset($line['arrival_code'])) {
2199
+				    	$data['arrival_code'] = $line['arrival_code'];
2200
+				    }
2201
+				    if (isset($line['arrival_date'])) {
2202
+				    	$data['arrival_date'] = $line['arrival_date'];
2203
+				    }
2204
+				    if (isset($line['typeid'])) {
2205
+				    	$data['type_id'] = $line['typeid'];
2206
+				    }
2207
+				    if (isset($line['statusid'])) {
2208
+				    	$data['status_id'] = $line['statusid'];
2209
+				    }
2210
+				    if (isset($line['timestamp'])) {
2211
+				    	$data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
2212
+				    } else {
2213
+				    	$data['datetime'] = date('Y-m-d H:i:s');
2214
+				    }
1596 2215
 				    //$data['datetime'] = date('Y-m-d H:i:s');
1597
-				    if (isset($line['ident'])) $data['ident'] = $line['ident'];
2216
+				    if (isset($line['ident'])) {
2217
+				    	$data['ident'] = $line['ident'];
2218
+				    }
1598 2219
 				    $data['latitude'] = $line['latitude'];
1599 2220
 				    $data['longitude'] = $line['longitude'];
1600 2221
 				    //$data['verticalrate'] = $line[16];
1601
-				    if (isset($line['speed'])) $data['speed'] = $line['speed'];
2222
+				    if (isset($line['speed'])) {
2223
+				    	$data['speed'] = $line['speed'];
2224
+				    }
1602 2225
 				    //else $data['speed'] = 0;
1603
-				    if (isset($line['altitude'])) $data['altitude'] = $line['altitude'];
1604
-				    if (isset($line['comment'])) $data['comment'] = $line['comment'];
1605
-				    if (isset($line['symbol'])) $data['type'] = $line['symbol'];
2226
+				    if (isset($line['altitude'])) {
2227
+				    	$data['altitude'] = $line['altitude'];
2228
+				    }
2229
+				    if (isset($line['comment'])) {
2230
+				    	$data['comment'] = $line['comment'];
2231
+				    }
2232
+				    if (isset($line['symbol'])) {
2233
+				    	$data['type'] = $line['symbol'];
2234
+				    }
1606 2235
 				    //if (isset($line['heading'])) $data['heading'] = $line['heading'];
1607 2236
 				    
1608
-				    if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading'];
2237
+				    if (isset($line['heading']) && isset($line['format_source'])) {
2238
+				    	$data['heading'] = $line['heading'];
2239
+				    }
1609 2240
 				    //else echo 'No heading...'."\n";
1610 2241
 				    //else $data['heading'] = 0;
1611
-				    if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth'];
2242
+				    if (isset($line['stealth'])) {
2243
+				    	$data['aircraft_type'] = $line['stealth'];
2244
+				    }
1612 2245
 				    //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true;
1613
-				    if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true;
1614
-				    elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false;
1615
-				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1616
-				    elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false;
2246
+				    if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) {
2247
+				    	$data['noarchive'] = true;
2248
+				    } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) {
2249
+				    	$data['noarchive'] = false;
2250
+				    }
2251
+				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2252
+				    	$data['noarchive'] = true;
2253
+				    } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) {
2254
+				    	$data['noarchive'] = false;
2255
+				    }
1617 2256
     				    $data['id_source'] = $id_source;
1618
-    				    if (isset($line['format_source'])) $data['format_source'] = $line['format_source'];
1619
-				    else $data['format_source'] = 'aprs';
2257
+    				    if (isset($line['format_source'])) {
2258
+    				    	$data['format_source'] = $line['format_source'];
2259
+    				    } else {
2260
+				    	$data['format_source'] = 'aprs';
2261
+				    }
1620 2262
 				    $data['source_name'] = $line['source'];
1621
-				    if (isset($line['source_type'])) $data['source_type'] = $line['source_type'];
1622
-				    else $data['source_type'] = 'flarm';
1623
-    				    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2263
+				    if (isset($line['source_type'])) {
2264
+				    	$data['source_type'] = $line['source_type'];
2265
+				    } else {
2266
+				    	$data['source_type'] = 'flarm';
2267
+				    }
2268
+    				    if (isset($globalSources[$nb]['sourcestats'])) {
2269
+    				    	$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2270
+    				    }
1624 2271
 				    $currentdate = date('Y-m-d H:i:s');
1625 2272
 				    $aprsdate = strtotime($data['datetime']);
1626
-				    if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL';
2273
+				    if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') {
2274
+				    	$data['altitude_relative'] = 'AMSL';
2275
+				    }
1627 2276
 				    // Accept data if time <= system time + 20s
1628 2277
 				    //if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1629 2278
 				    if (($data['source_type'] == 'modes') || isset($line['stealth']) && (!isset($data['hex']) || $data['hex'] != 'FFFFFF') && ($line['stealth'] == 0 || $line['stealth'] == '') && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1630 2279
 					$send = $SI->add($data);
1631 2280
 				    } elseif ($data['source_type'] == 'ais') {
1632 2281
 					$data['type'] = '';
1633
-					if (isset($globalMarine) && $globalMarine) $send = $MI->add($data);
2282
+					if (isset($globalMarine) && $globalMarine) {
2283
+						$send = $MI->add($data);
2284
+					}
1634 2285
 				    } elseif (isset($line['stealth'])) {
1635
-					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
1636
-					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
2286
+					if ($line['stealth'] != 0) {
2287
+						echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
2288
+					} else {
2289
+						echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
2290
+					}
1637 2291
 				    } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1638 2292
 					    //$line['symbol'] == 'Balloon' ||
1639 2293
 					    $line['symbol'] == 'Glider' || 
1640 2294
 					    $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) {
1641
-					    if ($line['symbol'] == 'Ballon') $data['aircraft_icao'] = 'BALL';
1642
-					    if ($line['symbol'] == 'Glider') $data['aircraft_icao'] = 'PARAGLIDER';
2295
+					    if ($line['symbol'] == 'Ballon') {
2296
+					    	$data['aircraft_icao'] = 'BALL';
2297
+					    }
2298
+					    if ($line['symbol'] == 'Glider') {
2299
+					    	$data['aircraft_icao'] = 'PARAGLIDER';
2300
+					    }
1643 2301
 					    $send = $SI->add($data);
1644 2302
 				    } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1645 2303
 					    $line['symbol'] == 'Yacht (Sail)' || 
@@ -1670,9 +2328,13 @@  discard block
 block discarded – undo
1670 2328
 				    //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1671 2329
 				//    } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1672 2330
 					//echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n";
1673
-					if (isset($globalTracker) && $globalTracker) $send = $TI->add($data);
2331
+					if (isset($globalTracker) && $globalTracker) {
2332
+						$send = $TI->add($data);
2333
+					}
1674 2334
 				    } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) {
1675
-					if (!isset($data['altitude'])) $data['altitude'] = 0;
2335
+					if (!isset($data['altitude'])) {
2336
+						$data['altitude'] = 0;
2337
+					}
1676 2338
 					$Source->deleteOldLocationByType('gs');
1677 2339
 					if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) {
1678 2340
 						$Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']);
@@ -1681,7 +2343,9 @@  discard block
 block discarded – undo
1681 2343
 					}
1682 2344
 				    } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') {
1683 2345
 					//if ($globalDebug) echo '!! Weather Station not yet supported'."\n";
1684
-					if ($globalDebug) echo '# Weather Station added'."\n";
2346
+					if ($globalDebug) {
2347
+						echo '# Weather Station added'."\n";
2348
+					}
1685 2349
 					$Source->deleteOldLocationByType('wx');
1686 2350
 					$weather_data = json_encode($line);
1687 2351
 					if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) {
@@ -1691,7 +2355,9 @@  discard block
 block discarded – undo
1691 2355
 					}
1692 2356
 				    } elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) {
1693 2357
 					//if ($globalDebug) echo '!! Weather Station not yet supported'."\n";
1694
-					if ($globalDebug) echo '☈ Lightning added'."\n";
2358
+					if ($globalDebug) {
2359
+						echo '☈ Lightning added'."\n";
2360
+					}
1695 2361
 					$Source->deleteOldLocationByType('lightning');
1696 2362
 					if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) {
1697 2363
 						$Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']);
@@ -1703,8 +2369,7 @@  discard block
 block discarded – undo
1703 2369
 				    	print_r($line);
1704 2370
 				    }
1705 2371
 				    unset($data);
1706
-				}
1707
-				elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') {
2372
+				} elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') {
1708 2373
 					$Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']);
1709 2374
 				}
1710 2375
 				/*
@@ -1713,7 +2378,9 @@  discard block
 block discarded – undo
1713 2378
 				}
1714 2379
 				*/
1715 2380
 				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n";
1716
-				elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n";
2381
+				elseif ($line == true && $globalDebug) {
2382
+					echo '!! Failed : '.$buffer."!!\n";
2383
+				}
1717 2384
 				if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) {
1718 2385
 					$Source->deleteOldLocationByType('lightning');
1719 2386
 					$Source->deleteOldLocationByType('wx');
@@ -1749,26 +2416,45 @@  discard block
 block discarded – undo
1749 2416
     				$data['ground'] = $line[21];
1750 2417
     				$data['emergency'] = $line[19];
1751 2418
     				$data['format_source'] = 'sbs';
1752
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1753
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1754
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
2419
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
2420
+					$data['source_name'] = $globalSources[$nb]['name'];
2421
+				}
2422
+    				if (isset($globalSources[$nb]['sourcestats'])) {
2423
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2424
+    				}
2425
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2426
+					$data['noarchive'] = true;
2427
+				}
1755 2428
     				$data['id_source'] = $id_source;
1756
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
1757
-    				else $error = true;
2429
+    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2430
+    					$send = $SI->add($data);
2431
+    				} else {
2432
+    					$error = true;
2433
+    				}
1758 2434
     				unset($data);
1759
-    			    } else $error = true;
2435
+    			    } else {
2436
+    			    	$error = true;
2437
+    			    }
1760 2438
 			    if ($error) {
1761 2439
 				if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { 
1762
-					if ($globalDebug) echo "Not a message. Ignoring... \n";
2440
+					if ($globalDebug) {
2441
+						echo "Not a message. Ignoring... \n";
2442
+					}
1763 2443
 				} else {
1764
-					if ($globalDebug) echo "Wrong line format. Ignoring... \n";
2444
+					if ($globalDebug) {
2445
+						echo "Wrong line format. Ignoring... \n";
2446
+					}
1765 2447
 					if ($globalDebug) {
1766 2448
 						echo $buffer;
1767 2449
 						//print_r($line);
1768 2450
 					}
1769 2451
 					//socket_close($r);
1770
-					if ($globalDebug) echo "Reconnect after an error...\n";
1771
-					if ($format == 'aprs') $aprs_connect = 0;
2452
+					if ($globalDebug) {
2453
+						echo "Reconnect after an error...\n";
2454
+					}
2455
+					if ($format == 'aprs') {
2456
+						$aprs_connect = 0;
2457
+					}
1772 2458
 					$sourceer[$nb] = $globalSources[$nb];
1773 2459
 					connect_all($sourceer);
1774 2460
 					$sourceer = array();
@@ -1776,10 +2462,14 @@  discard block
 block discarded – undo
1776 2462
 			    }
1777 2463
 			}
1778 2464
 			// Sleep for xxx microseconds
1779
-			if (isset($globalSBSSleep)) usleep($globalSBSSleep);
2465
+			if (isset($globalSBSSleep)) {
2466
+				usleep($globalSBSSleep);
2467
+			}
1780 2468
 		    } else {
1781 2469
 			if ($format == 'flightgearmp') {
1782
-			    	if ($globalDebug) echo "Reconnect FlightGear MP...";
2470
+			    	if ($globalDebug) {
2471
+			    		echo "Reconnect FlightGear MP...";
2472
+			    	}
1783 2473
 				//@socket_close($r);
1784 2474
 				sleep($globalMinFetch);
1785 2475
 				$sourcefg[$nb] = $globalSources[$nb];
@@ -1788,10 +2478,15 @@  discard block
 block discarded – undo
1788 2478
 				break;
1789 2479
 				
1790 2480
 			} elseif ($format != 'acars' && $format != 'flightgearsp') {
1791
-			    if (isset($tt[$format])) $tt[$format]++;
1792
-			    else $tt[$format] = 0;
2481
+			    if (isset($tt[$format])) {
2482
+			    	$tt[$format]++;
2483
+			    } else {
2484
+			    	$tt[$format] = 0;
2485
+			    }
1793 2486
 			    if ($tt[$format] > 30 || $buffer === FALSE) {
1794
-				if ($globalDebug) echo "ERROR : Reconnect ".$format."...";
2487
+				if ($globalDebug) {
2488
+					echo "ERROR : Reconnect ".$format."...";
2489
+				}
1795 2490
 				//@socket_close($r);
1796 2491
 				sleep(2);
1797 2492
 				$aprs_connect = 0;
@@ -1809,11 +2504,17 @@  discard block
 block discarded – undo
1809 2504
 	    } else {
1810 2505
 		$error = socket_strerror(socket_last_error());
1811 2506
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) {
1812
-			if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1813
-			if (isset($globalDebug)) echo "Restarting...\n";
2507
+			if ($globalDebug) {
2508
+				echo "ERROR : socket_select give this error ".$error . "\n";
2509
+			}
2510
+			if (isset($globalDebug)) {
2511
+				echo "Restarting...\n";
2512
+			}
1814 2513
 			// Restart the script if possible
1815 2514
 			if (is_array($sockets)) {
1816
-			    if ($globalDebug) echo "Shutdown all sockets...";
2515
+			    if ($globalDebug) {
2516
+			    	echo "Shutdown all sockets...";
2517
+			    }
1817 2518
 			    
1818 2519
 			    foreach ($sockets as $sock) {
1819 2520
 				@socket_shutdown($sock,2);
@@ -1821,25 +2522,45 @@  discard block
 block discarded – undo
1821 2522
 			    }
1822 2523
 			    
1823 2524
 			}
1824
-			if ($globalDebug) echo "Waiting...";
2525
+			if ($globalDebug) {
2526
+				echo "Waiting...";
2527
+			}
1825 2528
 			sleep(2);
1826 2529
 			$time = time();
1827 2530
 			//connect_all($hosts);
1828 2531
 			$aprs_connect = 0;
1829
-			if ($reset%5 == 0) sleep(20);
1830
-			if ($reset%10 == 0) sleep(100);
1831
-			if ($reset%20 == 0) sleep(200);
1832
-			if ($reset > 100) exit('Too many attempts...');
1833
-			if ($globalDebug) echo "Restart all connections...";
2532
+			if ($reset%5 == 0) {
2533
+				sleep(20);
2534
+			}
2535
+			if ($reset%10 == 0) {
2536
+				sleep(100);
2537
+			}
2538
+			if ($reset%20 == 0) {
2539
+				sleep(200);
2540
+			}
2541
+			if ($reset > 100) {
2542
+				exit('Too many attempts...');
2543
+			}
2544
+			if ($globalDebug) {
2545
+				echo "Restart all connections...";
2546
+			}
1834 2547
 			connect_all($globalSources);
1835 2548
 		}
1836 2549
 	    }
1837 2550
 	}
1838 2551
 	if ($globalDaemon === false) {
1839
-	    if ($globalDebug) echo 'Check all...'."\n";
1840
-	    if (isset($SI)) $SI->checkAll();
1841
-	    if (isset($TI)) $TI->checkAll();
1842
-	    if (isset($MI)) $MI->checkAll();
2552
+	    if ($globalDebug) {
2553
+	    	echo 'Check all...'."\n";
2554
+	    }
2555
+	    if (isset($SI)) {
2556
+	    	$SI->checkAll();
2557
+	    }
2558
+	    if (isset($TI)) {
2559
+	    	$TI->checkAll();
2560
+	    }
2561
+	    if (isset($MI)) {
2562
+	    	$MI->checkAll();
2563
+	    }
1843 2564
 	}
1844 2565
     }
1845 2566
 }
Please login to merge, or discard this patch.
require/class.MarineImport.php 3 patches
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Stats.php');
10 10
 require_once(dirname(__FILE__).'/class.Source.php');
11 11
 if (isset($globalServerAPRS) && $globalServerAPRS) {
12
-    require_once(dirname(__FILE__).'/class.APRS.php');
12
+	require_once(dirname(__FILE__).'/class.APRS.php');
13 13
 }
14 14
 
15 15
 class MarineImport {
16
-    private $all_tracked = array();
17
-    private $last_delete_hourly = 0;
18
-    private $last_delete = 0;
19
-    private $stats = array();
20
-    private $tmd = 0;
21
-    private $source_location = array();
22
-    public $db = null;
23
-    public $nb = 0;
16
+	private $all_tracked = array();
17
+	private $last_delete_hourly = 0;
18
+	private $last_delete = 0;
19
+	private $stats = array();
20
+	private $tmd = 0;
21
+	private $source_location = array();
22
+	public $db = null;
23
+	public $nb = 0;
24 24
 
25
-    public function __construct($dbc = null) {
25
+	public function __construct($dbc = null) {
26 26
 	global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB;
27 27
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
28
-	    $Connection = new Connection($dbc);
29
-	    $this->db = $Connection->db();
30
-	    date_default_timezone_set('UTC');
28
+		$Connection = new Connection($dbc);
29
+		$this->db = $Connection->db();
30
+		date_default_timezone_set('UTC');
31 31
 	}
32 32
 	// Get previous source stats
33 33
 	/*
@@ -46,57 +46,57 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 	*/
48 48
 	if (isset($globalServerAPRS) && $globalServerAPRS) {
49
-	    $APRSMarine = new APRSMarine();
50
-	    //$APRSSpotter->connect();
49
+		$APRSMarine = new APRSMarine();
50
+		//$APRSSpotter->connect();
51
+	}
51 52
 	}
52
-    }
53 53
 
54
-    public function checkAll() {
54
+	public function checkAll() {
55 55
 	global $globalDebug, $globalNoDB;
56 56
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
57
-	    if ($globalDebug) echo "Update last seen tracked data...\n";
58
-	    foreach ($this->all_tracked as $key => $flight) {
57
+		if ($globalDebug) echo "Update last seen tracked data...\n";
58
+		foreach ($this->all_tracked as $key => $flight) {
59 59
 		if (isset($this->all_tracked[$key]['id'])) {
60
-		    //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
61
-    		    $Marine = new Marine($this->db);
62
-    		    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
60
+			//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
61
+				$Marine = new Marine($this->db);
62
+				$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
63
+		}
63 64
 		}
64
-	    }
65 65
 	}
66
-    }
66
+	}
67 67
 
68
-    public function del() {
68
+	public function del() {
69 69
 	global $globalDebug, $globalNoDB, $globalNoImport;
70 70
 	// Delete old infos
71 71
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
72 72
 	foreach ($this->all_tracked as $key => $flight) {
73
-    	    if (isset($flight['lastupdate'])) {
74
-        	if ($flight['lastupdate'] < (time()-3000)) {
75
-            	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
76
-            		if (isset($this->all_tracked[$key]['id'])) {
77
-            		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
78
-			    /*
73
+			if (isset($flight['lastupdate'])) {
74
+			if ($flight['lastupdate'] < (time()-3000)) {
75
+					if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
76
+					if (isset($this->all_tracked[$key]['id'])) {
77
+						if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
78
+				/*
79 79
 			    $MarineLive = new MarineLive();
80 80
             		    $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']);
81 81
 			    $MarineLive->db = null;
82 82
 			    */
83
-            		    //$real_arrival = $this->arrival($key);
84
-            		    $Marine = new Marine($this->db);
85
-            		    if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
83
+						//$real_arrival = $this->arrival($key);
84
+						$Marine = new Marine($this->db);
85
+						if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
86 86
 				$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
87 87
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
88
-			    }
89
-			    // Put in archive
88
+				}
89
+				// Put in archive
90 90
 //				$Marine->db = null;
91 91
 			}
92
-            	    }
93
-            	    unset($this->all_tracked[$key]);
94
-    	        }
95
-	    }
96
-        }
97
-    }
92
+					}
93
+					unset($this->all_tracked[$key]);
94
+				}
95
+		}
96
+		}
97
+	}
98 98
 
99
-    public function add($line) {
99
+	public function add($line) {
100 100
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine;
101 101
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
102 102
 	date_default_timezone_set('UTC');
@@ -105,104 +105,104 @@  discard block
 block discarded – undo
105 105
 	
106 106
 	// SBS format is CSV format
107 107
 	if(is_array($line) && isset($line['mmsi'])) {
108
-	    //print_r($line);
109
-  	    if (isset($line['mmsi'])) {
108
+		//print_r($line);
109
+  		if (isset($line['mmsi'])) {
110 110
 
111 111
 		
112 112
 		// Increment message number
113 113
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
114
-		    $current_date = date('Y-m-d');
115
-		    if (isset($line['source_name'])) $source = $line['source_name'];
116
-		    else $source = '';
117
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
118
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
119
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
120
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
121
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
114
+			$current_date = date('Y-m-d');
115
+			if (isset($line['source_name'])) $source = $line['source_name'];
116
+			else $source = '';
117
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
118
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
119
+				$this->stats[$current_date][$source]['msg']['date'] = time();
120
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
121
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
122 122
 		}
123 123
 		
124 124
 		
125 125
 		$Common = new Common();
126 126
 		$AIS = new AIS();
127
-	        if (!isset($line['id'])) $id = trim($line['mmsi']);
128
-	        else $id = trim($line['id']);
127
+			if (!isset($line['id'])) $id = trim($line['mmsi']);
128
+			else $id = trim($line['id']);
129 129
 		
130 130
 		if (!isset($this->all_tracked[$id])) {
131
-		    $this->all_tracked[$id] = array();
132
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
133
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => ''));
134
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
135
-		    if (!isset($line['id'])) {
131
+			$this->all_tracked[$id] = array();
132
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
133
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => ''));
134
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
135
+			if (!isset($line['id'])) {
136 136
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
137 137
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
138
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
139
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
138
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
139
+			if ($globalAllTracked !== FALSE) $dataFound = true;
140 140
 		}
141 141
 		
142 142
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
143
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
144
-		    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
143
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
144
+			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
145 145
 			$Marine = new Marine($this->db);
146 146
 			$identity = $Marine->getIdentity($line['mmsi']);
147 147
 			if (!empty($identity)) {
148
-			    $this->all_tracked[$id]['ident'] = $identity['ship_name'];
149
-			    $this->all_tracked[$id]['type'] = $identity['type'];
150
-			    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type'])));
148
+				$this->all_tracked[$id]['ident'] = $identity['ship_name'];
149
+				$this->all_tracked[$id]['type'] = $identity['type'];
150
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type'])));
151 151
 			}
152 152
 			//print_r($identity);
153 153
 			unset($Marine);
154 154
 			//$dataFound = true;
155
-		    }
155
+			}
156 156
 		}
157 157
 		if (isset($line['type_id'])) {
158
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
159
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id']));
158
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
159
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id']));
160 160
 		}
161 161
 		if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') {
162
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
163
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type'])));
162
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
163
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type'])));
164 164
 		}
165 165
 		if (isset($line['status']) && $line['status'] != '') {
166
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
166
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
167 167
 		}
168 168
 		if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) {
169
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
170
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
169
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
170
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
171 171
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
172
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
172
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
173 173
 				$Marine = new Marine($this->db);
174 174
 				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']);
175 175
 				unset($Marine);
176
-			    }
176
+				}
177
+			}
177 178
 			}
178
-		    }
179 179
 		}
180 180
 
181 181
 
182 182
 		if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') {
183
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
183
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
184 184
 		}
185 185
 		if (isset($line['imo']) && $line['imo'] != '') {
186
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
186
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
187 187
 		}
188 188
 		if (isset($line['callsign']) && $line['callsign'] != '') {
189
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
189
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
190 190
 		}
191 191
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
192
-		    if (!isset($this->all_tracked[$id]['arrival_code'])) {
192
+			if (!isset($this->all_tracked[$id]['arrival_code'])) {
193 193
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
194 194
 			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
195 195
 			if ($this->all_tracked[$id]['addedMarine'] != 0) {
196
-			    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
196
+				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
197 197
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
198
-				    $Marine = new Marine($this->db);
199
-				    $fromsource = NULL;
200
-				    $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource);
201
-				    $Marine->db = null;
198
+					$Marine = new Marine($this->db);
199
+					$fromsource = NULL;
200
+					$Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource);
201
+					$Marine->db = null;
202
+				}
202 203
 				}
203
-			    }
204 204
 			}
205
-		    } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) {
205
+			} elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) {
206 206
 			$this->all_tracked[$id]['arrival_code'] = $line['arrival_code'];
207 207
 			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
208 208
 			if (!isset($line['id'])) {
@@ -210,26 +210,26 @@  discard block
 block discarded – undo
210 210
 				$this->all_tracked[$id]['forcenew'] = 1;
211 211
 				$this->all_tracked[$id]['addedMarine'] = 0;
212 212
 			}
213
-		    }
213
+			}
214 214
 		}
215 215
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
216
-		    if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
216
+			if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
217 217
 		}
218 218
 
219 219
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
220 220
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
221
-		    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
221
+			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
222 222
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
223
-			    $timeelapsed = microtime(true);
224
-			    $Marine = new Marine($this->db);
225
-			    $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']);
226
-			    $Marine->db = null;
223
+				$timeelapsed = microtime(true);
224
+				$Marine = new Marine($this->db);
225
+				$Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']);
226
+				$Marine->db = null;
227
+			}
227 228
 			}
228
-		    }
229
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
230
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
229
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
230
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
231 231
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
232
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
232
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
233 233
 				$timeelapsed = microtime(true);
234 234
 				$Marine = new Marine($this->db);
235 235
 				$fromsource = NULL;
@@ -237,20 +237,20 @@  discard block
 block discarded – undo
237 237
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
238 238
 				$Marine->db = null;
239 239
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
240
-			    }
240
+				}
241
+			}
241 242
 			}
242
-		    }
243
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
243
+			if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
244 244
 		}
245 245
 
246 246
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) {
247
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
247
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
248 248
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
249
-		    } else {
249
+			} else {
250 250
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
251 251
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
252 252
 				return '';
253
-		    }
253
+			}
254 254
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) {
255 255
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
256 256
 			return '';
@@ -267,24 +267,24 @@  discard block
 block discarded – undo
267 267
 
268 268
 
269 269
 		if (isset($line['speed'])) {
270
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
271
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
270
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
271
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
272 272
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
273
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
274
-		    if ($distance > 1000 && $distance < 10000) {
273
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
274
+			if ($distance > 1000 && $distance < 10000) {
275 275
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
276 276
 			$speed = $speed*3.6;
277 277
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
278 278
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
279
-		    }
279
+			}
280 280
 		}
281 281
 
282
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
283
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
284
-	    	    else unset($timediff);
285
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
282
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
283
+				if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
284
+				else unset($timediff);
285
+				if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
286 286
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
287
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
287
+				if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
288 288
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
289 289
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
290 290
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -292,195 +292,195 @@  discard block
 block discarded – undo
292 292
 				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
293 293
 				$timeelapsed = microtime(true);
294 294
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
295
-				    $Marine = new Marine($this->db);
296
-				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
297
-				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
298
-				    $Marine->db = null;
299
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
295
+					$Marine = new Marine($this->db);
296
+					$all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
297
+					if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
298
+					$Marine->db = null;
299
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
300 300
 				}
301 301
 				$this->tmd = 0;
302 302
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
303
-			    }
303
+				}
304 304
 			}
305 305
 
306 306
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
307 307
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
308 308
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
309
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
310
-				    $dataFound = true;
311
-				    $this->all_tracked[$id]['time_last_coord'] = time();
309
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
310
+					$dataFound = true;
311
+					$this->all_tracked[$id]['time_last_coord'] = time();
312 312
 				}
313 313
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
314 314
 			}
315 315
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
316
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
316
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
317 317
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
318 318
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
319
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
320
-				    $dataFound = true;
321
-				    $this->all_tracked[$id]['time_last_coord'] = time();
319
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
320
+					$dataFound = true;
321
+					$this->all_tracked[$id]['time_last_coord'] = time();
322 322
 				}
323 323
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
324 324
 			}
325 325
 
326
-		    } else if ($globalDebug && $timediff > 20) {
326
+			} else if ($globalDebug && $timediff > 20) {
327 327
 			$this->tmd = $this->tmd + 1;
328 328
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
329 329
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
330 330
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
331 331
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
332
-		    }
332
+			}
333 333
 		}
334 334
 		if (isset($line['last_update']) && $line['last_update'] != '') {
335
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
336
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
335
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
336
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
337 337
 		}
338 338
 		if (isset($line['format_source']) && $line['format_source'] != '') {
339
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
339
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
340 340
 		}
341 341
 		if (isset($line['source_name']) && $line['source_name'] != '') {
342
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
342
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
343 343
 		}
344 344
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
345
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
345
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
346 346
 		}
347 347
 		
348 348
 		if (isset($line['heading']) && $line['heading'] != '') {
349
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
350
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
351
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
352
-		    //$dataFound = true;
349
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
350
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
351
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
352
+			//$dataFound = true;
353 353
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
354
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
355
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
356
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
357
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
354
+  			$heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
355
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
356
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
357
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
358 358
   		}
359 359
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
360 360
 
361 361
 
362 362
 
363 363
 		if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) {
364
-		    $this->all_tracked[$id]['lastupdate'] = time();
365
-		    if ($this->all_tracked[$id]['addedMarine'] == 0) {
366
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
367
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
364
+			$this->all_tracked[$id]['lastupdate'] = time();
365
+			if ($this->all_tracked[$id]['addedMarine'] == 0) {
366
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
367
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
368 368
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
369
-				    if ($globalDebug) echo "Check if vessel is already in DB...";
370
-				    $timeelapsed = microtime(true);
371
-				    $MarineLive = new MarineLive($this->db);
372
-				    if (isset($line['id'])) {
369
+					if ($globalDebug) echo "Check if vessel is already in DB...";
370
+					$timeelapsed = microtime(true);
371
+					$MarineLive = new MarineLive($this->db);
372
+					if (isset($line['id'])) {
373 373
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
374 374
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
375
-				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
375
+					} elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
376 376
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
377 377
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
378
-				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
378
+					} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
379 379
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
380 380
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
381
-				    } else $recent_ident = '';
382
-				    $MarineLive->db=null;
383
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
384
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
381
+					} else $recent_ident = '';
382
+					$MarineLive->db=null;
383
+					if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
384
+					elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
385 385
 				} else $recent_ident = '';
386
-			    } else {
386
+				} else {
387 387
 				$recent_ident = '';
388 388
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
389
-			    }
390
-			    //if there was no vessel with the same callsign within the last hour and go post it into the archive
391
-			    if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
392
-			    {
389
+				}
390
+				//if there was no vessel with the same callsign within the last hour and go post it into the archive
391
+				if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
392
+				{
393 393
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
394 394
 				//adds the spotter data for the archive
395
-				    $highlight = '';
396
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
397
-				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
395
+					$highlight = '';
396
+					if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
397
+					if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
398 398
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
399
-					    $timeelapsed = microtime(true);
400
-					    $Marine = new Marine($this->db);
401
-					    $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
402
-					    $Marine->db = null;
403
-					    if ($globalDebug && isset($result)) echo $result."\n";
404
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
399
+						$timeelapsed = microtime(true);
400
+						$Marine = new Marine($this->db);
401
+						$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
402
+						$Marine->db = null;
403
+						if ($globalDebug && isset($result)) echo $result."\n";
404
+						if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
405
+					}
405 406
 					}
406
-				    }
407
-				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
407
+					if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
408 408
 					// Add source stat in DB
409 409
 					$Stats = new Stats($this->db);
410 410
 					if (!empty($this->stats)) {
411
-					    if ($globalDebug) echo 'Add source stats : ';
412
-				    	    foreach($this->stats as $date => $data) {
411
+						if ($globalDebug) echo 'Add source stats : ';
412
+							foreach($this->stats as $date => $data) {
413 413
 						foreach($data as $source => $sourced) {
414
-					    	    //print_r($sourced);
415
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
416
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
417
-				    		    if (isset($sourced['msg'])) {
418
-				    			if (time() - $sourced['msg']['date'] > 10) {
419
-				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
420
-				    		    	    echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
421
-			    			    	    unset($this->stats[$date][$source]['msg']);
422
-			    				}
423
-			    			    }
424
-			    			}
425
-			    			if ($date != date('Y-m-d')) {
426
-			    			    unset($this->stats[$date]);
427
-			    			}
428
-				    	    }
429
-				    	    if ($globalDebug) echo 'Done'."\n";
414
+								//print_r($sourced);
415
+									if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
416
+									if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
417
+								if (isset($sourced['msg'])) {
418
+								if (time() - $sourced['msg']['date'] > 10) {
419
+										$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
420
+										echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
421
+										unset($this->stats[$date][$source]['msg']);
422
+								}
423
+								}
424
+							}
425
+							if ($date != date('Y-m-d')) {
426
+								unset($this->stats[$date]);
427
+							}
428
+							}
429
+							if ($globalDebug) echo 'Done'."\n";
430 430
 					}
431 431
 					$Stats->db = null;
432
-				    }
432
+					}
433 433
 				    
434
-				    $this->del();
434
+					$this->del();
435 435
 				//$ignoreImport = false;
436 436
 				$this->all_tracked[$id]['addedMarine'] = 1;
437 437
 				//print_r($this->all_tracked[$id]);
438 438
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
439
-				    if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
440
-				    //MarineLive->deleteLiveMarineDataNotUpdated();
441
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
439
+					if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
440
+					//MarineLive->deleteLiveMarineDataNotUpdated();
441
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
442 442
 					$MarineLive = new MarineLive($this->db);
443 443
 					$MarineLive->deleteLiveMarineData();
444 444
 					$MarineLive->db=null;
445 445
 					if ($globalDebug) echo " Done\n";
446
-				    }
447
-				    $this->last_delete = time();
446
+					}
447
+					$this->last_delete = time();
448 448
 				}
449
-			    } elseif ($recent_ident != '') {
449
+				} elseif ($recent_ident != '') {
450 450
 				$this->all_tracked[$id]['id'] = $recent_ident;
451 451
 				$this->all_tracked[$id]['addedMarine'] = 1;
452 452
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
453
-				    if (isset($globalDaemon) && !$globalDaemon) {
453
+					if (isset($globalDaemon) && !$globalDaemon) {
454 454
 					$Marine = new Marine($this->db);
455 455
 					$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']);
456 456
 					$Marine->db = null;
457
-				    }
457
+					}
458 458
 				}
459 459
 				
460
-			    }
460
+				}
461 461
 			}
462
-		    }
463
-		    //adds the spotter LIVE data
464
-		    if ($globalDebug) {
462
+			}
463
+			//adds the spotter LIVE data
464
+			if ($globalDebug) {
465 465
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
466
-		    }
467
-		    $ignoreImport = false;
466
+			}
467
+			$ignoreImport = false;
468 468
 
469
-		    if (!$ignoreImport) {
469
+			if (!$ignoreImport) {
470 470
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
471 471
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
472 472
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
473
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
473
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
474 474
 					$timeelapsed = microtime(true);
475 475
 					$MarineLive = new MarineLive($this->db);
476 476
 					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
477 477
 					$MarineLive->db = null;
478 478
 					if ($globalDebug) echo $result."\n";
479 479
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
480
-				    }
480
+					}
481 481
 				}
482 482
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
483
-				    $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
483
+					$APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
484 484
 				}
485 485
 				$this->all_tracked[$id]['putinarchive'] = false;
486 486
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 					if ($stats_heading == 16) $stats_heading = 0;
513 513
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
514 514
 						for ($i=0;$i<=15;$i++) {
515
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
515
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
516 516
 						}
517 517
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
518 518
 					} else {
@@ -525,11 +525,11 @@  discard block
 block discarded – undo
525 525
 					//var_dump($this->stats);
526 526
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
527 527
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
528
-						    end($this->stats[$current_date][$source]['hist']);
529
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
528
+							end($this->stats[$current_date][$source]['hist']);
529
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
530 530
 						} else $mini = 0;
531 531
 						for ($i=$mini;$i<=$distance;$i+=10) {
532
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
532
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
533 533
 						}
534 534
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
535 535
 					} else {
@@ -545,24 +545,24 @@  discard block
 block discarded – undo
545 545
 			
546 546
 			
547 547
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
548
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
548
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
549 549
 				if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
550 550
 				$MarineLive = new MarineLive($this->db);
551 551
 				$MarineLive->deleteLiveMarineDataNotUpdated();
552 552
 				$MarineLive->db = null;
553 553
 				//MarineLive->deleteLiveMarineData();
554 554
 				if ($globalDebug) echo " Done\n";
555
-			    }
556
-			    $this->last_delete_hourly = time();
555
+				}
556
+				$this->last_delete_hourly = time();
557 557
 			}
558 558
 			
559
-		    }
560
-		    //$ignoreImport = false;
559
+			}
560
+			//$ignoreImport = false;
561 561
 		}
562 562
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
563 563
 		if ($send) return $this->all_tracked[$id];
564
-	    }
564
+		}
565
+	}
565 566
 	}
566
-    }
567 567
 }
568 568
 ?>
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		if (isset($this->all_tracked[$key]['id'])) {
60 60
 		    //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
61 61
     		    $Marine = new Marine($this->db);
62
-    		    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
62
+    		    $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']);
63 63
 		}
64 64
 	    }
65 65
 	}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
72 72
 	foreach ($this->all_tracked as $key => $flight) {
73 73
     	    if (isset($flight['lastupdate'])) {
74
-        	if ($flight['lastupdate'] < (time()-3000)) {
74
+        	if ($flight['lastupdate'] < (time() - 3000)) {
75 75
             	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
76 76
             		if (isset($this->all_tracked[$key]['id'])) {
77 77
             		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             		    //$real_arrival = $this->arrival($key);
84 84
             		    $Marine = new Marine($this->db);
85 85
             		    if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
86
-				$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
86
+				$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']);
87 87
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
88 88
 			    }
89 89
 			    // Put in archive
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
     }
98 98
 
99 99
     public function add($line) {
100
-	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine;
100
+	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS, $APRSMarine;
101 101
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
102 102
 	date_default_timezone_set('UTC');
103 103
 	$dataFound = false;
104 104
 	$send = false;
105 105
 	
106 106
 	// SBS format is CSV format
107
-	if(is_array($line) && isset($line['mmsi'])) {
107
+	if (is_array($line) && isset($line['mmsi'])) {
108 108
 	    //print_r($line);
109 109
   	    if (isset($line['mmsi'])) {
110 110
 
@@ -129,25 +129,25 @@  discard block
 block discarded – undo
129 129
 		
130 130
 		if (!isset($this->all_tracked[$id])) {
131 131
 		    $this->all_tracked[$id] = array();
132
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
133
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => ''));
134
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
132
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedMarine' => 0));
133
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'typeid' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '', 'mmsi' => '', 'status' => '', 'status_id' => '', 'imo' => '', 'callsign' => '', 'arrival_code' => '', 'arrival_date' => '', 'mmsi_type' => ''));
134
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time()));
135 135
 		    if (!isset($line['id'])) {
136 136
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
137
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
138
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
137
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi')));
138
+		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id']));
139 139
 		    if ($globalAllTracked !== FALSE) $dataFound = true;
140 140
 		}
141 141
 		
142 142
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
143
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
143
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi' => $line['mmsi']));
144 144
 		    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
145 145
 			$Marine = new Marine($this->db);
146 146
 			$identity = $Marine->getIdentity($line['mmsi']);
147 147
 			if (!empty($identity)) {
148 148
 			    $this->all_tracked[$id]['ident'] = $identity['ship_name'];
149 149
 			    $this->all_tracked[$id]['type'] = $identity['type'];
150
-			    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type'])));
150
+			    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $AIS->getShipTypeID($identity['type'])));
151 151
 			}
152 152
 			//print_r($identity);
153 153
 			unset($Marine);
@@ -155,23 +155,23 @@  discard block
 block discarded – undo
155 155
 		    }
156 156
 		}
157 157
 		if (isset($line['type_id'])) {
158
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
159
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id']));
158
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $AIS->getShipType($line['type_id'])));
159
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $line['type_id']));
160 160
 		}
161 161
 		if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') {
162
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
163
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type'])));
162
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type']));
163
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $AIS->getShipTypeID($line['type'])));
164 164
 		}
165 165
 		if (isset($line['status']) && $line['status'] != '') {
166
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
166
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status' => $line['status']));
167 167
 		}
168 168
 		if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) {
169
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
169
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status_id' => $line['status_id']));
170 170
 		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
171 171
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
172 172
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
173 173
 				$Marine = new Marine($this->db);
174
-				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']);
174
+				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['status']);
175 175
 				unset($Marine);
176 176
 			    }
177 177
 			}
@@ -180,24 +180,24 @@  discard block
 block discarded – undo
180 180
 
181 181
 
182 182
 		if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') {
183
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
183
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi_type' => $line['mmsi_type']));
184 184
 		}
185 185
 		if (isset($line['imo']) && $line['imo'] != '') {
186
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
186
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('imo' => $line['imo']));
187 187
 		}
188 188
 		if (isset($line['callsign']) && $line['callsign'] != '') {
189
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
189
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('callsign' => $line['callsign']));
190 190
 		}
191 191
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
192 192
 		    if (!isset($this->all_tracked[$id]['arrival_code'])) {
193
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
193
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_code' => $line['arrival_code']));
194 194
 			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
195 195
 			if ($this->all_tracked[$id]['addedMarine'] != 0) {
196 196
 			    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
197 197
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
198 198
 				    $Marine = new Marine($this->db);
199 199
 				    $fromsource = NULL;
200
-				    $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource);
200
+				    $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['arrival_code'], $fromsource);
201 201
 				    $Marine->db = null;
202 202
 				}
203 203
 			    }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 		    }
214 214
 		}
215 215
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
216
-		    if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
216
+		    if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_date' => $line['arrival_date']));
217 217
 		}
218 218
 
219 219
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
@@ -222,44 +222,44 @@  discard block
 block discarded – undo
222 222
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
223 223
 			    $timeelapsed = microtime(true);
224 224
 			    $Marine = new Marine($this->db);
225
-			    $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']);
225
+			    $Marine->addIdentity($this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['type']);
226 226
 			    $Marine->db = null;
227 227
 			}
228 228
 		    }
229
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
229
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident'])));
230 230
 		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
231 231
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
232 232
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
233 233
 				$timeelapsed = microtime(true);
234 234
 				$Marine = new Marine($this->db);
235 235
 				$fromsource = NULL;
236
-				$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
236
+				$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource);
237 237
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
238 238
 				$Marine->db = null;
239
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
239
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
240 240
 			    }
241 241
 			}
242 242
 		    }
243
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
243
+		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident']));
244 244
 		}
245 245
 
246
-		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) {
246
+		if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 30*60 && strtotime($line['datetime']) < time() + 20*60) {
247 247
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
248
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
248
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime']));
249 249
 		    } else {
250 250
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
251 251
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
252 252
 				return '';
253 253
 		    }
254
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) {
254
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time() - 30*60) {
255 255
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
256 256
 			return '';
257
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time()+20*60) {
257
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time() + 20*60) {
258 258
 			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
259 259
 			return '';
260 260
 		} elseif (!isset($line['datetime'])) {
261 261
 			date_default_timezone_set('UTC');
262
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
262
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s')));
263 263
 		} else {
264 264
 			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n";
265 265
 			return '';
@@ -267,24 +267,24 @@  discard block
 block discarded – undo
267 267
 
268 268
 
269 269
 		if (isset($line['speed'])) {
270
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
271
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
270
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed'])));
271
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true));
272 272
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
273
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
273
+		    $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm');
274 274
 		    if ($distance > 1000 && $distance < 10000) {
275 275
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
276 276
 			$speed = $speed*3.6;
277
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
277
+			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed)));
278 278
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
279 279
 		    }
280 280
 		}
281 281
 
282 282
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
283
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
283
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']);
284 284
 	    	    else unset($timediff);
285
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
285
+	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) {
286 286
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
287
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
287
+			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) {
288 288
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
289 289
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
290 290
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 				$timeelapsed = microtime(true);
294 294
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
295 295
 				    $Marine = new Marine($this->db);
296
-				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
296
+				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']);
297 297
 				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
298 298
 				    $Marine->db = null;
299
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
299
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
300 300
 				}
301 301
 				$this->tmd = 0;
302 302
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
@@ -305,55 +305,55 @@  discard block
 block discarded – undo
305 305
 
306 306
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
307 307
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
308
-				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
308
+				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
309 309
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
310 310
 				    $dataFound = true;
311 311
 				    $this->all_tracked[$id]['time_last_coord'] = time();
312 312
 				}
313
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
313
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude']));
314 314
 			}
315 315
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
316 316
 			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
317 317
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
318
-				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
318
+				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
319 319
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
320 320
 				    $dataFound = true;
321 321
 				    $this->all_tracked[$id]['time_last_coord'] = time();
322 322
 				}
323
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
323
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude']));
324 324
 			}
325 325
 
326 326
 		    } else if ($globalDebug && $timediff > 20) {
327 327
 			$this->tmd = $this->tmd + 1;
328 328
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
329
-			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
330
-			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
329
+			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -";
330
+			echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - ";
331 331
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
332 332
 		    }
333 333
 		}
334 334
 		if (isset($line['last_update']) && $line['last_update'] != '') {
335 335
 		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
336
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
336
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update']));
337 337
 		}
338 338
 		if (isset($line['format_source']) && $line['format_source'] != '') {
339
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
339
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source']));
340 340
 		}
341 341
 		if (isset($line['source_name']) && $line['source_name'] != '') {
342
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
342
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name']));
343 343
 		}
344 344
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
345
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
345
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true));
346 346
 		}
347 347
 		
348 348
 		if (isset($line['heading']) && $line['heading'] != '') {
349
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
350
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
351
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
349
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
350
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading'])));
351
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true));
352 352
 		    //$dataFound = true;
353 353
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
354
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
355
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
356
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
354
+  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
355
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading)));
356
+		    if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
357 357
   		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
358 358
   		}
359 359
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) {
364 364
 		    $this->all_tracked[$id]['lastupdate'] = time();
365 365
 		    if ($this->all_tracked[$id]['addedMarine'] == 0) {
366
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
366
+		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
367 367
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
368 368
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
369 369
 				    if ($globalDebug) echo "Check if vessel is already in DB...";
@@ -371,37 +371,37 @@  discard block
 block discarded – undo
371 371
 				    $MarineLive = new MarineLive($this->db);
372 372
 				    if (isset($line['id'])) {
373 373
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
374
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
374
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
375 375
 				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
376 376
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
377
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
377
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
378 378
 				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
379 379
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
380
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
380
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
381 381
 				    } else $recent_ident = '';
382
-				    $MarineLive->db=null;
382
+				    $MarineLive->db = null;
383 383
 				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
384 384
 				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
385 385
 				} else $recent_ident = '';
386 386
 			    } else {
387 387
 				$recent_ident = '';
388
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
388
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0));
389 389
 			    }
390 390
 			    //if there was no vessel with the same callsign within the last hour and go post it into the archive
391
-			    if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
391
+			    if ($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
392 392
 			    {
393 393
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
394 394
 				//adds the spotter data for the archive
395 395
 				    $highlight = '';
396
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
396
+				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
397 397
 				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
398 398
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
399 399
 					    $timeelapsed = microtime(true);
400 400
 					    $Marine = new Marine($this->db);
401
-					    $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
401
+					    $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']);
402 402
 					    $Marine->db = null;
403 403
 					    if ($globalDebug && isset($result)) echo $result."\n";
404
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
404
+					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
405 405
 					}
406 406
 				    }
407 407
 				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
@@ -409,15 +409,15 @@  discard block
 block discarded – undo
409 409
 					$Stats = new Stats($this->db);
410 410
 					if (!empty($this->stats)) {
411 411
 					    if ($globalDebug) echo 'Add source stats : ';
412
-				    	    foreach($this->stats as $date => $data) {
413
-						foreach($data as $source => $sourced) {
412
+				    	    foreach ($this->stats as $date => $data) {
413
+						foreach ($data as $source => $sourced) {
414 414
 					    	    //print_r($sourced);
415
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
416
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
415
+				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_marine', $date);
416
+				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_marine', $date);
417 417
 				    		    if (isset($sourced['msg'])) {
418 418
 				    			if (time() - $sourced['msg']['date'] > 10) {
419 419
 				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
420
-				    		    	    echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
420
+				    		    	    echo $Stats->addStatSource($nbmsg, $source, 'msg_marine', $date);
421 421
 			    			    	    unset($this->stats[$date][$source]['msg']);
422 422
 			    				}
423 423
 			    			    }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
442 442
 					$MarineLive = new MarineLive($this->db);
443 443
 					$MarineLive->deleteLiveMarineData();
444
-					$MarineLive->db=null;
444
+					$MarineLive->db = null;
445 445
 					if ($globalDebug) echo " Done\n";
446 446
 				    }
447 447
 				    $this->last_delete = time();
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
453 453
 				    if (isset($globalDaemon) && !$globalDaemon) {
454 454
 					$Marine = new Marine($this->db);
455
-					$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']);
455
+					$Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']);
456 456
 					$Marine->db = null;
457 457
 				    }
458 458
 				}
@@ -467,20 +467,20 @@  discard block
 block discarded – undo
467 467
 		    $ignoreImport = false;
468 468
 
469 469
 		    if (!$ignoreImport) {
470
-			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
470
+			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
471 471
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
472 472
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
473 473
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
474 474
 					$timeelapsed = microtime(true);
475 475
 					$MarineLive = new MarineLive($this->db);
476
-					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
476
+					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']);
477 477
 					$MarineLive->db = null;
478 478
 					if ($globalDebug) echo $result."\n";
479
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
479
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
480 480
 				    }
481 481
 				}
482 482
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
483
-				    $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
483
+				    $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']);
484 484
 				}
485 485
 				$this->all_tracked[$id]['putinarchive'] = false;
486 486
 
@@ -499,19 +499,19 @@  discard block
 block discarded – undo
499 499
 							$latitude = $globalCenterLatitude;
500 500
 							$longitude = $globalCenterLongitude;
501 501
 						}
502
-						$this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude);
502
+						$this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude);
503 503
 					} else {
504 504
 						$latitude = $this->source_location[$source]['latitude'];
505 505
 						$longitude = $this->source_location[$source]['longitude'];
506 506
 					}
507
-					$stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
507
+					$stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
508 508
 					//$stats_heading = $stats_heading%22.5;
509 509
 					$stats_heading = round($stats_heading/22.5);
510
-					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
510
+					$stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
511 511
 					$current_date = date('Y-m-d');
512 512
 					if ($stats_heading == 16) $stats_heading = 0;
513 513
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
514
-						for ($i=0;$i<=15;$i++) {
514
+						for ($i = 0; $i <= 15; $i++) {
515 515
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
516 516
 						}
517 517
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
527 527
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
528 528
 						    end($this->stats[$current_date][$source]['hist']);
529
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
529
+						    $mini = key($this->stats[$current_date][$source]['hist']) + 10;
530 530
 						} else $mini = 0;
531
-						for ($i=$mini;$i<=$distance;$i+=10) {
531
+						for ($i = $mini; $i <= $distance; $i += 10) {
532 532
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
533 533
 						}
534 534
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 
541 541
 				$this->all_tracked[$id]['lastupdate'] = time();
542 542
 				if ($this->all_tracked[$id]['putinarchive']) $send = true;
543
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
543
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n";
544 544
 			//$this->del();
545 545
 			
546 546
 			
Please login to merge, or discard this patch.
Braces   +202 added lines, -69 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
     public function checkAll() {
55 55
 	global $globalDebug, $globalNoDB;
56 56
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
57
-	    if ($globalDebug) echo "Update last seen tracked data...\n";
57
+	    if ($globalDebug) {
58
+	    	echo "Update last seen tracked data...\n";
59
+	    }
58 60
 	    foreach ($this->all_tracked as $key => $flight) {
59 61
 		if (isset($this->all_tracked[$key]['id'])) {
60 62
 		    //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
@@ -68,13 +70,17 @@  discard block
 block discarded – undo
68 70
     public function del() {
69 71
 	global $globalDebug, $globalNoDB, $globalNoImport;
70 72
 	// Delete old infos
71
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
73
+	if ($globalDebug) {
74
+		echo 'Delete old values and update latest data...'."\n";
75
+	}
72 76
 	foreach ($this->all_tracked as $key => $flight) {
73 77
     	    if (isset($flight['lastupdate'])) {
74 78
         	if ($flight['lastupdate'] < (time()-3000)) {
75 79
             	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
76 80
             		if (isset($this->all_tracked[$key]['id'])) {
77
-            		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
81
+            		    if ($globalDebug) {
82
+            		    	echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
83
+            		    }
78 84
 			    /*
79 85
 			    $MarineLive = new MarineLive();
80 86
             		    $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']);
@@ -84,7 +90,9 @@  discard block
 block discarded – undo
84 90
             		    $Marine = new Marine($this->db);
85 91
             		    if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
86 92
 				$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
87
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
93
+				if ($globalDebug && $result != 'success') {
94
+					echo '!!! ERROR : '.$result."\n";
95
+				}
88 96
 			    }
89 97
 			    // Put in archive
90 98
 //				$Marine->db = null;
@@ -98,7 +106,9 @@  discard block
 block discarded – undo
98 106
 
99 107
     public function add($line) {
100 108
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine;
101
-	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
109
+	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') {
110
+		$globalCoordMinChange = '0.02';
111
+	}
102 112
 	date_default_timezone_set('UTC');
103 113
 	$dataFound = false;
104 114
 	$send = false;
@@ -112,20 +122,30 @@  discard block
 block discarded – undo
112 122
 		// Increment message number
113 123
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
114 124
 		    $current_date = date('Y-m-d');
115
-		    if (isset($line['source_name'])) $source = $line['source_name'];
116
-		    else $source = '';
117
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
125
+		    if (isset($line['source_name'])) {
126
+		    	$source = $line['source_name'];
127
+		    } else {
128
+		    	$source = '';
129
+		    }
130
+		    if ($source == '' || $line['format_source'] == 'aprs') {
131
+		    	$source = $line['format_source'];
132
+		    }
118 133
 		    if (!isset($this->stats[$current_date][$source]['msg'])) {
119 134
 		    	$this->stats[$current_date][$source]['msg']['date'] = time();
120 135
 		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
121
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
136
+		    } else {
137
+		    	$this->stats[$current_date][$source]['msg']['nb'] += 1;
138
+		    }
122 139
 		}
123 140
 		
124 141
 		
125 142
 		$Common = new Common();
126 143
 		$AIS = new AIS();
127
-	        if (!isset($line['id'])) $id = trim($line['mmsi']);
128
-	        else $id = trim($line['id']);
144
+	        if (!isset($line['id'])) {
145
+	        	$id = trim($line['mmsi']);
146
+	        } else {
147
+	        	$id = trim($line['id']);
148
+	        }
129 149
 		
130 150
 		if (!isset($this->all_tracked[$id])) {
131 151
 		    $this->all_tracked[$id] = array();
@@ -133,10 +153,16 @@  discard block
 block discarded – undo
133 153
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => ''));
134 154
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
135 155
 		    if (!isset($line['id'])) {
136
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
156
+			if (!isset($globalDaemon)) {
157
+				$globalDaemon = TRUE;
158
+			}
137 159
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
138
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
139
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
160
+		     } else {
161
+		     	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
162
+		     }
163
+		    if ($globalAllTracked !== FALSE) {
164
+		    	$dataFound = true;
165
+		    }
140 166
 		}
141 167
 		
142 168
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
@@ -191,7 +217,9 @@  discard block
 block discarded – undo
191 217
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
192 218
 		    if (!isset($this->all_tracked[$id]['arrival_code'])) {
193 219
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
194
-			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
220
+			if ($globalDebug) {
221
+				echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
222
+			}
195 223
 			if ($this->all_tracked[$id]['addedMarine'] != 0) {
196 224
 			    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
197 225
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
@@ -204,7 +232,9 @@  discard block
 block discarded – undo
204 232
 			}
205 233
 		    } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) {
206 234
 			$this->all_tracked[$id]['arrival_code'] = $line['arrival_code'];
207
-			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
235
+			if ($globalDebug) {
236
+				echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
237
+			}
208 238
 			if (!isset($line['id'])) {
209 239
 				$this->all_tracked[$id]['id'] = $id.'-'.date('YmdHi');
210 240
 				$this->all_tracked[$id]['forcenew'] = 1;
@@ -213,7 +243,9 @@  discard block
 block discarded – undo
213 243
 		    }
214 244
 		}
215 245
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
216
-		    if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
246
+		    if (strtotime($line['arrival_date']) > time()) {
247
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
248
+		    }
217 249
 		}
218 250
 
219 251
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
@@ -234,34 +266,49 @@  discard block
 block discarded – undo
234 266
 				$Marine = new Marine($this->db);
235 267
 				$fromsource = NULL;
236 268
 				$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
237
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
269
+				if ($globalDebug && $result != 'success') {
270
+					echo '!!! ERROR : '.$result."\n";
271
+				}
238 272
 				$Marine->db = null;
239
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
273
+				if ($globalDebugTimeElapsed) {
274
+					echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
275
+				}
240 276
 			    }
241 277
 			}
242 278
 		    }
243
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
279
+		    if (!isset($this->all_tracked[$id]['id'])) {
280
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
281
+		    }
244 282
 		}
245 283
 
246 284
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) {
247 285
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
248 286
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
249 287
 		    } else {
250
-				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
251
-				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
288
+				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
289
+					echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
290
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
291
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
292
+				}
252 293
 				return '';
253 294
 		    }
254 295
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) {
255
-			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
296
+			if ($globalDebug) {
297
+				echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
298
+			}
256 299
 			return '';
257 300
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time()+20*60) {
258
-			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
301
+			if ($globalDebug) {
302
+				echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
303
+			}
259 304
 			return '';
260 305
 		} elseif (!isset($line['datetime'])) {
261 306
 			date_default_timezone_set('UTC');
262 307
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
263 308
 		} else {
264
-			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n";
309
+			if ($globalDebug) {
310
+				echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n";
311
+			}
265 312
 			return '';
266 313
 		}
267 314
 
@@ -274,14 +321,21 @@  discard block
 block discarded – undo
274 321
 		    if ($distance > 1000 && $distance < 10000) {
275 322
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
276 323
 			$speed = $speed*3.6;
277
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
278
-  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
324
+			if ($speed < 1000) {
325
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
326
+			}
327
+  			if ($globalDebug) {
328
+  				echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
329
+  			}
279 330
 		    }
280 331
 		}
281 332
 
282 333
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
283
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
284
-	    	    else unset($timediff);
334
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) {
335
+	    	    	$timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
336
+	    	    } else {
337
+	    	    	unset($timediff);
338
+	    	    }
285 339
 	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
286 340
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
287 341
 			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
@@ -289,22 +343,32 @@  discard block
 block discarded – undo
289 343
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
290 344
 				$this->all_tracked[$id]['putinarchive'] = true;
291 345
 				
292
-				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
346
+				if ($globalDebug) {
347
+					echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
348
+				}
293 349
 				$timeelapsed = microtime(true);
294 350
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
295 351
 				    $Marine = new Marine($this->db);
296 352
 				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
297
-				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
353
+				    if (!empty($all_country)) {
354
+				    	$this->all_tracked[$id]['over_country'] = $all_country['iso2'];
355
+				    }
298 356
 				    $Marine->db = null;
299
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
357
+				    if ($globalDebugTimeElapsed) {
358
+				    	echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
359
+				    }
300 360
 				}
301 361
 				$this->tmd = 0;
302
-				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
362
+				if ($globalDebug) {
363
+					echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
364
+				}
303 365
 			    }
304 366
 			}
305 367
 
306 368
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
307
-				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
369
+				if (!isset($this->all_tracked[$id]['archive_latitude'])) {
370
+					$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
371
+				}
308 372
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
309 373
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
310 374
 				    $dataFound = true;
@@ -313,8 +377,12 @@  discard block
 block discarded – undo
313 377
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
314 378
 			}
315 379
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
316
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
317
-				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
380
+			    if ($line['longitude'] > 180) {
381
+			    	$line['longitude'] = $line['longitude'] - 360;
382
+			    }
383
+				if (!isset($this->all_tracked[$id]['archive_longitude'])) {
384
+					$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
385
+				}
318 386
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
319 387
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
320 388
 				    $dataFound = true;
@@ -332,7 +400,9 @@  discard block
 block discarded – undo
332 400
 		    }
333 401
 		}
334 402
 		if (isset($line['last_update']) && $line['last_update'] != '') {
335
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
403
+		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) {
404
+		    	$dataFound = true;
405
+		    }
336 406
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
337 407
 		}
338 408
 		if (isset($line['format_source']) && $line['format_source'] != '') {
@@ -346,15 +416,21 @@  discard block
 block discarded – undo
346 416
 		}
347 417
 		
348 418
 		if (isset($line['heading']) && $line['heading'] != '') {
349
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
419
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) {
420
+		    	$this->all_tracked[$id]['putinarchive'] = true;
421
+		    }
350 422
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
351 423
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
352 424
 		    //$dataFound = true;
353 425
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
354 426
   		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
355 427
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
356
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
357
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
428
+		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) {
429
+		    	$this->all_tracked[$id]['putinarchive'] = true;
430
+		    }
431
+  		    if ($globalDebug) {
432
+  		    	echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
433
+  		    }
358 434
   		}
359 435
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
360 436
 
@@ -366,23 +442,38 @@  discard block
 block discarded – undo
366 442
 		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
367 443
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
368 444
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
369
-				    if ($globalDebug) echo "Check if vessel is already in DB...";
445
+				    if ($globalDebug) {
446
+				    	echo "Check if vessel is already in DB...";
447
+				    }
370 448
 				    $timeelapsed = microtime(true);
371 449
 				    $MarineLive = new MarineLive($this->db);
372 450
 				    if (isset($line['id'])) {
373 451
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
374
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
452
+					if ($globalDebugTimeElapsed) {
453
+						echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
454
+					}
375 455
 				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
376 456
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
377
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
457
+					if ($globalDebugTimeElapsed) {
458
+						echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
459
+					}
378 460
 				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
379 461
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
380
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
381
-				    } else $recent_ident = '';
462
+					if ($globalDebugTimeElapsed) {
463
+						echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
464
+					}
465
+				    } else {
466
+				    	$recent_ident = '';
467
+				    }
382 468
 				    $MarineLive->db=null;
383
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
384
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
385
-				} else $recent_ident = '';
469
+				    if ($globalDebug && $recent_ident == '') {
470
+				    	echo " Not in DB.\n";
471
+				    } elseif ($globalDebug && $recent_ident != '') {
472
+				    	echo " Already in DB.\n";
473
+				    }
474
+				} else {
475
+					$recent_ident = '';
476
+				}
386 477
 			    } else {
387 478
 				$recent_ident = '';
388 479
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
@@ -390,30 +481,44 @@  discard block
 block discarded – undo
390 481
 			    //if there was no vessel with the same callsign within the last hour and go post it into the archive
391 482
 			    if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
392 483
 			    {
393
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
484
+				if ($globalDebug) {
485
+					echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
486
+				}
394 487
 				//adds the spotter data for the archive
395 488
 				    $highlight = '';
396
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
489
+				    if (!isset($this->all_tracked[$id]['id'])) {
490
+				    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
491
+				    }
397 492
 				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
398 493
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
399 494
 					    $timeelapsed = microtime(true);
400 495
 					    $Marine = new Marine($this->db);
401 496
 					    $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
402 497
 					    $Marine->db = null;
403
-					    if ($globalDebug && isset($result)) echo $result."\n";
404
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
498
+					    if ($globalDebug && isset($result)) {
499
+					    	echo $result."\n";
500
+					    }
501
+					    if ($globalDebugTimeElapsed) {
502
+					    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
503
+					    }
405 504
 					}
406 505
 				    }
407 506
 				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
408 507
 					// Add source stat in DB
409 508
 					$Stats = new Stats($this->db);
410 509
 					if (!empty($this->stats)) {
411
-					    if ($globalDebug) echo 'Add source stats : ';
510
+					    if ($globalDebug) {
511
+					    	echo 'Add source stats : ';
512
+					    }
412 513
 				    	    foreach($this->stats as $date => $data) {
413 514
 						foreach($data as $source => $sourced) {
414 515
 					    	    //print_r($sourced);
415
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
416
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
516
+				    	    	    if (isset($sourced['polar'])) {
517
+				    	    	    	echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
518
+				    	    	    }
519
+				    	    	    if (isset($sourced['hist'])) {
520
+				    	    	    	echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
521
+				    	    	    }
417 522
 				    		    if (isset($sourced['msg'])) {
418 523
 				    			if (time() - $sourced['msg']['date'] > 10) {
419 524
 				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
@@ -426,7 +531,9 @@  discard block
 block discarded – undo
426 531
 			    			    unset($this->stats[$date]);
427 532
 			    			}
428 533
 				    	    }
429
-				    	    if ($globalDebug) echo 'Done'."\n";
534
+				    	    if ($globalDebug) {
535
+				    	    	echo 'Done'."\n";
536
+				    	    }
430 537
 					}
431 538
 					$Stats->db = null;
432 539
 				    }
@@ -436,13 +543,17 @@  discard block
 block discarded – undo
436 543
 				$this->all_tracked[$id]['addedMarine'] = 1;
437 544
 				//print_r($this->all_tracked[$id]);
438 545
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
439
-				    if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
546
+				    if ($globalDebug) {
547
+				    	echo "---- Deleting Live Marine data older than 9 hours...";
548
+				    }
440 549
 				    //MarineLive->deleteLiveMarineDataNotUpdated();
441 550
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
442 551
 					$MarineLive = new MarineLive($this->db);
443 552
 					$MarineLive->deleteLiveMarineData();
444 553
 					$MarineLive->db=null;
445
-					if ($globalDebug) echo " Done\n";
554
+					if ($globalDebug) {
555
+						echo " Done\n";
556
+					}
446 557
 				    }
447 558
 				    $this->last_delete = time();
448 559
 				}
@@ -468,15 +579,21 @@  discard block
 block discarded – undo
468 579
 
469 580
 		    if (!$ignoreImport) {
470 581
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
471
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
582
+				if ($globalDebug) {
583
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
584
+				}
472 585
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
473 586
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
474 587
 					$timeelapsed = microtime(true);
475 588
 					$MarineLive = new MarineLive($this->db);
476 589
 					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
477 590
 					$MarineLive->db = null;
478
-					if ($globalDebug) echo $result."\n";
479
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
591
+					if ($globalDebug) {
592
+						echo $result."\n";
593
+					}
594
+					if ($globalDebugTimeElapsed) {
595
+						echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
596
+					}
480 597
 				    }
481 598
 				}
482 599
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
@@ -488,7 +605,9 @@  discard block
 block discarded – undo
488 605
 				
489 606
 				if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
490 607
 					$source = $this->all_tracked[$id]['source_name'];
491
-					if ($source == '') $source = $this->all_tracked[$id]['format_source'];
608
+					if ($source == '') {
609
+						$source = $this->all_tracked[$id]['format_source'];
610
+					}
492 611
 					if (!isset($this->source_location[$source])) {
493 612
 						$Location = new Source($this->db);
494 613
 						$coord = $Location->getLocationInfobySourceName($source);
@@ -509,7 +628,9 @@  discard block
 block discarded – undo
509 628
 					$stats_heading = round($stats_heading/22.5);
510 629
 					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
511 630
 					$current_date = date('Y-m-d');
512
-					if ($stats_heading == 16) $stats_heading = 0;
631
+					if ($stats_heading == 16) {
632
+						$stats_heading = 0;
633
+					}
513 634
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
514 635
 						for ($i=0;$i<=15;$i++) {
515 636
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
@@ -527,7 +648,9 @@  discard block
 block discarded – undo
527 648
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
528 649
 						    end($this->stats[$current_date][$source]['hist']);
529 650
 						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
530
-						} else $mini = 0;
651
+						} else {
652
+							$mini = 0;
653
+						}
531 654
 						for ($i=$mini;$i<=$distance;$i+=10) {
532 655
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
533 656
 						}
@@ -539,19 +662,27 @@  discard block
 block discarded – undo
539 662
 				
540 663
 
541 664
 				$this->all_tracked[$id]['lastupdate'] = time();
542
-				if ($this->all_tracked[$id]['putinarchive']) $send = true;
543
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
665
+				if ($this->all_tracked[$id]['putinarchive']) {
666
+					$send = true;
667
+				}
668
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
669
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
670
+			}
544 671
 			//$this->del();
545 672
 			
546 673
 			
547 674
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
548 675
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
549
-				if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
676
+				if ($globalDebug) {
677
+					echo "---- Deleting Live Marine data Not updated since 2 hour...";
678
+				}
550 679
 				$MarineLive = new MarineLive($this->db);
551 680
 				$MarineLive->deleteLiveMarineDataNotUpdated();
552 681
 				$MarineLive->db = null;
553 682
 				//MarineLive->deleteLiveMarineData();
554
-				if ($globalDebug) echo " Done\n";
683
+				if ($globalDebug) {
684
+					echo " Done\n";
685
+				}
555 686
 			    }
556 687
 			    $this->last_delete_hourly = time();
557 688
 			}
@@ -560,7 +691,9 @@  discard block
 block discarded – undo
560 691
 		    //$ignoreImport = false;
561 692
 		}
562 693
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
563
-		if ($send) return $this->all_tracked[$id];
694
+		if ($send) {
695
+			return $this->all_tracked[$id];
696
+		}
564 697
 	    }
565 698
 	}
566 699
     }
Please login to merge, or discard this patch.
statistics.php 3 patches
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 }
24 24
 
25 25
 if (!isset($filter_name)) $filter_name = '';
26
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
26
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
27 27
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
28 28
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
29 29
 }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
33 33
 	if (isset($airline_info[0]['name'])) {
34 34
 		$airline_name = $airline_info[0]['name'];
35
-	} elseif (strpos($airline_icao,'alliance_') !== FALSE) {
35
+	} elseif (strpos($airline_icao, 'alliance_') !== FALSE) {
36 36
 		$alliance_name = $airline_icao;
37 37
 	}
38 38
 }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	$title = _("Statistics");
43 43
 }
44 44
 
45
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
45
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
46
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
47 47
 
48 48
 require_once('header.php');
49 49
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	date_default_timezone_set('UTC');
75 75
 	$lastupdate = strtotime($last_update[0]['value']);
76 76
 	if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
77
-	print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
77
+	print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
78 78
 }
79 79
 
80 80
 ?>
@@ -86,31 +86,31 @@  discard block
 block discarded – undo
86 86
 <?php
87 87
 if ($type == 'aircraft') {
88 88
 ?>
89
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
90
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
91
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
92
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
89
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
90
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
91
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
92
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
93 93
 <?php
94 94
 	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
95 95
 ?>
96
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
97
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
96
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
97
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
98 98
 <?php
99 99
 	}
100 100
 	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
101 101
 ?>
102
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
103
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
102
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
103
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
104 104
 <?php
105 105
 	}
106 106
 ?>
107
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
108
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
107
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
108
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
109 109
 <?php
110 110
 	if ($airline_icao == '') {
111 111
 ?>
112
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
113
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
112
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
113
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
114 114
 <?php
115 115
 	}
116 116
 ?>
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) {
119 119
 		if ($airline_icao == '' || $airline_icao == 'all') {
120 120
 ?>
121
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
122
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
121
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
122
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
123 123
 <?php
124 124
 		}
125 125
 	}
@@ -127,22 +127,22 @@  discard block
 block discarded – undo
127 127
 <?php
128 128
 } elseif ($type == 'marine') {
129 129
 ?>
130
-	<span><span class="badge"><?php print number_format($Stats->countOverallMarine($filter_name,$year,$month)); ?></span> <?php echo _("Vessels"); ?></span>
131
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
132
-	<span><span class="badge"><?php print number_format($Stats->countOverallMarineTypes($filter_name,$year,$month)); ?></span> <?php echo _("Types"); ?></span>
133
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
130
+	<span><span class="badge"><?php print number_format($Stats->countOverallMarine($filter_name, $year, $month)); ?></span> <?php echo _("Vessels"); ?></span>
131
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
132
+	<span><span class="badge"><?php print number_format($Stats->countOverallMarineTypes($filter_name, $year, $month)); ?></span> <?php echo _("Types"); ?></span>
133
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
134 134
 <?php
135 135
 } elseif ($type == 'tracker') {
136 136
 ?>
137
-	<span><span class="badge"><?php print number_format($Stats->countOverallTracker($filter_name,$year,$month)); ?></span> <?php echo _("Trackers"); ?></span>
138
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
139
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span>
140
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
137
+	<span><span class="badge"><?php print number_format($Stats->countOverallTracker($filter_name, $year, $month)); ?></span> <?php echo _("Trackers"); ?></span>
138
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
139
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span>
140
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
141 141
 <?php
142 142
 }
143 143
 ?>
144 144
     </p>
145
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
145
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
146 146
     <div class="specific-stats">
147 147
 <?php
148 148
 if ($type == 'aircraft') {
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
             <div class="col-md-6">
152 152
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
153 153
 <?php
154
-	$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
154
+	$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
155 155
 	if (count($aircraft_array) == 0) {
156 156
 		print _("No data available");
157 157
 	} else {
158 158
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
159 159
 		$aircraft_data = '';
160
-		foreach($aircraft_array as $aircraft_item) {
160
+		foreach ($aircraft_array as $aircraft_item) {
161 161
 			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
162 162
 			else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
163 163
 		}
@@ -186,16 +186,16 @@  discard block
 block discarded – undo
186 186
 ?>
187 187
                 </div>
188 188
             </div>
189
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
189
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
190 190
 <?php
191 191
 	if ($airline_icao == '' || $airline_icao == 'all') {
192
-		$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
192
+		$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
193 193
 		if (count($airline_array) > 0) {
194 194
 			print '<div class="col-md-6">';
195 195
 			print '<h2>'._("Top 10 Most Common Airline").'</h2>';
196 196
 			print '<div id="chart2" class="chart" width="100%"></div><script>';
197 197
 			$airline_data = '';
198
-			foreach($airline_array as $airline_item) {
198
+			foreach ($airline_array as $airline_item) {
199 199
 				$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
200 200
 			}
201 201
 			$airline_data = substr($airline_data, 0, -1);
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		}
221 221
 ?>
222 222
         </div>
223
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
223
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
224 224
 <?php
225 225
 	}
226 226
 }
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
             <div class="col-md-6">
233 233
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
234 234
 <?php
235
-	$marine_array = $Stats->countAllMarineTypes(true,$filter_name,$year,$month);
235
+	$marine_array = $Stats->countAllMarineTypes(true, $filter_name, $year, $month);
236 236
 	if (count($marine_array) == 0) print _("No data available");
237 237
 	else {
238 238
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
239 239
 		$marine_data = '';
240
-		foreach($marine_array as $marine_item) {
240
+		foreach ($marine_array as $marine_item) {
241 241
 			$marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
242 242
 		}
243 243
 		$marine_data = substr($marine_data, 0, -1);
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             	    ?>
267 267
                 </div>
268 268
             </div>
269
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
269
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
270 270
 <!--	</div>-->
271 271
 <?php
272 272
 }
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
             <div class="col-md-6">
277 277
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
278 278
 <?php
279
-	$tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
279
+	$tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month);
280 280
 	if (count($tracker_array) == 0) print _("No data available");
281 281
 	else {
282 282
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
283 283
 		$tracker_data = '';
284
-		foreach($tracker_array as $tracker_item) {
284
+		foreach ($tracker_array as $tracker_item) {
285 285
 			$tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],';
286 286
 		}
287 287
 		$tracker_data = substr($tracker_data, 0, -1);
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             	    ?>
312 312
                 </div>
313 313
             </div>
314
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
314
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
315 315
 <!--	</div>-->
316 316
 <?php
317 317
 }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		else {
327 327
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
328 328
 			$owner_data = '';
329
-			foreach($owner_array as $owner_item) {
329
+			foreach ($owner_array as $owner_item) {
330 330
 				$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
331 331
 			}
332 332
 			$owner_data = substr($owner_data, 0, -1);
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                 </div>
347 347
                 -->
348 348
             </div>
349
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
349
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
350 350
             <div class="col-md-6">
351 351
                 <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2>
352 352
 <?php
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 		else {
356 356
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
357 357
 			$owner_data = '';
358
-			foreach($countries_array as $owner_item) {
358
+			foreach ($countries_array as $owner_item) {
359 359
 				$owner_data .= '["'.$owner_item['country_name'].'",'.$owner_item['country_count'].'],';
360 360
 			}
361 361
 			$owner_data = substr($owner_data, 0, -1);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                 -->
377 377
             </div>
378 378
             
379
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
379
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
380 380
 ²	</div>
381 381
         <div class="row column">
382 382
             <div class="col-md-6">
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		else {
388 388
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
389 389
 			$launch_site_data = '';
390
-			foreach($launch_site_array as $launch_site_item) {
390
+			foreach ($launch_site_array as $launch_site_item) {
391 391
 				$launch_site_data .= '["'.$launch_site_item['launch_site'].'",'.$launch_site_item['launch_site_count'].'],';
392 392
 			}
393 393
 			$launch_site_data = substr($launch_site_data, 0, -1);
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 ?>
415 415
         <div class="row column">
416 416
 <?php
417
-	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
417
+	$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
418 418
 	//if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
419 419
 	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
420 420
 		if (empty($flightover_array)) {
@@ -425,12 +425,12 @@  discard block
 block discarded – undo
425 425
 ?>
426 426
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
427 427
 <?php
428
-		$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
428
+		$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
429 429
 		if (count($pilot_array) == 0) print _("No data available");
430 430
 		else {
431 431
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
432 432
 			$pilot_data = '';
433
-			foreach($pilot_array as $pilot_item) {
433
+			foreach ($pilot_array as $pilot_item) {
434 434
 				$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
435 435
 			}
436 436
 			$pilot_data = substr($pilot_data, 0, -1);
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 ?>
452 452
             </div>
453 453
 
454
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
454
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
455 455
 <?php
456 456
 	}
457 457
 	// else {
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
             <div class="col-md-6">
461 461
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
462 462
 <?php
463
-		$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
463
+		$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
464 464
 		if (count($owner_array) == 0) print _("No data available");
465 465
 		else {
466 466
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
467 467
 			$owner_data = '';
468
-			foreach($owner_array as $owner_item) {
468
+			foreach ($owner_array as $owner_item) {
469 469
 				$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
470 470
 			}
471 471
 			$owner_data = substr($owner_data, 0, -1);
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
                 </div>
485 485
             </div>
486 486
         
487
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
487
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
488 488
 <?php
489 489
 	}
490 490
 	if (!empty($flightover_array)) {
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
499 499
 			print 'var series = [';
500 500
 			$flightover_data = '';
501
-			foreach($flightover_array as $flightover_item) {
501
+			foreach ($flightover_array as $flightover_item) {
502 502
 				$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
503 503
 			}
504 504
 			$flightover_data = substr($flightover_data, 0, -1);
@@ -543,12 +543,12 @@  discard block
 block discarded – undo
543 543
 	}
544 544
 ?>
545 545
         </div>
546
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
546
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
547 547
         </div>
548 548
 <?php
549 549
 }
550 550
 if ($type == 'marine') {
551
-	$flightover_array = $Stats->countAllMarineOverCountries(true,$filter_name,$year,$month);
551
+	$flightover_array = $Stats->countAllMarineOverCountries(true, $filter_name, $year, $month);
552 552
 ?>
553 553
 <!--    <div class="row column">-->
554 554
 	<div class="col-md-6">
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
560 560
 		print 'var series = [';
561 561
 		$flightover_data = '';
562
-		foreach($flightover_array as $flightover_item) {
562
+		foreach ($flightover_array as $flightover_item) {
563 563
 			$flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
564 564
 		}
565 565
 		$flightover_data = substr($flightover_data, 0, -1);
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
                 <div class="more">
600 600
                     <a href="<?php print $globalURL; ?>/marine/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
601 601
                 </div>
602
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
602
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
603 603
             </div>
604 604
         </div>
605 605
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
618 618
 		print 'var series = [';
619 619
 		$flightover_data = '';
620
-		foreach($flightover_array as $flightover_item) {
620
+		foreach ($flightover_array as $flightover_item) {
621 621
 			$flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],';
622 622
 		}
623 623
 		$flightover_data = substr($flightover_data, 0, -1);
@@ -667,14 +667,14 @@  discard block
 block discarded – undo
667 667
         <div class="row column">
668 668
             <div class="col-md-6">
669 669
 <?php
670
-	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
670
+	$airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
671 671
 	if (count($airport_airport_array) > 0) {
672 672
 		print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
673 673
 		print '<div id="chart3" class="chart" width="100%"></div><script>';
674 674
 		print "\n";
675 675
 		print 'var series = [';
676 676
 		$airport_data = '';
677
-		foreach($airport_airport_array as $airport_item) {
677
+		foreach ($airport_airport_array as $airport_item) {
678 678
 			$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
679 679
 		}
680 680
 		$airport_data = substr($airport_data, 0, -1);
@@ -724,18 +724,18 @@  discard block
 block discarded – undo
724 724
 	}
725 725
 ?>
726 726
             </div>
727
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
727
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
728 728
 
729 729
             <div class="col-md-6">
730 730
 <?php
731
-	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
731
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
732 732
 	if (count($airport_airport_array2) > 0) {
733 733
 		print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
734 734
 		print '<div id="chart4" class="chart" width="100%"></div><script>';
735 735
 		print "\n";
736 736
 		print 'var series = [';
737 737
 		$airport_data = '';
738
-		foreach($airport_airport_array2 as $airport_item)
738
+		foreach ($airport_airport_array2 as $airport_item)
739 739
 		{
740 740
 			if (isset($airport_item['airport_arrival_longitude']) && isset($airport_item['airport_arrival_latitude'])) {
741 741
 				$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 ?>
790 790
             </div>
791 791
         </div>
792
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
792
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
793 793
 <?php 
794 794
 }
795 795
 if ($type == 'aircraft') {
@@ -801,18 +801,18 @@  discard block
 block discarded – undo
801 801
             <div class="col-md-6">
802 802
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
803 803
 <?php
804
-		$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
804
+		$year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
805 805
 		if (count($year_array) == 0) print _("No data available");
806 806
 		else {
807 807
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
808 808
 			$year_data = '';
809 809
 			$year_cnt = '';
810
-			foreach($year_array as $year_item) {
810
+			foreach ($year_array as $year_item) {
811 811
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
812 812
 				$year_cnt .= $year_item['date_count'].',';
813 813
 			}
814 814
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
815
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
815
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
816 816
 			print 'c3.generate({
817 817
 			    bindto: "#chart8",
818 818
 			    data: { x: "x",
@@ -825,22 +825,22 @@  discard block
 block discarded – undo
825 825
                     <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
826 826
                 </div>
827 827
             </div>
828
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
828
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
829 829
             <div class="col-md-6">
830 830
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
831 831
 <?php
832
-		$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
832
+		$month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
833 833
 		if (count($month_array) == 0) print _("No data available");
834 834
 		else {
835 835
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
836 836
 			$month_data = '';
837 837
 			$month_cnt = '';
838
-			foreach($month_array as $month_item) {
838
+			foreach ($month_array as $month_item) {
839 839
 				$month_data .= '"'.$month_item['date_name'].'",';
840 840
 				$month_cnt .= $month_item['date_count'].',';
841 841
 			}
842 842
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
843
-			$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
843
+			$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]";
844 844
 			print 'c3.generate({
845 845
 			    bindto: "#chart9",
846 846
 			    data: { x: "x",
@@ -853,23 +853,23 @@  discard block
 block discarded – undo
853 853
                     <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
854 854
                 </div>
855 855
             </div>
856
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
856
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
857 857
 
858 858
             <div class="col-md-6">
859 859
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
860 860
 <?php
861
-		$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
861
+		$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
862 862
 		if (empty($date_array)) print _("No data available");
863 863
 		else {
864 864
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
865 865
 			$date_data = '';
866 866
 			$date_cnt = '';
867
-			foreach($date_array as $date_item) {
867
+			foreach ($date_array as $date_item) {
868 868
 				$date_data .= '"'.$date_item['date_name'].'",';
869 869
 				$date_cnt .= $date_item['date_count'].',';
870 870
 			}
871 871
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
872
-			$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
872
+			$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
873 873
 			print 'c3.generate({
874 874
 			    bindto: "#chart5",
875 875
 			    data: { x: "x",
@@ -882,22 +882,22 @@  discard block
 block discarded – undo
882 882
                     <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
883 883
                 </div>
884 884
             </div>
885
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
885
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
886 886
             <div class="col-md-6">
887 887
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
888 888
 <?php
889
-		$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
889
+		$hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
890 890
 		if (empty($hour_array)) print _("No data available");
891 891
 		else {
892 892
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
893 893
 			$hour_data = '';
894 894
 			$hour_cnt = '';
895
-			foreach($hour_array as $hour_item) {
895
+			foreach ($hour_array as $hour_item) {
896 896
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
897 897
 				$hour_cnt .= $hour_item['hour_count'].',';
898 898
 			}
899 899
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
900
-			$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
900
+			$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
901 901
 			print 'c3.generate({
902 902
 			    bindto: "#chart6",
903 903
 			    data: {
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
                     <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
911 911
                 </div>
912 912
             </div>
913
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
913
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
914 914
         </div>
915 915
 <?php
916 916
 	}
@@ -926,18 +926,18 @@  discard block
 block discarded – undo
926 926
             <div class="col-md-6">
927 927
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
928 928
 <?php
929
-		$year_array = $Stats->countAllMarineMonthsLastYear(true,$filter_name);
929
+		$year_array = $Stats->countAllMarineMonthsLastYear(true, $filter_name);
930 930
 		if (count($year_array) == 0) print _("No data available");
931 931
 		else {
932 932
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
933 933
 			$year_data = '';
934 934
 			$year_cnt = '';
935
-			foreach($year_array as $year_item) {
935
+			foreach ($year_array as $year_item) {
936 936
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
937 937
 				$year_cnt .= $year_item['date_count'].',';
938 938
 			}
939 939
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
940
-			$year_cnt = "['vessels',".substr($year_cnt,0,-1)."]";
940
+			$year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]";
941 941
 			print 'c3.generate({
942 942
 			    bindto: "#chart8",
943 943
 			    data: { x: "x",
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
                 </div>
952 952
             </div>
953 953
             
954
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
954
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
955 955
             <div class="col-md-6">
956 956
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
957 957
 <?php
@@ -961,12 +961,12 @@  discard block
 block discarded – undo
961 961
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
962 962
 			$month_data = '';
963 963
 			$month_cnt = '';
964
-			foreach($month_array as $month_item) {
964
+			foreach ($month_array as $month_item) {
965 965
 				$month_data .= '"'.$month_item['date_name'].'",';
966 966
 				$month_cnt .= $month_item['date_count'].',';
967 967
 			}
968 968
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
969
-			$month_cnt = "['vessels',".substr($month_cnt,0,-1)."]";
969
+			$month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]";
970 970
 			print 'c3.generate({
971 971
 			    bindto: "#chart9",
972 972
 			    data: { x: "x",
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
                     <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
980 980
                 </div>
981 981
             </div>
982
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
982
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
983 983
 
984 984
             <div class="col-md-6">
985 985
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
@@ -990,12 +990,12 @@  discard block
 block discarded – undo
990 990
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
991 991
 			$date_data = '';
992 992
 			$date_cnt = '';
993
-			foreach($date_array as $date_item) {
993
+			foreach ($date_array as $date_item) {
994 994
 				$date_data .= '"'.$date_item['date_name'].'",';
995 995
 				$date_cnt .= $date_item['date_count'].',';
996 996
 			}
997 997
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
998
-			$date_cnt = "['vessels',".substr($date_cnt,0,-1)."]";
998
+			$date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]";
999 999
 			print 'c3.generate({
1000 1000
 			    bindto: "#chart5",
1001 1001
 			    data: { x: "x",
@@ -1008,22 +1008,22 @@  discard block
 block discarded – undo
1008 1008
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1009 1009
                 </div>
1010 1010
             </div>
1011
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1011
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1012 1012
             <div class="col-md-6">
1013 1013
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1014 1014
 <?php
1015
-		$hour_array = $Stats->countAllMarineHours('hour',true,$filter_name);
1015
+		$hour_array = $Stats->countAllMarineHours('hour', true, $filter_name);
1016 1016
 		if (empty($hour_array)) print _("No data available");
1017 1017
 		else {
1018 1018
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1019 1019
 			$hour_data = '';
1020 1020
 			$hour_cnt = '';
1021
-			foreach($hour_array as $hour_item) {
1021
+			foreach ($hour_array as $hour_item) {
1022 1022
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
1023 1023
 				$hour_cnt .= $hour_item['hour_count'].',';
1024 1024
 			}
1025 1025
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
1026
-			$hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]";
1026
+			$hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]";
1027 1027
 			print 'c3.generate({
1028 1028
 			    bindto: "#chart6",
1029 1029
 			    data: {
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
                     <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1037 1037
                 </div>
1038 1038
             </div>
1039
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1039
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1040 1040
         </div>
1041 1041
 <?php
1042 1042
 	}
@@ -1058,12 +1058,12 @@  discard block
 block discarded – undo
1058 1058
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
1059 1059
 			$year_data = '';
1060 1060
 			$year_cnt = '';
1061
-			foreach($year_array as $year_item) {
1061
+			foreach ($year_array as $year_item) {
1062 1062
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1063 1063
 				$year_cnt .= $year_item['date_count'].',';
1064 1064
 			}
1065 1065
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1066
-			$year_cnt = "['trackers',".substr($year_cnt,0,-1)."]";
1066
+			$year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]";
1067 1067
 			print 'c3.generate({
1068 1068
 			    bindto: "#chart8",
1069 1069
 			    data: { x: "x",
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
                 </div>
1078 1078
             </div>
1079 1079
             
1080
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1080
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1081 1081
             <div class="col-md-6">
1082 1082
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1083 1083
 <?php
@@ -1087,12 +1087,12 @@  discard block
 block discarded – undo
1087 1087
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
1088 1088
 			$month_data = '';
1089 1089
 			$month_cnt = '';
1090
-			foreach($month_array as $month_item) {
1090
+			foreach ($month_array as $month_item) {
1091 1091
 				$month_data .= '"'.$month_item['date_name'].'",';
1092 1092
 				$month_cnt .= $month_item['date_count'].',';
1093 1093
 			}
1094 1094
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
1095
-			$month_cnt = "['trackers',".substr($month_cnt,0,-1)."]";
1095
+			$month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]";
1096 1096
 			print 'c3.generate({
1097 1097
 			    bindto: "#chart9",
1098 1098
 			    data: { x: "x",
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
                     <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1106 1106
                 </div>
1107 1107
             </div>
1108
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1108
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1109 1109
 
1110 1110
             <div class="col-md-6">
1111 1111
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
@@ -1116,12 +1116,12 @@  discard block
 block discarded – undo
1116 1116
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1117 1117
 			$date_data = '';
1118 1118
 			$date_cnt = '';
1119
-			foreach($date_array as $date_item) {
1119
+			foreach ($date_array as $date_item) {
1120 1120
 				$date_data .= '"'.$date_item['date_name'].'",';
1121 1121
 				$date_cnt .= $date_item['date_count'].',';
1122 1122
 			}
1123 1123
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
1124
-			$date_cnt = "['trackers',".substr($date_cnt,0,-1)."]";
1124
+			$date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]";
1125 1125
 			print 'c3.generate({
1126 1126
 			    bindto: "#chart5",
1127 1127
 			    data: { x: "x",
@@ -1134,22 +1134,22 @@  discard block
 block discarded – undo
1134 1134
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1135 1135
                 </div>
1136 1136
             </div>
1137
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1137
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1138 1138
             <div class="col-md-6">
1139 1139
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1140 1140
 <?php
1141
-		$hour_array = $Stats->countAllTrackerHours('hour',true);
1141
+		$hour_array = $Stats->countAllTrackerHours('hour', true);
1142 1142
 		if (empty($hour_array)) print _("No data available");
1143 1143
 		else {
1144 1144
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1145 1145
 			$hour_data = '';
1146 1146
 			$hour_cnt = '';
1147
-			foreach($hour_array as $hour_item) {
1147
+			foreach ($hour_array as $hour_item) {
1148 1148
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
1149 1149
 				$hour_cnt .= $hour_item['hour_count'].',';
1150 1150
 			}
1151 1151
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
1152
-			$hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]";
1152
+			$hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]";
1153 1153
 			print 'c3.generate({
1154 1154
 			    bindto: "#chart6",
1155 1155
 			    data: {
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
                     <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1163 1163
                 </div>
1164 1164
             </div>
1165
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1165
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1166 1166
         </div>
1167 1167
 <?php
1168 1168
 	}
@@ -1184,12 +1184,12 @@  discard block
 block discarded – undo
1184 1184
 			print '<div id="chart21" class="chart" width="100%"></div><script>';
1185 1185
 			$year_data = '';
1186 1186
 			$year_cnt = '';
1187
-			foreach($year_array as $year_item) {
1187
+			foreach ($year_array as $year_item) {
1188 1188
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1189 1189
 				$year_cnt .= $year_item['date_count'].',';
1190 1190
 			}
1191 1191
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1192
-			$year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1192
+			$year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]";
1193 1193
 			print 'c3.generate({
1194 1194
 			    bindto: "#chart21",
1195 1195
 			    data: { x: "x",
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
             -->
1206 1206
             </div>
1207 1207
             
1208
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1208
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1209 1209
             <div class="col-md-6">
1210 1210
                 <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2>
1211 1211
 <?php
@@ -1215,12 +1215,12 @@  discard block
 block discarded – undo
1215 1215
 			print '<div id="chart22" class="chart" width="100%"></div><script>';
1216 1216
 			$year_data = '';
1217 1217
 			$year_cnt = '';
1218
-			foreach($year_array as $year_item) {
1218
+			foreach ($year_array as $year_item) {
1219 1219
 				$year_data .= '"'.$year_item['year_name'].'-01-01'.'",';
1220 1220
 				$year_cnt .= $year_item['date_count'].',';
1221 1221
 			}
1222 1222
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1223
-			$year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1223
+			$year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]";
1224 1224
 			print 'c3.generate({
1225 1225
 			    bindto: "#chart22",
1226 1226
 			    data: { x: "x",
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
             -->
1237 1237
             </div>
1238 1238
             
1239
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1239
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1240 1240
         </div>
1241 1241
 <?php
1242 1242
 	}
@@ -1258,12 +1258,12 @@  discard block
 block discarded – undo
1258 1258
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
1259 1259
 			$year_data = '';
1260 1260
 			$year_cnt = '';
1261
-			foreach($year_array as $year_item) {
1261
+			foreach ($year_array as $year_item) {
1262 1262
 				$year_data .= '"'.$year_item['year'].'-01-01",';
1263 1263
 				$year_cnt .= $year_item['count'].',';
1264 1264
 			}
1265 1265
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1266
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1266
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1267 1267
 			print 'c3.generate({
1268 1268
 			    bindto: "#chart32",
1269 1269
 			    data: { x: "x",
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1277 1277
                 </div>
1278 1278
             </div>
1279
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1279
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1280 1280
 
1281 1281
         <div class="row column">
1282 1282
             <div class="col-md-6">
@@ -1288,12 +1288,12 @@  discard block
 block discarded – undo
1288 1288
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
1289 1289
 			$year_data = '';
1290 1290
 			$year_cnt = '';
1291
-			foreach($year_array as $year_item) {
1291
+			foreach ($year_array as $year_item) {
1292 1292
 				$year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
1293 1293
 				$year_cnt .= $year_item['count'].',';
1294 1294
 			}
1295 1295
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1296
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1296
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1297 1297
 			print 'c3.generate({
1298 1298
 			    bindto: "#chart33",
1299 1299
 			    data: { x: "x",
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1307 1307
                 </div>
1308 1308
             </div>
1309
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1309
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1310 1310
 <br/>
1311 1311
 <?php
1312 1312
 	}
@@ -1320,19 +1320,19 @@  discard block
 block discarded – undo
1320 1320
 	//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
1321 1321
 	if ($year == '' && $month == '') {
1322 1322
 		if ($type == 'aircraft') {
1323
-			$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
1323
+			$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
1324 1324
 		} elseif ($type == 'marine') {
1325
-			$polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d'));
1325
+			$polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d'));
1326 1326
 		} elseif ($type == 'tracker') {
1327
-			$polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d'));
1327
+			$polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d'));
1328 1328
 		}
1329 1329
 	} else {
1330 1330
 		if ($type == 'aircraft') {
1331
-			$polar = $Stats->getStatsSource('polar',$year,$month);
1331
+			$polar = $Stats->getStatsSource('polar', $year, $month);
1332 1332
 		} elseif ($type == 'marine') {
1333
-			$polar = $Stats->getStatsSource('polar_marine',$year,$month);
1333
+			$polar = $Stats->getStatsSource('polar_marine', $year, $month);
1334 1334
 		} elseif ($type == 'tracker') {
1335
-			$polar = $Stats->getStatsSource('polar_tracker',$year,$month);
1335
+			$polar = $Stats->getStatsSource('polar_tracker', $year, $month);
1336 1336
 		}
1337 1337
 	}
1338 1338
 	if (!empty($polar)) {
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
 			unset($polar_data);
1342 1342
 			$Spotter = new Spotter();
1343 1343
 			$data = json_decode($eachpolar['source_data']);
1344
-			foreach($data as $value => $key) {
1344
+			foreach ($data as $value => $key) {
1345 1345
 				$direction = $Spotter->parseDirection(($value*22.5));
1346 1346
 				$distance = $key;
1347 1347
 				$unit = 'km';
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 ?>
1362 1362
             <div class="col-md-6">
1363 1363
                 <h4><?php print $eachpolar['source_name']; ?></h4>
1364
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1364
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1365 1365
         	<script>
1366 1366
         	    (function() {
1367 1367
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
 		      color: color,
1386 1386
 		      unit: '<?php echo $unit; ?>'
1387 1387
 		    };
1388
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1388
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1389 1389
 		    })();
1390 1390
 		</script>
1391 1391
             </div>
@@ -1400,19 +1400,19 @@  discard block
 block discarded – undo
1400 1400
 	//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
1401 1401
 	if ($year == '' && $month == '') {
1402 1402
 		if ($type == 'aircraft') {
1403
-			$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
1403
+			$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
1404 1404
 		} elseif ($type == 'marine') {
1405
-			$msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d'));
1405
+			$msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d'));
1406 1406
 		} elseif ($type == 'tracker') {
1407
-			$msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d'));
1407
+			$msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d'));
1408 1408
 		}
1409 1409
 	} else {
1410 1410
 		if ($type == 'aircraft') {
1411
-			$msg = $Stats->getStatsSource('msg',$year,$month);
1411
+			$msg = $Stats->getStatsSource('msg', $year, $month);
1412 1412
 		} elseif ($type == 'marine') {
1413
-			$msg = $Stats->getStatsSource('msg_marine',$year,$month);
1413
+			$msg = $Stats->getStatsSource('msg_marine', $year, $month);
1414 1414
 		} elseif ($type == 'tracker') {
1415
-			$msg = $Stats->getStatsSource('msg_tracker',$year,$month);
1415
+			$msg = $Stats->getStatsSource('msg_tracker', $year, $month);
1416 1416
 		}
1417 1417
 	}
1418 1418
 	if (!empty($msg)) {
@@ -1420,13 +1420,13 @@  discard block
 block discarded – undo
1420 1420
 		foreach ($msg as $eachmsg) {
1421 1421
 			//$eachmsg = $msg[0];
1422 1422
 			$data = $eachmsg['source_data'];
1423
-			if ($data > 500) $max = (round(($data+100)/100))*100;
1423
+			if ($data > 500) $max = (round(($data + 100)/100))*100;
1424 1424
 			else $max = 500;
1425 1425
 ?>
1426
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1426
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1427 1427
         	<script>
1428 1428
 		      var g = new JustGage({
1429
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
1429
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
1430 1430
 			    value: <?php echo $data; ?>,
1431 1431
 			    min: 0,
1432 1432
 			    max: <?php print $max; ?>,
@@ -1448,19 +1448,19 @@  discard block
 block discarded – undo
1448 1448
 	//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
1449 1449
 	if ($year == '' && $month == '') {
1450 1450
 		if ($type == 'aircraft') {
1451
-			$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
1451
+			$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
1452 1452
 		} elseif ($type == 'marine') {
1453
-			$hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d'));
1453
+			$hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d'));
1454 1454
 		} elseif ($type == 'tracker') {
1455
-			$hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d'));
1455
+			$hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d'));
1456 1456
 		}
1457 1457
 	} else {
1458 1458
 		if ($type == 'aircraft') {
1459
-			$hist = $Stats->getStatsSource('hist',$year,$month);
1459
+			$hist = $Stats->getStatsSource('hist', $year, $month);
1460 1460
 		} elseif ($type == 'marine') {
1461
-			$hist = $Stats->getStatsSource('hist_marine',$year,$month);
1461
+			$hist = $Stats->getStatsSource('hist_marine', $year, $month);
1462 1462
 		} elseif ($type == 'tracker') {
1463
-			$hist = $Stats->getStatsSource('hist_tracker',$year,$month);
1463
+			$hist = $Stats->getStatsSource('hist_tracker', $year, $month);
1464 1464
 		}
1465 1465
 	}
1466 1466
 	foreach ($hist as $hists) {
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
 		$source = $hists['source_name'];
1471 1471
 		$hist_array = json_decode($hists['source_data']);
1472 1472
 		$unit = 'km';
1473
-		foreach($hist_array as $distance => $nb) {
1473
+		foreach ($hist_array as $distance => $nb) {
1474 1474
 			if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1475 1475
 				$distance = round($distance*0.539957);
1476 1476
 				$unit = 'nm';
@@ -1490,18 +1490,18 @@  discard block
 block discarded – undo
1490 1490
 		$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
1491 1491
 ?>
1492 1492
             <div class="col-md-6">
1493
-                <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2>
1493
+                <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2>
1494 1494
 <?php
1495
-		print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
1495
+		print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>';
1496 1496
 		print 'c3.generate({
1497
-		    bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
1497
+		    bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'",
1498 1498
 		    data: { x: "x",
1499 1499
 		    columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
1500 1500
 		    axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
1501 1501
 		print '</script>';
1502 1502
 ?>
1503 1503
     	    </div>
1504
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1504
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1505 1505
 <?php
1506 1506
 	}
1507 1507
 ?>
Please login to merge, or discard this patch.
Braces   +169 added lines, -80 removed lines patch added patch discarded remove patch
@@ -22,11 +22,15 @@  discard block
 block discarded – undo
22 22
 	require_once('require/class.Spotter.php');
23 23
 }
24 24
 
25
-if (!isset($filter_name)) $filter_name = '';
25
+if (!isset($filter_name)) {
26
+	$filter_name = '';
27
+}
26 28
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
27 29
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
28
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
29
-}
30
+	if (isset($globalFilter['airline'])) {
31
+		$airline_icao = $globalFilter['airline'][0];
32
+	}
33
+	}
30 34
 if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') {
31 35
 	$Spotter = new Spotter();
32 36
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
@@ -61,7 +65,12 @@  discard block
 block discarded – undo
61 65
 <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script>
62 66
 <div class="column">
63 67
     <div class="info">
64
-            <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1>
68
+            <h1><?php if (isset($airline_name)) {
69
+	echo _("Statistics for ").$airline_name;
70
+} else {
71
+	echo _("Statistics");
72
+}
73
+?></h1>
65 74
 <?php 
66 75
 if ($type == 'aircraft') {
67 76
 	$last_update = $Stats->getLastStatsUpdate();
@@ -73,7 +82,9 @@  discard block
 block discarded – undo
73 82
 if (isset($last_update[0]['value'])) {
74 83
 	date_default_timezone_set('UTC');
75 84
 	$lastupdate = strtotime($last_update[0]['value']);
76
-	if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
85
+	if (isset($globalTimezone) && $globalTimezone != '') {
86
+		date_default_timezone_set($globalTimezone);
87
+	}
77 88
 	print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
78 89
 }
79 90
 
@@ -158,8 +169,11 @@  discard block
 block discarded – undo
158 169
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
159 170
 		$aircraft_data = '';
160 171
 		foreach($aircraft_array as $aircraft_item) {
161
-			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
162
-			else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
172
+			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') {
173
+				$aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
174
+			} else {
175
+				$aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
176
+			}
163 177
 		}
164 178
 		$aircraft_data = substr($aircraft_data, 0, -1);
165 179
 		print 'var series = ['.$aircraft_data.'];';
@@ -176,11 +190,17 @@  discard block
 block discarded – undo
176 190
 <?php
177 191
 	if ($year != '' && $month != '') {
178 192
 ?>
179
-            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
193
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
194
+	echo '/'.$airline_icao;
195
+}
196
+?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
180 197
 <?php
181 198
 	} else {
182 199
 ?>
183
-            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
200
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
201
+	echo '/'.$airline_icao;
202
+}
203
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
184 204
 <?php
185 205
 	}
186 206
 ?>
@@ -209,11 +229,15 @@  discard block
 block discarded – undo
209 229
 			print '</script>';
210 230
 			if ($year != '' && $month != '') {
211 231
 				print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
212
-				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
232
+				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
233
+					echo '/'.$airline_icao;
234
+				}
213 235
 				print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
214 236
 			} else {
215 237
 				print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
216
-				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
238
+				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
239
+					echo '/'.$airline_icao;
240
+				}
217 241
 				print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
218 242
 			}
219 243
 			print '</div>';
@@ -233,8 +257,9 @@  discard block
 block discarded – undo
233 257
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
234 258
 <?php
235 259
 	$marine_array = $Stats->countAllMarineTypes(true,$filter_name,$year,$month);
236
-	if (count($marine_array) == 0) print _("No data available");
237
-	else {
260
+	if (count($marine_array) == 0) {
261
+		print _("No data available");
262
+	} else {
238 263
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
239 264
 		$marine_data = '';
240 265
 		foreach($marine_array as $marine_item) {
@@ -277,8 +302,9 @@  discard block
 block discarded – undo
277 302
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
278 303
 <?php
279 304
 	$tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
280
-	if (count($tracker_array) == 0) print _("No data available");
281
-	else {
305
+	if (count($tracker_array) == 0) {
306
+		print _("No data available");
307
+	} else {
282 308
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
283 309
 		$tracker_data = '';
284 310
 		foreach($tracker_array as $tracker_item) {
@@ -322,8 +348,9 @@  discard block
 block discarded – undo
322 348
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
323 349
 <?php
324 350
 		$owner_array = $Satellite->countAllOwners(true);
325
-		if (count($owner_array) == 0) print _("No data available");
326
-		else {
351
+		if (count($owner_array) == 0) {
352
+			print _("No data available");
353
+		} else {
327 354
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
328 355
 			$owner_data = '';
329 356
 			foreach($owner_array as $owner_item) {
@@ -342,7 +369,10 @@  discard block
 block discarded – undo
342 369
 ?>
343 370
                <!--
344 371
                 <div class="more">
345
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
372
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
373
+	echo '/'.$airline_icao;
374
+}
375
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
346 376
                 </div>
347 377
                 -->
348 378
             </div>
@@ -351,8 +381,9 @@  discard block
 block discarded – undo
351 381
                 <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2>
352 382
 <?php
353 383
 		$countries_array = $Satellite->countAllCountriesOwners(true);
354
-		if (count($countries_array) == 0) print _("No data available");
355
-		else {
384
+		if (count($countries_array) == 0) {
385
+			print _("No data available");
386
+		} else {
356 387
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
357 388
 			$owner_data = '';
358 389
 			foreach($countries_array as $owner_item) {
@@ -371,7 +402,10 @@  discard block
 block discarded – undo
371 402
 ?>
372 403
 	    <!--
373 404
                 <div class="more">
374
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
405
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
406
+	echo '/'.$airline_icao;
407
+}
408
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
375 409
                 </div>
376 410
                 -->
377 411
             </div>
@@ -383,8 +417,9 @@  discard block
 block discarded – undo
383 417
                 <h2><?php echo _("Top 10 Most Common Launch Sites"); ?></h2>
384 418
 <?php
385 419
 		$launch_site_array = $Satellite->countAllLaunchSite(true);
386
-		if (count($launch_site_array) == 0) print _("No data available");
387
-		else {
420
+		if (count($launch_site_array) == 0) {
421
+			print _("No data available");
422
+		} else {
388 423
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
389 424
 			$launch_site_data = '';
390 425
 			foreach($launch_site_array as $launch_site_item) {
@@ -403,7 +438,10 @@  discard block
 block discarded – undo
403 438
 ?>
404 439
                <!--
405 440
                 <div class="more">
406
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
441
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
442
+	echo '/'.$airline_icao;
443
+}
444
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
407 445
                 </div>
408 446
                 -->
409 447
             </div>
@@ -426,8 +464,9 @@  discard block
 block discarded – undo
426 464
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
427 465
 <?php
428 466
 		$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
429
-		if (count($pilot_array) == 0) print _("No data available");
430
-		else {
467
+		if (count($pilot_array) == 0) {
468
+			print _("No data available");
469
+		} else {
431 470
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
432 471
 			$pilot_data = '';
433 472
 			foreach($pilot_array as $pilot_item) {
@@ -445,7 +484,9 @@  discard block
 block discarded – undo
445 484
 		}
446 485
 		print '<div class="more">';
447 486
 		print '<a href="'.$globalURL.'/statistics/pilot'; 
448
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
487
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
488
+			echo '/'.$airline_icao;
489
+		}
449 490
 		print'" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
450 491
 		print '</div>';
451 492
 ?>
@@ -461,8 +502,9 @@  discard block
 block discarded – undo
461 502
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
462 503
 <?php
463 504
 		$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
464
-		if (count($owner_array) == 0) print _("No data available");
465
-		else {
505
+		if (count($owner_array) == 0) {
506
+			print _("No data available");
507
+		} else {
466 508
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
467 509
 			$owner_data = '';
468 510
 			foreach($owner_array as $owner_item) {
@@ -480,7 +522,10 @@  discard block
 block discarded – undo
480 522
 		}
481 523
 ?>
482 524
                 <div class="more">
483
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
525
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
526
+	echo '/'.$airline_icao;
527
+}
528
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
484 529
                 </div>
485 530
             </div>
486 531
         
@@ -493,8 +538,9 @@  discard block
 block discarded – undo
493 538
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
494 539
 <?php
495 540
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
496
-		if (count($flightover_array) == 0) print _("No data available");
497
-		else {
541
+		if (count($flightover_array) == 0) {
542
+			print _("No data available");
543
+		} else {
498 544
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
499 545
 			print 'var series = [';
500 546
 			$flightover_data = '';
@@ -536,7 +582,10 @@  discard block
 block discarded – undo
536 582
 		}
537 583
 ?>
538 584
                 <div class="more">
539
-                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
585
+                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
586
+	echo '/'.$airline_icao;
587
+}
588
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
540 589
                 </div>
541 590
             </div>
542 591
 <?php
@@ -554,8 +603,9 @@  discard block
 block discarded – undo
554 603
 	<div class="col-md-6">
555 604
             <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2>
556 605
 <?php
557
-	if (count($flightover_array) == 0) print _("No data available");
558
-	else {
606
+	if (count($flightover_array) == 0) {
607
+		print _("No data available");
608
+	} else {
559 609
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
560 610
 		print 'var series = [';
561 611
 		$flightover_data = '';
@@ -612,8 +662,9 @@  discard block
 block discarded – undo
612 662
 	<div class="col-md-6">
613 663
             <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2>
614 664
 <?php
615
-	if (count($flightover_array) == 0) print _("No data available");
616
-	else {
665
+	if (count($flightover_array) == 0) {
666
+		print _("No data available");
667
+	} else {
617 668
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
618 669
 		print 'var series = [';
619 670
 		$flightover_data = '';
@@ -719,7 +770,9 @@  discard block
 block discarded – undo
719 770
 		});";
720 771
 		print '</script>';
721 772
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; 
722
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
773
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
774
+			echo '/'.$airline_icao;
775
+		}
723 776
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
724 777
 	}
725 778
 ?>
@@ -783,7 +836,9 @@  discard block
 block discarded – undo
783 836
 		});";
784 837
 		print '</script>';
785 838
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
786
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
839
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
840
+			echo '/'.$airline_icao;
841
+		}
787 842
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
788 843
 	}
789 844
 ?>
@@ -802,8 +857,9 @@  discard block
 block discarded – undo
802 857
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
803 858
 <?php
804 859
 		$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
805
-		if (count($year_array) == 0) print _("No data available");
806
-		else {
860
+		if (count($year_array) == 0) {
861
+			print _("No data available");
862
+		} else {
807 863
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
808 864
 			$year_data = '';
809 865
 			$year_cnt = '';
@@ -822,7 +878,10 @@  discard block
 block discarded – undo
822 878
 		}
823 879
 ?>
824 880
                 <div class="more">
825
-                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
881
+                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
882
+	echo '/'.$airline_icao;
883
+}
884
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
826 885
                 </div>
827 886
             </div>
828 887
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -830,8 +889,9 @@  discard block
 block discarded – undo
830 889
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
831 890
 <?php
832 891
 		$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
833
-		if (count($month_array) == 0) print _("No data available");
834
-		else {
892
+		if (count($month_array) == 0) {
893
+			print _("No data available");
894
+		} else {
835 895
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
836 896
 			$month_data = '';
837 897
 			$month_cnt = '';
@@ -850,7 +910,10 @@  discard block
 block discarded – undo
850 910
 		}
851 911
 ?>
852 912
                 <div class="more">
853
-                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
913
+                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
914
+	echo '/'.$airline_icao;
915
+}
916
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
854 917
                 </div>
855 918
             </div>
856 919
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -859,8 +922,9 @@  discard block
 block discarded – undo
859 922
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
860 923
 <?php
861 924
 		$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
862
-		if (empty($date_array)) print _("No data available");
863
-		else {
925
+		if (empty($date_array)) {
926
+			print _("No data available");
927
+		} else {
864 928
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
865 929
 			$date_data = '';
866 930
 			$date_cnt = '';
@@ -879,7 +943,10 @@  discard block
 block discarded – undo
879 943
 		}
880 944
 ?>
881 945
                 <div class="more">
882
-                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
946
+                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
947
+	echo '/'.$airline_icao;
948
+}
949
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
883 950
                 </div>
884 951
             </div>
885 952
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -887,8 +954,9 @@  discard block
 block discarded – undo
887 954
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
888 955
 <?php
889 956
 		$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
890
-		if (empty($hour_array)) print _("No data available");
891
-		else {
957
+		if (empty($hour_array)) {
958
+			print _("No data available");
959
+		} else {
892 960
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
893 961
 			$hour_data = '';
894 962
 			$hour_cnt = '';
@@ -907,7 +975,10 @@  discard block
 block discarded – undo
907 975
 		}
908 976
 ?>
909 977
                 <div class="more">
910
-                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
978
+                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
979
+	echo '/'.$airline_icao;
980
+}
981
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
911 982
                 </div>
912 983
             </div>
913 984
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -927,8 +998,9 @@  discard block
 block discarded – undo
927 998
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
928 999
 <?php
929 1000
 		$year_array = $Stats->countAllMarineMonthsLastYear(true,$filter_name);
930
-		if (count($year_array) == 0) print _("No data available");
931
-		else {
1001
+		if (count($year_array) == 0) {
1002
+			print _("No data available");
1003
+		} else {
932 1004
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
933 1005
 			$year_data = '';
934 1006
 			$year_cnt = '';
@@ -956,8 +1028,9 @@  discard block
 block discarded – undo
956 1028
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
957 1029
 <?php
958 1030
 		$month_array = $Stats->countAllMarineDatesLastMonth($filter_name);
959
-		if (count($month_array) == 0) print _("No data available");
960
-		else {
1031
+		if (count($month_array) == 0) {
1032
+			print _("No data available");
1033
+		} else {
961 1034
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
962 1035
 			$month_data = '';
963 1036
 			$month_cnt = '';
@@ -985,8 +1058,9 @@  discard block
 block discarded – undo
985 1058
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
986 1059
 <?php
987 1060
 		$date_array = $Stats->countAllMarineDatesLast7Days($filter_name);
988
-		if (empty($date_array)) print _("No data available");
989
-		else {
1061
+		if (empty($date_array)) {
1062
+			print _("No data available");
1063
+		} else {
990 1064
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
991 1065
 			$date_data = '';
992 1066
 			$date_cnt = '';
@@ -1013,8 +1087,9 @@  discard block
 block discarded – undo
1013 1087
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1014 1088
 <?php
1015 1089
 		$hour_array = $Stats->countAllMarineHours('hour',true,$filter_name);
1016
-		if (empty($hour_array)) print _("No data available");
1017
-		else {
1090
+		if (empty($hour_array)) {
1091
+			print _("No data available");
1092
+		} else {
1018 1093
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1019 1094
 			$hour_data = '';
1020 1095
 			$hour_cnt = '';
@@ -1053,8 +1128,9 @@  discard block
 block discarded – undo
1053 1128
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
1054 1129
 <?php
1055 1130
 		$year_array = $Stats->countAllTrackerMonthsLastYear(true);
1056
-		if (count($year_array) == 0) print _("No data available");
1057
-		else {
1131
+		if (count($year_array) == 0) {
1132
+			print _("No data available");
1133
+		} else {
1058 1134
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
1059 1135
 			$year_data = '';
1060 1136
 			$year_cnt = '';
@@ -1082,8 +1158,9 @@  discard block
 block discarded – undo
1082 1158
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1083 1159
 <?php
1084 1160
 		$month_array = $Stats->countAllTrackerDatesLastMonth();
1085
-		if (count($month_array) == 0) print _("No data available");
1086
-		else {
1161
+		if (count($month_array) == 0) {
1162
+			print _("No data available");
1163
+		} else {
1087 1164
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
1088 1165
 			$month_data = '';
1089 1166
 			$month_cnt = '';
@@ -1111,8 +1188,9 @@  discard block
 block discarded – undo
1111 1188
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
1112 1189
 <?php
1113 1190
 		$date_array = $Stats->countAllTrackerDatesLast7Days();
1114
-		if (empty($date_array)) print _("No data available");
1115
-		else {
1191
+		if (empty($date_array)) {
1192
+			print _("No data available");
1193
+		} else {
1116 1194
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1117 1195
 			$date_data = '';
1118 1196
 			$date_cnt = '';
@@ -1139,8 +1217,9 @@  discard block
 block discarded – undo
1139 1217
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1140 1218
 <?php
1141 1219
 		$hour_array = $Stats->countAllTrackerHours('hour',true);
1142
-		if (empty($hour_array)) print _("No data available");
1143
-		else {
1220
+		if (empty($hour_array)) {
1221
+			print _("No data available");
1222
+		} else {
1144 1223
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1145 1224
 			$hour_data = '';
1146 1225
 			$hour_cnt = '';
@@ -1179,8 +1258,9 @@  discard block
 block discarded – undo
1179 1258
                 <h2><?php echo _("Busiest Launch Months of the last 12 Months"); ?></h2>
1180 1259
 <?php
1181 1260
 		$year_array = $Satellite->countAllMonthsLastYear();
1182
-		if (count($year_array) == 0) print _("No data available");
1183
-		else {
1261
+		if (count($year_array) == 0) {
1262
+			print _("No data available");
1263
+		} else {
1184 1264
 			print '<div id="chart21" class="chart" width="100%"></div><script>';
1185 1265
 			$year_data = '';
1186 1266
 			$year_cnt = '';
@@ -1210,8 +1290,9 @@  discard block
 block discarded – undo
1210 1290
                 <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2>
1211 1291
 <?php
1212 1292
 		$year_array = $Satellite->countAllYears();
1213
-		if (count($year_array) == 0) print _("No data available");
1214
-		else {
1293
+		if (count($year_array) == 0) {
1294
+			print _("No data available");
1295
+		} else {
1215 1296
 			print '<div id="chart22" class="chart" width="100%"></div><script>';
1216 1297
 			$year_data = '';
1217 1298
 			$year_cnt = '';
@@ -1253,8 +1334,9 @@  discard block
 block discarded – undo
1253 1334
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
1254 1335
 <?php
1255 1336
 		$year_array = $Stats->countFatalitiesByYear();
1256
-		if (count($year_array) == 0) print _("No data available");
1257
-		else {
1337
+		if (count($year_array) == 0) {
1338
+			print _("No data available");
1339
+		} else {
1258 1340
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
1259 1341
 			$year_data = '';
1260 1342
 			$year_cnt = '';
@@ -1283,8 +1365,9 @@  discard block
 block discarded – undo
1283 1365
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
1284 1366
 <?php
1285 1367
 		$year_array = $Stats->countFatalitiesLast12Months();
1286
-		if (count($year_array) == 0) print _("No data available");
1287
-		else {
1368
+		if (count($year_array) == 0) {
1369
+			print _("No data available");
1370
+		} else {
1288 1371
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
1289 1372
 			$year_data = '';
1290 1373
 			$year_cnt = '';
@@ -1355,8 +1438,11 @@  discard block
 block discarded – undo
1355 1438
 					$distance = $distance;
1356 1439
 					$unit = 'km';
1357 1440
 				}
1358
-				if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1359
-				else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1441
+				if (!isset($polar_data)) {
1442
+					$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1443
+				} else {
1444
+					$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1445
+				}
1360 1446
 			}
1361 1447
 ?>
1362 1448
             <div class="col-md-6">
@@ -1420,9 +1506,12 @@  discard block
 block discarded – undo
1420 1506
 		foreach ($msg as $eachmsg) {
1421 1507
 			//$eachmsg = $msg[0];
1422 1508
 			$data = $eachmsg['source_data'];
1423
-			if ($data > 500) $max = (round(($data+100)/100))*100;
1424
-			else $max = 500;
1425
-?>
1509
+			if ($data > 500) {
1510
+				$max = (round(($data+100)/100))*100;
1511
+			} else {
1512
+				$max = 500;
1513
+			}
1514
+			?>
1426 1515
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1427 1516
         	<script>
1428 1517
 		      var g = new JustGage({
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
                 <div class="more">
255 255
             	    <?php
256 256
             	    
257
-            		if ($year != '' && $month != '') {
258
-            	    ?>
257
+					if ($year != '' && $month != '') {
258
+					?>
259 259
             	    <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
260 260
             	    <?php
261
-            		} else {
262
-            	    ?>
261
+					} else {
262
+					?>
263 263
             	    <a href="<?php print $globalURL; ?>/marine/statistics/type" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
264 264
             	    <?php
265
-            		}
266
-            	    ?>
265
+					}
266
+					?>
267 267
                 </div>
268 268
             </div>
269 269
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 ?>
298 298
                 <div class="more">
299 299
             	    <?php
300
-            	    /*
300
+					/*
301 301
             		if ($year != '' && $month != '') {
302 302
             	    ?>
303 303
             	    <a href="<?php print $globalURL; ?>/tracker/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             	    <?php
309 309
             		}
310 310
             		*/
311
-            	    ?>
311
+					?>
312 312
                 </div>
313 313
             </div>
314 314
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
Please login to merge, or discard this patch.
aircraft-data.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime);
18
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime);
19 19
 		if (empty($spotter_array)) {
20 20
 			$from_archive = true;
21
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime);
21
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime);
22 22
 		}
23 23
 	} else {
24 24
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 }
31 31
 if (isset($_GET['flightaware_id'])) {
32
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
32
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
33 33
 	if (isset($_GET['currenttime'])) {
34
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
34
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
35 35
 		$currenttime = round($currenttime/1000);
36
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime);
36
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime);
37 37
 		if (empty($spotter_array)) {
38 38
 			$from_archive = true;
39 39
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
40
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime);
40
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime);
41 41
 		}
42 42
 	} else {
43 43
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
58 58
 	{
59 59
 		if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
60
-			$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
60
+			$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
61 61
 		} else $image = $spotter_item['image_thumbnail'];
62 62
 	}
63 63
 	/* else {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
78 78
 		if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
79 79
 			if ($spotter_item['departure_airport_time'] > 2460) {
80
-				print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>';
80
+				print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>';
81 81
 			} else {
82 82
 				print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>';
83 83
 			}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
87 87
 		if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
88 88
 			if ($spotter_item['arrival_airport_time'] > 2460) {
89
-				print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>';
89
+				print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>';
90 90
 			} else {
91 91
 				print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>';
92 92
 			}
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	print '<div id ="altitude"><span>'._("Altitude").'</span>';
112 112
 	if (isset($globalGroundAltitude) && $globalGroundAltitude) {
113 113
 		try {
114
-			$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
115
-		} catch(Exception $e) {
114
+			$groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']);
115
+		} catch (Exception $e) {
116 116
 			// If catched not exist
117 117
 		}
118 118
 	}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	print '</div>';
180 180
 	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
181 181
 	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
182
-	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
182
+	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>';
183 183
 	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
184 184
 	print '</div>';
185 185
 }
Please login to merge, or discard this patch.
Braces   +49 added lines, -18 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@  discard block
 block discarded – undo
58 58
 	{
59 59
 		if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
60 60
 			$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
61
-		} else $image = $spotter_item['image_thumbnail'];
61
+		} else {
62
+			$image = $spotter_item['image_thumbnail'];
63
+		}
62 64
 	}
63 65
 	/* else {
64 66
 		$image = "images/placeholder_thumb.png";
@@ -70,8 +72,12 @@  discard block
 block discarded – undo
70 72
 	}
71 73
 	print '<div class="right">';
72 74
 	print '<div class="callsign-details">';
73
-	if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
74
-	if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
75
+	if ($spotter_item['ident'] != 'Not Available') {
76
+		print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
77
+	}
78
+	if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') {
79
+		print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
80
+	}
75 81
 	print '</div>';
76 82
 	if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') {
77 83
 		print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
@@ -103,10 +109,16 @@  discard block
 block discarded – undo
103 109
 	print '</div>';
104 110
 	print '<div id="aircraft">';
105 111
 	print '<span>'._("Aircraft").'</span>';
106
-	if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
107
-	if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
108
-	elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
109
-	else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
112
+	if (isset($spotter_item['aircraft_wiki'])) {
113
+		print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
114
+	}
115
+	if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') {
116
+		print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
117
+	} elseif (isset($spotter_item['aircraft_type'])) {
118
+		print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
119
+	} else {
120
+		print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
121
+	}
110 122
 	print '</div>';
111 123
 	print '<div id ="altitude"><span>'._("Altitude").'</span>';
112 124
 	if (isset($globalGroundAltitude) && $globalGroundAltitude) {
@@ -118,11 +130,17 @@  discard block
 block discarded – undo
118 130
 	}
119 131
 
120 132
 	if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
121
-		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
122
-		else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
133
+		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
134
+			print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
135
+		} else {
136
+			print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
137
+		}
123 138
 	} else {
124
-		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
125
-		else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
139
+		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
140
+			print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
141
+		} else {
142
+			print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
143
+		}
126 144
 	}
127 145
 
128 146
 	if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) {
@@ -136,7 +154,9 @@  discard block
 block discarded – undo
136 154
 		print '</i>';
137 155
 	}
138 156
 	print '</div>';
139
-	if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
157
+	if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') {
158
+		print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
159
+	}
140 160
 	print '<div id="speed"><span>'._("Speed").'</span>';
141 161
 	if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
142 162
 		print round($spotter_item['ground_speed']*1.15078).' mph';
@@ -150,8 +170,11 @@  discard block
 block discarded – undo
150 170
 	print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>';
151 171
 	if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') {
152 172
 		print '<div id="pilot"><span>'._("Pilot").'</span>';
153
-		if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
154
-		else print $spotter_item['pilot_name'];
173
+		if (isset($spotter_item['pilot_id'])) {
174
+			print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
175
+		} else {
176
+			print $spotter_item['pilot_name'];
177
+		}
155 178
 		print '</div>';
156 179
 	}
157 180
 	if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') {
@@ -177,10 +200,18 @@  discard block
 block discarded – undo
177 200
 	}
178 201
 	print '</div>';
179 202
 	print '</div>';
180
-	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
181
-	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
182
-	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
183
-	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
203
+	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') {
204
+		print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
205
+	}
206
+	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') {
207
+		print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
208
+	}
209
+	if (isset($spotter_item['acars']['message'])) {
210
+		print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
211
+	}
212
+	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) {
213
+		print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
214
+	}
184 215
 	print '</div>';
185 216
 }
186 217
 ?>
Please login to merge, or discard this patch.
manufacturer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@
 block discarded – undo
5 5
 
6 6
 if (isset($_POST['aircraft_manufacturer']) && $_POST['aircraft_manufacturer'] != '')
7 7
 {
8
-	$aircraft_manufacturer = filter_input(INPUT_POST,'aircraft_manufacturer',FILTER_SANITIZE_STRING);
8
+	$aircraft_manufacturer = filter_input(INPUT_POST, 'aircraft_manufacturer', FILTER_SANITIZE_STRING);
9 9
 	header('Location: '.$globalURL.'/manufacturer/'.$aircraft_manufacturer);
10 10
 } elseif (isset($_GET['aircraft_manufacturer']) && $_GET['aircraft_manufacturer'] != '')
11 11
 {
12
-	$aircraft_manufacturer = filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING);
12
+	$aircraft_manufacturer = filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING);
13 13
 	header('Location: '.$globalURL.'/manufacturer/'.$aircraft_manufacturer);
14 14
 } else {
15 15
 	if ($globalURL == '') {
Please login to merge, or discard this patch.
getLatestData-tv.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@
 block discarded – undo
5 5
 require_once('require/class.Language.php');
6 6
 
7 7
 header('Content-Type: text/javascript');
8
-$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
8
+$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
9 9
 $SpotterLive = new SpotterLive();
10 10
 $spotter_array = $SpotterLive->getRealTimeData($q);
11 11
 
12 12
 $output = '{';
13 13
 $output .= '"flights": [';
14 14
 if (!empty($spotter_array)) {
15
-	foreach($spotter_array as $spotter_item)
15
+	foreach ($spotter_array as $spotter_item)
16 16
 	{
17 17
 		$output .= '{';
18 18
 		$output .= '"flight_id": "'.$spotter_item['spotter_id'].'",';
Please login to merge, or discard this patch.
tv.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 <?php
30 30
 if (isset($_GET['q']))
31 31
 {
32
-	$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
32
+	$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
33 33
 	$spotter_array = $Spotter->searchSpotterData($q, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "0,10", "", "");
34 34
 } else {
35 35
 	$spotter_array = $Spotter->getLatestSpotterData("0,10", "");
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
    
149 149
 <?php
150 150
 	if (isset($_GET['image']) && isset($_GET['q'])) {
151
-		$image = filter_input(INPUT_GET,'image',FILTER_SANITIZE_STRING);
152
-		$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
151
+		$image = filter_input(INPUT_GET, 'image', FILTER_SANITIZE_STRING);
152
+		$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
153 153
 ?>
154 154
    $.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&image=<?php print $image; ?>&q=<?php print $q; ?>", function( data ) {
155 155
 <?php
156 156
 	} elseif (isset($_GET['image'])) {
157
-		$image = filter_input(INPUT_GET,'image',FILTER_SANITIZE_STRING);
157
+		$image = filter_input(INPUT_GET, 'image', FILTER_SANITIZE_STRING);
158 158
 ?>
159 159
    $.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&image=<?php print $image; ?>", function( data ) {
160 160
 <?php
161 161
 	} elseif (isset($_GET['q'])) {
162
-		$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
162
+		$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
163 163
 ?>
164 164
    $.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&q=<?php print $q; ?>", function( data ) {
165 165
 <?php
Please login to merge, or discard this patch.
require/libs/SimplePie.compiled.php 4 patches
Doc Comments   +75 added lines, -21 removed lines patch added patch discarded remove patch
@@ -2760,7 +2760,7 @@  discard block
 block discarded – undo
2760 2760
 	 * @since 1.0
2761 2761
 	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
2762 2762
 	 * @link http://www.georss.org/ GeoRSS
2763
-	 * @return string|null
2763
+	 * @return double|null
2764 2764
 	 */
2765 2765
 	public function get_latitude()
2766 2766
 	{
@@ -2789,7 +2789,7 @@  discard block
 block discarded – undo
2789 2789
 	 * @since 1.0
2790 2790
 	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
2791 2791
 	 * @link http://www.georss.org/ GeoRSS
2792
-	 * @return string|null
2792
+	 * @return double|null
2793 2793
 	 */
2794 2794
 	public function get_longitude()
2795 2795
 	{
@@ -2930,7 +2930,7 @@  discard block
 block discarded – undo
2930 2930
 	 * Uses `<image><width>` or defaults to 88.0 if no width is specified and
2931 2931
 	 * the feed is an RSS 2.0 feed.
2932 2932
 	 *
2933
-	 * @return int|float|null
2933
+	 * @return double|null
2934 2934
 	 */
2935 2935
 	public function get_image_width()
2936 2936
 	{
@@ -2956,7 +2956,7 @@  discard block
 block discarded – undo
2956 2956
 	 * Uses `<image><height>` or defaults to 31.0 if no height is specified and
2957 2957
 	 * the feed is an RSS 2.0 feed.
2958 2958
 	 *
2959
-	 * @return int|float|null
2959
+	 * @return double|null
2960 2960
 	 */
2961 2961
 	public function get_image_height()
2962 2962
 	{
@@ -3185,7 +3185,7 @@  discard block
 block discarded – undo
3185 3185
 	 * @access private
3186 3186
 	 * @param SimplePie $a
3187 3187
 	 * @param SimplePie $b
3188
-	 * @return boolean
3188
+	 * @return integer
3189 3189
 	 */
3190 3190
 	public static function sort_items($a, $b)
3191 3191
 	{
@@ -4384,7 +4384,7 @@  discard block
 block discarded – undo
4384 4384
 	/**
4385 4385
 	 * Retrieve the last modified time for the cache
4386 4386
 	 *
4387
-	 * @return int Timestamp
4387
+	 * @return false|string Timestamp
4388 4388
 	 */
4389 4389
 	public function mtime()
4390 4390
 	{
@@ -4504,7 +4504,6 @@  discard block
 block discarded – undo
4504 4504
      *
4505 4505
      * @param string $location Location string (from SimplePie::$cache_location)
4506 4506
      * @param string $name Unique ID for the cache
4507
-     * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
4508 4507
      */
4509 4508
     public function __construct($location, $name, $options = null) {
4510 4509
         //$this->cache = \flow\simple\cache\Redis::getRedisClientInstance();
@@ -5461,7 +5460,7 @@  discard block
 block discarded – undo
5461 5460
 	 * Consume the next byte
5462 5461
 	 *
5463 5462
 	 * @access private
5464
-	 * @return mixed The next byte, or false, if there is no more data
5463
+	 * @return string|false The next byte, or false, if there is no more data
5465 5464
 	 */
5466 5465
 	public function consume()
5467 5466
 	{
@@ -5481,7 +5480,7 @@  discard block
 block discarded – undo
5481 5480
 	 *
5482 5481
 	 * @access private
5483 5482
 	 * @param string $chars Characters to consume
5484
-	 * @return mixed A series of characters that match the range, or false
5483
+	 * @return string|false A series of characters that match the range, or false
5485 5484
 	 */
5486 5485
 	public function consume_range($chars)
5487 5486
 	{
@@ -6571,7 +6570,7 @@  discard block
 block discarded – undo
6571 6570
 	/**
6572 6571
 	 * Get length
6573 6572
 	 *
6574
-	 * @return float Length in bytes
6573
+	 * @return string|null Length in bytes
6575 6574
 	 */
6576 6575
 	public function get_length()
6577 6576
 	{
@@ -8279,7 +8278,7 @@  discard block
 block discarded – undo
8279 8278
 	 *
8280 8279
 	 * Returns false if $base is not absolute, otherwise an IRI.
8281 8280
 	 *
8282
-	 * @param IRI|string $base (Absolute) Base IRI
8281
+	 * @param SimplePie_IRI $base (Absolute) Base IRI
8283 8282
 	 * @param IRI|string $relative Relative IRI
8284 8283
 	 * @return IRI|false
8285 8284
 	 */
@@ -9068,7 +9067,7 @@  discard block
 block discarded – undo
9068 9067
 	 * Set the ipath.
9069 9068
 	 *
9070 9069
 	 * @param string $ipath
9071
-	 * @return bool
9070
+	 * @return null|boolean
9072 9071
 	 */
9073 9072
 	public function set_path($ipath, $clear_cache = false)
9074 9073
 	{
@@ -9145,6 +9144,7 @@  discard block
 block discarded – undo
9145 9144
 	/**
9146 9145
 	 * Convert an IRI to a URI (or parts thereof)
9147 9146
 	 *
9147
+	 * @param false|string $string
9148 9148
 	 * @return string
9149 9149
 	 */
9150 9150
 	public function to_uri($string)
@@ -10114,7 +10114,7 @@  discard block
 block discarded – undo
10114 10114
 	 * @since 1.0
10115 10115
 	 *
10116 10116
 	 * @param string $date_format Supports any PHP date format from {@see http://php.net/strftime} (empty for the raw data)
10117
-	 * @return int|string|null
10117
+	 * @return string|null
10118 10118
 	 */
10119 10119
 	public function get_local_date($date_format = '%c')
10120 10120
 	{
@@ -10137,7 +10137,7 @@  discard block
 block discarded – undo
10137 10137
 	 *
10138 10138
 	 * @see get_date
10139 10139
 	 * @param string $date_format Supports any PHP date format from {@see http://php.net/date}
10140
-	 * @return int|string|null
10140
+	 * @return null|string
10141 10141
 	 */
10142 10142
 	public function get_gmdate($date_format = 'j F Y, g:i a')
10143 10143
 	{
@@ -10155,7 +10155,7 @@  discard block
 block discarded – undo
10155 10155
 	 *
10156 10156
 	 * @see get_updated_date
10157 10157
 	 * @param string $date_format Supports any PHP date format from {@see http://php.net/date}
10158
-	 * @return int|string|null
10158
+	 * @return null|string
10159 10159
 	 */
10160 10160
 	public function get_updated_gmdate($date_format = 'j F Y, g:i a')
10161 10161
 	{
@@ -12159,7 +12159,7 @@  discard block
 block discarded – undo
12159 12159
 	 * @since 1.0
12160 12160
 	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
12161 12161
 	 * @link http://www.georss.org/ GeoRSS
12162
-	 * @return string|null
12162
+	 * @return double|null
12163 12163
 	 */
12164 12164
 	public function get_latitude()
12165 12165
 	{
@@ -12187,7 +12187,7 @@  discard block
 block discarded – undo
12187 12187
 	 * @since 1.0
12188 12188
 	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
12189 12189
 	 * @link http://www.georss.org/ GeoRSS
12190
-	 * @return string|null
12190
+	 * @return double|null
12191 12191
 	 */
12192 12192
 	public function get_longitude()
12193 12193
 	{
@@ -12403,6 +12403,9 @@  discard block
 block discarded – undo
12403 12403
 		}
12404 12404
 	}
12405 12405
 
12406
+	/**
12407
+	 * @param string $name
12408
+	 */
12406 12409
 	protected function search_elements_by_tag($name, &$done, $feeds)
12407 12410
 	{
12408 12411
 		if ($this->dom === null)
@@ -12621,6 +12624,9 @@  discard block
 block discarded – undo
12621 12624
  */
12622 12625
 class SimplePie_Misc
12623 12626
 {
12627
+	/**
12628
+	 * @param integer $seconds
12629
+	 */
12624 12630
 	public static function time_hms($seconds)
12625 12631
 	{
12626 12632
 		$time = '';
@@ -12923,6 +12929,11 @@  discard block
 block discarded – undo
12923 12929
 		}
12924 12930
 	}
12925 12931
 
12932
+	/**
12933
+	 * @param string $data
12934
+	 * @param string $input
12935
+	 * @param string $output
12936
+	 */
12926 12937
 	protected static function change_encoding_mbstring($data, $input, $output)
12927 12938
 	{
12928 12939
 		if ($input === 'windows-949')
@@ -12961,6 +12972,11 @@  discard block
 block discarded – undo
12961 12972
 		return false;
12962 12973
 	}
12963 12974
 
12975
+	/**
12976
+	 * @param string $data
12977
+	 * @param string $input
12978
+	 * @param string $output
12979
+	 */
12964 12980
 	protected static function change_encoding_iconv($data, $input, $output)
12965 12981
 	{
12966 12982
 		return @iconv($input, $output, $data);
@@ -14301,6 +14317,9 @@  discard block
 block discarded – undo
14301 14317
 		}
14302 14318
 	}
14303 14319
 
14320
+	/**
14321
+	 * @return string
14322
+	 */
14304 14323
 	public static function get_curl_version()
14305 14324
 	{
14306 14325
 		if (is_array($curl = curl_version()))
@@ -14368,7 +14387,6 @@  discard block
 block discarded – undo
14368 14387
 	/**
14369 14388
 	 * Remove RFC822 comments
14370 14389
 	 *
14371
-	 * @param string $data Data to strip comments from
14372 14390
 	 * @return string Comment stripped string
14373 14391
 	 */
14374 14392
 	public static function uncomment_rfc822($string)
@@ -14624,7 +14642,7 @@  discard block
 block discarded – undo
14624 14642
 	 * @todo Add support for EBCDIC
14625 14643
 	 * @param string $data XML data
14626 14644
 	 * @param SimplePie_Registry $registry Class registry
14627
-	 * @return array Possible encodings
14645
+	 * @return string[] Possible encodings
14628 14646
 	 */
14629 14647
 	public static function xml_encoding($data, $registry)
14630 14648
 	{
@@ -14997,7 +15015,7 @@  discard block
 block discarded – undo
14997 15015
 	 *           0:0:0:0:0:FFFF:129.144.52.38
14998 15016
 	 *
14999 15017
 	 * @param string $ip An IPv6 address
15000
-	 * @return array [0] contains the IPv6 represented part, and [1] the IPv4 represented part
15018
+	 * @return string[] [0] contains the IPv6 represented part, and [1] the IPv4 represented part
15001 15019
 	 */
15002 15020
 	private static function split_v6_v4($ip)
15003 15021
 	{
@@ -15744,7 +15762,6 @@  discard block
 block discarded – undo
15744 15762
 	 * Remove RFC822 comments
15745 15763
 	 *
15746 15764
 	 * @access protected
15747
-	 * @param string $data Data to strip comments from
15748 15765
 	 * @return string Comment stripped string
15749 15766
 	 */
15750 15767
 	public function remove_rfc2822_comments($string)
@@ -16258,6 +16275,9 @@  discard block
 block discarded – undo
16258 16275
 		return $this->data;
16259 16276
 	}
16260 16277
 
16278
+	/**
16279
+	 * @param string $tag
16280
+	 */
16261 16281
 	public function tag_open($parser, $tag, $attributes)
16262 16282
 	{
16263 16283
 		list($this->namespace[], $this->element[]) = $this->split_ns($tag);
@@ -16325,6 +16345,9 @@  discard block
 block discarded – undo
16325 16345
 		}
16326 16346
 	}
16327 16347
 
16348
+	/**
16349
+	 * @param string $cdata
16350
+	 */
16328 16351
 	public function cdata($parser, $cdata)
16329 16352
 	{
16330 16353
 		if ($this->current_xhtml_construct >= 0)
@@ -16337,6 +16360,9 @@  discard block
 block discarded – undo
16337 16360
 		}
16338 16361
 	}
16339 16362
 
16363
+	/**
16364
+	 * @param string $tag
16365
+	 */
16340 16366
 	public function tag_close($parser, $tag)
16341 16367
 	{
16342 16368
 		if ($this->current_xhtml_construct >= 0)
@@ -16422,6 +16448,9 @@  discard block
 block discarded – undo
16422 16448
 		return isset($data['value']) ? $data['value'] : '';
16423 16449
 	}
16424 16450
 
16451
+	/**
16452
+	 * @param string $url
16453
+	 */
16425 16454
 	private function parse_microformats(&$data, $url) {
16426 16455
 		$feed_title = '';
16427 16456
 		$feed_author = NULL;
@@ -16953,6 +16982,8 @@  discard block
 block discarded – undo
16953 16982
 	 *
16954 16983
 	 * For documentation on all the parameters, see the corresponding
16955 16984
 	 * properties and their accessors
16985
+	 * @param string $relationship
16986
+	 * @param string $value
16956 16987
 	 */
16957 16988
 	public function __construct($relationship = null, $type = null, $value = null)
16958 16989
 	{
@@ -17390,6 +17421,9 @@  discard block
 block discarded – undo
17390 17421
 		return $data;
17391 17422
 	}
17392 17423
 
17424
+	/**
17425
+	 * @param string $html
17426
+	 */
17393 17427
 	protected function preprocess($html, $type)
17394 17428
 	{
17395 17429
 		$ret = '';
@@ -17414,6 +17448,9 @@  discard block
 block discarded – undo
17414 17448
 		return $ret;
17415 17449
 	}
17416 17450
 
17451
+	/**
17452
+	 * @param DOMDocument $document
17453
+	 */
17417 17454
 	public function replace_urls($document, $tag, $attributes)
17418 17455
 	{
17419 17456
 		if (!is_array($attributes))
@@ -17466,6 +17503,10 @@  discard block
 block discarded – undo
17466 17503
 		}
17467 17504
 	}
17468 17505
 
17506
+	/**
17507
+	 * @param DOMDocument $document
17508
+	 * @param DOMXPath $xpath
17509
+	 */
17469 17510
 	protected function strip_tag($tag, $document, $xpath, $type)
17470 17511
 	{
17471 17512
 		$elements = $xpath->query('body//' . $tag);
@@ -17550,6 +17591,9 @@  discard block
 block discarded – undo
17550 17591
 		}
17551 17592
 	}
17552 17593
 
17594
+	/**
17595
+	 * @param DOMXPath $xpath
17596
+	 */
17553 17597
 	protected function strip_attr($attrib, $xpath)
17554 17598
 	{
17555 17599
 		$elements = $xpath->query('//*[@' . $attrib . ']');
@@ -17560,6 +17604,9 @@  discard block
 block discarded – undo
17560 17604
 		}
17561 17605
 	}
17562 17606
 
17607
+	/**
17608
+	 * @param DOMDocument $document
17609
+	 */
17563 17610
 	protected function add_attr($tag, $valuePairs, $document)
17564 17611
 	{
17565 17612
 		$elements = $document->getElementsByTagName($tag);
@@ -17605,6 +17652,10 @@  discard block
 block discarded – undo
17605 17652
 		return md5(serialize($this->data));
17606 17653
 	}
17607 17654
 
17655
+	/**
17656
+	 * @param string $namespace
17657
+	 * @param string $tag
17658
+	 */
17608 17659
 	public function get_source_tags($namespace, $tag)
17609 17660
 	{
17610 17661
 		if (isset($this->data['child'][$namespace][$tag]))
@@ -17617,6 +17668,9 @@  discard block
 block discarded – undo
17617 17668
 		}
17618 17669
 	}
17619 17670
 
17671
+	/**
17672
+	 * @return string
17673
+	 */
17620 17674
 	public function get_base($element = array())
17621 17675
 	{
17622 17676
 		return $this->item->get_base($element);
Please login to merge, or discard this patch.
Indentation   +281 added lines, -282 removed lines patch added patch discarded remove patch
@@ -868,7 +868,6 @@  discard block
 block discarded – undo
868 868
 	 * This tells SimplePie to ignore any file errors and fall back to cache
869 869
 	 * instead. This only works if caching is enabled and cached content
870 870
 	 * still exists.
871
-
872 871
 	 * @param bool $enable Force use of cache on fail.
873 872
 	 */
874 873
 	public function force_cache_fallback($enable = false)
@@ -1663,7 +1662,7 @@  discard block
 block discarded – undo
1663 1662
 					// Now also do feed discovery, but if microformats were found don't
1664 1663
 					// overwrite the current value of file.
1665 1664
 					$discovered = $locate->find($this->autodiscovery,
1666
-					                            $this->all_discovered_feeds);
1665
+												$this->all_discovered_feeds);
1667 1666
 					if ($microformats)
1668 1667
 					{
1669 1668
 						if ($hub = $locate->get_rel_link('hub'))
@@ -1928,8 +1927,8 @@  discard block
 block discarded – undo
1928 1927
 			{
1929 1928
 				// sanitize encodes ampersands which are required when used in a url.
1930 1929
 				return str_replace('&amp;', '&',
1931
-				                   $this->sanitize($this->permanent_url,
1932
-				                                   SIMPLEPIE_CONSTRUCT_IRI));
1930
+								   $this->sanitize($this->permanent_url,
1931
+												   SIMPLEPIE_CONSTRUCT_IRI));
1933 1932
 			}
1934 1933
 		}
1935 1934
 		else
@@ -1937,8 +1936,8 @@  discard block
 block discarded – undo
1937 1936
 			if ($this->feed_url !== null)
1938 1937
 			{
1939 1938
 				return str_replace('&amp;', '&',
1940
-				                   $this->sanitize($this->feed_url,
1941
-				                                   SIMPLEPIE_CONSTRUCT_IRI));
1939
+								   $this->sanitize($this->feed_url,
1940
+												   SIMPLEPIE_CONSTRUCT_IRI));
1942 1941
 			}
1943 1942
 		}
1944 1943
 		return null;
@@ -2597,8 +2596,8 @@  discard block
 block discarded – undo
2597 2596
 		}
2598 2597
 
2599 2598
 		if (isset($this->data['headers']['link']) &&
2600
-		    preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/',
2601
-		               $this->data['headers']['link'], $match))
2599
+			preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/',
2600
+					   $this->data['headers']['link'], $match))
2602 2601
 		{
2603 2602
 			return array($match[1]);
2604 2603
 		}
@@ -3937,112 +3936,112 @@  discard block
 block discarded – undo
3937 3936
  */
3938 3937
 class SimplePie_Cache_Memcached implements SimplePie_Cache_Base
3939 3938
 {
3940
-    /**
3941
-     * Memcached instance
3942
-     * @var Memcached
3943
-     */
3944
-    protected $cache;
3945
-
3946
-    /**
3947
-     * Options
3948
-     * @var array
3949
-     */
3950
-    protected $options;
3951
-
3952
-    /**
3953
-     * Cache name
3954
-     * @var string
3955
-     */
3956
-    protected $name;
3957
-
3958
-    /**
3959
-     * Create a new cache object
3960
-     * @param string $location Location string (from SimplePie::$cache_location)
3961
-     * @param string $name     Unique ID for the cache
3962
-     * @param string $type     Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
3963
-     */
3964
-    public function __construct($location, $name, $type) {
3965
-        $this->options = array(
3966
-            'host'   => '127.0.0.1',
3967
-            'port'   => 11211,
3968
-            'extras' => array(
3969
-                'timeout' => 3600, // one hour
3970
-                'prefix'  => 'simplepie_',
3971
-            ),
3972
-        );
3973
-        $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
3974
-
3975
-        $this->name = $this->options['extras']['prefix'] . md5("$name:$type");
3976
-
3977
-        $this->cache = new Memcached();
3978
-        $this->cache->addServer($this->options['host'], (int)$this->options['port']);
3979
-    }
3980
-
3981
-    /**
3982
-     * Save data to the cache
3983
-     * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
3984
-     * @return bool Successfulness
3985
-     */
3986
-    public function save($data) {
3987
-        if ($data instanceof SimplePie) {
3988
-            $data = $data->data;
3989
-        }
3990
-
3991
-        return $this->setData(serialize($data));
3992
-    }
3993
-
3994
-    /**
3995
-     * Retrieve the data saved to the cache
3996
-     * @return array Data for SimplePie::$data
3997
-     */
3998
-    public function load() {
3999
-        $data = $this->cache->get($this->name);
4000
-
4001
-        if ($data !== false) {
4002
-            return unserialize($data);
4003
-        }
4004
-        return false;
4005
-    }
4006
-
4007
-    /**
4008
-     * Retrieve the last modified time for the cache
4009
-     * @return int Timestamp
4010
-     */
4011
-    public function mtime() {
4012
-        $data = $this->cache->get($this->name . '_mtime');
4013
-        return (int) $data;
4014
-    }
4015
-
4016
-    /**
4017
-     * Set the last modified time to the current time
4018
-     * @return bool Success status
4019
-     */
4020
-    public function touch() {
4021
-        $data = $this->cache->get($this->name);
4022
-        return $this->setData($data);
4023
-    }
4024
-
4025
-    /**
4026
-     * Remove the cache
4027
-     * @return bool Success status
4028
-     */
4029
-    public function unlink() {
4030
-        return $this->cache->delete($this->name, 0);
4031
-    }
4032
-
4033
-    /**
4034
-     * Set the last modified time and data to Memcached
4035
-     * @return bool Success status
4036
-     */
4037
-    private function setData($data) {
4038
-
4039
-        if ($data !== false) {
4040
-            $this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']);
4041
-            return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']);
4042
-        }
4043
-
4044
-        return false;
4045
-    }
3939
+	/**
3940
+	 * Memcached instance
3941
+	 * @var Memcached
3942
+	 */
3943
+	protected $cache;
3944
+
3945
+	/**
3946
+	 * Options
3947
+	 * @var array
3948
+	 */
3949
+	protected $options;
3950
+
3951
+	/**
3952
+	 * Cache name
3953
+	 * @var string
3954
+	 */
3955
+	protected $name;
3956
+
3957
+	/**
3958
+	 * Create a new cache object
3959
+	 * @param string $location Location string (from SimplePie::$cache_location)
3960
+	 * @param string $name     Unique ID for the cache
3961
+	 * @param string $type     Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
3962
+	 */
3963
+	public function __construct($location, $name, $type) {
3964
+		$this->options = array(
3965
+			'host'   => '127.0.0.1',
3966
+			'port'   => 11211,
3967
+			'extras' => array(
3968
+				'timeout' => 3600, // one hour
3969
+				'prefix'  => 'simplepie_',
3970
+			),
3971
+		);
3972
+		$this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
3973
+
3974
+		$this->name = $this->options['extras']['prefix'] . md5("$name:$type");
3975
+
3976
+		$this->cache = new Memcached();
3977
+		$this->cache->addServer($this->options['host'], (int)$this->options['port']);
3978
+	}
3979
+
3980
+	/**
3981
+	 * Save data to the cache
3982
+	 * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
3983
+	 * @return bool Successfulness
3984
+	 */
3985
+	public function save($data) {
3986
+		if ($data instanceof SimplePie) {
3987
+			$data = $data->data;
3988
+		}
3989
+
3990
+		return $this->setData(serialize($data));
3991
+	}
3992
+
3993
+	/**
3994
+	 * Retrieve the data saved to the cache
3995
+	 * @return array Data for SimplePie::$data
3996
+	 */
3997
+	public function load() {
3998
+		$data = $this->cache->get($this->name);
3999
+
4000
+		if ($data !== false) {
4001
+			return unserialize($data);
4002
+		}
4003
+		return false;
4004
+	}
4005
+
4006
+	/**
4007
+	 * Retrieve the last modified time for the cache
4008
+	 * @return int Timestamp
4009
+	 */
4010
+	public function mtime() {
4011
+		$data = $this->cache->get($this->name . '_mtime');
4012
+		return (int) $data;
4013
+	}
4014
+
4015
+	/**
4016
+	 * Set the last modified time to the current time
4017
+	 * @return bool Success status
4018
+	 */
4019
+	public function touch() {
4020
+		$data = $this->cache->get($this->name);
4021
+		return $this->setData($data);
4022
+	}
4023
+
4024
+	/**
4025
+	 * Remove the cache
4026
+	 * @return bool Success status
4027
+	 */
4028
+	public function unlink() {
4029
+		return $this->cache->delete($this->name, 0);
4030
+	}
4031
+
4032
+	/**
4033
+	 * Set the last modified time and data to Memcached
4034
+	 * @return bool Success status
4035
+	 */
4036
+	private function setData($data) {
4037
+
4038
+		if ($data !== false) {
4039
+			$this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']);
4040
+			return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']);
4041
+		}
4042
+
4043
+		return false;
4044
+	}
4046 4045
 }
4047 4046
 
4048 4047
 /**
@@ -4471,143 +4470,143 @@  discard block
 block discarded – undo
4471 4470
  * @uses Redis
4472 4471
  */
4473 4472
 class SimplePie_Cache_Redis implements SimplePie_Cache_Base {
4474
-    /**
4475
-     * Redis instance
4476
-     *
4477
-     * @var \Redis
4478
-     */
4479
-    protected $cache;
4480
-
4481
-    /**
4482
-     * Options
4483
-     *
4484
-     * @var array
4485
-     */
4486
-    protected $options;
4487
-
4488
-    /**
4489
-     * Cache name
4490
-     *
4491
-     * @var string
4492
-     */
4493
-    protected $name;
4494
-
4495
-    /**
4496
-     * Cache Data
4497
-     *
4498
-     * @var type
4499
-     */
4500
-    protected $data;
4501
-
4502
-    /**
4503
-     * Create a new cache object
4504
-     *
4505
-     * @param string $location Location string (from SimplePie::$cache_location)
4506
-     * @param string $name Unique ID for the cache
4507
-     * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
4508
-     */
4509
-    public function __construct($location, $name, $options = null) {
4510
-        //$this->cache = \flow\simple\cache\Redis::getRedisClientInstance();
4511
-        $parsed = SimplePie_Cache::parse_URL($location);
4512
-        $redis = new Redis();
4513
-        $redis->connect($parsed['host'], $parsed['port']);
4514
-        $this->cache = $redis;
4515
-
4516
-        if (!is_null($options) && is_array($options)) {
4517
-            $this->options = $options;
4518
-        } else {
4519
-            $this->options = array (
4520
-                'prefix' => 'rss:simple_primary:',
4521
-                'expire' => 0,
4522
-            );
4523
-        }
4524
-
4525
-        $this->name = $this->options['prefix'] . $name;
4526
-    }
4527
-
4528
-    /**
4529
-     * @param \Redis $cache
4530
-     */
4531
-    public function setRedisClient(\Redis $cache) {
4532
-        $this->cache = $cache;
4533
-    }
4534
-
4535
-    /**
4536
-     * Save data to the cache
4537
-     *
4538
-     * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
4539
-     * @return bool Successfulness
4540
-     */
4541
-    public function save($data) {
4542
-        if ($data instanceof SimplePie) {
4543
-            $data = $data->data;
4544
-        }
4545
-        $response = $this->cache->set($this->name, serialize($data));
4546
-        if ($this->options['expire']) {
4547
-            $this->cache->expire($this->name, $this->options['expire']);
4548
-        }
4549
-
4550
-        return $response;
4551
-    }
4552
-
4553
-    /**
4554
-     * Retrieve the data saved to the cache
4555
-     *
4556
-     * @return array Data for SimplePie::$data
4557
-     */
4558
-    public function load() {
4559
-        $data = $this->cache->get($this->name);
4560
-
4561
-        if ($data !== false) {
4562
-            return unserialize($data);
4563
-        }
4564
-        return false;
4565
-    }
4566
-
4567
-    /**
4568
-     * Retrieve the last modified time for the cache
4569
-     *
4570
-     * @return int Timestamp
4571
-     */
4572
-    public function mtime() {
4573
-
4574
-        $data = $this->cache->get($this->name);
4575
-
4576
-        if ($data !== false) {
4577
-            return time();
4578
-        }
4579
-
4580
-        return false;
4581
-    }
4582
-
4583
-    /**
4584
-     * Set the last modified time to the current time
4585
-     *
4586
-     * @return bool Success status
4587
-     */
4588
-    public function touch() {
4589
-
4590
-        $data = $this->cache->get($this->name);
4591
-
4592
-        if ($data !== false) {
4593
-            $return = $this->cache->set($this->name, $data);
4594
-            if ($this->options['expire']) {
4595
-                return $this->cache->expire($this->name, $this->ttl);
4596
-            }
4597
-            return $return;
4598
-        }
4599
-
4600
-        return false;
4601
-    }
4602
-
4603
-    /**
4604
-     * Remove the cache
4605
-     *
4606
-     * @return bool Success status
4607
-     */
4608
-    public function unlink() {
4609
-        return $this->cache->set($this->name, null);
4610
-    }
4473
+	/**
4474
+	 * Redis instance
4475
+	 *
4476
+	 * @var \Redis
4477
+	 */
4478
+	protected $cache;
4479
+
4480
+	/**
4481
+	 * Options
4482
+	 *
4483
+	 * @var array
4484
+	 */
4485
+	protected $options;
4486
+
4487
+	/**
4488
+	 * Cache name
4489
+	 *
4490
+	 * @var string
4491
+	 */
4492
+	protected $name;
4493
+
4494
+	/**
4495
+	 * Cache Data
4496
+	 *
4497
+	 * @var type
4498
+	 */
4499
+	protected $data;
4500
+
4501
+	/**
4502
+	 * Create a new cache object
4503
+	 *
4504
+	 * @param string $location Location string (from SimplePie::$cache_location)
4505
+	 * @param string $name Unique ID for the cache
4506
+	 * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
4507
+	 */
4508
+	public function __construct($location, $name, $options = null) {
4509
+		//$this->cache = \flow\simple\cache\Redis::getRedisClientInstance();
4510
+		$parsed = SimplePie_Cache::parse_URL($location);
4511
+		$redis = new Redis();
4512
+		$redis->connect($parsed['host'], $parsed['port']);
4513
+		$this->cache = $redis;
4514
+
4515
+		if (!is_null($options) && is_array($options)) {
4516
+			$this->options = $options;
4517
+		} else {
4518
+			$this->options = array (
4519
+				'prefix' => 'rss:simple_primary:',
4520
+				'expire' => 0,
4521
+			);
4522
+		}
4523
+
4524
+		$this->name = $this->options['prefix'] . $name;
4525
+	}
4526
+
4527
+	/**
4528
+	 * @param \Redis $cache
4529
+	 */
4530
+	public function setRedisClient(\Redis $cache) {
4531
+		$this->cache = $cache;
4532
+	}
4533
+
4534
+	/**
4535
+	 * Save data to the cache
4536
+	 *
4537
+	 * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
4538
+	 * @return bool Successfulness
4539
+	 */
4540
+	public function save($data) {
4541
+		if ($data instanceof SimplePie) {
4542
+			$data = $data->data;
4543
+		}
4544
+		$response = $this->cache->set($this->name, serialize($data));
4545
+		if ($this->options['expire']) {
4546
+			$this->cache->expire($this->name, $this->options['expire']);
4547
+		}
4548
+
4549
+		return $response;
4550
+	}
4551
+
4552
+	/**
4553
+	 * Retrieve the data saved to the cache
4554
+	 *
4555
+	 * @return array Data for SimplePie::$data
4556
+	 */
4557
+	public function load() {
4558
+		$data = $this->cache->get($this->name);
4559
+
4560
+		if ($data !== false) {
4561
+			return unserialize($data);
4562
+		}
4563
+		return false;
4564
+	}
4565
+
4566
+	/**
4567
+	 * Retrieve the last modified time for the cache
4568
+	 *
4569
+	 * @return int Timestamp
4570
+	 */
4571
+	public function mtime() {
4572
+
4573
+		$data = $this->cache->get($this->name);
4574
+
4575
+		if ($data !== false) {
4576
+			return time();
4577
+		}
4578
+
4579
+		return false;
4580
+	}
4581
+
4582
+	/**
4583
+	 * Set the last modified time to the current time
4584
+	 *
4585
+	 * @return bool Success status
4586
+	 */
4587
+	public function touch() {
4588
+
4589
+		$data = $this->cache->get($this->name);
4590
+
4591
+		if ($data !== false) {
4592
+			$return = $this->cache->set($this->name, $data);
4593
+			if ($this->options['expire']) {
4594
+				return $this->cache->expire($this->name, $this->ttl);
4595
+			}
4596
+			return $return;
4597
+		}
4598
+
4599
+		return false;
4600
+	}
4601
+
4602
+	/**
4603
+	 * Remove the cache
4604
+	 *
4605
+	 * @return bool Success status
4606
+	 */
4607
+	public function unlink() {
4608
+		return $this->cache->set($this->name, null);
4609
+	}
4611 4610
 
4612 4611
 }
4613 4612
 
@@ -8269,9 +8268,9 @@  discard block
 block discarded – undo
8269 8268
 	 * Clean up
8270 8269
 	 */
8271 8270
 	public function __destruct() {
8272
-	    $this->set_iri(null, true);
8273
-	    $this->set_path(null, true);
8274
-	    $this->set_authority(null, true);
8271
+		$this->set_iri(null, true);
8272
+		$this->set_path(null, true);
8273
+		$this->set_authority(null, true);
8275 8274
 	}
8276 8275
 
8277 8276
 	/**
@@ -8794,9 +8793,9 @@  discard block
 block discarded – undo
8794 8793
 		// Relative urls cannot have a colon in the first path segment (and the
8795 8794
 		// slashes themselves are not included so skip the first character).
8796 8795
 		if (!$this->scheme && !$isauthority &&
8797
-		    strpos($this->ipath, ':') !== false &&
8798
-		    strpos($this->ipath, '/', 1) !== false &&
8799
-		    strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false;
8796
+			strpos($this->ipath, ':') !== false &&
8797
+			strpos($this->ipath, '/', 1) !== false &&
8798
+			strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false;
8800 8799
 
8801 8800
 		return true;
8802 8801
 	}
@@ -9469,7 +9468,7 @@  discard block
 block discarded – undo
9469 9468
 			$fn = 'md5';
9470 9469
 		}
9471 9470
 		return call_user_func($fn,
9472
-		       $this->get_permalink().$this->get_title().$this->get_content());
9471
+			   $this->get_permalink().$this->get_title().$this->get_content());
9473 9472
 	}
9474 9473
 
9475 9474
 	/**
@@ -9538,47 +9537,47 @@  discard block
 block discarded – undo
9538 9537
 	public function get_description($description_only = false)
9539 9538
 	{
9540 9539
 		if (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) &&
9541
-		    ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9540
+			($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9542 9541
 		{
9543 9542
 			return $return;
9544 9543
 		}
9545 9544
 		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) &&
9546
-		        ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9545
+				($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9547 9546
 		{
9548 9547
 			return $return;
9549 9548
 		}
9550 9549
 		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) &&
9551
-		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($tags[0]))))
9550
+				($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($tags[0]))))
9552 9551
 		{
9553 9552
 			return $return;
9554 9553
 		}
9555 9554
 		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) &&
9556
-		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
9555
+				($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
9557 9556
 		{
9558 9557
 			return $return;
9559 9558
 		}
9560 9559
 		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) &&
9561
-		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
9560
+				($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
9562 9561
 		{
9563 9562
 			return $return;
9564 9563
 		}
9565 9564
 		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) &&
9566
-		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
9565
+				($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
9567 9566
 		{
9568 9567
 			return $return;
9569 9568
 		}
9570 9569
 		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) &&
9571
-		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
9570
+				($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
9572 9571
 		{
9573 9572
 			return $return;
9574 9573
 		}
9575 9574
 		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) &&
9576
-		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
9575
+				($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
9577 9576
 		{
9578 9577
 			return $return;
9579 9578
 		}
9580 9579
 		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) &&
9581
-		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML)))
9580
+				($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML)))
9582 9581
 		{
9583 9582
 			return $return;
9584 9583
 		}
@@ -9610,17 +9609,17 @@  discard block
 block discarded – undo
9610 9609
 	public function get_content($content_only = false)
9611 9610
 	{
9612 9611
 		if (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) &&
9613
-		    ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9612
+			($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9614 9613
 		{
9615 9614
 			return $return;
9616 9615
 		}
9617 9616
 		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) &&
9618
-		        ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9617
+				($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9619 9618
 		{
9620 9619
 			return $return;
9621 9620
 		}
9622 9621
 		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) &&
9623
-		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
9622
+				($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
9624 9623
 		{
9625 9624
 			return $return;
9626 9625
 		}
@@ -12335,8 +12334,8 @@  discard block
 block discarded – undo
12335 12334
 			$sniffer = $this->registry->create('Content_Type_Sniffer', array($file));
12336 12335
 			$sniffed = $sniffer->get_type();
12337 12336
 			$mime_types = array('application/rss+xml', 'application/rdf+xml',
12338
-			                    'text/rdf', 'application/atom+xml', 'text/xml',
12339
-			                    'application/xml', 'application/x-rss+xml');
12337
+								'text/rdf', 'application/atom+xml', 'text/xml',
12338
+								'application/xml', 'application/x-rss+xml');
12340 12339
 			if ($check_html)
12341 12340
 			{
12342 12341
 				$mime_types[] = 'text/html';
@@ -12510,12 +12509,12 @@  discard block
 block discarded – undo
12510 12509
 		if ($this->dom === null)
12511 12510
 		{
12512 12511
 			throw new SimplePie_Exception('DOMDocument not found, unable to use '.
12513
-			                              'locator');
12512
+										  'locator');
12514 12513
 		}
12515 12514
 		if (!class_exists('DOMXpath'))
12516 12515
 		{
12517 12516
 			throw new SimplePie_Exception('DOMXpath not found, unable to use '.
12518
-			                              'get_rel_link');
12517
+										  'get_rel_link');
12519 12518
 		}
12520 12519
 
12521 12520
 		$xpath = new DOMXpath($this->dom);
@@ -12525,22 +12524,22 @@  discard block
 block discarded – undo
12525 12524
 			$href = trim($link->getAttribute('href'));
12526 12525
 			$parsed = $this->registry->call('Misc', 'parse_url', array($href));
12527 12526
 			if ($parsed['scheme'] === '' ||
12528
-			    preg_match('/^https?$/i', $parsed['scheme']))
12527
+				preg_match('/^https?$/i', $parsed['scheme']))
12529 12528
 			{
12530 12529
 				if (method_exists($link, 'getLineNo') &&
12531
-				    $this->base_location < $link->getLineNo())
12530
+					$this->base_location < $link->getLineNo())
12532 12531
 				{
12533 12532
 					$href =
12534 12533
 						$this->registry->call('Misc', 'absolutize_url',
12535
-						                      array(trim($link->getAttribute('href')),
12536
-						                            $this->base));
12534
+											  array(trim($link->getAttribute('href')),
12535
+													$this->base));
12537 12536
 				}
12538 12537
 				else
12539 12538
 				{
12540 12539
 					$href =
12541 12540
 						$this->registry->call('Misc', 'absolutize_url',
12542
-						                      array(trim($link->getAttribute('href')),
12543
-						                            $this->http_base));
12541
+											  array(trim($link->getAttribute('href')),
12542
+													$this->http_base));
12544 12543
 				}
12545 12544
 				if ($href === false)
12546 12545
 				{
@@ -16630,9 +16629,9 @@  discard block
 block discarded – undo
16630 16629
 		}
16631 16630
 		$channel = array('channel' => array(array('child' => array('' =>
16632 16631
 			array('link' => $link, 'image' => $image, 'title' => $feed_title,
16633
-			      'item' => $items)))));
16632
+				  'item' => $items)))));
16634 16633
 		$rss = array(array('attribs' => array('' => array('version' => '2.0')),
16635
-		                   'child' => array('' => $channel)));
16634
+						   'child' => array('' => $channel)));
16636 16635
 		$this->data = array('child' => array('' => array('rss' => $rss)));
16637 16636
 		return true;
16638 16637
 	}
Please login to merge, or discard this patch.
Spacing   +250 added lines, -250 removed lines patch added patch discarded remove patch
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
  * SimplePie Useragent
70 70
  * @see SimplePie::set_useragent()
71 71
  */
72
-define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD);
72
+define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME.'/'.SIMPLEPIE_VERSION.' (Feed Parser; '.SIMPLEPIE_URL.'; Allow like Gecko) Build/'.SIMPLEPIE_BUILD);
73 73
 
74 74
 /**
75 75
  * SimplePie Linkback
76 76
  */
77
-define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>');
77
+define('SIMPLEPIE_LINKBACK', '<a href="'.SIMPLEPIE_URL.'" title="'.SIMPLEPIE_NAME.' '.SIMPLEPIE_VERSION.'">'.SIMPLEPIE_NAME.'</a>');
78 78
 
79 79
 /**
80 80
  * No Autodiscovery
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 		{
786 786
 			$this->feed_url = $file->url;
787 787
 			$this->permanent_url = $this->feed_url;
788
-			$this->file =& $file;
788
+			$this->file = & $file;
789 789
 			return true;
790 790
 		}
791 791
 		return false;
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 	 */
874 874
 	public function force_cache_fallback($enable = false)
875 875
 	{
876
-		$this->force_cache_fallback= (bool) $enable;
876
+		$this->force_cache_fallback = (bool) $enable;
877 877
 	}
878 878
 
879 879
 	/**
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
 	{
1259 1259
 		if ($page !== false)
1260 1260
 		{
1261
-			$this->sanitize->set_image_handler($page . '?' . $qs . '=');
1261
+			$this->sanitize->set_image_handler($page.'?'.$qs.'=');
1262 1262
 		}
1263 1263
 		else
1264 1264
 		{
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 		}
1390 1390
 		
1391 1391
 		// Empty response check
1392
-		if(empty($this->raw_data)){
1392
+		if (empty($this->raw_data)) {
1393 1393
 			$this->error = "A feed could not be found at `$this->feed_url`. Empty body.";
1394 1394
 			$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
1395 1395
 			return false;
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
 				if ($parser->parse($utf8_data, 'UTF-8', $this->permanent_url))
1456 1456
 				{
1457 1457
 					$this->data = $parser->get_data();
1458
-					if (!($this->get_type() & ~SIMPLEPIE_TYPE_NONE))
1458
+					if (!($this->get_type()&~SIMPLEPIE_TYPE_NONE))
1459 1459
 					{
1460 1460
 						$this->error = "A feed could not be found at `$this->feed_url`. This does not appear to be a valid RSS or Atom feed.";
1461 1461
 						$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
 				if (!class_exists('\UConverter')) {
1501 1501
 					$missingExtensions[] = 'intl (PHP 5.5+)';
1502 1502
 				}
1503
-				$this->error .= ' Try installing/enabling the ' . implode(' or ', $missingExtensions) . ' extension.';
1503
+				$this->error .= ' Try installing/enabling the '.implode(' or ', $missingExtensions).' extension.';
1504 1504
 			}
1505 1505
 		}
1506 1506
 
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
 						else
1592 1592
 						{
1593 1593
 							$this->check_modified = false;
1594
-							if($this->force_cache_fallback)
1594
+							if ($this->force_cache_fallback)
1595 1595
 							{
1596 1596
 								$cache->touch();
1597 1597
 								return true;
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
 		{
1621 1621
 			if ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url)
1622 1622
 			{
1623
-				$file =& $this->file;
1623
+				$file = & $this->file;
1624 1624
 			}
1625 1625
 			else
1626 1626
 			{
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
 			}
1632 1632
 		}
1633 1633
 		// If the file connection has an error, set SimplePie::error to that and quit
1634
-		if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
1634
+		if (!$file->success && !($file->method&SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
1635 1635
 		{
1636 1636
 			$this->error = $file->error;
1637 1637
 			return !empty($this->data);
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
 			$header = "Content-type: $mime;";
1787 1787
 			if ($this->get_encoding())
1788 1788
 			{
1789
-				$header .= ' charset=' . $this->get_encoding();
1789
+				$header .= ' charset='.$this->get_encoding();
1790 1790
 			}
1791 1791
 			else
1792 1792
 			{
@@ -1978,28 +1978,28 @@  discard block
 block discarded – undo
1978 1978
 	public function get_feed_tags($namespace, $tag)
1979 1979
 	{
1980 1980
 		$type = $this->get_type();
1981
-		if ($type & SIMPLEPIE_TYPE_ATOM_10)
1981
+		if ($type&SIMPLEPIE_TYPE_ATOM_10)
1982 1982
 		{
1983 1983
 			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag]))
1984 1984
 			{
1985 1985
 				return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag];
1986 1986
 			}
1987 1987
 		}
1988
-		if ($type & SIMPLEPIE_TYPE_ATOM_03)
1988
+		if ($type&SIMPLEPIE_TYPE_ATOM_03)
1989 1989
 		{
1990 1990
 			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag]))
1991 1991
 			{
1992 1992
 				return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag];
1993 1993
 			}
1994 1994
 		}
1995
-		if ($type & SIMPLEPIE_TYPE_RSS_RDF)
1995
+		if ($type&SIMPLEPIE_TYPE_RSS_RDF)
1996 1996
 		{
1997 1997
 			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]))
1998 1998
 			{
1999 1999
 				return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag];
2000 2000
 			}
2001 2001
 		}
2002
-		if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
2002
+		if ($type&SIMPLEPIE_TYPE_RSS_SYNDICATION)
2003 2003
 		{
2004 2004
 			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]))
2005 2005
 			{
@@ -2026,14 +2026,14 @@  discard block
 block discarded – undo
2026 2026
 	public function get_channel_tags($namespace, $tag)
2027 2027
 	{
2028 2028
 		$type = $this->get_type();
2029
-		if ($type & SIMPLEPIE_TYPE_ATOM_ALL)
2029
+		if ($type&SIMPLEPIE_TYPE_ATOM_ALL)
2030 2030
 		{
2031 2031
 			if ($return = $this->get_feed_tags($namespace, $tag))
2032 2032
 			{
2033 2033
 				return $return;
2034 2034
 			}
2035 2035
 		}
2036
-		if ($type & SIMPLEPIE_TYPE_RSS_10)
2036
+		if ($type&SIMPLEPIE_TYPE_RSS_10)
2037 2037
 		{
2038 2038
 			if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel'))
2039 2039
 			{
@@ -2043,7 +2043,7 @@  discard block
 block discarded – undo
2043 2043
 				}
2044 2044
 			}
2045 2045
 		}
2046
-		if ($type & SIMPLEPIE_TYPE_RSS_090)
2046
+		if ($type&SIMPLEPIE_TYPE_RSS_090)
2047 2047
 		{
2048 2048
 			if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel'))
2049 2049
 			{
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
 				}
2054 2054
 			}
2055 2055
 		}
2056
-		if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
2056
+		if ($type&SIMPLEPIE_TYPE_RSS_SYNDICATION)
2057 2057
 		{
2058 2058
 			if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel'))
2059 2059
 			{
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
 	public function get_image_tags($namespace, $tag)
2084 2084
 	{
2085 2085
 		$type = $this->get_type();
2086
-		if ($type & SIMPLEPIE_TYPE_RSS_10)
2086
+		if ($type&SIMPLEPIE_TYPE_RSS_10)
2087 2087
 		{
2088 2088
 			if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image'))
2089 2089
 			{
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
 				}
2094 2094
 			}
2095 2095
 		}
2096
-		if ($type & SIMPLEPIE_TYPE_RSS_090)
2096
+		if ($type&SIMPLEPIE_TYPE_RSS_090)
2097 2097
 		{
2098 2098
 			if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image'))
2099 2099
 			{
@@ -2103,7 +2103,7 @@  discard block
 block discarded – undo
2103 2103
 				}
2104 2104
 			}
2105 2105
 		}
2106
-		if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
2106
+		if ($type&SIMPLEPIE_TYPE_RSS_SYNDICATION)
2107 2107
 		{
2108 2108
 			if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image'))
2109 2109
 			{
@@ -2130,7 +2130,7 @@  discard block
 block discarded – undo
2130 2130
 	 */
2131 2131
 	public function get_base($element = array())
2132 2132
 	{
2133
-		if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base']))
2133
+		if (!($this->get_type()&SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base']))
2134 2134
 		{
2135 2135
 			return $element['xml_base'];
2136 2136
 		}
@@ -2578,19 +2578,19 @@  discard block
 block discarded – undo
2578 2578
 			{
2579 2579
 				if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
2580 2580
 				{
2581
-					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
2581
+					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]))
2582 2582
 					{
2583
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
2584
-						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
2583
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]);
2584
+						$this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key];
2585 2585
 					}
2586 2586
 					else
2587 2587
 					{
2588
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
2588
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key];
2589 2589
 					}
2590 2590
 				}
2591 2591
 				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
2592 2592
 				{
2593
-					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
2593
+					$this->data['links'][substr($key, 41)] = & $this->data['links'][$key];
2594 2594
 				}
2595 2595
 				$this->data['links'][$key] = array_unique($this->data['links'][$key]);
2596 2596
 			}
@@ -2938,7 +2938,7 @@  discard block
 block discarded – undo
2938 2938
 		{
2939 2939
 			return round($return[0]['data']);
2940 2940
 		}
2941
-		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2941
+		elseif ($this->get_type()&SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2942 2942
 		{
2943 2943
 			return 88.0;
2944 2944
 		}
@@ -2964,7 +2964,7 @@  discard block
 block discarded – undo
2964 2964
 		{
2965 2965
 			return round($return[0]['data']);
2966 2966
 		}
2967
-		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2967
+		elseif ($this->get_type()&SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2968 2968
 		{
2969 2969
 			return 31.0;
2970 2970
 		}
@@ -3144,7 +3144,7 @@  discard block
 block discarded – undo
3144 3144
 
3145 3145
 		if (($url = $this->get_link()) !== null)
3146 3146
 		{
3147
-			return 'https://www.google.com/s2/favicons?domain=' . urlencode($url);
3147
+			return 'https://www.google.com/s2/favicons?domain='.urlencode($url);
3148 3148
 		}
3149 3149
 
3150 3150
 		return false;
@@ -3606,19 +3606,19 @@  discard block
 block discarded – undo
3606 3606
 
3607 3607
 			if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
3608 3608
 			{
3609
-				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
3609
+				$channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
3610 3610
 			}
3611 3611
 			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
3612 3612
 			{
3613
-				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
3613
+				$channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
3614 3614
 			}
3615 3615
 			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
3616 3616
 			{
3617
-				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
3617
+				$channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
3618 3618
 			}
3619 3619
 			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]))
3620 3620
 			{
3621
-				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0];
3621
+				$channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0];
3622 3622
 			}
3623 3623
 			else
3624 3624
 			{
@@ -3838,7 +3838,7 @@  discard block
 block discarded – undo
3838 3838
 		);
3839 3839
 		$this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
3840 3840
 
3841
-		$this->name = $this->options['extras']['prefix'] . md5("$name:$type");
3841
+		$this->name = $this->options['extras']['prefix'].md5("$name:$type");
3842 3842
 
3843 3843
 		$this->cache = new Memcache();
3844 3844
 		$this->cache->addServer($this->options['host'], (int) $this->options['port']);
@@ -3972,10 +3972,10 @@  discard block
 block discarded – undo
3972 3972
         );
3973 3973
         $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
3974 3974
 
3975
-        $this->name = $this->options['extras']['prefix'] . md5("$name:$type");
3975
+        $this->name = $this->options['extras']['prefix'].md5("$name:$type");
3976 3976
 
3977 3977
         $this->cache = new Memcached();
3978
-        $this->cache->addServer($this->options['host'], (int)$this->options['port']);
3978
+        $this->cache->addServer($this->options['host'], (int) $this->options['port']);
3979 3979
     }
3980 3980
 
3981 3981
     /**
@@ -4009,7 +4009,7 @@  discard block
 block discarded – undo
4009 4009
      * @return int Timestamp
4010 4010
      */
4011 4011
     public function mtime() {
4012
-        $data = $this->cache->get($this->name . '_mtime');
4012
+        $data = $this->cache->get($this->name.'_mtime');
4013 4013
         return (int) $data;
4014 4014
     }
4015 4015
 
@@ -4037,8 +4037,8 @@  discard block
 block discarded – undo
4037 4037
     private function setData($data) {
4038 4038
 
4039 4039
         if ($data !== false) {
4040
-            $this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']);
4041
-            return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']);
4040
+            $this->cache->set($this->name.'_mtime', time(), (int) $this->options['extras']['timeout']);
4041
+            return $this->cache->set($this->name, $data, (int) $this->options['extras']['timeout']);
4042 4042
         }
4043 4043
 
4044 4044
         return false;
@@ -4116,7 +4116,7 @@  discard block
 block discarded – undo
4116 4116
 			return;
4117 4117
 		}
4118 4118
 
4119
-		$this->id = $name . $type;
4119
+		$this->id = $name.$type;
4120 4120
 
4121 4121
 		if (!$query = $this->mysql->query('SHOW TABLES'))
4122 4122
 		{
@@ -4130,23 +4130,23 @@  discard block
 block discarded – undo
4130 4130
 			$db[] = $row;
4131 4131
 		}
4132 4132
 
4133
-		if (!in_array($this->options['extras']['prefix'] . 'cache_data', $db))
4133
+		if (!in_array($this->options['extras']['prefix'].'cache_data', $db))
4134 4134
 		{
4135
-			$query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))');
4135
+			$query = $this->mysql->exec('CREATE TABLE `'.$this->options['extras']['prefix'].'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))');
4136 4136
 			if ($query === false)
4137 4137
 			{
4138
-				trigger_error("Can't create " . $this->options['extras']['prefix'] . "cache_data table, check permissions", E_USER_WARNING);
4138
+				trigger_error("Can't create ".$this->options['extras']['prefix']."cache_data table, check permissions", E_USER_WARNING);
4139 4139
 				$this->mysql = null;
4140 4140
 				return;
4141 4141
 			}
4142 4142
 		}
4143 4143
 
4144
-		if (!in_array($this->options['extras']['prefix'] . 'items', $db))
4144
+		if (!in_array($this->options['extras']['prefix'].'items', $db))
4145 4145
 		{
4146
-			$query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` MEDIUMBLOB NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))');
4146
+			$query = $this->mysql->exec('CREATE TABLE `'.$this->options['extras']['prefix'].'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` MEDIUMBLOB NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))');
4147 4147
 			if ($query === false)
4148 4148
 			{
4149
-				trigger_error("Can't create " . $this->options['extras']['prefix'] . "items table, check permissions", E_USER_WARNING);
4149
+				trigger_error("Can't create ".$this->options['extras']['prefix']."items table, check permissions", E_USER_WARNING);
4150 4150
 				$this->mysql = null;
4151 4151
 				return;
4152 4152
 			}
@@ -4166,9 +4166,9 @@  discard block
 block discarded – undo
4166 4166
 			return false;
4167 4167
 		}
4168 4168
 
4169
-		$query = $this->mysql->prepare('DELETE i, cd FROM `' . $this->options['extras']['prefix'] . 'cache_data` cd, ' .
4170
-			'`' . $this->options['extras']['prefix'] . 'items` i ' .
4171
-			'WHERE cd.id = i.feed_id ' .
4169
+		$query = $this->mysql->prepare('DELETE i, cd FROM `'.$this->options['extras']['prefix'].'cache_data` cd, '.
4170
+			'`'.$this->options['extras']['prefix'].'items` i '.
4171
+			'WHERE cd.id = i.feed_id '.
4172 4172
 			'AND cd.mtime < (unix_timestamp() - :purge_time)');
4173 4173
 		$query->bindValue(':purge_time', $this->options['extras']['cache_purge_time']);
4174 4174
 
@@ -4183,7 +4183,7 @@  discard block
 block discarded – undo
4183 4183
 
4184 4184
 			$prepared = self::prepare_simplepie_object_for_cache($data);
4185 4185
 
4186
-			$query = $this->mysql->prepare('SELECT COUNT(*) FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed');
4186
+			$query = $this->mysql->prepare('SELECT COUNT(*) FROM `'.$this->options['extras']['prefix'].'cache_data` WHERE `id` = :feed');
4187 4187
 			$query->bindValue(':feed', $this->id);
4188 4188
 			if ($query->execute())
4189 4189
 			{
@@ -4192,13 +4192,13 @@  discard block
 block discarded – undo
4192 4192
 					$items = count($prepared[1]);
4193 4193
 					if ($items)
4194 4194
 					{
4195
-						$sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed';
4195
+						$sql = 'UPDATE `'.$this->options['extras']['prefix'].'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed';
4196 4196
 						$query = $this->mysql->prepare($sql);
4197 4197
 						$query->bindValue(':items', $items);
4198 4198
 					}
4199 4199
 					else
4200 4200
 					{
4201
-						$sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed';
4201
+						$sql = 'UPDATE `'.$this->options['extras']['prefix'].'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed';
4202 4202
 						$query = $this->mysql->prepare($sql);
4203 4203
 					}
4204 4204
 
@@ -4212,7 +4212,7 @@  discard block
 block discarded – undo
4212 4212
 				}
4213 4213
 				else
4214 4214
 				{
4215
-					$query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:feed, :count, :data, :time)');
4215
+					$query = $this->mysql->prepare('INSERT INTO `'.$this->options['extras']['prefix'].'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:feed, :count, :data, :time)');
4216 4216
 					$query->bindValue(':feed', $this->id);
4217 4217
 					$query->bindValue(':count', count($prepared[1]));
4218 4218
 					$query->bindValue(':data', $prepared[0]);
@@ -4231,7 +4231,7 @@  discard block
 block discarded – undo
4231 4231
 						$database_ids[] = $this->mysql->quote($id);
4232 4232
 					}
4233 4233
 
4234
-					$query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `id` = ' . implode(' OR `id` = ', $database_ids) . ' AND `feed_id` = :feed');
4234
+					$query = $this->mysql->prepare('SELECT `id` FROM `'.$this->options['extras']['prefix'].'items` WHERE `id` = '.implode(' OR `id` = ', $database_ids).' AND `feed_id` = :feed');
4235 4235
 					$query->bindValue(':feed', $this->id);
4236 4236
 
4237 4237
 					if ($query->execute())
@@ -4251,7 +4251,7 @@  discard block
 block discarded – undo
4251 4251
 								$date = time();
4252 4252
 							}
4253 4253
 
4254
-							$query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(:feed, :id, :data, :date)');
4254
+							$query = $this->mysql->prepare('INSERT INTO `'.$this->options['extras']['prefix'].'items` (`feed_id`, `id`, `data`, `posted`) VALUES(:feed, :id, :data, :date)');
4255 4255
 							$query->bindValue(':feed', $this->id);
4256 4256
 							$query->bindValue(':id', $new_id);
4257 4257
 							$query->bindValue(':data', serialize($prepared[1][$new_id]->data));
@@ -4272,13 +4272,13 @@  discard block
 block discarded – undo
4272 4272
 		}
4273 4273
 		else
4274 4274
 		{
4275
-			$query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed');
4275
+			$query = $this->mysql->prepare('SELECT `id` FROM `'.$this->options['extras']['prefix'].'cache_data` WHERE `id` = :feed');
4276 4276
 			$query->bindValue(':feed', $this->id);
4277 4277
 			if ($query->execute())
4278 4278
 			{
4279 4279
 				if ($query->rowCount() > 0)
4280 4280
 				{
4281
-					$query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = 0, `data` = :data, `mtime` = :time WHERE `id` = :feed');
4281
+					$query = $this->mysql->prepare('UPDATE `'.$this->options['extras']['prefix'].'cache_data` SET `items` = 0, `data` = :data, `mtime` = :time WHERE `id` = :feed');
4282 4282
 					$query->bindValue(':data', serialize($data));
4283 4283
 					$query->bindValue(':time', time());
4284 4284
 					$query->bindValue(':feed', $this->id);
@@ -4289,7 +4289,7 @@  discard block
 block discarded – undo
4289 4289
 				}
4290 4290
 				else
4291 4291
 				{
4292
-					$query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:id, 0, :data, :time)');
4292
+					$query = $this->mysql->prepare('INSERT INTO `'.$this->options['extras']['prefix'].'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:id, 0, :data, :time)');
4293 4293
 					$query->bindValue(':id', $this->id);
4294 4294
 					$query->bindValue(':data', serialize($data));
4295 4295
 					$query->bindValue(':time', time());
@@ -4315,7 +4315,7 @@  discard block
 block discarded – undo
4315 4315
 			return false;
4316 4316
 		}
4317 4317
 
4318
-		$query = $this->mysql->prepare('SELECT `items`, `data` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');
4318
+		$query = $this->mysql->prepare('SELECT `items`, `data` FROM `'.$this->options['extras']['prefix'].'cache_data` WHERE `id` = :id');
4319 4319
 		$query->bindValue(':id', $this->id);
4320 4320
 		if ($query->execute() && ($row = $query->fetch()))
4321 4321
 		{
@@ -4334,19 +4334,19 @@  discard block
 block discarded – undo
4334 4334
 			{
4335 4335
 				if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
4336 4336
 				{
4337
-					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
4337
+					$feed = & $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
4338 4338
 				}
4339 4339
 				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
4340 4340
 				{
4341
-					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
4341
+					$feed = & $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
4342 4342
 				}
4343 4343
 				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
4344 4344
 				{
4345
-					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
4345
+					$feed = & $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
4346 4346
 				}
4347 4347
 				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]))
4348 4348
 				{
4349
-					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0];
4349
+					$feed = & $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0];
4350 4350
 				}
4351 4351
 				else
4352 4352
 				{
@@ -4355,10 +4355,10 @@  discard block
 block discarded – undo
4355 4355
 
4356 4356
 				if ($feed !== null)
4357 4357
 				{
4358
-					$sql = 'SELECT `data` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :feed ORDER BY `posted` DESC';
4358
+					$sql = 'SELECT `data` FROM `'.$this->options['extras']['prefix'].'items` WHERE `feed_id` = :feed ORDER BY `posted` DESC';
4359 4359
 					if ($items > 0)
4360 4360
 					{
4361
-						$sql .= ' LIMIT ' . $items;
4361
+						$sql .= ' LIMIT '.$items;
4362 4362
 					}
4363 4363
 
4364 4364
 					$query = $this->mysql->prepare($sql);
@@ -4393,7 +4393,7 @@  discard block
 block discarded – undo
4393 4393
 			return false;
4394 4394
 		}
4395 4395
 
4396
-		$query = $this->mysql->prepare('SELECT `mtime` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');
4396
+		$query = $this->mysql->prepare('SELECT `mtime` FROM `'.$this->options['extras']['prefix'].'cache_data` WHERE `id` = :id');
4397 4397
 		$query->bindValue(':id', $this->id);
4398 4398
 		if ($query->execute() && ($time = $query->fetchColumn()))
4399 4399
 		{
@@ -4417,7 +4417,7 @@  discard block
 block discarded – undo
4417 4417
 			return false;
4418 4418
 		}
4419 4419
 
4420
-		$query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `mtime` = :time WHERE `id` = :id');
4420
+		$query = $this->mysql->prepare('UPDATE `'.$this->options['extras']['prefix'].'cache_data` SET `mtime` = :time WHERE `id` = :id');
4421 4421
 		$query->bindValue(':time', time());
4422 4422
 		$query->bindValue(':id', $this->id);
4423 4423
 		if ($query->execute() && $query->rowCount() > 0)
@@ -4442,9 +4442,9 @@  discard block
 block discarded – undo
4442 4442
 			return false;
4443 4443
 		}
4444 4444
 
4445
-		$query = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');
4445
+		$query = $this->mysql->prepare('DELETE FROM `'.$this->options['extras']['prefix'].'cache_data` WHERE `id` = :id');
4446 4446
 		$query->bindValue(':id', $this->id);
4447
-		$query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id');
4447
+		$query2 = $this->mysql->prepare('DELETE FROM `'.$this->options['extras']['prefix'].'items` WHERE `feed_id` = :id');
4448 4448
 		$query2->bindValue(':id', $this->id);
4449 4449
 		if ($query->execute() && $query2->execute())
4450 4450
 		{
@@ -4516,13 +4516,13 @@  discard block
 block discarded – undo
4516 4516
         if (!is_null($options) && is_array($options)) {
4517 4517
             $this->options = $options;
4518 4518
         } else {
4519
-            $this->options = array (
4519
+            $this->options = array(
4520 4520
                 'prefix' => 'rss:simple_primary:',
4521 4521
                 'expire' => 0,
4522 4522
             );
4523 4523
         }
4524 4524
 
4525
-        $this->name = $this->options['prefix'] . $name;
4525
+        $this->name = $this->options['prefix'].$name;
4526 4526
     }
4527 4527
 
4528 4528
     /**
@@ -6841,7 +6841,7 @@  discard block
 block discarded – undo
6841 6841
 	 * @param array|string $options See first paramter to {@see embed}
6842 6842
 	 * @return string HTML string to output
6843 6843
 	 */
6844
-	public function native_embed($options='')
6844
+	public function native_embed($options = '')
6845 6845
 	{
6846 6846
 		return $this->embed($options, true);
6847 6847
 	}
@@ -6915,7 +6915,7 @@  discard block
 block discarded – undo
6915 6915
 		else
6916 6916
 		{
6917 6917
 			$options = explode(',', $options);
6918
-			foreach($options as $option)
6918
+			foreach ($options as $option)
6919 6919
 			{
6920 6920
 				$opt = explode(':', $option, 2);
6921 6921
 				if (isset($opt[0], $opt[1]))
@@ -7050,11 +7050,11 @@  discard block
 block discarded – undo
7050 7050
 		{
7051 7051
 			if ($native)
7052 7052
 			{
7053
-				$embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
7053
+				$embed .= "<embed src=\"".$this->get_link()."\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
7054 7054
 			}
7055 7055
 			else
7056 7056
 			{
7057
-				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>";
7057
+				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '".$this->get_link()."', '$loop', '$type');</script>";
7058 7058
 			}
7059 7059
 		}
7060 7060
 
@@ -7065,11 +7065,11 @@  discard block
 block discarded – undo
7065 7065
 			$height += 20;
7066 7066
 			if ($native)
7067 7067
 			{
7068
-				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
7068
+				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=".rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension())."&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
7069 7069
 			}
7070 7070
 			else
7071 7071
 			{
7072
-				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>";
7072
+				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '".rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension())."', '$placeholder', '$loop', '$mediaplayer');</script>";
7073 7073
 			}
7074 7074
 		}
7075 7075
 
@@ -7082,16 +7082,16 @@  discard block
 block discarded – undo
7082 7082
 			{
7083 7083
 				if ($placeholder !== '')
7084 7084
 				{
7085
-					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
7085
+					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"".$this->get_link()."\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
7086 7086
 				}
7087 7087
 				else
7088 7088
 				{
7089
-					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
7089
+					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"".$this->get_link()."\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
7090 7090
 				}
7091 7091
 			}
7092 7092
 			else
7093 7093
 			{
7094
-				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>";
7094
+				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '".$this->get_link()."', '$placeholder', '$loop');</script>";
7095 7095
 			}
7096 7096
 		}
7097 7097
 
@@ -7101,16 +7101,16 @@  discard block
 block discarded – undo
7101 7101
 			$height += 45;
7102 7102
 			if ($native)
7103 7103
 			{
7104
-				$embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
7104
+				$embed .= "<embed type=\"application/x-mplayer2\" src=\"".$this->get_link()."\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
7105 7105
 			}
7106 7106
 			else
7107 7107
 			{
7108
-				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>";
7108
+				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '".$this->get_link()."');</script>";
7109 7109
 			}
7110 7110
 		}
7111 7111
 
7112 7112
 		// Everything else
7113
-		else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
7113
+		else $embed .= '<a href="'.$this->get_link().'" class="'.$altclass.'">'.$alt.'</a>';
7114 7114
 
7115 7115
 		return $embed;
7116 7116
 	}
@@ -7130,7 +7130,7 @@  discard block
 block discarded – undo
7130 7130
 	{
7131 7131
 		// Mime-types by handler.
7132 7132
 		$types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
7133
-		$types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
7133
+		$types_fmedia = array('video/flv', 'video/x-flv', 'flv-application/octet-stream'); // Flash Media Player
7134 7134
 		$types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
7135 7135
 		$types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
7136 7136
 		$types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
@@ -7359,7 +7359,7 @@  discard block
 block discarded – undo
7359 7359
 			}
7360 7360
 			if (!$force_fsockopen && function_exists('curl_exec'))
7361 7361
 			{
7362
-				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
7362
+				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE|SIMPLEPIE_FILE_SOURCE_CURL;
7363 7363
 				$fp = curl_init();
7364 7364
 				$headers2 = array();
7365 7365
 				foreach ($headers as $key => $value)
@@ -7396,7 +7396,7 @@  discard block
 block discarded – undo
7396 7396
 				}
7397 7397
 				if (curl_errno($fp))
7398 7398
 				{
7399
-					$this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
7399
+					$this->error = 'cURL error '.curl_errno($fp).': '.curl_error($fp);
7400 7400
 					$this->success = false;
7401 7401
 				}
7402 7402
 				else
@@ -7427,7 +7427,7 @@  discard block
 block discarded – undo
7427 7427
 			}
7428 7428
 			else
7429 7429
 			{
7430
-				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
7430
+				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE|SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
7431 7431
 				$url_parts = parse_url($url);
7432 7432
 				$socket_host = $url_parts['host'];
7433 7433
 				if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https')
@@ -7442,7 +7442,7 @@  discard block
 block discarded – undo
7442 7442
 				$fp = @fsockopen($socket_host, $url_parts['port'], $errno, $errstr, $timeout);
7443 7443
 				if (!$fp)
7444 7444
 				{
7445
-					$this->error = 'fsockopen error: ' . $errstr;
7445
+					$this->error = 'fsockopen error: '.$errstr;
7446 7446
 					$this->success = false;
7447 7447
 				}
7448 7448
 				else
@@ -7473,7 +7473,7 @@  discard block
 block discarded – undo
7473 7473
 
7474 7474
 					if (isset($url_parts['user']) && isset($url_parts['pass']))
7475 7475
 					{
7476
-						$out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
7476
+						$out .= "Authorization: Basic ".base64_encode("$url_parts[user]:$url_parts[pass]")."\r\n";
7477 7477
 					}
7478 7478
 					foreach ($headers as $key => $value)
7479 7479
 					{
@@ -7564,7 +7564,7 @@  discard block
 block discarded – undo
7564 7564
 		}
7565 7565
 		else
7566 7566
 		{
7567
-			$this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
7567
+			$this->method = SIMPLEPIE_FILE_SOURCE_LOCAL|SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
7568 7568
 			if (empty($url) || !($this->body = trim(file_get_contents($url))))
7569 7569
 			{
7570 7570
 				$this->error = 'file_get_contents could not read the file';
@@ -7789,7 +7789,7 @@  discard block
 block discarded – undo
7789 7789
 			// We should only use the last Content-Type header. c.f. issue #1
7790 7790
 			if (isset($this->headers[$this->name]) && $this->name !== 'content-type')
7791 7791
 			{
7792
-				$this->headers[$this->name] .= ', ' . $this->value;
7792
+				$this->headers[$this->name] .= ', '.$this->value;
7793 7793
 			}
7794 7794
 			else
7795 7795
 			{
@@ -7999,7 +7999,7 @@  discard block
 block discarded – undo
7999 7999
 
8000 8000
 		while (true)
8001 8001
 		{
8002
-			$is_chunked = (bool) preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches );
8002
+			$is_chunked = (bool) preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches);
8003 8003
 			if (!$is_chunked)
8004 8004
 			{
8005 8005
 				// Looks like it's not chunked after all
@@ -8154,9 +8154,9 @@  discard block
 block discarded – undo
8154 8154
 	 */
8155 8155
 	public function __set($name, $value)
8156 8156
 	{
8157
-		if (method_exists($this, 'set_' . $name))
8157
+		if (method_exists($this, 'set_'.$name))
8158 8158
 		{
8159
-			call_user_func(array($this, 'set_' . $name), $value);
8159
+			call_user_func(array($this, 'set_'.$name), $value);
8160 8160
 		}
8161 8161
 		elseif (
8162 8162
 			   $name === 'iauthority'
@@ -8167,7 +8167,7 @@  discard block
 block discarded – undo
8167 8167
 			|| $name === 'ifragment'
8168 8168
 		)
8169 8169
 		{
8170
-			call_user_func(array($this, 'set_' . substr($name, 1)), $value);
8170
+			call_user_func(array($this, 'set_'.substr($name, 1)), $value);
8171 8171
 		}
8172 8172
 	}
8173 8173
 
@@ -8197,7 +8197,7 @@  discard block
 block discarded – undo
8197 8197
 			$return = $this->$name;
8198 8198
 		}
8199 8199
 		// host -> ihost
8200
-		elseif (($prop = 'i' . $name) && array_key_exists($prop, $props))
8200
+		elseif (($prop = 'i'.$name) && array_key_exists($prop, $props))
8201 8201
 		{
8202 8202
 			$name = $prop;
8203 8203
 			$return = $this->$prop;
@@ -8210,7 +8210,7 @@  discard block
 block discarded – undo
8210 8210
 		}
8211 8211
 		else
8212 8212
 		{
8213
-			trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
8213
+			trigger_error('Undefined property: '.get_class($this).'::'.$name, E_USER_NOTICE);
8214 8214
 			$return = null;
8215 8215
 		}
8216 8216
 
@@ -8232,7 +8232,7 @@  discard block
 block discarded – undo
8232 8232
 	 */
8233 8233
 	public function __isset($name)
8234 8234
 	{
8235
-		if (method_exists($this, 'get_' . $name) || isset($this->$name))
8235
+		if (method_exists($this, 'get_'.$name) || isset($this->$name))
8236 8236
 		{
8237 8237
 			return true;
8238 8238
 		}
@@ -8249,9 +8249,9 @@  discard block
 block discarded – undo
8249 8249
 	 */
8250 8250
 	public function __unset($name)
8251 8251
 	{
8252
-		if (method_exists($this, 'set_' . $name))
8252
+		if (method_exists($this, 'set_'.$name))
8253 8253
 		{
8254
-			call_user_func(array($this, 'set_' . $name), '');
8254
+			call_user_func(array($this, 'set_'.$name), '');
8255 8255
 		}
8256 8256
 	}
8257 8257
 
@@ -8327,11 +8327,11 @@  discard block
 block discarded – undo
8327 8327
 							}
8328 8328
 							elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '')
8329 8329
 							{
8330
-								$target->ipath = '/' . $relative->ipath;
8330
+								$target->ipath = '/'.$relative->ipath;
8331 8331
 							}
8332 8332
 							elseif (($last_segment = strrpos($base->ipath, '/')) !== false)
8333 8333
 							{
8334
-								$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
8334
+								$target->ipath = substr($base->ipath, 0, $last_segment + 1).$relative->ipath;
8335 8335
 							}
8336 8336
 							else
8337 8337
 							{
@@ -8467,7 +8467,7 @@  discard block
 block discarded – undo
8467 8467
 				$input = '';
8468 8468
 			}
8469 8469
 		}
8470
-		return $output . $input;
8470
+		return $output.$input;
8471 8471
 	}
8472 8472
 
8473 8473
 	/**
@@ -8506,23 +8506,23 @@  discard block
 block discarded – undo
8506 8506
 
8507 8507
 			// No one byte sequences are valid due to the while.
8508 8508
 			// Two byte sequence:
8509
-			if (($value & 0xE0) === 0xC0)
8509
+			if (($value&0xE0) === 0xC0)
8510 8510
 			{
8511
-				$character = ($value & 0x1F) << 6;
8511
+				$character = ($value&0x1F) << 6;
8512 8512
 				$length = 2;
8513 8513
 				$remaining = 1;
8514 8514
 			}
8515 8515
 			// Three byte sequence:
8516
-			elseif (($value & 0xF0) === 0xE0)
8516
+			elseif (($value&0xF0) === 0xE0)
8517 8517
 			{
8518
-				$character = ($value & 0x0F) << 12;
8518
+				$character = ($value&0x0F) << 12;
8519 8519
 				$length = 3;
8520 8520
 				$remaining = 2;
8521 8521
 			}
8522 8522
 			// Four byte sequence:
8523
-			elseif (($value & 0xF8) === 0xF0)
8523
+			elseif (($value&0xF8) === 0xF0)
8524 8524
 			{
8525
-				$character = ($value & 0x07) << 18;
8525
+				$character = ($value&0x07) << 18;
8526 8526
 				$length = 4;
8527 8527
 				$remaining = 3;
8528 8528
 			}
@@ -8543,9 +8543,9 @@  discard block
 block discarded – undo
8543 8543
 						$value = ord($string[$position]);
8544 8544
 
8545 8545
 						// Check that the byte is valid, then add it to the character:
8546
-						if (($value & 0xC0) === 0x80)
8546
+						if (($value&0xC0) === 0x80)
8547 8547
 						{
8548
-							$character |= ($value & 0x3F) << (--$remaining * 6);
8548
+							$character |= ($value&0x3F) << (--$remaining*6);
8549 8549
 						}
8550 8550
 						// If it is invalid, count the sequence as invalid and reprocess the current byte:
8551 8551
 						else
@@ -8573,7 +8573,7 @@  discard block
 block discarded – undo
8573 8573
 				|| $length > 3 && $character <= 0xFFFF
8574 8574
 				// Outside of range of ucschar codepoints
8575 8575
 				// Noncharacters
8576
-				|| ($character & 0xFFFE) === 0xFFFE
8576
+				|| ($character&0xFFFE) === 0xFFFE
8577 8577
 				|| $character >= 0xFDD0 && $character <= 0xFDEF
8578 8578
 				|| (
8579 8579
 					// Everything else not in ucschar
@@ -8648,23 +8648,23 @@  discard block
 block discarded – undo
8648 8648
 					$length = 1;
8649 8649
 				}
8650 8650
 				// Two byte sequence:
8651
-				elseif (($value & 0xE0) === 0xC0)
8651
+				elseif (($value&0xE0) === 0xC0)
8652 8652
 				{
8653
-					$character = ($value & 0x1F) << 6;
8653
+					$character = ($value&0x1F) << 6;
8654 8654
 					$length = 2;
8655 8655
 					$remaining = 1;
8656 8656
 				}
8657 8657
 				// Three byte sequence:
8658
-				elseif (($value & 0xF0) === 0xE0)
8658
+				elseif (($value&0xF0) === 0xE0)
8659 8659
 				{
8660
-					$character = ($value & 0x0F) << 12;
8660
+					$character = ($value&0x0F) << 12;
8661 8661
 					$length = 3;
8662 8662
 					$remaining = 2;
8663 8663
 				}
8664 8664
 				// Four byte sequence:
8665
-				elseif (($value & 0xF8) === 0xF0)
8665
+				elseif (($value&0xF8) === 0xF0)
8666 8666
 				{
8667
-					$character = ($value & 0x07) << 18;
8667
+					$character = ($value&0x07) << 18;
8668 8668
 					$length = 4;
8669 8669
 					$remaining = 3;
8670 8670
 				}
@@ -8679,10 +8679,10 @@  discard block
 block discarded – undo
8679 8679
 			else
8680 8680
 			{
8681 8681
 				// Check that the byte is valid, then add it to the character:
8682
-				if (($value & 0xC0) === 0x80)
8682
+				if (($value&0xC0) === 0x80)
8683 8683
 				{
8684 8684
 					$remaining--;
8685
-					$character |= ($value & 0x3F) << ($remaining * 6);
8685
+					$character |= ($value&0x3F) << ($remaining*6);
8686 8686
 				}
8687 8687
 				// If it is invalid, count the sequence as invalid and reprocess the current byte as the start of a sequence:
8688 8688
 				else
@@ -8708,7 +8708,7 @@  discard block
 block discarded – undo
8708 8708
 					|| $character < 0x2D
8709 8709
 					|| $character > 0xEFFFD
8710 8710
 					// Noncharacters
8711
-					|| ($character & 0xFFFE) === 0xFFFE
8711
+					|| ($character&0xFFFE) === 0xFFFE
8712 8712
 					|| $character >= 0xFDD0 && $character <= 0xFDEF
8713 8713
 					// Everything else not in iunreserved (this is all BMP)
8714 8714
 					|| $character === 0x2F
@@ -8721,7 +8721,7 @@  discard block
 block discarded – undo
8721 8721
 				{
8722 8722
 					for ($j = $start; $j <= $i; $j++)
8723 8723
 					{
8724
-						$string .= '%' . strtoupper($bytes[$j]);
8724
+						$string .= '%'.strtoupper($bytes[$j]);
8725 8725
 					}
8726 8726
 				}
8727 8727
 				else
@@ -8740,7 +8740,7 @@  discard block
 block discarded – undo
8740 8740
 		{
8741 8741
 			for ($j = $start; $j < $len; $j++)
8742 8742
 			{
8743
-				$string .= '%' . strtoupper($bytes[$j]);
8743
+				$string .= '%'.strtoupper($bytes[$j]);
8744 8744
 			}
8745 8745
 		}
8746 8746
 
@@ -8999,7 +8999,7 @@  discard block
 block discarded – undo
8999 8999
 		{
9000 9000
 			if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1)))
9001 9001
 			{
9002
-				$this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']';
9002
+				$this->ihost = '['.SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)).']';
9003 9003
 			}
9004 9004
 			else
9005 9005
 			{
@@ -9095,7 +9095,7 @@  discard block
 block discarded – undo
9095 9095
 			$removed = $this->remove_dot_segments($valid);
9096 9096
 
9097 9097
 			$cache[$ipath] = array($valid, $removed);
9098
-			$this->ipath =  ($this->scheme !== null) ? $removed : $valid;
9098
+			$this->ipath = ($this->scheme !== null) ? $removed : $valid;
9099 9099
 		}
9100 9100
 
9101 9101
 		$this->scheme_normalization();
@@ -9182,11 +9182,11 @@  discard block
 block discarded – undo
9182 9182
 		$iri = '';
9183 9183
 		if ($this->scheme !== null)
9184 9184
 		{
9185
-			$iri .= $this->scheme . ':';
9185
+			$iri .= $this->scheme.':';
9186 9186
 		}
9187 9187
 		if (($iauthority = $this->get_iauthority()) !== null)
9188 9188
 		{
9189
-			$iri .= '//' . $iauthority;
9189
+			$iri .= '//'.$iauthority;
9190 9190
 		}
9191 9191
 		if ($this->ipath !== '')
9192 9192
 		{
@@ -9198,11 +9198,11 @@  discard block
 block discarded – undo
9198 9198
 		}
9199 9199
 		if ($this->iquery !== null)
9200 9200
 		{
9201
-			$iri .= '?' . $this->iquery;
9201
+			$iri .= '?'.$this->iquery;
9202 9202
 		}
9203 9203
 		if ($this->ifragment !== null)
9204 9204
 		{
9205
-			$iri .= '#' . $this->ifragment;
9205
+			$iri .= '#'.$this->ifragment;
9206 9206
 		}
9207 9207
 
9208 9208
 		return $iri;
@@ -9230,7 +9230,7 @@  discard block
 block discarded – undo
9230 9230
 			$iauthority = '';
9231 9231
 			if ($this->iuserinfo !== null)
9232 9232
 			{
9233
-				$iauthority .= $this->iuserinfo . '@';
9233
+				$iauthority .= $this->iuserinfo.'@';
9234 9234
 			}
9235 9235
 			if ($this->ihost !== null)
9236 9236
 			{
@@ -9238,7 +9238,7 @@  discard block
 block discarded – undo
9238 9238
 			}
9239 9239
 			if ($this->port !== null)
9240 9240
 			{
9241
-				$iauthority .= ':' . $this->port;
9241
+				$iauthority .= ':'.$this->port;
9242 9242
 			}
9243 9243
 			return $iauthority;
9244 9244
 		}
@@ -10273,19 +10273,19 @@  discard block
 block discarded – undo
10273 10273
 			{
10274 10274
 				if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
10275 10275
 				{
10276
-					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
10276
+					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]))
10277 10277
 					{
10278
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
10279
-						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
10278
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]);
10279
+						$this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key];
10280 10280
 					}
10281 10281
 					else
10282 10282
 					{
10283
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
10283
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key];
10284 10284
 					}
10285 10285
 				}
10286 10286
 				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
10287 10287
 				{
10288
-					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
10288
+					$this->data['links'][substr($key, 41)] = & $this->data['links'][$key];
10289 10289
 				}
10290 10290
 				$this->data['links'][$key] = array_unique($this->data['links'][$key]);
10291 10291
 			}
@@ -10626,12 +10626,12 @@  discard block
 block discarded – undo
10626 10626
 					if (sizeof($temp) > 0)
10627 10627
 					{
10628 10628
 						$minutes = (int) array_pop($temp);
10629
-						$seconds += $minutes * 60;
10629
+						$seconds += $minutes*60;
10630 10630
 					}
10631 10631
 					if (sizeof($temp) > 0)
10632 10632
 					{
10633 10633
 						$hours = (int) array_pop($temp);
10634
-						$seconds += $hours * 3600;
10634
+						$seconds += $hours*3600;
10635 10635
 					}
10636 10636
 					unset($temp);
10637 10637
 					$duration_parent = $seconds;
@@ -10986,7 +10986,7 @@  discard block
 block discarded – undo
10986 10986
 			// If we have media:group tags, loop through them.
10987 10987
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group)
10988 10988
 			{
10989
-				if(isset($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']))
10989
+				if (isset($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']))
10990 10990
 				{
10991 10991
 					// If we have media:content tags, loop through them.
10992 10992
 					foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
@@ -12284,7 +12284,7 @@  discard block
 block discarded – undo
12284 12284
 			return $this->file;
12285 12285
 		}
12286 12286
 
12287
-		if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
12287
+		if ($this->file->method&SIMPLEPIE_FILE_SOURCE_REMOTE)
12288 12288
 		{
12289 12289
 			$sniffer = $this->registry->create('Content_Type_Sniffer', array($this->file));
12290 12290
 			if ($sniffer->get_type() !== 'text/html')
@@ -12293,34 +12293,34 @@  discard block
 block discarded – undo
12293 12293
 			}
12294 12294
 		}
12295 12295
 
12296
-		if ($type & ~SIMPLEPIE_LOCATOR_NONE)
12296
+		if ($type&~SIMPLEPIE_LOCATOR_NONE)
12297 12297
 		{
12298 12298
 			$this->get_base();
12299 12299
 		}
12300 12300
 
12301
-		if ($type & SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery())
12301
+		if ($type&SIMPLEPIE_LOCATOR_AUTODISCOVERY && $working = $this->autodiscovery())
12302 12302
 		{
12303 12303
 			return $working[0];
12304 12304
 		}
12305 12305
 
12306
-		if ($type & (SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY | SIMPLEPIE_LOCATOR_REMOTE_EXTENSION | SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links())
12306
+		if ($type&(SIMPLEPIE_LOCATOR_LOCAL_EXTENSION|SIMPLEPIE_LOCATOR_LOCAL_BODY|SIMPLEPIE_LOCATOR_REMOTE_EXTENSION|SIMPLEPIE_LOCATOR_REMOTE_BODY) && $this->get_links())
12307 12307
 		{
12308
-			if ($type & SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local))
12308
+			if ($type&SIMPLEPIE_LOCATOR_LOCAL_EXTENSION && $working = $this->extension($this->local))
12309 12309
 			{
12310 12310
 				return $working[0];
12311 12311
 			}
12312 12312
 
12313
-			if ($type & SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local))
12313
+			if ($type&SIMPLEPIE_LOCATOR_LOCAL_BODY && $working = $this->body($this->local))
12314 12314
 			{
12315 12315
 				return $working[0];
12316 12316
 			}
12317 12317
 
12318
-			if ($type & SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere))
12318
+			if ($type&SIMPLEPIE_LOCATOR_REMOTE_EXTENSION && $working = $this->extension($this->elsewhere))
12319 12319
 			{
12320 12320
 				return $working[0];
12321 12321
 			}
12322 12322
 
12323
-			if ($type & SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere))
12323
+			if ($type&SIMPLEPIE_LOCATOR_REMOTE_BODY && $working = $this->body($this->elsewhere))
12324 12324
 			{
12325 12325
 				return $working[0];
12326 12326
 			}
@@ -12330,7 +12330,7 @@  discard block
 block discarded – undo
12330 12330
 
12331 12331
 	public function is_feed($file, $check_html = false)
12332 12332
 	{
12333
-		if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
12333
+		if ($file->method&SIMPLEPIE_FILE_SOURCE_REMOTE)
12334 12334
 		{
12335 12335
 			$sniffer = $this->registry->create('Content_Type_Sniffer', array($file));
12336 12336
 			$sniffed = $sniffer->get_type();
@@ -12350,7 +12350,7 @@  discard block
 block discarded – undo
12350 12350
 				return false;
12351 12351
 			}
12352 12352
 		}
12353
-		elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL)
12353
+		elseif ($file->method&SIMPLEPIE_FILE_SOURCE_LOCAL)
12354 12354
 		{
12355 12355
 			return true;
12356 12356
 		}
@@ -12442,7 +12442,7 @@  discard block
 block discarded – undo
12442 12442
 						'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
12443 12443
 					);
12444 12444
 					$feed = $this->registry->create('File', array($href, $this->timeout, 5, $headers, $this->useragent));
12445
-					if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed, true))
12445
+					if ($feed->success && ($feed->method&SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed, true))
12446 12446
 					{
12447 12447
 						$feeds[$href] = $feed;
12448 12448
 					}
@@ -12572,7 +12572,7 @@  discard block
 block discarded – undo
12572 12572
 					'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
12573 12573
 				);
12574 12574
 				$feed = $this->registry->create('File', array($value, $this->timeout, 5, $headers, $this->useragent));
12575
-				if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
12575
+				if ($feed->success && ($feed->method&SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
12576 12576
 				{
12577 12577
 					return array($feed);
12578 12578
 				}
@@ -12600,7 +12600,7 @@  discard block
 block discarded – undo
12600 12600
 					'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
12601 12601
 				);
12602 12602
 				$feed = $this->registry->create('File', array($value, $this->timeout, 5, null, $this->useragent));
12603
-				if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
12603
+				if ($feed->success && ($feed->method&SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
12604 12604
 				{
12605 12605
 					return array($feed);
12606 12606
 				}
@@ -12625,22 +12625,22 @@  discard block
 block discarded – undo
12625 12625
 	{
12626 12626
 		$time = '';
12627 12627
 
12628
-		$hours = floor($seconds / 3600);
12629
-		$remainder = $seconds % 3600;
12628
+		$hours = floor($seconds/3600);
12629
+		$remainder = $seconds%3600;
12630 12630
 		if ($hours > 0)
12631 12631
 		{
12632 12632
 			$time .= $hours.':';
12633 12633
 		}
12634 12634
 
12635
-		$minutes = floor($remainder / 60);
12636
-		$seconds = $remainder % 60;
12635
+		$minutes = floor($remainder/60);
12636
+		$seconds = $remainder%60;
12637 12637
 		if ($minutes < 10 && $hours > 0)
12638 12638
 		{
12639
-			$minutes = '0' . $minutes;
12639
+			$minutes = '0'.$minutes;
12640 12640
 		}
12641 12641
 		if ($seconds < 10)
12642 12642
 		{
12643
-			$seconds = '0' . $seconds;
12643
+			$seconds = '0'.$seconds;
12644 12644
 		}
12645 12645
 
12646 12646
 		$time .= $minutes.':';
@@ -12671,7 +12671,7 @@  discard block
 block discarded – undo
12671 12671
 	{
12672 12672
 		$return = array();
12673 12673
 		$name = preg_quote($realname, '/');
12674
-		if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
12674
+		if (preg_match_all("/<($name)".SIMPLEPIE_PCRE_HTML_ATTRIBUTE."(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE))
12675 12675
 		{
12676 12676
 			for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++)
12677 12677
 			{
@@ -12688,7 +12688,7 @@  discard block
 block discarded – undo
12688 12688
 					$return[$i]['content'] = $matches[$i][4][0];
12689 12689
 				}
12690 12690
 				$return[$i]['attribs'] = array();
12691
-				if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER))
12691
+				if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' '.$matches[$i][2][0].' ', $attribs, PREG_SET_ORDER))
12692 12692
 				{
12693 12693
 					for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
12694 12694
 					{
@@ -12710,7 +12710,7 @@  discard block
 block discarded – undo
12710 12710
 		foreach ($element['attribs'] as $key => $value)
12711 12711
 		{
12712 12712
 			$key = strtolower($key);
12713
-			$full .= " $key=\"" . htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8') . '"';
12713
+			$full .= " $key=\"".htmlspecialchars($value['data'], ENT_COMPAT, 'UTF-8').'"';
12714 12714
 		}
12715 12715
 		if ($element['self_closing'])
12716 12716
 		{
@@ -12725,7 +12725,7 @@  discard block
 block discarded – undo
12725 12725
 
12726 12726
 	public static function error($message, $level, $file, $line)
12727 12727
 	{
12728
-		if ((ini_get('error_reporting') & $level) > 0)
12728
+		if ((ini_get('error_reporting')&$level) > 0)
12729 12729
 		{
12730 12730
 			switch ($level)
12731 12731
 			{
@@ -14343,7 +14343,7 @@  discard block
 block discarded – undo
14343 14343
 				$data = '';
14344 14344
 			}
14345 14345
 		}
14346
-		return $output . $data;
14346
+		return $output.$data;
14347 14347
 	}
14348 14348
 
14349 14349
 	public static function parse_date($dt)
@@ -14453,23 +14453,23 @@  discard block
 block discarded – undo
14453 14453
 			{
14454 14454
 				case 'text':
14455 14455
 				case 'text/plain':
14456
-					return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
14456
+					return SIMPLEPIE_CONSTRUCT_TEXT|$mode;
14457 14457
 
14458 14458
 				case 'html':
14459 14459
 				case 'text/html':
14460
-					return SIMPLEPIE_CONSTRUCT_HTML | $mode;
14460
+					return SIMPLEPIE_CONSTRUCT_HTML|$mode;
14461 14461
 
14462 14462
 				case 'xhtml':
14463 14463
 				case 'application/xhtml+xml':
14464
-					return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
14464
+					return SIMPLEPIE_CONSTRUCT_XHTML|$mode;
14465 14465
 
14466 14466
 				default:
14467
-					return SIMPLEPIE_CONSTRUCT_NONE | $mode;
14467
+					return SIMPLEPIE_CONSTRUCT_NONE|$mode;
14468 14468
 			}
14469 14469
 		}
14470 14470
 		else
14471 14471
 		{
14472
-			return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
14472
+			return SIMPLEPIE_CONSTRUCT_TEXT|$mode;
14473 14473
 		}
14474 14474
 	}
14475 14475
 
@@ -14570,15 +14570,15 @@  discard block
 block discarded – undo
14570 14570
 		}
14571 14571
 		else if ($codepoint <= 0x7ff)
14572 14572
 		{
14573
-			return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
14573
+			return chr(0xc0|($codepoint >> 6)).chr(0x80|($codepoint&0x3f));
14574 14574
 		}
14575 14575
 		else if ($codepoint <= 0xffff)
14576 14576
 		{
14577
-			return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
14577
+			return chr(0xe0|($codepoint >> 12)).chr(0x80|(($codepoint >> 6)&0x3f)).chr(0x80|($codepoint&0x3f));
14578 14578
 		}
14579 14579
 		else if ($codepoint <= 0x10ffff)
14580 14580
 		{
14581
-			return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
14581
+			return chr(0xf0|($codepoint >> 18)).chr(0x80|(($codepoint >> 12)&0x3f)).chr(0x80|(($codepoint >> 6)&0x3f)).chr(0x80|($codepoint&0x3f));
14582 14582
 		}
14583 14583
 		else
14584 14584
 		{
@@ -14734,7 +14734,7 @@  discard block
 block discarded – undo
14734 14734
 		}
14735 14735
 		header('Content-type: text/javascript; charset: UTF-8');
14736 14736
 		header('Cache-Control: must-revalidate');
14737
-		header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
14737
+		header('Expires: '.gmdate('D, d M Y H:i:s', time() + 604800).' GMT'); // 7 days
14738 14738
 		?>
14739 14739
 function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
14740 14740
 	if (placeholder != '') {
@@ -14768,14 +14768,14 @@  discard block
 block discarded – undo
14768 14768
 	public static function get_build()
14769 14769
 	{
14770 14770
 		$root = dirname(dirname(__FILE__));
14771
-		if (file_exists($root . '/.git/index'))
14771
+		if (file_exists($root.'/.git/index'))
14772 14772
 		{
14773
-			return filemtime($root . '/.git/index');
14773
+			return filemtime($root.'/.git/index');
14774 14774
 		}
14775
-		elseif (file_exists($root . '/SimplePie'))
14775
+		elseif (file_exists($root.'/SimplePie'))
14776 14776
 		{
14777 14777
 			$time = 0;
14778
-			foreach (glob($root . '/SimplePie/*.php') as $file)
14778
+			foreach (glob($root.'/SimplePie/*.php') as $file)
14779 14779
 			{
14780 14780
 				if (($mtime = filemtime($file)) > $time)
14781 14781
 				{
@@ -14784,9 +14784,9 @@  discard block
 block discarded – undo
14784 14784
 			}
14785 14785
 			return $time;
14786 14786
 		}
14787
-		elseif (file_exists(dirname(__FILE__) . '/Core.php'))
14787
+		elseif (file_exists(dirname(__FILE__).'/Core.php'))
14788 14788
 		{
14789
-			return filemtime(dirname(__FILE__) . '/Core.php');
14789
+			return filemtime(dirname(__FILE__).'/Core.php');
14790 14790
 		}
14791 14791
 		else
14792 14792
 		{
@@ -14799,11 +14799,11 @@  discard block
 block discarded – undo
14799 14799
 	 */
14800 14800
 	public static function debug(&$sp)
14801 14801
 	{
14802
-		$info = 'SimplePie ' . SIMPLEPIE_VERSION . ' Build ' . SIMPLEPIE_BUILD . "\n";
14803
-		$info .= 'PHP ' . PHP_VERSION . "\n";
14802
+		$info = 'SimplePie '.SIMPLEPIE_VERSION.' Build '.SIMPLEPIE_BUILD."\n";
14803
+		$info .= 'PHP '.PHP_VERSION."\n";
14804 14804
 		if ($sp->error() !== null)
14805 14805
 		{
14806
-			$info .= 'Error occurred: ' . $sp->error() . "\n";
14806
+			$info .= 'Error occurred: '.$sp->error()."\n";
14807 14807
 		}
14808 14808
 		else
14809 14809
 		{
@@ -14819,20 +14819,20 @@  discard block
 block discarded – undo
14819 14819
 				switch ($ext)
14820 14820
 				{
14821 14821
 					case 'pcre':
14822
-						$info .= '      Version ' . PCRE_VERSION . "\n";
14822
+						$info .= '      Version '.PCRE_VERSION."\n";
14823 14823
 						break;
14824 14824
 					case 'curl':
14825 14825
 						$version = curl_version();
14826
-						$info .= '      Version ' . $version['version'] . "\n";
14826
+						$info .= '      Version '.$version['version']."\n";
14827 14827
 						break;
14828 14828
 					case 'mbstring':
14829
-						$info .= '      Overloading: ' . mb_get_info('func_overload') . "\n";
14829
+						$info .= '      Overloading: '.mb_get_info('func_overload')."\n";
14830 14830
 						break;
14831 14831
 					case 'iconv':
14832
-						$info .= '      Version ' . ICONV_VERSION . "\n";
14832
+						$info .= '      Version '.ICONV_VERSION."\n";
14833 14833
 						break;
14834 14834
 					case 'xml':
14835
-						$info .= '      Version ' . LIBXML_DOTTED_VERSION . "\n";
14835
+						$info .= '      Version '.LIBXML_DOTTED_VERSION."\n";
14836 14836
 						break;
14837 14837
 				}
14838 14838
 			}
@@ -14930,7 +14930,7 @@  discard block
 block discarded – undo
14930 14930
 			// xxx::xxx
14931 14931
 			else
14932 14932
 			{
14933
-				$fill = ':' . str_repeat('0:', 6 - $c2 - $c1);
14933
+				$fill = ':'.str_repeat('0:', 6 - $c2 - $c1);
14934 14934
 				$ip = str_replace('::', $fill, $ip);
14935 14935
 			}
14936 14936
 		}
@@ -15581,8 +15581,8 @@  discard block
 block discarded – undo
15581 15581
 	 */
15582 15582
 	public function __construct()
15583 15583
 	{
15584
-		$this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')';
15585
-		$this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')';
15584
+		$this->day_pcre = '('.implode(array_keys($this->day), '|').')';
15585
+		$this->month_pcre = '('.implode(array_keys($this->month), '|').')';
15586 15586
 
15587 15587
 		static $cache;
15588 15588
 		if (!isset($cache[get_class($this)]))
@@ -15684,7 +15684,7 @@  discard block
 block discarded – undo
15684 15684
 			$month = $day = $hour = $minute = $second = '([0-9]{2})';
15685 15685
 			$decimal = '([0-9]*)';
15686 15686
 			$zone = '(?:(Z)|([+\-])([0-9]{1,2}):?([0-9]{1,2}))';
15687
-			$pcre = '/^' . $year . '(?:-?' . $month . '(?:-?' . $day . '(?:[Tt\x09\x20]+' . $hour . '(?::?' . $minute . '(?::?' . $second . '(?:.' . $decimal . ')?)?)?' . $zone . ')?)?)?$/';
15687
+			$pcre = '/^'.$year.'(?:-?'.$month.'(?:-?'.$day.'(?:[Tt\x09\x20]+'.$hour.'(?::?'.$minute.'(?::?'.$second.'(?:.'.$decimal.')?)?)?'.$zone.')?)?)?$/';
15688 15688
 		}
15689 15689
 		if (preg_match($pcre, $date, $match))
15690 15690
 		{
@@ -15717,8 +15717,8 @@  discard block
 block discarded – undo
15717 15717
 			// Numeric timezone
15718 15718
 			if (isset($match[9]) && $match[9] !== '')
15719 15719
 			{
15720
-				$timezone = $match[10] * 3600;
15721
-				$timezone += $match[11] * 60;
15720
+				$timezone = $match[10]*3600;
15721
+				$timezone += $match[11]*60;
15722 15722
 				if ($match[9] === '-')
15723 15723
 				{
15724 15724
 					$timezone = 0 - $timezone;
@@ -15730,7 +15730,7 @@  discard block
 block discarded – undo
15730 15730
 			}
15731 15731
 
15732 15732
 			// Convert the number of seconds to an integer, taking decimals into account
15733
-			$second = round((int)$match[6] + (int)$match[7] / pow(10, strlen($match[7])));
15733
+			$second = round((int) $match[6] + (int) $match[7]/pow(10, strlen($match[7])));
15734 15734
 
15735 15735
 			return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
15736 15736
 		}
@@ -15813,8 +15813,8 @@  discard block
 block discarded – undo
15813 15813
 		if (!$pcre)
15814 15814
 		{
15815 15815
 			$wsp = '[\x09\x20]';
15816
-			$fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
15817
-			$optional_fws = $fws . '?';
15816
+			$fws = '(?:'.$wsp.'+|'.$wsp.'*(?:\x0D\x0A'.$wsp.'+)+)';
15817
+			$optional_fws = $fws.'?';
15818 15818
 			$day_name = $this->day_pcre;
15819 15819
 			$month = $this->month_pcre;
15820 15820
 			$day = '([0-9]{1,2})';
@@ -15822,8 +15822,8 @@  discard block
 block discarded – undo
15822 15822
 			$year = '([0-9]{2,4})';
15823 15823
 			$num_zone = '([+\-])([0-9]{2})([0-9]{2})';
15824 15824
 			$character_zone = '([A-Z]{1,5})';
15825
-			$zone = '(?:' . $num_zone . '|' . $character_zone . ')';
15826
-			$pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i';
15825
+			$zone = '(?:'.$num_zone.'|'.$character_zone.')';
15826
+			$pcre = '/(?:'.$optional_fws.$day_name.$optional_fws.',)?'.$optional_fws.$day.$fws.$month.$fws.$year.$fws.$hour.$optional_fws.':'.$optional_fws.$minute.'(?:'.$optional_fws.':'.$optional_fws.$second.')?'.$fws.$zone.'/i';
15827 15827
 		}
15828 15828
 		if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
15829 15829
 		{
@@ -15848,8 +15848,8 @@  discard block
 block discarded – undo
15848 15848
 			// Numeric timezone
15849 15849
 			if ($match[8] !== '')
15850 15850
 			{
15851
-				$timezone = $match[9] * 3600;
15852
-				$timezone += $match[10] * 60;
15851
+				$timezone = $match[9]*3600;
15852
+				$timezone += $match[10]*60;
15853 15853
 				if ($match[8] === '-')
15854 15854
 				{
15855 15855
 					$timezone = 0 - $timezone;
@@ -15911,7 +15911,7 @@  discard block
 block discarded – undo
15911 15911
 			$day = '([0-9]{1,2})';
15912 15912
 			$year = $hour = $minute = $second = '([0-9]{2})';
15913 15913
 			$zone = '([A-Z]{1,5})';
15914
-			$pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i';
15914
+			$pcre = '/^'.$day_name.','.$space.$day.'-'.$month.'-'.$year.$space.$hour.':'.$minute.':'.$second.$space.$zone.'$/i';
15915 15915
 		}
15916 15916
 		if (preg_match($pcre, $date, $match))
15917 15917
 		{
@@ -15977,7 +15977,7 @@  discard block
 block discarded – undo
15977 15977
 			$hour = $sec = $min = '([0-9]{2})';
15978 15978
 			$year = '([0-9]{4})';
15979 15979
 			$terminator = '\x0A?\x00?';
15980
-			$pcre = '/^' . $wday_name . $space . $mon_name . $space . $day . $space . $hour . ':' . $min . ':' . $sec . $space . $year . $terminator . '$/i';
15980
+			$pcre = '/^'.$wday_name.$space.$mon_name.$space.$day.$space.$hour.':'.$min.':'.$sec.$space.$year.$terminator.'$/i';
15981 15981
 		}
15982 15982
 		if (preg_match($pcre, $date, $match))
15983 15983
 		{
@@ -16113,7 +16113,7 @@  discard block
 block discarded – undo
16113 16113
 			if ($declaration->parse())
16114 16114
 			{
16115 16115
 				$data = substr($data, $pos + 2);
16116
-				$data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' ."\n". $this->declare_html_entities() . $data;
16116
+				$data = '<?xml version="'.$declaration->version.'" encoding="'.$encoding.'" standalone="'.(($declaration->standalone) ? 'yes' : 'no').'"?>'."\n".$this->declare_html_entities().$data;
16117 16117
 			}
16118 16118
 			else
16119 16119
 			{
@@ -16169,7 +16169,7 @@  discard block
 block discarded – undo
16169 16169
 					case constant('XMLReader::END_ELEMENT'):
16170 16170
 						if ($xml->namespaceURI !== '')
16171 16171
 						{
16172
-							$tagName = $xml->namespaceURI . $this->separator . $xml->localName;
16172
+							$tagName = $xml->namespaceURI.$this->separator.$xml->localName;
16173 16173
 						}
16174 16174
 						else
16175 16175
 						{
@@ -16181,7 +16181,7 @@  discard block
 block discarded – undo
16181 16181
 						$empty = $xml->isEmptyElement;
16182 16182
 						if ($xml->namespaceURI !== '')
16183 16183
 						{
16184
-							$tagName = $xml->namespaceURI . $this->separator . $xml->localName;
16184
+							$tagName = $xml->namespaceURI.$this->separator.$xml->localName;
16185 16185
 						}
16186 16186
 						else
16187 16187
 						{
@@ -16192,7 +16192,7 @@  discard block
 block discarded – undo
16192 16192
 						{
16193 16193
 							if ($xml->namespaceURI !== '')
16194 16194
 							{
16195
-								$attrName = $xml->namespaceURI . $this->separator . $xml->localName;
16195
+								$attrName = $xml->namespaceURI.$this->separator.$xml->localName;
16196 16196
 							}
16197 16197
 							else
16198 16198
 							{
@@ -16298,12 +16298,12 @@  discard block
 block discarded – undo
16298 16298
 			$this->current_xhtml_construct++;
16299 16299
 			if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML)
16300 16300
 			{
16301
-				$this->data['data'] .= '<' . end($this->element);
16301
+				$this->data['data'] .= '<'.end($this->element);
16302 16302
 				if (isset($attribs['']))
16303 16303
 				{
16304 16304
 					foreach ($attribs[''] as $name => $value)
16305 16305
 					{
16306
-						$this->data['data'] .= ' ' . $name . '="' . htmlspecialchars($value, ENT_COMPAT, $this->encoding) . '"';
16306
+						$this->data['data'] .= ' '.$name.'="'.htmlspecialchars($value, ENT_COMPAT, $this->encoding).'"';
16307 16307
 					}
16308 16308
 				}
16309 16309
 				$this->data['data'] .= '>';
@@ -16311,8 +16311,8 @@  discard block
 block discarded – undo
16311 16311
 		}
16312 16312
 		else
16313 16313
 		{
16314
-			$this->datas[] =& $this->data;
16315
-			$this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
16314
+			$this->datas[] = & $this->data;
16315
+			$this->data = & $this->data['child'][end($this->namespace)][end($this->element)][];
16316 16316
 			$this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang));
16317 16317
 			if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml')
16318 16318
 			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml')
@@ -16344,12 +16344,12 @@  discard block
 block discarded – undo
16344 16344
 			$this->current_xhtml_construct--;
16345 16345
 			if (end($this->namespace) === SIMPLEPIE_NAMESPACE_XHTML && !in_array(end($this->element), array('area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param')))
16346 16346
 			{
16347
-				$this->data['data'] .= '</' . end($this->element) . '>';
16347
+				$this->data['data'] .= '</'.end($this->element).'>';
16348 16348
 			}
16349 16349
 		}
16350 16350
 		if ($this->current_xhtml_construct === -1)
16351 16351
 		{
16352
-			$this->data =& $this->datas[count($this->datas) - 1];
16352
+			$this->data = & $this->datas[count($this->datas) - 1];
16353 16353
 			array_pop($this->datas);
16354 16354
 		}
16355 16355
 
@@ -16384,7 +16384,7 @@  discard block
 block discarded – undo
16384 16384
 					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2 ||
16385 16385
 					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3 ||
16386 16386
 					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4 ||
16387
-					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5 )
16387
+					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5)
16388 16388
 				{
16389 16389
 					$namespace = SIMPLEPIE_NAMESPACE_MEDIARSS;
16390 16390
 				}
@@ -17227,11 +17227,11 @@  discard block
 block discarded – undo
17227 17227
 	public function sanitize($data, $type, $base = '')
17228 17228
 	{
17229 17229
 		$data = trim($data);
17230
-		if ($data !== '' || $type & SIMPLEPIE_CONSTRUCT_IRI)
17230
+		if ($data !== '' || $type&SIMPLEPIE_CONSTRUCT_IRI)
17231 17231
 		{
17232
-			if ($type & SIMPLEPIE_CONSTRUCT_MAYBE_HTML)
17232
+			if ($type&SIMPLEPIE_CONSTRUCT_MAYBE_HTML)
17233 17233
 			{
17234
-				if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
17234
+				if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*'.SIMPLEPIE_PCRE_HTML_ATTRIBUTE.'>)/', $data))
17235 17235
 				{
17236 17236
 					$type |= SIMPLEPIE_CONSTRUCT_HTML;
17237 17237
 				}
@@ -17241,12 +17241,12 @@  discard block
 block discarded – undo
17241 17241
 				}
17242 17242
 			}
17243 17243
 
17244
-			if ($type & SIMPLEPIE_CONSTRUCT_BASE64)
17244
+			if ($type&SIMPLEPIE_CONSTRUCT_BASE64)
17245 17245
 			{
17246 17246
 				$data = base64_decode($data);
17247 17247
 			}
17248 17248
 
17249
-			if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML))
17249
+			if ($type&(SIMPLEPIE_CONSTRUCT_HTML|SIMPLEPIE_CONSTRUCT_XHTML))
17250 17250
 			{
17251 17251
 
17252 17252
 				if (!class_exists('DOMDocument'))
@@ -17322,18 +17322,18 @@  discard block
 block discarded – undo
17322 17322
 
17323 17323
 							if ($cache->load())
17324 17324
 							{
17325
-								$img->setAttribute('src', $this->image_handler . $image_url);
17325
+								$img->setAttribute('src', $this->image_handler.$image_url);
17326 17326
 							}
17327 17327
 							else
17328 17328
 							{
17329 17329
 								$file = $this->registry->create('File', array($img->getAttribute('src'), $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen));
17330 17330
 								$headers = $file->headers;
17331 17331
 
17332
-								if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
17332
+								if ($file->success && ($file->method&SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
17333 17333
 								{
17334 17334
 									if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
17335 17335
 									{
17336
-										$img->setAttribute('src', $this->image_handler . $image_url);
17336
+										$img->setAttribute('src', $this->image_handler.$image_url);
17337 17337
 									}
17338 17338
 									else
17339 17339
 									{
@@ -17359,16 +17359,16 @@  discard block
 block discarded – undo
17359 17359
 
17360 17360
 				if ($this->remove_div)
17361 17361
 				{
17362
-					$data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '', $data);
17362
+					$data = preg_replace('/^<div'.SIMPLEPIE_PCRE_XML_ATTRIBUTE.'>/', '', $data);
17363 17363
 					$data = preg_replace('/<\/div>$/', '', $data);
17364 17364
 				}
17365 17365
 				else
17366 17366
 				{
17367
-					$data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '<div>', $data);
17367
+					$data = preg_replace('/^<div'.SIMPLEPIE_PCRE_XML_ATTRIBUTE.'>/', '<div>', $data);
17368 17368
 				}
17369 17369
 			}
17370 17370
 
17371
-			if ($type & SIMPLEPIE_CONSTRUCT_IRI)
17371
+			if ($type&SIMPLEPIE_CONSTRUCT_IRI)
17372 17372
 			{
17373 17373
 				$absolute = $this->registry->call('Misc', 'absolutize_url', array($data, $base));
17374 17374
 				if ($absolute !== false)
@@ -17377,7 +17377,7 @@  discard block
 block discarded – undo
17377 17377
 				}
17378 17378
 			}
17379 17379
 
17380
-			if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI))
17380
+			if ($type&(SIMPLEPIE_CONSTRUCT_TEXT|SIMPLEPIE_CONSTRUCT_IRI))
17381 17381
 			{
17382 17382
 				$data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
17383 17383
 			}
@@ -17394,11 +17394,11 @@  discard block
 block discarded – undo
17394 17394
 	{
17395 17395
 		$ret = '';
17396 17396
 		$html = preg_replace('%</?(?:html|body)[^>]*?'.'>%is', '', $html);
17397
-		if ($type & ~SIMPLEPIE_CONSTRUCT_XHTML)
17397
+		if ($type&~SIMPLEPIE_CONSTRUCT_XHTML)
17398 17398
 		{
17399 17399
 			// Atom XHTML constructs are wrapped with a div by default
17400 17400
 			// Note: No protection if $html contains a stray </div>!
17401
-			$html = '<div>' . $html . '</div>';
17401
+			$html = '<div>'.$html.'</div>';
17402 17402
 			$ret .= '<!DOCTYPE html>';
17403 17403
 			$content_type = 'text/html';
17404 17404
 		}
@@ -17409,8 +17409,8 @@  discard block
 block discarded – undo
17409 17409
 		}
17410 17410
 
17411 17411
 		$ret .= '<html><head>';
17412
-		$ret .= '<meta http-equiv="Content-Type" content="' . $content_type . '; charset=utf-8" />';
17413
-		$ret .= '</head><body>' . $html . '</body></html>';
17412
+		$ret .= '<meta http-equiv="Content-Type" content="'.$content_type.'; charset=utf-8" />';
17413
+		$ret .= '</head><body>'.$html.'</body></html>';
17414 17414
 		return $ret;
17415 17415
 	}
17416 17416
 
@@ -17468,7 +17468,7 @@  discard block
 block discarded – undo
17468 17468
 
17469 17469
 	protected function strip_tag($tag, $document, $xpath, $type)
17470 17470
 	{
17471
-		$elements = $xpath->query('body//' . $tag);
17471
+		$elements = $xpath->query('body//'.$tag);
17472 17472
 		if ($this->encode_instead_of_strip)
17473 17473
 		{
17474 17474
 			foreach ($elements as $element)
@@ -17478,7 +17478,7 @@  discard block
 block discarded – undo
17478 17478
 				// For elements which aren't script or style, include the tag itself
17479 17479
 				if (!in_array($tag, array('script', 'style')))
17480 17480
 				{
17481
-					$text = '<' . $tag;
17481
+					$text = '<'.$tag;
17482 17482
 					if ($element->hasAttributes())
17483 17483
 					{
17484 17484
 						$attrs = array();
@@ -17487,21 +17487,21 @@  discard block
 block discarded – undo
17487 17487
 							$value = $attr->value;
17488 17488
 
17489 17489
 							// In XHTML, empty values should never exist, so we repeat the value
17490
-							if (empty($value) && ($type & SIMPLEPIE_CONSTRUCT_XHTML))
17490
+							if (empty($value) && ($type&SIMPLEPIE_CONSTRUCT_XHTML))
17491 17491
 							{
17492 17492
 								$value = $name;
17493 17493
 							}
17494 17494
 							// For HTML, empty is fine
17495
-							elseif (empty($value) && ($type & SIMPLEPIE_CONSTRUCT_HTML))
17495
+							elseif (empty($value) && ($type&SIMPLEPIE_CONSTRUCT_HTML))
17496 17496
 							{
17497 17497
 								$attrs[] = $name;
17498 17498
 								continue;
17499 17499
 							}
17500 17500
 
17501 17501
 							// Standard attribute text
17502
-							$attrs[] = $name . '="' . $attr->value . '"';
17502
+							$attrs[] = $name.'="'.$attr->value.'"';
17503 17503
 						}
17504
-						$text .= ' ' . implode(' ', $attrs);
17504
+						$text .= ' '.implode(' ', $attrs);
17505 17505
 					}
17506 17506
 					$text .= '>';
17507 17507
 					$fragment->appendChild(new DOMText($text));
@@ -17516,7 +17516,7 @@  discard block
 block discarded – undo
17516 17516
 
17517 17517
 				if (!in_array($tag, array('script', 'style')))
17518 17518
 				{
17519
-					$fragment->appendChild(new DOMText('</' . $tag . '>'));
17519
+					$fragment->appendChild(new DOMText('</'.$tag.'>'));
17520 17520
 				}
17521 17521
 
17522 17522
 				$element->parentNode->replaceChild($fragment, $element);
@@ -17552,7 +17552,7 @@  discard block
 block discarded – undo
17552 17552
 
17553 17553
 	protected function strip_attr($attrib, $xpath)
17554 17554
 	{
17555
-		$elements = $xpath->query('//*[@' . $attrib . ']');
17555
+		$elements = $xpath->query('//*[@'.$attrib.']');
17556 17556
 
17557 17557
 		foreach ($elements as $element)
17558 17558
 		{
@@ -17959,19 +17959,19 @@  discard block
 block discarded – undo
17959 17959
 			{
17960 17960
 				if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
17961 17961
 				{
17962
-					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
17962
+					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]))
17963 17963
 					{
17964
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
17965
-						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
17964
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]);
17965
+						$this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key];
17966 17966
 					}
17967 17967
 					else
17968 17968
 					{
17969
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
17969
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key];
17970 17970
 					}
17971 17971
 				}
17972 17972
 				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
17973 17973
 				{
17974
-					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
17974
+					$this->data['links'][substr($key, 41)] = & $this->data['links'][$key];
17975 17975
 				}
17976 17976
 				$this->data['links'][$key] = array_unique($this->data['links'][$key]);
17977 17977
 			}
@@ -18653,7 +18653,7 @@  discard block
 block discarded – undo
18653 18653
 			$this->OS = ord($this->compressed_data[$this->position++]);
18654 18654
 
18655 18655
 			// Parse the FEXTRA
18656
-			if ($this->flags & 4)
18656
+			if ($this->flags&4)
18657 18657
 			{
18658 18658
 				// Read subfield IDs
18659 18659
 				$this->SI1 = $this->compressed_data[$this->position++];
@@ -18684,7 +18684,7 @@  discard block
 block discarded – undo
18684 18684
 			}
18685 18685
 
18686 18686
 			// Parse the FNAME
18687
-			if ($this->flags & 8)
18687
+			if ($this->flags&8)
18688 18688
 			{
18689 18689
 				// Get the length of the filename
18690 18690
 				$len = strcspn($this->compressed_data, "\x00", $this->position);
@@ -18704,7 +18704,7 @@  discard block
 block discarded – undo
18704 18704
 			}
18705 18705
 
18706 18706
 			// Parse the FCOMMENT
18707
-			if ($this->flags & 16)
18707
+			if ($this->flags&16)
18708 18708
 			{
18709 18709
 				// Get the length of the comment
18710 18710
 				$len = strcspn($this->compressed_data, "\x00", $this->position);
@@ -18724,7 +18724,7 @@  discard block
 block discarded – undo
18724 18724
 			}
18725 18725
 
18726 18726
 			// Parse the FHCRC
18727
-			if ($this->flags & 2)
18727
+			if ($this->flags&2)
18728 18728
 			{
18729 18729
 				// Check the length of the string is still valid
18730 18730
 				$this->min_compressed_size += $len + 2;
@@ -18734,7 +18734,7 @@  discard block
 block discarded – undo
18734 18734
 					$crc = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
18735 18735
 
18736 18736
 					// Check the CRC matches
18737
-					if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
18737
+					if ((crc32(substr($this->compressed_data, 0, $this->position))&0xFFFF) === $crc)
18738 18738
 					{
18739 18739
 						$this->position += 2;
18740 18740
 					}
@@ -18770,7 +18770,7 @@  discard block
 block discarded – undo
18770 18770
 			// Check ISIZE of data
18771 18771
 			$isize = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
18772 18772
 			$this->position += 4;
18773
-			if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize))
18773
+			if (sprintf('%u', strlen($this->data)&0xFFFFFFFF) !== sprintf('%u', $isize))
18774 18774
 			{
18775 18775
 				return false;
18776 18776
 			}
Please login to merge, or discard this patch.
Braces   +661 added lines, -1229 removed lines patch added patch discarded remove patch
@@ -765,8 +765,7 @@  discard block
 block discarded – undo
765 765
 			{
766 766
 				$this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', array($value, 1));
767 767
 			}
768
-		}
769
-		else
768
+		} else
770 769
 		{
771 770
 			$this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1));
772 771
 			$this->permanent_url = $this->feed_url;
@@ -931,8 +930,7 @@  discard block
 block discarded – undo
931 930
 		if ($encoding)
932 931
 		{
933 932
 			$this->input_encoding = (string) $encoding;
934
-		}
935
-		else
933
+		} else
936 934
 		{
937 935
 			$this->input_encoding = false;
938 936
 		}
@@ -1259,8 +1257,7 @@  discard block
 block discarded – undo
1259 1257
 		if ($page !== false)
1260 1258
 		{
1261 1259
 			$this->sanitize->set_image_handler($page . '?' . $qs . '=');
1262
-		}
1263
-		else
1260
+		} else
1264 1261
 		{
1265 1262
 			$this->image_handler = '';
1266 1263
 		}
@@ -1354,8 +1351,7 @@  discard block
 block discarded – undo
1354 1351
 				$i++;
1355 1352
 			}
1356 1353
 			return (bool) $success;
1357
-		}
1358
-		elseif ($this->feed_url === null && $this->raw_data === null)
1354
+		} elseif ($this->feed_url === null && $this->raw_data === null)
1359 1355
 		{
1360 1356
 			return false;
1361 1357
 		}
@@ -1380,8 +1376,7 @@  discard block
 block discarded – undo
1380 1376
 			if (($fetched = $this->fetch_data($cache)) === true)
1381 1377
 			{
1382 1378
 				return true;
1383
-			}
1384
-			elseif ($fetched === false) {
1379
+			} elseif ($fetched === false) {
1385 1380
 				return false;
1386 1381
 			}
1387 1382
 
@@ -1418,8 +1413,7 @@  discard block
 block discarded – undo
1418 1413
 				}
1419 1414
 				$encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry)));
1420 1415
 				$encodings[] = 'UTF-8';
1421
-			}
1422
-			elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml')
1416
+			} elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml')
1423 1417
 			{
1424 1418
 				if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
1425 1419
 				{
@@ -1483,8 +1477,7 @@  discard block
 block discarded – undo
1483 1477
 			// We have an error, just set SimplePie_Misc::error to it and quit
1484 1478
 			$this->error = $this->feed_url;
1485 1479
 			$this->error .= sprintf(' is invalid XML, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
1486
-		}
1487
-		else
1480
+		} else
1488 1481
 		{
1489 1482
 			$this->error = 'The data could not be converted to UTF-8.';
1490 1483
 			if (!extension_loaded('mbstring') && !extension_loaded('iconv') && !class_exists('\UConverter')) {
@@ -1587,8 +1580,7 @@  discard block
 block discarded – undo
1587 1580
 								$cache->touch();
1588 1581
 								return true;
1589 1582
 							}
1590
-						}
1591
-						else
1583
+						} else
1592 1584
 						{
1593 1585
 							$this->check_modified = false;
1594 1586
 							if($this->force_cache_fallback)
@@ -1621,8 +1613,7 @@  discard block
 block discarded – undo
1621 1613
 			if ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url)
1622 1614
 			{
1623 1615
 				$file =& $this->file;
1624
-			}
1625
-			else
1616
+			} else
1626 1617
 			{
1627 1618
 				$headers = array(
1628 1619
 					'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
@@ -1676,14 +1667,12 @@  discard block
 block discarded – undo
1676 1667
 						if (isset($this->all_discovered_feeds)) {
1677 1668
 							$this->all_discovered_feeds[] = $file;
1678 1669
 						}
1679
-					}
1680
-					else
1670
+					} else
1681 1671
 					{
1682 1672
 						if ($discovered)
1683 1673
 						{
1684 1674
 							$file = $discovered;
1685
-						}
1686
-						else
1675
+						} else
1687 1676
 						{
1688 1677
 							// We need to unset this so that if SimplePie::set_file() has
1689 1678
 							// been called that object is untouched
@@ -1693,8 +1682,7 @@  discard block
 block discarded – undo
1693 1682
 							return false;
1694 1683
 						}
1695 1684
 					}
1696
-				}
1697
-				catch (SimplePie_Exception $e)
1685
+				} catch (SimplePie_Exception $e)
1698 1686
 				{
1699 1687
 					// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
1700 1688
 					unset($file);
@@ -1787,8 +1775,7 @@  discard block
 block discarded – undo
1787 1775
 			if ($this->get_encoding())
1788 1776
 			{
1789 1777
 				$header .= ' charset=' . $this->get_encoding();
1790
-			}
1791
-			else
1778
+			} else
1792 1779
 			{
1793 1780
 				$header .= ' charset=UTF-8';
1794 1781
 			}
@@ -1830,12 +1817,10 @@  discard block
 block discarded – undo
1830 1817
 			if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed']))
1831 1818
 			{
1832 1819
 				$this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10;
1833
-			}
1834
-			elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed']))
1820
+			} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed']))
1835 1821
 			{
1836 1822
 				$this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03;
1837
-			}
1838
-			elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
1823
+			} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
1839 1824
 			{
1840 1825
 				if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel'])
1841 1826
 				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
@@ -1851,8 +1836,7 @@  discard block
 block discarded – undo
1851 1836
 				{
1852 1837
 					$this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
1853 1838
 				}
1854
-			}
1855
-			elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
1839
+			} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
1856 1840
 			{
1857 1841
 				$this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
1858 1842
 				if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
@@ -1893,8 +1877,7 @@  discard block
 block discarded – undo
1893 1877
 							break;
1894 1878
 					}
1895 1879
 				}
1896
-			}
1897
-			else
1880
+			} else
1898 1881
 			{
1899 1882
 				$this->data['type'] = SIMPLEPIE_TYPE_NONE;
1900 1883
 			}
@@ -1931,8 +1914,7 @@  discard block
 block discarded – undo
1931 1914
 				                   $this->sanitize($this->permanent_url,
1932 1915
 				                                   SIMPLEPIE_CONSTRUCT_IRI));
1933 1916
 			}
1934
-		}
1935
-		else
1917
+		} else
1936 1918
 		{
1937 1919
 			if ($this->feed_url !== null)
1938 1920
 			{
@@ -2133,12 +2115,10 @@  discard block
 block discarded – undo
2133 2115
 		if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base']))
2134 2116
 		{
2135 2117
 			return $element['xml_base'];
2136
-		}
2137
-		elseif ($this->get_link() !== null)
2118
+		} elseif ($this->get_link() !== null)
2138 2119
 		{
2139 2120
 			return $this->get_link();
2140
-		}
2141
-		else
2121
+		} else
2142 2122
 		{
2143 2123
 			return $this->subscribe_url();
2144 2124
 		}
@@ -2159,8 +2139,7 @@  discard block
 block discarded – undo
2159 2139
 		try
2160 2140
 		{
2161 2141
 			return $this->sanitize->sanitize($data, $type, $base);
2162
-		}
2163
-		catch (SimplePie_Exception $e)
2142
+		} catch (SimplePie_Exception $e)
2164 2143
 		{
2165 2144
 			if (!$this->enable_exceptions)
2166 2145
 			{
@@ -2186,32 +2165,25 @@  discard block
 block discarded – undo
2186 2165
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
2187 2166
 		{
2188 2167
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2189
-		}
2190
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
2168
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
2191 2169
 		{
2192 2170
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2193
-		}
2194
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
2171
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
2195 2172
 		{
2196 2173
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2197
-		}
2198
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2174
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2199 2175
 		{
2200 2176
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2201
-		}
2202
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
2177
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
2203 2178
 		{
2204 2179
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2205
-		}
2206
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2180
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2207 2181
 		{
2208 2182
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2209
-		}
2210
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2183
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2211 2184
 		{
2212 2185
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2213
-		}
2214
-		else
2186
+		} else
2215 2187
 		{
2216 2188
 			return null;
2217 2189
 		}
@@ -2230,8 +2202,7 @@  discard block
 block discarded – undo
2230 2202
 		if (isset($categories[$key]))
2231 2203
 		{
2232 2204
 			return $categories[$key];
2233
-		}
2234
-		else
2205
+		} else
2235 2206
 		{
2236 2207
 			return null;
2237 2208
 		}
@@ -2276,8 +2247,7 @@  discard block
 block discarded – undo
2276 2247
 			if (isset($category['attribs']['']['domain']))
2277 2248
 			{
2278 2249
 				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
2279
-			}
2280
-			else
2250
+			} else
2281 2251
 			{
2282 2252
 				$scheme = null;
2283 2253
 			}
@@ -2295,8 +2265,7 @@  discard block
 block discarded – undo
2295 2265
 		if (!empty($categories))
2296 2266
 		{
2297 2267
 			return array_unique($categories);
2298
-		}
2299
-		else
2268
+		} else
2300 2269
 		{
2301 2270
 			return null;
2302 2271
 		}
@@ -2315,8 +2284,7 @@  discard block
 block discarded – undo
2315 2284
 		if (isset($authors[$key]))
2316 2285
 		{
2317 2286
 			return $authors[$key];
2318
-		}
2319
-		else
2287
+		} else
2320 2288
 		{
2321 2289
 			return null;
2322 2290
 		}
@@ -2393,8 +2361,7 @@  discard block
 block discarded – undo
2393 2361
 		if (!empty($authors))
2394 2362
 		{
2395 2363
 			return array_unique($authors);
2396
-		}
2397
-		else
2364
+		} else
2398 2365
 		{
2399 2366
 			return null;
2400 2367
 		}
@@ -2413,8 +2380,7 @@  discard block
 block discarded – undo
2413 2380
 		if (isset($contributors[$key]))
2414 2381
 		{
2415 2382
 			return $contributors[$key];
2416
-		}
2417
-		else
2383
+		} else
2418 2384
 		{
2419 2385
 			return null;
2420 2386
 		}
@@ -2479,8 +2445,7 @@  discard block
 block discarded – undo
2479 2445
 		if (!empty($contributors))
2480 2446
 		{
2481 2447
 			return array_unique($contributors);
2482
-		}
2483
-		else
2448
+		} else
2484 2449
 		{
2485 2450
 			return null;
2486 2451
 		}
@@ -2500,8 +2465,7 @@  discard block
 block discarded – undo
2500 2465
 		if (isset($links[$key]))
2501 2466
 		{
2502 2467
 			return $links[$key];
2503
-		}
2504
-		else
2468
+		} else
2505 2469
 		{
2506 2470
 			return null;
2507 2471
 		}
@@ -2582,13 +2546,11 @@  discard block
 block discarded – undo
2582 2546
 					{
2583 2547
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
2584 2548
 						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
2585
-					}
2586
-					else
2549
+					} else
2587 2550
 					{
2588 2551
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
2589 2552
 					}
2590
-				}
2591
-				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
2553
+				} elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
2592 2554
 				{
2593 2555
 					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
2594 2556
 				}
@@ -2601,12 +2563,10 @@  discard block
 block discarded – undo
2601 2563
 		               $this->data['headers']['link'], $match))
2602 2564
 		{
2603 2565
 			return array($match[1]);
2604
-		}
2605
-		else if (isset($this->data['links'][$rel]))
2566
+		} else if (isset($this->data['links'][$rel]))
2606 2567
 		{
2607 2568
 			return $this->data['links'][$rel];
2608
-		}
2609
-		else
2569
+		} else
2610 2570
 		{
2611 2571
 			return null;
2612 2572
 		}
@@ -2631,40 +2591,31 @@  discard block
 block discarded – undo
2631 2591
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
2632 2592
 		{
2633 2593
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2634
-		}
2635
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
2594
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
2636 2595
 		{
2637 2596
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2638
-		}
2639
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
2597
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
2640 2598
 		{
2641 2599
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2642
-		}
2643
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
2600
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
2644 2601
 		{
2645 2602
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
2646
-		}
2647
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
2603
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
2648 2604
 		{
2649 2605
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
2650
-		}
2651
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
2606
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
2652 2607
 		{
2653 2608
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2654
-		}
2655
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
2609
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
2656 2610
 		{
2657 2611
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2658
-		}
2659
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
2612
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
2660 2613
 		{
2661 2614
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
2662
-		}
2663
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
2615
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
2664 2616
 		{
2665 2617
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
2666
-		}
2667
-		else
2618
+		} else
2668 2619
 		{
2669 2620
 			return null;
2670 2621
 		}
@@ -2683,24 +2634,19 @@  discard block
 block discarded – undo
2683 2634
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
2684 2635
 		{
2685 2636
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2686
-		}
2687
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
2637
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
2688 2638
 		{
2689 2639
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
2690
-		}
2691
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
2640
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
2692 2641
 		{
2693 2642
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2694
-		}
2695
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
2643
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
2696 2644
 		{
2697 2645
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2698
-		}
2699
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
2646
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
2700 2647
 		{
2701 2648
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2702
-		}
2703
-		else
2649
+		} else
2704 2650
 		{
2705 2651
 			return null;
2706 2652
 		}
@@ -2719,32 +2665,25 @@  discard block
 block discarded – undo
2719 2665
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
2720 2666
 		{
2721 2667
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2722
-		}
2723
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
2668
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
2724 2669
 		{
2725 2670
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2726
-		}
2727
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
2671
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
2728 2672
 		{
2729 2673
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2730
-		}
2731
-		elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang']))
2674
+		} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang']))
2732 2675
 		{
2733 2676
 			return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2734
-		}
2735
-		elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang']))
2677
+		} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang']))
2736 2678
 		{
2737 2679
 			return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2738
-		}
2739
-		elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang']))
2680
+		} elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang']))
2740 2681
 		{
2741 2682
 			return $this->sanitize($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
2742
-		}
2743
-		elseif (isset($this->data['headers']['content-language']))
2683
+		} elseif (isset($this->data['headers']['content-language']))
2744 2684
 		{
2745 2685
 			return $this->sanitize($this->data['headers']['content-language'], SIMPLEPIE_CONSTRUCT_TEXT);
2746
-		}
2747
-		else
2686
+		} else
2748 2687
 		{
2749 2688
 			return null;
2750 2689
 		}
@@ -2768,12 +2707,10 @@  discard block
 block discarded – undo
2768 2707
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
2769 2708
 		{
2770 2709
 			return (float) $return[0]['data'];
2771
-		}
2772
-		elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2710
+		} elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2773 2711
 		{
2774 2712
 			return (float) $match[1];
2775
-		}
2776
-		else
2713
+		} else
2777 2714
 		{
2778 2715
 			return null;
2779 2716
 		}
@@ -2796,16 +2733,13 @@  discard block
 block discarded – undo
2796 2733
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
2797 2734
 		{
2798 2735
 			return (float) $return[0]['data'];
2799
-		}
2800
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
2736
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
2801 2737
 		{
2802 2738
 			return (float) $return[0]['data'];
2803
-		}
2804
-		elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2739
+		} elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2805 2740
 		{
2806 2741
 			return (float) $match[2];
2807
-		}
2808
-		else
2742
+		} else
2809 2743
 		{
2810 2744
 			return null;
2811 2745
 		}
@@ -2825,24 +2759,19 @@  discard block
 block discarded – undo
2825 2759
 		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
2826 2760
 		{
2827 2761
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2828
-		}
2829
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2762
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
2830 2763
 		{
2831 2764
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2832
-		}
2833
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
2765
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
2834 2766
 		{
2835 2767
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2836
-		}
2837
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2768
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
2838 2769
 		{
2839 2770
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2840
-		}
2841
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2771
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
2842 2772
 		{
2843 2773
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2844
-		}
2845
-		else
2774
+		} else
2846 2775
 		{
2847 2776
 			return null;
2848 2777
 		}
@@ -2864,28 +2793,22 @@  discard block
 block discarded – undo
2864 2793
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
2865 2794
 		{
2866 2795
 			return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
2867
-		}
2868
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
2796
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
2869 2797
 		{
2870 2798
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2871
-		}
2872
-		elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
2799
+		} elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
2873 2800
 		{
2874 2801
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2875
-		}
2876
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url'))
2802
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'url'))
2877 2803
 		{
2878 2804
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2879
-		}
2880
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url'))
2805
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'url'))
2881 2806
 		{
2882 2807
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2883
-		}
2884
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2808
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2885 2809
 		{
2886 2810
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2887
-		}
2888
-		else
2811
+		} else
2889 2812
 		{
2890 2813
 			return null;
2891 2814
 		}
@@ -2907,16 +2830,13 @@  discard block
 block discarded – undo
2907 2830
 		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
2908 2831
 		{
2909 2832
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2910
-		}
2911
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
2833
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
2912 2834
 		{
2913 2835
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2914
-		}
2915
-		elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
2836
+		} elseif ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
2916 2837
 		{
2917 2838
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
2918
-		}
2919
-		else
2839
+		} else
2920 2840
 		{
2921 2841
 			return null;
2922 2842
 		}
@@ -2937,12 +2857,10 @@  discard block
 block discarded – undo
2937 2857
 		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'width'))
2938 2858
 		{
2939 2859
 			return round($return[0]['data']);
2940
-		}
2941
-		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2860
+		} elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2942 2861
 		{
2943 2862
 			return 88.0;
2944
-		}
2945
-		else
2863
+		} else
2946 2864
 		{
2947 2865
 			return null;
2948 2866
 		}
@@ -2963,12 +2881,10 @@  discard block
 block discarded – undo
2963 2881
 		if ($return = $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'height'))
2964 2882
 		{
2965 2883
 			return round($return[0]['data']);
2966
-		}
2967
-		elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2884
+		} elseif ($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION && $this->get_image_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'url'))
2968 2885
 		{
2969 2886
 			return 31.0;
2970
-		}
2971
-		else
2887
+		} else
2972 2888
 		{
2973 2889
 			return null;
2974 2890
 		}
@@ -2990,8 +2906,7 @@  discard block
 block discarded – undo
2990 2906
 		if ($max === 0)
2991 2907
 		{
2992 2908
 			return $qty;
2993
-		}
2994
-		else
2909
+		} else
2995 2910
 		{
2996 2911
 			return ($qty > $max) ? $max : $qty;
2997 2912
 		}
@@ -3015,8 +2930,7 @@  discard block
 block discarded – undo
3015 2930
 		if (isset($items[$key]))
3016 2931
 		{
3017 2932
 			return $items[$key];
3018
-		}
3019
-		else
2933
+		} else
3020 2934
 		{
3021 2935
 			return null;
3022 2936
 		}
@@ -3104,8 +3018,7 @@  discard block
 block discarded – undo
3104 3018
 				usort($this->data['ordered_items'], array(get_class($this), 'sort_items'));
3105 3019
 		 	}
3106 3020
 			$items = $this->data['ordered_items'];
3107
-		}
3108
-		else
3021
+		} else
3109 3022
 		{
3110 3023
 			$items = $this->data['items'];
3111 3024
 		}
@@ -3113,8 +3026,7 @@  discard block
 block discarded – undo
3113 3026
 		if ($end === 0)
3114 3027
 		{
3115 3028
 			return array_slice($items, $start);
3116
-		}
3117
-		else
3029
+		} else
3118 3030
 		{
3119 3031
 			return array_slice($items, $start, $end);
3120 3032
 		}
@@ -3227,8 +3139,7 @@  discard block
 block discarded – undo
3227 3139
 				if ($arg instanceof SimplePie)
3228 3140
 				{
3229 3141
 					$items = array_merge($items, $arg->get_items(0, $limit));
3230
-				}
3231
-				else
3142
+				} else
3232 3143
 				{
3233 3144
 					trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);
3234 3145
 				}
@@ -3239,13 +3150,11 @@  discard block
 block discarded – undo
3239 3150
 			if ($end === 0)
3240 3151
 			{
3241 3152
 				return array_slice($items, $start);
3242
-			}
3243
-			else
3153
+			} else
3244 3154
 			{
3245 3155
 				return array_slice($items, $start, $end);
3246 3156
 			}
3247
-		}
3248
-		else
3157
+		} else
3249 3158
 		{
3250 3159
 			trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING);
3251 3160
 			return array();
@@ -3277,8 +3186,7 @@  discard block
 block discarded – undo
3277 3186
 				{
3278 3187
 					$file->headers['link'] = ', ';
3279 3188
 				}
3280
-			}
3281
-			else
3189
+			} else
3282 3190
 			{
3283 3191
 				$file->headers['link'] = '';
3284 3192
 			}
@@ -3362,8 +3270,7 @@  discard block
 block discarded – undo
3362 3270
 		if ($this->name !== null)
3363 3271
 		{
3364 3272
 			return $this->name;
3365
-		}
3366
-		else
3273
+		} else
3367 3274
 		{
3368 3275
 			return null;
3369 3276
 		}
@@ -3379,8 +3286,7 @@  discard block
 block discarded – undo
3379 3286
 		if ($this->link !== null)
3380 3287
 		{
3381 3288
 			return $this->link;
3382
-		}
3383
-		else
3289
+		} else
3384 3290
 		{
3385 3291
 			return null;
3386 3292
 		}
@@ -3396,8 +3302,7 @@  discard block
 block discarded – undo
3396 3302
 		if ($this->email !== null)
3397 3303
 		{
3398 3304
 			return $this->email;
3399
-		}
3400
-		else
3305
+		} else
3401 3306
 		{
3402 3307
 			return null;
3403 3308
 		}
@@ -3607,20 +3512,16 @@  discard block
 block discarded – undo
3607 3512
 			if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
3608 3513
 			{
3609 3514
 				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
3610
-			}
3611
-			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
3515
+			} elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
3612 3516
 			{
3613 3517
 				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
3614
-			}
3615
-			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
3518
+			} elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
3616 3519
 			{
3617 3520
 				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
3618
-			}
3619
-			elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]))
3521
+			} elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]))
3620 3522
 			{
3621 3523
 				$channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0];
3622
-			}
3623
-			else
3524
+			} else
3624 3525
 			{
3625 3526
 				$channel = null;
3626 3527
 			}
@@ -4109,8 +4010,7 @@  discard block
 block discarded – undo
4109 4010
 		try
4110 4011
 		{
4111 4012
 			$this->mysql = new PDO("mysql:dbname={$this->options['dbname']};host={$this->options['host']};port={$this->options['port']}", $this->options['user'], $this->options['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
4112
-		}
4113
-		catch (PDOException $e)
4013
+		} catch (PDOException $e)
4114 4014
 		{
4115 4015
 			$this->mysql = null;
4116 4016
 			return;
@@ -4195,8 +4095,7 @@  discard block
 block discarded – undo
4195 4095
 						$sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed';
4196 4096
 						$query = $this->mysql->prepare($sql);
4197 4097
 						$query->bindValue(':items', $items);
4198
-					}
4199
-					else
4098
+					} else
4200 4099
 					{
4201 4100
 						$sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed';
4202 4101
 						$query = $this->mysql->prepare($sql);
@@ -4209,8 +4108,7 @@  discard block
 block discarded – undo
4209 4108
 					{
4210 4109
 						return false;
4211 4110
 					}
4212
-				}
4213
-				else
4111
+				} else
4214 4112
 				{
4215 4113
 					$query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:feed, :count, :data, :time)');
4216 4114
 					$query->bindValue(':feed', $this->id);
@@ -4263,14 +4161,12 @@  discard block
 block discarded – undo
4263 4161
 						}
4264 4162
 						return true;
4265 4163
 					}
4266
-				}
4267
-				else
4164
+				} else
4268 4165
 				{
4269 4166
 					return true;
4270 4167
 				}
4271 4168
 			}
4272
-		}
4273
-		else
4169
+		} else
4274 4170
 		{
4275 4171
 			$query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed');
4276 4172
 			$query->bindValue(':feed', $this->id);
@@ -4286,8 +4182,7 @@  discard block
 block discarded – undo
4286 4182
 					{
4287 4183
 						return true;
4288 4184
 					}
4289
-				}
4290
-				else
4185
+				} else
4291 4186
 				{
4292 4187
 					$query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:id, 0, :data, :time)');
4293 4188
 					$query->bindValue(':id', $this->id);
@@ -4324,8 +4219,7 @@  discard block
 block discarded – undo
4324 4219
 			if (isset($this->options['items'][0]))
4325 4220
 			{
4326 4221
 				$items = (int) $this->options['items'][0];
4327
-			}
4328
-			else
4222
+			} else
4329 4223
 			{
4330 4224
 				$items = (int) $row[0];
4331 4225
 			}
@@ -4335,20 +4229,16 @@  discard block
 block discarded – undo
4335 4229
 				if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]))
4336 4230
 				{
4337 4231
 					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0];
4338
-				}
4339
-				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
4232
+				} elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]))
4340 4233
 				{
4341 4234
 					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0];
4342
-				}
4343
-				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
4235
+				} elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]))
4344 4236
 				{
4345 4237
 					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0];
4346
-				}
4347
-				elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]))
4238
+				} elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]))
4348 4239
 				{
4349 4240
 					$feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0];
4350
-				}
4351
-				else
4241
+				} else
4352 4242
 				{
4353 4243
 					$feed = null;
4354 4244
 				}
@@ -4369,8 +4259,7 @@  discard block
 block discarded – undo
4369 4259
 						{
4370 4260
 							$feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row);
4371 4261
 						}
4372
-					}
4373
-					else
4262
+					} else
4374 4263
 					{
4375 4264
 						return false;
4376 4265
 					}
@@ -4398,8 +4287,7 @@  discard block
 block discarded – undo
4398 4287
 		if ($query->execute() && ($time = $query->fetchColumn()))
4399 4288
 		{
4400 4289
 			return $time;
4401
-		}
4402
-		else
4290
+		} else
4403 4291
 		{
4404 4292
 			return false;
4405 4293
 		}
@@ -4423,8 +4311,7 @@  discard block
 block discarded – undo
4423 4311
 		if ($query->execute() && $query->rowCount() > 0)
4424 4312
 		{
4425 4313
 			return true;
4426
-		}
4427
-		else
4314
+		} else
4428 4315
 		{
4429 4316
 			return false;
4430 4317
 		}
@@ -4449,8 +4336,7 @@  discard block
 block discarded – undo
4449 4336
 		if ($query->execute() && $query2->execute())
4450 4337
 		{
4451 4338
 			return true;
4452
-		}
4453
-		else
4339
+		} else
4454 4340
 		{
4455 4341
 			return false;
4456 4342
 		}
@@ -4699,8 +4585,7 @@  discard block
 block discarded – undo
4699 4585
 		if ($this->endTime !== null)
4700 4586
 		{
4701 4587
 			return $this->endTime;
4702
-		}
4703
-		else
4588
+		} else
4704 4589
 		{
4705 4590
 			return null;
4706 4591
 		}
@@ -4717,8 +4602,7 @@  discard block
 block discarded – undo
4717 4602
 		if ($this->lang !== null)
4718 4603
 		{
4719 4604
 			return $this->lang;
4720
-		}
4721
-		else
4605
+		} else
4722 4606
 		{
4723 4607
 			return null;
4724 4608
 		}
@@ -4734,8 +4618,7 @@  discard block
 block discarded – undo
4734 4618
 		if ($this->startTime !== null)
4735 4619
 		{
4736 4620
 			return $this->startTime;
4737
-		}
4738
-		else
4621
+		} else
4739 4622
 		{
4740 4623
 			return null;
4741 4624
 		}
@@ -4751,8 +4634,7 @@  discard block
 block discarded – undo
4751 4634
 		if ($this->text !== null)
4752 4635
 		{
4753 4636
 			return $this->text;
4754
-		}
4755
-		else
4637
+		} else
4756 4638
 		{
4757 4639
 			return null;
4758 4640
 		}
@@ -4768,8 +4650,7 @@  discard block
 block discarded – undo
4768 4650
 		if ($this->type !== null)
4769 4651
 		{
4770 4652
 			return $this->type;
4771
-		}
4772
-		else
4653
+		} else
4773 4654
 		{
4774 4655
 			return null;
4775 4656
 		}
@@ -4950,8 +4831,7 @@  discard block
 block discarded – undo
4950 4831
 			if (($pos = strpos($this->file->headers['content-type'], ';')) !== false)
4951 4832
 			{
4952 4833
 				$official = substr($this->file->headers['content-type'], 0, $pos);
4953
-			}
4954
-			else
4834
+			} else
4955 4835
 			{
4956 4836
 				$official = $this->file->headers['content-type'];
4957 4837
 			}
@@ -4961,34 +4841,28 @@  discard block
 block discarded – undo
4961 4841
 				|| $official === 'application/unknown')
4962 4842
 			{
4963 4843
 				return $this->unknown();
4964
-			}
4965
-			elseif (substr($official, -4) === '+xml'
4844
+			} elseif (substr($official, -4) === '+xml'
4966 4845
 				|| $official === 'text/xml'
4967 4846
 				|| $official === 'application/xml')
4968 4847
 			{
4969 4848
 				return $official;
4970
-			}
4971
-			elseif (substr($official, 0, 6) === 'image/')
4849
+			} elseif (substr($official, 0, 6) === 'image/')
4972 4850
 			{
4973 4851
 				if ($return = $this->image())
4974 4852
 				{
4975 4853
 					return $return;
4976
-				}
4977
-				else
4854
+				} else
4978 4855
 				{
4979 4856
 					return $official;
4980 4857
 				}
4981
-			}
4982
-			elseif ($official === 'text/html')
4858
+			} elseif ($official === 'text/html')
4983 4859
 			{
4984 4860
 				return $this->feed_or_html();
4985
-			}
4986
-			else
4861
+			} else
4987 4862
 			{
4988 4863
 				return $official;
4989 4864
 			}
4990
-		}
4991
-		else
4865
+		} else
4992 4866
 		{
4993 4867
 			return $this->unknown();
4994 4868
 		}
@@ -5007,12 +4881,10 @@  discard block
 block discarded – undo
5007 4881
 			|| substr($this->file->body, 0, 3) === "\xEF\xBB\xBF")
5008 4882
 		{
5009 4883
 			return 'text/plain';
5010
-		}
5011
-		elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
4884
+		} elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body))
5012 4885
 		{
5013 4886
 			return 'application/octect-stream';
5014
-		}
5015
-		else
4887
+		} else
5016 4888
 		{
5017 4889
 			return 'text/plain';
5018 4890
 		}
@@ -5031,37 +4903,29 @@  discard block
 block discarded – undo
5031 4903
 			|| strtolower(substr($this->file->body, $ws, 7)) === '<script')
5032 4904
 		{
5033 4905
 			return 'text/html';
5034
-		}
5035
-		elseif (substr($this->file->body, 0, 5) === '%PDF-')
4906
+		} elseif (substr($this->file->body, 0, 5) === '%PDF-')
5036 4907
 		{
5037 4908
 			return 'application/pdf';
5038
-		}
5039
-		elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-')
4909
+		} elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-')
5040 4910
 		{
5041 4911
 			return 'application/postscript';
5042
-		}
5043
-		elseif (substr($this->file->body, 0, 6) === 'GIF87a'
4912
+		} elseif (substr($this->file->body, 0, 6) === 'GIF87a'
5044 4913
 			|| substr($this->file->body, 0, 6) === 'GIF89a')
5045 4914
 		{
5046 4915
 			return 'image/gif';
5047
-		}
5048
-		elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
4916
+		} elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
5049 4917
 		{
5050 4918
 			return 'image/png';
5051
-		}
5052
-		elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
4919
+		} elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
5053 4920
 		{
5054 4921
 			return 'image/jpeg';
5055
-		}
5056
-		elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
4922
+		} elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
5057 4923
 		{
5058 4924
 			return 'image/bmp';
5059
-		}
5060
-		elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
4925
+		} elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
5061 4926
 		{
5062 4927
 			return 'image/vnd.microsoft.icon';
5063
-		}
5064
-		else
4928
+		} else
5065 4929
 		{
5066 4930
 			return $this->text_or_binary();
5067 4931
 		}
@@ -5078,24 +4942,19 @@  discard block
 block discarded – undo
5078 4942
 			|| substr($this->file->body, 0, 6) === 'GIF89a')
5079 4943
 		{
5080 4944
 			return 'image/gif';
5081
-		}
5082
-		elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
4945
+		} elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
5083 4946
 		{
5084 4947
 			return 'image/png';
5085
-		}
5086
-		elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
4948
+		} elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
5087 4949
 		{
5088 4950
 			return 'image/jpeg';
5089
-		}
5090
-		elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
4951
+		} elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
5091 4952
 		{
5092 4953
 			return 'image/bmp';
5093
-		}
5094
-		elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
4954
+		} elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
5095 4955
 		{
5096 4956
 			return 'image/vnd.microsoft.icon';
5097
-		}
5098
-		else
4957
+		} else
5099 4958
 		{
5100 4959
 			return false;
5101 4960
 		}
@@ -5136,44 +4995,36 @@  discard block
 block discarded – undo
5136 4995
 				if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false)
5137 4996
 				{
5138 4997
 					$pos += 3;
5139
-				}
5140
-				else
4998
+				} else
5141 4999
 				{
5142 5000
 					return 'text/html';
5143 5001
 				}
5144
-			}
5145
-			elseif (substr($this->file->body, $pos, 1) === '!')
5002
+			} elseif (substr($this->file->body, $pos, 1) === '!')
5146 5003
 			{
5147 5004
 				if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false)
5148 5005
 				{
5149 5006
 					$pos++;
5150
-				}
5151
-				else
5007
+				} else
5152 5008
 				{
5153 5009
 					return 'text/html';
5154 5010
 				}
5155
-			}
5156
-			elseif (substr($this->file->body, $pos, 1) === '?')
5011
+			} elseif (substr($this->file->body, $pos, 1) === '?')
5157 5012
 			{
5158 5013
 				if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false)
5159 5014
 				{
5160 5015
 					$pos += 2;
5161
-				}
5162
-				else
5016
+				} else
5163 5017
 				{
5164 5018
 					return 'text/html';
5165 5019
 				}
5166
-			}
5167
-			elseif (substr($this->file->body, $pos, 3) === 'rss'
5020
+			} elseif (substr($this->file->body, $pos, 3) === 'rss'
5168 5021
 				|| substr($this->file->body, $pos, 7) === 'rdf:RDF')
5169 5022
 			{
5170 5023
 				return 'application/rss+xml';
5171
-			}
5172
-			elseif (substr($this->file->body, $pos, 4) === 'feed')
5024
+			} elseif (substr($this->file->body, $pos, 4) === 'feed')
5173 5025
 			{
5174 5026
 				return 'application/atom+xml';
5175
-			}
5176
-			else
5027
+			} else
5177 5028
 			{
5178 5029
 				return 'text/html';
5179 5030
 			}
@@ -5244,8 +5095,7 @@  discard block
 block discarded – undo
5244 5095
 		if ($this->url !== null)
5245 5096
 		{
5246 5097
 			return $this->url;
5247
-		}
5248
-		else
5098
+		} else
5249 5099
 		{
5250 5100
 			return null;
5251 5101
 		}
@@ -5261,8 +5111,7 @@  discard block
 block discarded – undo
5261 5111
 		if ($this->label !== null)
5262 5112
 		{
5263 5113
 			return $this->label;
5264
-		}
5265
-		else
5114
+		} else
5266 5115
 		{
5267 5116
 			return null;
5268 5117
 		}
@@ -5353,8 +5202,7 @@  discard block
 block discarded – undo
5353 5202
 		if ($this->role !== null)
5354 5203
 		{
5355 5204
 			return $this->role;
5356
-		}
5357
-		else
5205
+		} else
5358 5206
 		{
5359 5207
 			return null;
5360 5208
 		}
@@ -5370,8 +5218,7 @@  discard block
 block discarded – undo
5370 5218
 		if ($this->scheme !== null)
5371 5219
 		{
5372 5220
 			return $this->scheme;
5373
-		}
5374
-		else
5221
+		} else
5375 5222
 		{
5376 5223
 			return null;
5377 5224
 		}
@@ -5387,8 +5234,7 @@  discard block
 block discarded – undo
5387 5234
 		if ($this->name !== null)
5388 5235
 		{
5389 5236
 			return $this->name;
5390
-		}
5391
-		else
5237
+		} else
5392 5238
 		{
5393 5239
 			return null;
5394 5240
 		}
@@ -5469,8 +5315,7 @@  discard block
 block discarded – undo
5469 5315
 		{
5470 5316
 			$this->consumed .= $this->data[$this->position];
5471 5317
 			return $this->data[$this->position++];
5472
-		}
5473
-		else
5318
+		} else
5474 5319
 		{
5475 5320
 			return false;
5476 5321
 		}
@@ -5491,8 +5336,7 @@  discard block
 block discarded – undo
5491 5336
 			$this->consumed .= $data;
5492 5337
 			$this->position += $len;
5493 5338
 			return $data;
5494
-		}
5495
-		else
5339
+		} else
5496 5340
 		{
5497 5341
 			return false;
5498 5342
 		}
@@ -5551,8 +5395,7 @@  discard block
 block discarded – undo
5551 5395
 					if ($hex)
5552 5396
 					{
5553 5397
 						$codepoint = hexdec($codepoint);
5554
-					}
5555
-					else
5398
+					} else
5556 5399
 					{
5557 5400
 						$codepoint = intval($codepoint);
5558 5401
 					}
@@ -5560,8 +5403,7 @@  discard block
 block discarded – undo
5560 5403
 					if (isset($windows_1252_specials[$codepoint]))
5561 5404
 					{
5562 5405
 						$replacement = $windows_1252_specials[$codepoint];
5563
-					}
5564
-					else
5406
+					} else
5565 5407
 					{
5566 5408
 						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
5567 5409
 					}
@@ -6206,8 +6048,7 @@  discard block
 block discarded – undo
6206 6048
 		if ($this->bitrate !== null)
6207 6049
 		{
6208 6050
 			return $this->bitrate;
6209
-		}
6210
-		else
6051
+		} else
6211 6052
 		{
6212 6053
 			return null;
6213 6054
 		}
@@ -6225,8 +6066,7 @@  discard block
 block discarded – undo
6225 6066
 		if (isset($captions[$key]))
6226 6067
 		{
6227 6068
 			return $captions[$key];
6228
-		}
6229
-		else
6069
+		} else
6230 6070
 		{
6231 6071
 			return null;
6232 6072
 		}
@@ -6242,8 +6082,7 @@  discard block
 block discarded – undo
6242 6082
 		if ($this->captions !== null)
6243 6083
 		{
6244 6084
 			return $this->captions;
6245
-		}
6246
-		else
6085
+		} else
6247 6086
 		{
6248 6087
 			return null;
6249 6088
 		}
@@ -6261,8 +6100,7 @@  discard block
 block discarded – undo
6261 6100
 		if (isset($categories[$key]))
6262 6101
 		{
6263 6102
 			return $categories[$key];
6264
-		}
6265
-		else
6103
+		} else
6266 6104
 		{
6267 6105
 			return null;
6268 6106
 		}
@@ -6278,8 +6116,7 @@  discard block
 block discarded – undo
6278 6116
 		if ($this->categories !== null)
6279 6117
 		{
6280 6118
 			return $this->categories;
6281
-		}
6282
-		else
6119
+		} else
6283 6120
 		{
6284 6121
 			return null;
6285 6122
 		}
@@ -6295,8 +6132,7 @@  discard block
 block discarded – undo
6295 6132
 		if ($this->channels !== null)
6296 6133
 		{
6297 6134
 			return $this->channels;
6298
-		}
6299
-		else
6135
+		} else
6300 6136
 		{
6301 6137
 			return null;
6302 6138
 		}
@@ -6312,8 +6148,7 @@  discard block
 block discarded – undo
6312 6148
 		if ($this->copyright !== null)
6313 6149
 		{
6314 6150
 			return $this->copyright;
6315
-		}
6316
-		else
6151
+		} else
6317 6152
 		{
6318 6153
 			return null;
6319 6154
 		}
@@ -6331,8 +6166,7 @@  discard block
 block discarded – undo
6331 6166
 		if (isset($credits[$key]))
6332 6167
 		{
6333 6168
 			return $credits[$key];
6334
-		}
6335
-		else
6169
+		} else
6336 6170
 		{
6337 6171
 			return null;
6338 6172
 		}
@@ -6348,8 +6182,7 @@  discard block
 block discarded – undo
6348 6182
 		if ($this->credits !== null)
6349 6183
 		{
6350 6184
 			return $this->credits;
6351
-		}
6352
-		else
6185
+		} else
6353 6186
 		{
6354 6187
 			return null;
6355 6188
 		}
@@ -6365,8 +6198,7 @@  discard block
 block discarded – undo
6365 6198
 		if ($this->description !== null)
6366 6199
 		{
6367 6200
 			return $this->description;
6368
-		}
6369
-		else
6201
+		} else
6370 6202
 		{
6371 6203
 			return null;
6372 6204
 		}
@@ -6386,13 +6218,11 @@  discard block
 block discarded – undo
6386 6218
 			{
6387 6219
 				$time = SimplePie_Misc::time_hms($this->duration);
6388 6220
 				return $time;
6389
-			}
6390
-			else
6221
+			} else
6391 6222
 			{
6392 6223
 				return $this->duration;
6393 6224
 			}
6394
-		}
6395
-		else
6225
+		} else
6396 6226
 		{
6397 6227
 			return null;
6398 6228
 		}
@@ -6408,8 +6238,7 @@  discard block
 block discarded – undo
6408 6238
 		if ($this->expression !== null)
6409 6239
 		{
6410 6240
 			return $this->expression;
6411
-		}
6412
-		else
6241
+		} else
6413 6242
 		{
6414 6243
 			return 'full';
6415 6244
 		}
@@ -6443,8 +6272,7 @@  discard block
 block discarded – undo
6443 6272
 		if ($this->framerate !== null)
6444 6273
 		{
6445 6274
 			return $this->framerate;
6446
-		}
6447
-		else
6275
+		} else
6448 6276
 		{
6449 6277
 			return null;
6450 6278
 		}
@@ -6473,8 +6301,7 @@  discard block
 block discarded – undo
6473 6301
 		if (isset($hashes[$key]))
6474 6302
 		{
6475 6303
 			return $hashes[$key];
6476
-		}
6477
-		else
6304
+		} else
6478 6305
 		{
6479 6306
 			return null;
6480 6307
 		}
@@ -6490,8 +6317,7 @@  discard block
 block discarded – undo
6490 6317
 		if ($this->hashes !== null)
6491 6318
 		{
6492 6319
 			return $this->hashes;
6493
-		}
6494
-		else
6320
+		} else
6495 6321
 		{
6496 6322
 			return null;
6497 6323
 		}
@@ -6507,8 +6333,7 @@  discard block
 block discarded – undo
6507 6333
 		if ($this->height !== null)
6508 6334
 		{
6509 6335
 			return $this->height;
6510
-		}
6511
-		else
6336
+		} else
6512 6337
 		{
6513 6338
 			return null;
6514 6339
 		}
@@ -6525,8 +6350,7 @@  discard block
 block discarded – undo
6525 6350
 		if ($this->lang !== null)
6526 6351
 		{
6527 6352
 			return $this->lang;
6528
-		}
6529
-		else
6353
+		} else
6530 6354
 		{
6531 6355
 			return null;
6532 6356
 		}
@@ -6544,8 +6368,7 @@  discard block
 block discarded – undo
6544 6368
 		if (isset($keywords[$key]))
6545 6369
 		{
6546 6370
 			return $keywords[$key];
6547
-		}
6548
-		else
6371
+		} else
6549 6372
 		{
6550 6373
 			return null;
6551 6374
 		}
@@ -6561,8 +6384,7 @@  discard block
 block discarded – undo
6561 6384
 		if ($this->keywords !== null)
6562 6385
 		{
6563 6386
 			return $this->keywords;
6564
-		}
6565
-		else
6387
+		} else
6566 6388
 		{
6567 6389
 			return null;
6568 6390
 		}
@@ -6578,8 +6400,7 @@  discard block
 block discarded – undo
6578 6400
 		if ($this->length !== null)
6579 6401
 		{
6580 6402
 			return $this->length;
6581
-		}
6582
-		else
6403
+		} else
6583 6404
 		{
6584 6405
 			return null;
6585 6406
 		}
@@ -6595,8 +6416,7 @@  discard block
 block discarded – undo
6595 6416
 		if ($this->link !== null)
6596 6417
 		{
6597 6418
 			return urldecode($this->link);
6598
-		}
6599
-		else
6419
+		} else
6600 6420
 		{
6601 6421
 			return null;
6602 6422
 		}
@@ -6613,8 +6433,7 @@  discard block
 block discarded – undo
6613 6433
 		if ($this->medium !== null)
6614 6434
 		{
6615 6435
 			return $this->medium;
6616
-		}
6617
-		else
6436
+		} else
6618 6437
 		{
6619 6438
 			return null;
6620 6439
 		}
@@ -6631,8 +6450,7 @@  discard block
 block discarded – undo
6631 6450
 		if ($this->player !== null)
6632 6451
 		{
6633 6452
 			return $this->player;
6634
-		}
6635
-		else
6453
+		} else
6636 6454
 		{
6637 6455
 			return null;
6638 6456
 		}
@@ -6650,8 +6468,7 @@  discard block
 block discarded – undo
6650 6468
 		if (isset($ratings[$key]))
6651 6469
 		{
6652 6470
 			return $ratings[$key];
6653
-		}
6654
-		else
6471
+		} else
6655 6472
 		{
6656 6473
 			return null;
6657 6474
 		}
@@ -6667,8 +6484,7 @@  discard block
 block discarded – undo
6667 6484
 		if ($this->ratings !== null)
6668 6485
 		{
6669 6486
 			return $this->ratings;
6670
-		}
6671
-		else
6487
+		} else
6672 6488
 		{
6673 6489
 			return null;
6674 6490
 		}
@@ -6686,8 +6502,7 @@  discard block
 block discarded – undo
6686 6502
 		if (isset($restrictions[$key]))
6687 6503
 		{
6688 6504
 			return $restrictions[$key];
6689
-		}
6690
-		else
6505
+		} else
6691 6506
 		{
6692 6507
 			return null;
6693 6508
 		}
@@ -6703,8 +6518,7 @@  discard block
 block discarded – undo
6703 6518
 		if ($this->restrictions !== null)
6704 6519
 		{
6705 6520
 			return $this->restrictions;
6706
-		}
6707
-		else
6521
+		} else
6708 6522
 		{
6709 6523
 			return null;
6710 6524
 		}
@@ -6720,8 +6534,7 @@  discard block
 block discarded – undo
6720 6534
 		if ($this->samplingrate !== null)
6721 6535
 		{
6722 6536
 			return $this->samplingrate;
6723
-		}
6724
-		else
6537
+		} else
6725 6538
 		{
6726 6539
 			return null;
6727 6540
 		}
@@ -6738,8 +6551,7 @@  discard block
 block discarded – undo
6738 6551
 		if ($length !== null)
6739 6552
 		{
6740 6553
 			return round($length/1048576, 2);
6741
-		}
6742
-		else
6554
+		} else
6743 6555
 		{
6744 6556
 			return null;
6745 6557
 		}
@@ -6757,8 +6569,7 @@  discard block
 block discarded – undo
6757 6569
 		if (isset($thumbnails[$key]))
6758 6570
 		{
6759 6571
 			return $thumbnails[$key];
6760
-		}
6761
-		else
6572
+		} else
6762 6573
 		{
6763 6574
 			return null;
6764 6575
 		}
@@ -6774,8 +6585,7 @@  discard block
 block discarded – undo
6774 6585
 		if ($this->thumbnails !== null)
6775 6586
 		{
6776 6587
 			return $this->thumbnails;
6777
-		}
6778
-		else
6588
+		} else
6779 6589
 		{
6780 6590
 			return null;
6781 6591
 		}
@@ -6791,8 +6601,7 @@  discard block
 block discarded – undo
6791 6601
 		if ($this->title !== null)
6792 6602
 		{
6793 6603
 			return $this->title;
6794
-		}
6795
-		else
6604
+		} else
6796 6605
 		{
6797 6606
 			return null;
6798 6607
 		}
@@ -6809,8 +6618,7 @@  discard block
 block discarded – undo
6809 6618
 		if ($this->type !== null)
6810 6619
 		{
6811 6620
 			return $this->type;
6812
-		}
6813
-		else
6621
+		} else
6814 6622
 		{
6815 6623
 			return null;
6816 6624
 		}
@@ -6826,8 +6634,7 @@  discard block
 block discarded – undo
6826 6634
 		if ($this->width !== null)
6827 6635
 		{
6828 6636
 			return $this->width;
6829
-		}
6830
-		else
6637
+		} else
6831 6638
 		{
6832 6639
 			return null;
6833 6640
 		}
@@ -6911,8 +6718,7 @@  discard block
 block discarded – undo
6911 6718
 		if (is_array($options))
6912 6719
 		{
6913 6720
 			extract($options);
6914
-		}
6915
-		else
6721
+		} else
6916 6722
 		{
6917 6723
 			$options = explode(',', $options);
6918 6724
 			foreach($options as $option)
@@ -6979,17 +6785,14 @@  discard block
 block discarded – undo
6979 6785
 				if ($height === 'auto')
6980 6786
 				{
6981 6787
 					$width = 480;
6982
-				}
6983
-				elseif ($widescreen)
6788
+				} elseif ($widescreen)
6984 6789
 				{
6985 6790
 					$width = round((intval($height)/9)*16);
6986
-				}
6987
-				else
6791
+				} else
6988 6792
 				{
6989 6793
 					$width = round((intval($height)/3)*4);
6990 6794
 				}
6991
-			}
6992
-			else
6795
+			} else
6993 6796
 			{
6994 6797
 				$width = '100%';
6995 6798
 			}
@@ -7000,35 +6803,29 @@  discard block
 block discarded – undo
7000 6803
 			if ($mime === 'audio')
7001 6804
 			{
7002 6805
 				$height = 0;
7003
-			}
7004
-			elseif ($mime === 'video')
6806
+			} elseif ($mime === 'video')
7005 6807
 			{
7006 6808
 				if ($width === 'auto')
7007 6809
 				{
7008 6810
 					if ($widescreen)
7009 6811
 					{
7010 6812
 						$height = 270;
7011
-					}
7012
-					else
6813
+					} else
7013 6814
 					{
7014 6815
 						$height = 360;
7015 6816
 					}
7016
-				}
7017
-				elseif ($widescreen)
6817
+				} elseif ($widescreen)
7018 6818
 				{
7019 6819
 					$height = round((intval($width)/16)*9);
7020
-				}
7021
-				else
6820
+				} else
7022 6821
 				{
7023 6822
 					$height = round((intval($width)/4)*3);
7024 6823
 				}
7025
-			}
7026
-			else
6824
+			} else
7027 6825
 			{
7028 6826
 				$height = 376;
7029 6827
 			}
7030
-		}
7031
-		elseif ($mime === 'audio')
6828
+		} elseif ($mime === 'audio')
7032 6829
 		{
7033 6830
 			$height = 0;
7034 6831
 		}
@@ -7037,8 +6834,7 @@  discard block
 block discarded – undo
7037 6834
 		if ($mime === 'audio')
7038 6835
 		{
7039 6836
 			$placeholder = $audio;
7040
-		}
7041
-		elseif ($mime === 'video')
6837
+		} elseif ($mime === 'video')
7042 6838
 		{
7043 6839
 			$placeholder = $video;
7044 6840
 		}
@@ -7051,8 +6847,7 @@  discard block
 block discarded – undo
7051 6847
 			if ($native)
7052 6848
 			{
7053 6849
 				$embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
7054
-			}
7055
-			else
6850
+			} else
7056 6851
 			{
7057 6852
 				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>";
7058 6853
 			}
@@ -7066,8 +6861,7 @@  discard block
 block discarded – undo
7066 6861
 			if ($native)
7067 6862
 			{
7068 6863
 				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
7069
-			}
7070
-			else
6864
+			} else
7071 6865
 			{
7072 6866
 				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>";
7073 6867
 			}
@@ -7083,13 +6877,11 @@  discard block
 block discarded – undo
7083 6877
 				if ($placeholder !== '')
7084 6878
 				{
7085 6879
 					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
7086
-				}
7087
-				else
6880
+				} else
7088 6881
 				{
7089 6882
 					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
7090 6883
 				}
7091
-			}
7092
-			else
6884
+			} else
7093 6885
 			{
7094 6886
 				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>";
7095 6887
 			}
@@ -7102,15 +6894,16 @@  discard block
 block discarded – undo
7102 6894
 			if ($native)
7103 6895
 			{
7104 6896
 				$embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
7105
-			}
7106
-			else
6897
+			} else
7107 6898
 			{
7108 6899
 				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>";
7109 6900
 			}
7110 6901
 		}
7111 6902
 
7112 6903
 		// Everything else
7113
-		else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
6904
+		else {
6905
+			$embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
6906
+		}
7114 6907
 
7115 6908
 		return $embed;
7116 6909
 	}
@@ -7138,8 +6931,7 @@  discard block
 block discarded – undo
7138 6931
 		if ($this->get_type() !== null)
7139 6932
 		{
7140 6933
 			$type = strtolower($this->type);
7141
-		}
7142
-		else
6934
+		} else
7143 6935
 		{
7144 6936
 			$type = null;
7145 6937
 		}
@@ -7273,29 +7065,23 @@  discard block
 block discarded – undo
7273 7065
 			if (in_array($type, $types_flash))
7274 7066
 			{
7275 7067
 				return 'flash';
7276
-			}
7277
-			elseif (in_array($type, $types_fmedia))
7068
+			} elseif (in_array($type, $types_fmedia))
7278 7069
 			{
7279 7070
 				return 'fmedia';
7280
-			}
7281
-			elseif (in_array($type, $types_quicktime))
7071
+			} elseif (in_array($type, $types_quicktime))
7282 7072
 			{
7283 7073
 				return 'quicktime';
7284
-			}
7285
-			elseif (in_array($type, $types_wmedia))
7074
+			} elseif (in_array($type, $types_wmedia))
7286 7075
 			{
7287 7076
 				return 'wmedia';
7288
-			}
7289
-			elseif (in_array($type, $types_mp3))
7077
+			} elseif (in_array($type, $types_mp3))
7290 7078
 			{
7291 7079
 				return 'mp3';
7292
-			}
7293
-			else
7080
+			} else
7294 7081
 			{
7295 7082
 				return null;
7296 7083
 			}
7297
-		}
7298
-		else
7084
+		} else
7299 7085
 		{
7300 7086
 			return $type;
7301 7087
 		}
@@ -7398,8 +7184,7 @@  discard block
 block discarded – undo
7398 7184
 				{
7399 7185
 					$this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
7400 7186
 					$this->success = false;
7401
-				}
7402
-				else
7187
+				} else
7403 7188
 				{
7404 7189
 					// Use the updated url provided by curl_getinfo after any redirects.
7405 7190
 					if ($info = curl_getinfo($fp)) {
@@ -7424,8 +7209,7 @@  discard block
 block discarded – undo
7424 7209
 						}
7425 7210
 					}
7426 7211
 				}
7427
-			}
7428
-			else
7212
+			} else
7429 7213
 			{
7430 7214
 				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
7431 7215
 				$url_parts = parse_url($url);
@@ -7444,8 +7228,7 @@  discard block
 block discarded – undo
7444 7228
 				{
7445 7229
 					$this->error = 'fsockopen error: ' . $errstr;
7446 7230
 					$this->success = false;
7447
-				}
7448
-				else
7231
+				} else
7449 7232
 				{
7450 7233
 					stream_set_timeout($fp, $timeout);
7451 7234
 					if (isset($url_parts['path']))
@@ -7453,13 +7236,11 @@  discard block
 block discarded – undo
7453 7236
 						if (isset($url_parts['query']))
7454 7237
 						{
7455 7238
 							$get = "$url_parts[path]?$url_parts[query]";
7456
-						}
7457
-						else
7239
+						} else
7458 7240
 						{
7459 7241
 							$get = $url_parts['path'];
7460 7242
 						}
7461
-					}
7462
-					else
7243
+					} else
7463 7244
 					{
7464 7245
 						$get = '/';
7465 7246
 					}
@@ -7519,8 +7300,7 @@  discard block
 block discarded – undo
7519 7300
 										{
7520 7301
 											$this->error = 'Unable to decode HTTP "gzip" stream';
7521 7302
 											$this->success = false;
7522
-										}
7523
-										else
7303
+										} else
7524 7304
 										{
7525 7305
 											$this->body = trim($decoder->data);
7526 7306
 										}
@@ -7530,16 +7310,13 @@  discard block
 block discarded – undo
7530 7310
 										if (($decompressed = gzinflate($this->body)) !== false)
7531 7311
 										{
7532 7312
 											$this->body = $decompressed;
7533
-										}
7534
-										else if (($decompressed = gzuncompress($this->body)) !== false)
7313
+										} else if (($decompressed = gzuncompress($this->body)) !== false)
7535 7314
 										{
7536 7315
 											$this->body = $decompressed;
7537
-										}
7538
-										else if (function_exists('gzdecode') && ($decompressed = gzdecode($this->body)) !== false)
7316
+										} else if (function_exists('gzdecode') && ($decompressed = gzdecode($this->body)) !== false)
7539 7317
 										{
7540 7318
 											$this->body = $decompressed;
7541
-										}
7542
-										else
7319
+										} else
7543 7320
 										{
7544 7321
 											$this->error = 'Unable to decode HTTP "deflate" stream';
7545 7322
 											$this->success = false;
@@ -7552,8 +7329,7 @@  discard block
 block discarded – undo
7552 7329
 								}
7553 7330
 							}
7554 7331
 						}
7555
-					}
7556
-					else
7332
+					} else
7557 7333
 					{
7558 7334
 						$this->error = 'fsocket timed out';
7559 7335
 						$this->success = false;
@@ -7561,8 +7337,7 @@  discard block
 block discarded – undo
7561 7337
 					fclose($fp);
7562 7338
 				}
7563 7339
 			}
7564
-		}
7565
-		else
7340
+		} else
7566 7341
 		{
7567 7342
 			$this->method = SIMPLEPIE_FILE_SOURCE_LOCAL | SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS;
7568 7343
 			if (empty($url) || !($this->body = trim(file_get_contents($url))))
@@ -7686,8 +7461,7 @@  discard block
 block discarded – undo
7686 7461
 		if ($this->state === 'emit' || $this->state === 'body')
7687 7462
 		{
7688 7463
 			return true;
7689
-		}
7690
-		else
7464
+		} else
7691 7465
 		{
7692 7466
 			$this->http_version = '';
7693 7467
 			$this->status_code = '';
@@ -7737,13 +7511,11 @@  discard block
 block discarded – undo
7737 7511
 				$this->http_version = (float) $this->http_version;
7738 7512
 				$this->position += strspn($this->data, "\x09\x20", $this->position);
7739 7513
 				$this->state = 'status';
7740
-			}
7741
-			else
7514
+			} else
7742 7515
 			{
7743 7516
 				$this->state = false;
7744 7517
 			}
7745
-		}
7746
-		else
7518
+		} else
7747 7519
 		{
7748 7520
 			$this->state = false;
7749 7521
 		}
@@ -7759,8 +7531,7 @@  discard block
 block discarded – undo
7759 7531
 			$this->status_code = (int) substr($this->data, $this->position, $len);
7760 7532
 			$this->position += $len;
7761 7533
 			$this->state = 'reason';
7762
-		}
7763
-		else
7534
+		} else
7764 7535
 		{
7765 7536
 			$this->state = false;
7766 7537
 		}
@@ -7790,8 +7561,7 @@  discard block
 block discarded – undo
7790 7561
 			if (isset($this->headers[$this->name]) && $this->name !== 'content-type')
7791 7562
 			{
7792 7563
 				$this->headers[$this->name] .= ', ' . $this->value;
7793
-			}
7794
-			else
7564
+			} else
7795 7565
 			{
7796 7566
 				$this->headers[$this->name] = $this->value;
7797 7567
 			}
@@ -7802,13 +7572,11 @@  discard block
 block discarded – undo
7802 7572
 		{
7803 7573
 			$this->position += 2;
7804 7574
 			$this->state = 'body';
7805
-		}
7806
-		elseif ($this->data[$this->position] === "\x0A")
7575
+		} elseif ($this->data[$this->position] === "\x0A")
7807 7576
 		{
7808 7577
 			$this->position++;
7809 7578
 			$this->state = 'body';
7810
-		}
7811
-		else
7579
+		} else
7812 7580
 		{
7813 7581
 			$this->state = 'name';
7814 7582
 		}
@@ -7826,15 +7594,13 @@  discard block
 block discarded – undo
7826 7594
 			{
7827 7595
 				$this->position += $len;
7828 7596
 				$this->state = 'new_line';
7829
-			}
7830
-			else
7597
+			} else
7831 7598
 			{
7832 7599
 				$this->name = substr($this->data, $this->position, $len);
7833 7600
 				$this->position += $len + 1;
7834 7601
 				$this->state = 'value';
7835 7602
 			}
7836
-		}
7837
-		else
7603
+		} else
7838 7604
 		{
7839 7605
 			$this->state = false;
7840 7606
 		}
@@ -7850,8 +7616,7 @@  discard block
 block discarded – undo
7850 7616
 			if (substr($this->data, $this->position, 2) === "\x0D\x0A")
7851 7617
 			{
7852 7618
 				$this->position += 2;
7853
-			}
7854
-			elseif ($this->data[$this->position] === "\x0A")
7619
+			} elseif ($this->data[$this->position] === "\x0A")
7855 7620
 			{
7856 7621
 				$this->position++;
7857 7622
 			}
@@ -7868,8 +7633,7 @@  discard block
 block discarded – undo
7868 7633
 		if ($this->is_linear_whitespace())
7869 7634
 		{
7870 7635
 			$this->linear_whitespace();
7871
-		}
7872
-		else
7636
+		} else
7873 7637
 		{
7874 7638
 			switch ($this->data[$this->position])
7875 7639
 			{
@@ -7918,8 +7682,7 @@  discard block
 block discarded – undo
7918 7682
 		if ($this->is_linear_whitespace())
7919 7683
 		{
7920 7684
 			$this->linear_whitespace();
7921
-		}
7922
-		else
7685
+		} else
7923 7686
 		{
7924 7687
 			switch ($this->data[$this->position])
7925 7688
 			{
@@ -7976,8 +7739,7 @@  discard block
 block discarded – undo
7976 7739
 		{
7977 7740
 			unset($this->headers['transfer-encoding']);
7978 7741
 			$this->state = 'chunked';
7979
-		}
7980
-		else
7742
+		} else
7981 7743
 		{
7982 7744
 			$this->state = 'emit';
7983 7745
 		}
@@ -8157,8 +7919,7 @@  discard block
 block discarded – undo
8157 7919
 		if (method_exists($this, 'set_' . $name))
8158 7920
 		{
8159 7921
 			call_user_func(array($this, 'set_' . $name), $value);
8160
-		}
8161
-		elseif (
7922
+		} elseif (
8162 7923
 			   $name === 'iauthority'
8163 7924
 			|| $name === 'iuserinfo'
8164 7925
 			|| $name === 'ihost'
@@ -8191,8 +7952,7 @@  discard block
 block discarded – undo
8191 7952
 		)
8192 7953
 		{
8193 7954
 			$return = $this->{"get_$name"}();
8194
-		}
8195
-		elseif (array_key_exists($name, $props))
7955
+		} elseif (array_key_exists($name, $props))
8196 7956
 		{
8197 7957
 			$return = $this->$name;
8198 7958
 		}
@@ -8207,8 +7967,7 @@  discard block
 block discarded – undo
8207 7967
 		{
8208 7968
 			$name = $prop;
8209 7969
 			$return = $this->$prop;
8210
-		}
8211
-		else
7970
+		} else
8212 7971
 		{
8213 7972
 			trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
8214 7973
 			$return = null;
@@ -8217,8 +7976,7 @@  discard block
 block discarded – undo
8217 7976
 		if ($return === null && isset($this->normalization[$this->scheme][$name]))
8218 7977
 		{
8219 7978
 			return $this->normalization[$this->scheme][$name];
8220
-		}
8221
-		else
7979
+		} else
8222 7980
 		{
8223 7981
 			return $return;
8224 7982
 		}
@@ -8235,8 +7993,7 @@  discard block
 block discarded – undo
8235 7993
 		if (method_exists($this, 'get_' . $name) || isset($this->$name))
8236 7994
 		{
8237 7995
 			return true;
8238
-		}
8239
-		else
7996
+		} else
8240 7997
 		{
8241 7998
 			return false;
8242 7999
 		}
@@ -8292,12 +8049,10 @@  discard block
 block discarded – undo
8292 8049
 		if (!$relative->is_valid())
8293 8050
 		{
8294 8051
 			return false;
8295
-		}
8296
-		elseif ($relative->scheme !== null)
8052
+		} elseif ($relative->scheme !== null)
8297 8053
 		{
8298 8054
 			return clone $relative;
8299
-		}
8300
-		else
8055
+		} else
8301 8056
 		{
8302 8057
 			if (!($base instanceof SimplePie_IRI))
8303 8058
 			{
@@ -8311,8 +8066,7 @@  discard block
 block discarded – undo
8311 8066
 					{
8312 8067
 						$target = clone $relative;
8313 8068
 						$target->scheme = $base->scheme;
8314
-					}
8315
-					else
8069
+					} else
8316 8070
 					{
8317 8071
 						$target = new SimplePie_IRI;
8318 8072
 						$target->scheme = $base->scheme;
@@ -8324,46 +8078,39 @@  discard block
 block discarded – undo
8324 8078
 							if ($relative->ipath[0] === '/')
8325 8079
 							{
8326 8080
 								$target->ipath = $relative->ipath;
8327
-							}
8328
-							elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '')
8081
+							} elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '')
8329 8082
 							{
8330 8083
 								$target->ipath = '/' . $relative->ipath;
8331
-							}
8332
-							elseif (($last_segment = strrpos($base->ipath, '/')) !== false)
8084
+							} elseif (($last_segment = strrpos($base->ipath, '/')) !== false)
8333 8085
 							{
8334 8086
 								$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
8335
-							}
8336
-							else
8087
+							} else
8337 8088
 							{
8338 8089
 								$target->ipath = $relative->ipath;
8339 8090
 							}
8340 8091
 							$target->ipath = $target->remove_dot_segments($target->ipath);
8341 8092
 							$target->iquery = $relative->iquery;
8342
-						}
8343
-						else
8093
+						} else
8344 8094
 						{
8345 8095
 							$target->ipath = $base->ipath;
8346 8096
 							if ($relative->iquery !== null)
8347 8097
 							{
8348 8098
 								$target->iquery = $relative->iquery;
8349
-							}
8350
-							elseif ($base->iquery !== null)
8099
+							} elseif ($base->iquery !== null)
8351 8100
 							{
8352 8101
 								$target->iquery = $base->iquery;
8353 8102
 							}
8354 8103
 						}
8355 8104
 						$target->ifragment = $relative->ifragment;
8356 8105
 					}
8357
-				}
8358
-				else
8106
+				} else
8359 8107
 				{
8360 8108
 					$target = clone $base;
8361 8109
 					$target->ifragment = null;
8362 8110
 				}
8363 8111
 				$target->scheme_normalization();
8364 8112
 				return $target;
8365
-			}
8366
-			else
8113
+			} else
8367 8114
 			{
8368 8115
 				return false;
8369 8116
 			}
@@ -8402,8 +8149,7 @@  discard block
 block discarded – undo
8402 8149
 				$match['fragment'] = null;
8403 8150
 			}
8404 8151
 			return $match;
8405
-		}
8406
-		else
8152
+		} else
8407 8153
 		{
8408 8154
 			// This can occur when a paragraph is accidentally parsed as a URI
8409 8155
 			return false;
@@ -8425,8 +8171,7 @@  discard block
 block discarded – undo
8425 8171
 			if (strpos($input, '../') === 0)
8426 8172
 			{
8427 8173
 				$input = substr($input, 3);
8428
-			}
8429
-			elseif (strpos($input, './') === 0)
8174
+			} elseif (strpos($input, './') === 0)
8430 8175
 			{
8431 8176
 				$input = substr($input, 2);
8432 8177
 			}
@@ -8434,8 +8179,7 @@  discard block
 block discarded – undo
8434 8179
 			elseif (strpos($input, '/./') === 0)
8435 8180
 			{
8436 8181
 				$input = substr($input, 2);
8437
-			}
8438
-			elseif ($input === '/.')
8182
+			} elseif ($input === '/.')
8439 8183
 			{
8440 8184
 				$input = '/';
8441 8185
 			}
@@ -8444,8 +8188,7 @@  discard block
 block discarded – undo
8444 8188
 			{
8445 8189
 				$input = substr($input, 3);
8446 8190
 				$output = substr_replace($output, '', strrpos($output, '/'));
8447
-			}
8448
-			elseif ($input === '/..')
8191
+			} elseif ($input === '/..')
8449 8192
 			{
8450 8193
 				$input = '/';
8451 8194
 				$output = substr_replace($output, '', strrpos($output, '/'));
@@ -8460,8 +8203,7 @@  discard block
 block discarded – undo
8460 8203
 			{
8461 8204
 				$output .= substr($input, 0, $pos);
8462 8205
 				$input = substr_replace($input, '', 0, $pos);
8463
-			}
8464
-			else
8206
+			} else
8465 8207
 			{
8466 8208
 				$output .= $input;
8467 8209
 				$input = '';
@@ -8555,8 +8297,7 @@  discard block
 block discarded – undo
8555 8297
 							break;
8556 8298
 						}
8557 8299
 					}
8558
-				}
8559
-				else
8300
+				} else
8560 8301
 				{
8561 8302
 					$position = $strlen - 1;
8562 8303
 					$valid = false;
@@ -8590,8 +8331,9 @@  discard block
 block discarded – undo
8590 8331
 			)
8591 8332
 			{
8592 8333
 				// If we were a character, pretend we weren't, but rather an error.
8593
-				if ($valid)
8594
-					$position--;
8334
+				if ($valid) {
8335
+									$position--;
8336
+				}
8595 8337
 
8596 8338
 				for ($j = $start; $j <= $position; $j++)
8597 8339
 				{
@@ -8723,8 +8465,7 @@  discard block
 block discarded – undo
8723 8465
 					{
8724 8466
 						$string .= '%' . strtoupper($bytes[$j]);
8725 8467
 					}
8726
-				}
8727
-				else
8468
+				} else
8728 8469
 				{
8729 8470
 					for ($j = $start; $j <= $i; $j++)
8730 8471
 					{
@@ -8783,20 +8524,28 @@  discard block
 block discarded – undo
8783 8524
 	 */
8784 8525
 	public function is_valid()
8785 8526
 	{
8786
-		if ($this->ipath === '') return true;
8527
+		if ($this->ipath === '') {
8528
+			return true;
8529
+		}
8787 8530
 
8788 8531
 		$isauthority = $this->iuserinfo !== null || $this->ihost !== null ||
8789 8532
 			$this->port !== null;
8790
-		if ($isauthority && $this->ipath[0] === '/') return true;
8533
+		if ($isauthority && $this->ipath[0] === '/') {
8534
+			return true;
8535
+		}
8791 8536
 
8792
-		if (!$isauthority && (substr($this->ipath, 0, 2) === '//')) return false;
8537
+		if (!$isauthority && (substr($this->ipath, 0, 2) === '//')) {
8538
+			return false;
8539
+		}
8793 8540
 
8794 8541
 		// Relative urls cannot have a colon in the first path segment (and the
8795 8542
 		// slashes themselves are not included so skip the first character).
8796 8543
 		if (!$this->scheme && !$isauthority &&
8797 8544
 		    strpos($this->ipath, ':') !== false &&
8798 8545
 		    strpos($this->ipath, '/', 1) !== false &&
8799
-		    strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false;
8546
+		    strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) {
8547
+			return false;
8548
+		}
8800 8549
 
8801 8550
 		return true;
8802 8551
 	}
@@ -8824,8 +8573,7 @@  discard block
 block discarded – undo
8824 8573
 		if ($iri === null)
8825 8574
 		{
8826 8575
 			return true;
8827
-		}
8828
-		elseif (isset($cache[$iri]))
8576
+		} elseif (isset($cache[$iri]))
8829 8577
 		{
8830 8578
 			list($this->scheme,
8831 8579
 				 $this->iuserinfo,
@@ -8836,8 +8584,7 @@  discard block
 block discarded – undo
8836 8584
 				 $this->ifragment,
8837 8585
 				 $return) = $cache[$iri];
8838 8586
 			return $return;
8839
-		}
8840
-		else
8587
+		} else
8841 8588
 		{
8842 8589
 			$parsed = $this->parse_iri((string) $iri);
8843 8590
 			if (!$parsed)
@@ -8875,13 +8622,11 @@  discard block
 block discarded – undo
8875 8622
 		if ($scheme === null)
8876 8623
 		{
8877 8624
 			$this->scheme = null;
8878
-		}
8879
-		elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme))
8625
+		} elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme))
8880 8626
 		{
8881 8627
 			$this->scheme = null;
8882 8628
 			return false;
8883
-		}
8884
-		else
8629
+		} else
8885 8630
 		{
8886 8631
 			$this->scheme = strtolower($scheme);
8887 8632
 		}
@@ -8903,8 +8648,9 @@  discard block
 block discarded – undo
8903 8648
 			$cache = null;
8904 8649
 			return;
8905 8650
 		}
8906
-		if (!$cache)
8907
-			$cache = array();
8651
+		if (!$cache) {
8652
+					$cache = array();
8653
+		}
8908 8654
 
8909 8655
 		if ($authority === null)
8910 8656
 		{
@@ -8912,8 +8658,7 @@  discard block
 block discarded – undo
8912 8658
 			$this->ihost = null;
8913 8659
 			$this->port = null;
8914 8660
 			return true;
8915
-		}
8916
-		elseif (isset($cache[$authority]))
8661
+		} elseif (isset($cache[$authority]))
8917 8662
 		{
8918 8663
 			list($this->iuserinfo,
8919 8664
 				 $this->ihost,
@@ -8921,16 +8666,14 @@  discard block
 block discarded – undo
8921 8666
 				 $return) = $cache[$authority];
8922 8667
 
8923 8668
 			return $return;
8924
-		}
8925
-		else
8669
+		} else
8926 8670
 		{
8927 8671
 			$remaining = $authority;
8928 8672
 			if (($iuserinfo_end = strrpos($remaining, '@')) !== false)
8929 8673
 			{
8930 8674
 				$iuserinfo = substr($remaining, 0, $iuserinfo_end);
8931 8675
 				$remaining = substr($remaining, $iuserinfo_end + 1);
8932
-			}
8933
-			else
8676
+			} else
8934 8677
 			{
8935 8678
 				$iuserinfo = null;
8936 8679
 			}
@@ -8941,8 +8684,7 @@  discard block
 block discarded – undo
8941 8684
 					$port = null;
8942 8685
 				}
8943 8686
 				$remaining = substr($remaining, 0, $port_start);
8944
-			}
8945
-			else
8687
+			} else
8946 8688
 			{
8947 8689
 				$port = null;
8948 8690
 			}
@@ -8971,8 +8713,7 @@  discard block
 block discarded – undo
8971 8713
 		if ($iuserinfo === null)
8972 8714
 		{
8973 8715
 			$this->iuserinfo = null;
8974
-		}
8975
-		else
8716
+		} else
8976 8717
 		{
8977 8718
 			$this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:');
8978 8719
 			$this->scheme_normalization();
@@ -8994,20 +8735,17 @@  discard block
 block discarded – undo
8994 8735
 		{
8995 8736
 			$this->ihost = null;
8996 8737
 			return true;
8997
-		}
8998
-		elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']')
8738
+		} elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']')
8999 8739
 		{
9000 8740
 			if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1)))
9001 8741
 			{
9002 8742
 				$this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']';
9003
-			}
9004
-			else
8743
+			} else
9005 8744
 			{
9006 8745
 				$this->ihost = null;
9007 8746
 				return false;
9008 8747
 			}
9009
-		}
9010
-		else
8748
+		} else
9011 8749
 		{
9012 8750
 			$ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;=');
9013 8751
 
@@ -9021,8 +8759,7 @@  discard block
 block discarded – undo
9021 8759
 				if ($ihost[$position] === '%')
9022 8760
 				{
9023 8761
 					$position += 3;
9024
-				}
9025
-				else
8762
+				} else
9026 8763
 				{
9027 8764
 					$ihost[$position] = strtolower($ihost[$position]);
9028 8765
 					$position++;
@@ -9050,14 +8787,12 @@  discard block
 block discarded – undo
9050 8787
 		{
9051 8788
 			$this->port = null;
9052 8789
 			return true;
9053
-		}
9054
-		elseif (strspn($port, '0123456789') === strlen($port))
8790
+		} elseif (strspn($port, '0123456789') === strlen($port))
9055 8791
 		{
9056 8792
 			$this->port = (int) $port;
9057 8793
 			$this->scheme_normalization();
9058 8794
 			return true;
9059
-		}
9060
-		else
8795
+		} else
9061 8796
 		{
9062 8797
 			$this->port = null;
9063 8798
 			return false;
@@ -9088,8 +8823,7 @@  discard block
 block discarded – undo
9088 8823
 		if (isset($cache[$ipath]))
9089 8824
 		{
9090 8825
 			$this->ipath = $cache[$ipath][(int) ($this->scheme !== null)];
9091
-		}
9092
-		else
8826
+		} else
9093 8827
 		{
9094 8828
 			$valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/');
9095 8829
 			$removed = $this->remove_dot_segments($valid);
@@ -9113,8 +8847,7 @@  discard block
 block discarded – undo
9113 8847
 		if ($iquery === null)
9114 8848
 		{
9115 8849
 			$this->iquery = null;
9116
-		}
9117
-		else
8850
+		} else
9118 8851
 		{
9119 8852
 			$this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true);
9120 8853
 			$this->scheme_normalization();
@@ -9133,8 +8866,7 @@  discard block
 block discarded – undo
9133 8866
 		if ($ifragment === null)
9134 8867
 		{
9135 8868
 			$this->ifragment = null;
9136
-		}
9137
-		else
8869
+		} else
9138 8870
 		{
9139 8871
 			$this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?');
9140 8872
 			$this->scheme_normalization();
@@ -9191,8 +8923,7 @@  discard block
 block discarded – undo
9191 8923
 		if ($this->ipath !== '')
9192 8924
 		{
9193 8925
 			$iri .= $this->ipath;
9194
-		}
9195
-		elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
8926
+		} elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
9196 8927
 		{
9197 8928
 			$iri .= $this->normalization[$this->scheme]['ipath'];
9198 8929
 		}
@@ -9241,8 +8972,7 @@  discard block
 block discarded – undo
9241 8972
 				$iauthority .= ':' . $this->port;
9242 8973
 			}
9243 8974
 			return $iauthority;
9244
-		}
9245
-		else
8975
+		} else
9246 8976
 		{
9247 8977
 			return null;
9248 8978
 		}
@@ -9256,10 +8986,11 @@  discard block
 block discarded – undo
9256 8986
 	protected function get_authority()
9257 8987
 	{
9258 8988
 		$iauthority = $this->get_iauthority();
9259
-		if (is_string($iauthority))
9260
-			return $this->to_uri($iauthority);
9261
-		else
9262
-			return $iauthority;
8989
+		if (is_string($iauthority)) {
8990
+					return $this->to_uri($iauthority);
8991
+		} else {
8992
+					return $iauthority;
8993
+		}
9263 8994
 	}
9264 8995
 }
9265 8996
 
@@ -9367,8 +9098,7 @@  discard block
 block discarded – undo
9367 9098
 		if (isset($this->data['child'][$namespace][$tag]))
9368 9099
 		{
9369 9100
 			return $this->data['child'][$namespace][$tag];
9370
-		}
9371
-		else
9101
+		} else
9372 9102
 		{
9373 9103
 			return null;
9374 9104
 		}
@@ -9437,24 +9167,19 @@  discard block
 block discarded – undo
9437 9167
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
9438 9168
 			{
9439 9169
 				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
9440
-			}
9441
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
9170
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
9442 9171
 			{
9443 9172
 				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
9444
-			}
9445
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
9173
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
9446 9174
 			{
9447 9175
 				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
9448
-			}
9449
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
9176
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
9450 9177
 			{
9451 9178
 				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
9452
-			}
9453
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
9179
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
9454 9180
 			{
9455 9181
 				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
9456
-			}
9457
-			elseif (isset($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about']))
9182
+			} elseif (isset($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about']))
9458 9183
 			{
9459 9184
 				return $this->sanitize($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'], SIMPLEPIE_CONSTRUCT_TEXT);
9460 9185
 			}
@@ -9462,8 +9187,7 @@  discard block
 block discarded – undo
9462 9187
 		if ($fn === false)
9463 9188
 		{
9464 9189
 			return null;
9465
-		}
9466
-		elseif (!is_callable($fn))
9190
+		} elseif (!is_callable($fn))
9467 9191
 		{
9468 9192
 			trigger_error('User-supplied function $fn must be callable', E_USER_WARNING);
9469 9193
 			$fn = 'md5';
@@ -9487,32 +9211,25 @@  discard block
 block discarded – undo
9487 9211
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
9488 9212
 			{
9489 9213
 				$this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
9490
-			}
9491
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
9214
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
9492 9215
 			{
9493 9216
 				$this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
9494
-			}
9495
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
9217
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
9496 9218
 			{
9497 9219
 				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
9498
-			}
9499
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
9220
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
9500 9221
 			{
9501 9222
 				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
9502
-			}
9503
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
9223
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
9504 9224
 			{
9505 9225
 				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
9506
-			}
9507
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
9226
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
9508 9227
 			{
9509 9228
 				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
9510
-			}
9511
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
9229
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
9512 9230
 			{
9513 9231
 				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
9514
-			}
9515
-			else
9232
+			} else
9516 9233
 			{
9517 9234
 				$this->data['title'] = null;
9518 9235
 			}
@@ -9541,53 +9258,42 @@  discard block
 block discarded – undo
9541 9258
 		    ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9542 9259
 		{
9543 9260
 			return $return;
9544
-		}
9545
-		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) &&
9261
+		} elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) &&
9546 9262
 		        ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9547 9263
 		{
9548 9264
 			return $return;
9549
-		}
9550
-		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) &&
9265
+		} elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) &&
9551 9266
 		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($tags[0]))))
9552 9267
 		{
9553 9268
 			return $return;
9554
-		}
9555
-		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) &&
9269
+		} elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) &&
9556 9270
 		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
9557 9271
 		{
9558 9272
 			return $return;
9559
-		}
9560
-		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) &&
9273
+		} elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) &&
9561 9274
 		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
9562 9275
 		{
9563 9276
 			return $return;
9564
-		}
9565
-		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) &&
9277
+		} elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) &&
9566 9278
 		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
9567 9279
 		{
9568 9280
 			return $return;
9569
-		}
9570
-		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) &&
9281
+		} elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) &&
9571 9282
 		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
9572 9283
 		{
9573 9284
 			return $return;
9574
-		}
9575
-		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) &&
9285
+		} elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) &&
9576 9286
 		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)))
9577 9287
 		{
9578 9288
 			return $return;
9579
-		}
9580
-		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) &&
9289
+		} elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) &&
9581 9290
 		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML)))
9582 9291
 		{
9583 9292
 			return $return;
9584
-		}
9585
-
9586
-		elseif (!$description_only)
9293
+		} elseif (!$description_only)
9587 9294
 		{
9588 9295
 			return $this->get_content(true);
9589
-		}
9590
-		else
9296
+		} else
9591 9297
 		{
9592 9298
 			return null;
9593 9299
 		}
@@ -9613,22 +9319,18 @@  discard block
 block discarded – undo
9613 9319
 		    ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9614 9320
 		{
9615 9321
 			return $return;
9616
-		}
9617
-		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) &&
9322
+		} elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) &&
9618 9323
 		        ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0]))))
9619 9324
 		{
9620 9325
 			return $return;
9621
-		}
9622
-		elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) &&
9326
+		} elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) &&
9623 9327
 		        ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0]))))
9624 9328
 		{
9625 9329
 			return $return;
9626
-		}
9627
-		elseif (!$content_only)
9330
+		} elseif (!$content_only)
9628 9331
 		{
9629 9332
 			return $this->get_description(true);
9630
-		}
9631
-		else
9333
+		} else
9632 9334
 		{
9633 9335
 			return null;
9634 9336
 		}
@@ -9649,8 +9351,7 @@  discard block
 block discarded – undo
9649 9351
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
9650 9352
 			{
9651 9353
 				$this->data['thumbnail'] = $return[0]['attribs'][''];
9652
-			}
9653
-			else
9354
+			} else
9654 9355
 			{
9655 9356
 				$this->data['thumbnail'] = null;
9656 9357
 			}
@@ -9671,8 +9372,7 @@  discard block
 block discarded – undo
9671 9372
 		if (isset($categories[$key]))
9672 9373
 		{
9673 9374
 			return $categories[$key];
9674
-		}
9675
-		else
9375
+		} else
9676 9376
 		{
9677 9377
 			return null;
9678 9378
 		}
@@ -9718,8 +9418,7 @@  discard block
 block discarded – undo
9718 9418
 			if (isset($category['attribs']['']['domain']))
9719 9419
 			{
9720 9420
 				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
9721
-			}
9722
-			else
9421
+			} else
9723 9422
 			{
9724 9423
 				$scheme = null;
9725 9424
 			}
@@ -9739,8 +9438,7 @@  discard block
 block discarded – undo
9739 9438
 		if (!empty($categories))
9740 9439
 		{
9741 9440
 			return array_unique($categories);
9742
-		}
9743
-		else
9441
+		} else
9744 9442
 		{
9745 9443
 			return null;
9746 9444
 		}
@@ -9759,8 +9457,7 @@  discard block
 block discarded – undo
9759 9457
 		if (isset($authors[$key]))
9760 9458
 		{
9761 9459
 			return $authors[$key];
9762
-		}
9763
-		else
9460
+		} else
9764 9461
 		{
9765 9462
 			return null;
9766 9463
 		}
@@ -9779,8 +9476,7 @@  discard block
 block discarded – undo
9779 9476
 		if (isset($contributors[$key]))
9780 9477
 		{
9781 9478
 			return $contributors[$key];
9782
-		}
9783
-		else
9479
+		} else
9784 9480
 		{
9785 9481
 			return null;
9786 9482
 		}
@@ -9845,8 +9541,7 @@  discard block
 block discarded – undo
9845 9541
 		if (!empty($contributors))
9846 9542
 		{
9847 9543
 			return array_unique($contributors);
9848
-		}
9849
-		else
9544
+		} else
9850 9545
 		{
9851 9546
 			return null;
9852 9547
 		}
@@ -9927,16 +9622,13 @@  discard block
 block discarded – undo
9927 9622
 		if (!empty($authors))
9928 9623
 		{
9929 9624
 			return array_unique($authors);
9930
-		}
9931
-		elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
9625
+		} elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
9932 9626
 		{
9933 9627
 			return $authors;
9934
-		}
9935
-		elseif ($authors = $this->feed->get_authors())
9628
+		} elseif ($authors = $this->feed->get_authors())
9936 9629
 		{
9937 9630
 			return $authors;
9938
-		}
9939
-		else
9631
+		} else
9940 9632
 		{
9941 9633
 			return null;
9942 9634
 		}
@@ -9955,16 +9647,13 @@  discard block
 block discarded – undo
9955 9647
 		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
9956 9648
 		{
9957 9649
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
9958
-		}
9959
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
9650
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
9960 9651
 		{
9961 9652
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
9962
-		}
9963
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
9653
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
9964 9654
 		{
9965 9655
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
9966
-		}
9967
-		else
9656
+		} else
9968 9657
 		{
9969 9658
 			return null;
9970 9659
 		}
@@ -9991,32 +9680,25 @@  discard block
 block discarded – undo
9991 9680
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published'))
9992 9681
 			{
9993 9682
 				$this->data['date']['raw'] = $return[0]['data'];
9994
-			}
9995
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
9683
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
9996 9684
 			{
9997 9685
 				$this->data['date']['raw'] = $return[0]['data'];
9998
-			}
9999
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
9686
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
10000 9687
 			{
10001 9688
 				$this->data['date']['raw'] = $return[0]['data'];
10002
-			}
10003
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
9689
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
10004 9690
 			{
10005 9691
 				$this->data['date']['raw'] = $return[0]['data'];
10006
-			}
10007
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
9692
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
10008 9693
 			{
10009 9694
 				$this->data['date']['raw'] = $return[0]['data'];
10010
-			}
10011
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued'))
9695
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued'))
10012 9696
 			{
10013 9697
 				$this->data['date']['raw'] = $return[0]['data'];
10014
-			}
10015
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created'))
9698
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created'))
10016 9699
 			{
10017 9700
 				$this->data['date']['raw'] = $return[0]['data'];
10018
-			}
10019
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified'))
9701
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified'))
10020 9702
 			{
10021 9703
 				$this->data['date']['raw'] = $return[0]['data'];
10022 9704
 			}
@@ -10025,8 +9707,7 @@  discard block
 block discarded – undo
10025 9707
 			{
10026 9708
 				$parser = $this->registry->call('Parse_Date', 'get');
10027 9709
 				$this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
10028
-			}
10029
-			else
9710
+			} else
10030 9711
 			{
10031 9712
 				$this->data['date'] = null;
10032 9713
 			}
@@ -10045,8 +9726,7 @@  discard block
 block discarded – undo
10045 9726
 				default:
10046 9727
 					return date($date_format, $this->data['date']['parsed']);
10047 9728
 			}
10048
-		}
10049
-		else
9729
+		} else
10050 9730
 		{
10051 9731
 			return null;
10052 9732
 		}
@@ -10076,8 +9756,7 @@  discard block
 block discarded – undo
10076 9756
 			{
10077 9757
 				$parser = $this->registry->call('Parse_Date', 'get');
10078 9758
 				$this->data['updated']['parsed'] = $parser->parse($this->data['updated']['raw']);
10079
-			}
10080
-			else
9759
+			} else
10081 9760
 			{
10082 9761
 				$this->data['updated'] = null;
10083 9762
 			}
@@ -10096,8 +9775,7 @@  discard block
 block discarded – undo
10096 9775
 				default:
10097 9776
 					return date($date_format, $this->data['updated']['parsed']);
10098 9777
 			}
10099
-		}
10100
-		else
9778
+		} else
10101 9779
 		{
10102 9780
 			return null;
10103 9781
 		}
@@ -10121,12 +9799,10 @@  discard block
 block discarded – undo
10121 9799
 		if (!$date_format)
10122 9800
 		{
10123 9801
 			return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT);
10124
-		}
10125
-		elseif (($date = $this->get_date('U')) !== null && $date !== false)
9802
+		} elseif (($date = $this->get_date('U')) !== null && $date !== false)
10126 9803
 		{
10127 9804
 			return strftime($date_format, $date);
10128
-		}
10129
-		else
9805
+		} else
10130 9806
 		{
10131 9807
 			return null;
10132 9808
 		}
@@ -10185,12 +9861,10 @@  discard block
 block discarded – undo
10185 9861
 		if ($link !== null)
10186 9862
 		{
10187 9863
 			return $link;
10188
-		}
10189
-		elseif ($enclosure !== null)
9864
+		} elseif ($enclosure !== null)
10190 9865
 		{
10191 9866
 			return $enclosure->get_link();
10192
-		}
10193
-		else
9867
+		} else
10194 9868
 		{
10195 9869
 			return null;
10196 9870
 		}
@@ -10210,8 +9884,7 @@  discard block
 block discarded – undo
10210 9884
 		if ($links[$key] !== null)
10211 9885
 		{
10212 9886
 			return $links[$key];
10213
-		}
10214
-		else
9887
+		} else
10215 9888
 		{
10216 9889
 			return null;
10217 9890
 		}
@@ -10277,13 +9950,11 @@  discard block
 block discarded – undo
10277 9950
 					{
10278 9951
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
10279 9952
 						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
10280
-					}
10281
-					else
9953
+					} else
10282 9954
 					{
10283 9955
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
10284 9956
 					}
10285
-				}
10286
-				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
9957
+				} elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
10287 9958
 				{
10288 9959
 					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
10289 9960
 				}
@@ -10293,8 +9964,7 @@  discard block
 block discarded – undo
10293 9964
 		if (isset($this->data['links'][$rel]))
10294 9965
 		{
10295 9966
 			return $this->data['links'][$rel];
10296
-		}
10297
-		else
9967
+		} else
10298 9968
 		{
10299 9969
 			return null;
10300 9970
 		}
@@ -10316,8 +9986,7 @@  discard block
 block discarded – undo
10316 9986
 		if (isset($enclosures[$key]))
10317 9987
 		{
10318 9988
 			return $enclosures[$key];
10319
-		}
10320
-		else
9989
+		} else
10321 9990
 		{
10322 9991
 			return null;
10323 9992
 		}
@@ -10393,8 +10062,7 @@  discard block
 block discarded – undo
10393 10062
 					}
10394 10063
 					$captions_parent[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
10395 10064
 				}
10396
-			}
10397
-			elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
10065
+			} elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
10398 10066
 			{
10399 10067
 				foreach ($captions as $caption)
10400 10068
 				{
@@ -10444,8 +10112,7 @@  discard block
 block discarded – undo
10444 10112
 				if (isset($category['attribs']['']['scheme']))
10445 10113
 				{
10446 10114
 					$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
10447
-				}
10448
-				else
10115
+				} else
10449 10116
 				{
10450 10117
 					$scheme = 'http://search.yahoo.com/mrss/category_schema';
10451 10118
 				}
@@ -10467,8 +10134,7 @@  discard block
 block discarded – undo
10467 10134
 				if (isset($category['attribs']['']['scheme']))
10468 10135
 				{
10469 10136
 					$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
10470
-				}
10471
-				else
10137
+				} else
10472 10138
 				{
10473 10139
 					$scheme = 'http://search.yahoo.com/mrss/category_schema';
10474 10140
 				}
@@ -10520,8 +10186,7 @@  discard block
 block discarded – undo
10520 10186
 					$copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
10521 10187
 				}
10522 10188
 				$copyrights_parent = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
10523
-			}
10524
-			elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
10189
+			} elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
10525 10190
 			{
10526 10191
 				$copyright_url = null;
10527 10192
 				$copyright_label = null;
@@ -10551,8 +10216,7 @@  discard block
 block discarded – undo
10551 10216
 					if (isset($credit['attribs']['']['scheme']))
10552 10217
 					{
10553 10218
 						$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
10554
-					}
10555
-					else
10219
+					} else
10556 10220
 					{
10557 10221
 						$credit_scheme = 'urn:ebu';
10558 10222
 					}
@@ -10562,8 +10226,7 @@  discard block
 block discarded – undo
10562 10226
 					}
10563 10227
 					$credits_parent[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
10564 10228
 				}
10565
-			}
10566
-			elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
10229
+			} elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
10567 10230
 			{
10568 10231
 				foreach ($credits as $credit)
10569 10232
 				{
@@ -10577,8 +10240,7 @@  discard block
 block discarded – undo
10577 10240
 					if (isset($credit['attribs']['']['scheme']))
10578 10241
 					{
10579 10242
 						$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
10580
-					}
10581
-					else
10243
+					} else
10582 10244
 					{
10583 10245
 						$credit_scheme = 'urn:ebu';
10584 10246
 					}
@@ -10601,8 +10263,7 @@  discard block
 block discarded – undo
10601 10263
 				{
10602 10264
 					$description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
10603 10265
 				}
10604
-			}
10605
-			elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
10266
+			} elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
10606 10267
 			{
10607 10268
 				if (isset($description_parent[0]['data']))
10608 10269
 				{
@@ -10652,15 +10313,13 @@  discard block
 block discarded – undo
10652 10313
 					if (isset($hash['attribs']['']['algo']))
10653 10314
 					{
10654 10315
 						$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
10655
-					}
10656
-					else
10316
+					} else
10657 10317
 					{
10658 10318
 						$algo = 'md5';
10659 10319
 					}
10660 10320
 					$hashes_parent[] = $algo.':'.$value;
10661 10321
 				}
10662
-			}
10663
-			elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
10322
+			} elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
10664 10323
 			{
10665 10324
 				foreach ($hashes_iterator as $hash)
10666 10325
 				{
@@ -10673,8 +10332,7 @@  discard block
 block discarded – undo
10673 10332
 					if (isset($hash['attribs']['']['algo']))
10674 10333
 					{
10675 10334
 						$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
10676
-					}
10677
-					else
10335
+					} else
10678 10336
 					{
10679 10337
 						$algo = 'md5';
10680 10338
 					}
@@ -10698,8 +10356,7 @@  discard block
 block discarded – undo
10698 10356
 					}
10699 10357
 				}
10700 10358
 				unset($temp);
10701
-			}
10702
-			elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
10359
+			} elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
10703 10360
 			{
10704 10361
 				if (isset($keywords[0]['data']))
10705 10362
 				{
@@ -10710,8 +10367,7 @@  discard block
 block discarded – undo
10710 10367
 					}
10711 10368
 				}
10712 10369
 				unset($temp);
10713
-			}
10714
-			elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
10370
+			} elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
10715 10371
 			{
10716 10372
 				if (isset($keywords[0]['data']))
10717 10373
 				{
@@ -10722,8 +10378,7 @@  discard block
 block discarded – undo
10722 10378
 					}
10723 10379
 				}
10724 10380
 				unset($temp);
10725
-			}
10726
-			elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
10381
+			} elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
10727 10382
 			{
10728 10383
 				if (isset($keywords[0]['data']))
10729 10384
 				{
@@ -10747,8 +10402,7 @@  discard block
 block discarded – undo
10747 10402
 				{
10748 10403
 					$player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
10749 10404
 				}
10750
-			}
10751
-			elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
10405
+			} elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
10752 10406
 			{
10753 10407
 				if (isset($player_parent[0]['attribs']['']['url']))
10754 10408
 				{
@@ -10766,8 +10420,7 @@  discard block
 block discarded – undo
10766 10420
 					if (isset($rating['attribs']['']['scheme']))
10767 10421
 					{
10768 10422
 						$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
10769
-					}
10770
-					else
10423
+					} else
10771 10424
 					{
10772 10425
 						$rating_scheme = 'urn:simple';
10773 10426
 					}
@@ -10777,8 +10430,7 @@  discard block
 block discarded – undo
10777 10430
 					}
10778 10431
 					$ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
10779 10432
 				}
10780
-			}
10781
-			elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
10433
+			} elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
10782 10434
 			{
10783 10435
 				foreach ($ratings as $rating)
10784 10436
 				{
@@ -10790,8 +10442,7 @@  discard block
 block discarded – undo
10790 10442
 					}
10791 10443
 					$ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
10792 10444
 				}
10793
-			}
10794
-			elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
10445
+			} elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
10795 10446
 			{
10796 10447
 				foreach ($ratings as $rating)
10797 10448
 				{
@@ -10800,8 +10451,7 @@  discard block
 block discarded – undo
10800 10451
 					if (isset($rating['attribs']['']['scheme']))
10801 10452
 					{
10802 10453
 						$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
10803
-					}
10804
-					else
10454
+					} else
10805 10455
 					{
10806 10456
 						$rating_scheme = 'urn:simple';
10807 10457
 					}
@@ -10811,8 +10461,7 @@  discard block
 block discarded – undo
10811 10461
 					}
10812 10462
 					$ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
10813 10463
 				}
10814
-			}
10815
-			elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
10464
+			} elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
10816 10465
 			{
10817 10466
 				foreach ($ratings as $rating)
10818 10467
 				{
@@ -10852,8 +10501,7 @@  discard block
 block discarded – undo
10852 10501
 					}
10853 10502
 					$restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
10854 10503
 				}
10855
-			}
10856
-			elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
10504
+			} elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
10857 10505
 			{
10858 10506
 				foreach ($restrictions as $restriction)
10859 10507
 				{
@@ -10866,8 +10514,7 @@  discard block
 block discarded – undo
10866 10514
 					}
10867 10515
 					$restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
10868 10516
 				}
10869
-			}
10870
-			elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
10517
+			} elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
10871 10518
 			{
10872 10519
 				foreach ($restrictions as $restriction)
10873 10520
 				{
@@ -10888,8 +10535,7 @@  discard block
 block discarded – undo
10888 10535
 					}
10889 10536
 					$restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
10890 10537
 				}
10891
-			}
10892
-			elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
10538
+			} elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
10893 10539
 			{
10894 10540
 				foreach ($restrictions as $restriction)
10895 10541
 				{
@@ -10906,8 +10552,7 @@  discard block
 block discarded – undo
10906 10552
 			if (is_array($restrictions_parent))
10907 10553
 			{
10908 10554
 				$restrictions_parent = array_values(array_unique($restrictions_parent));
10909
-			}
10910
-			else
10555
+			} else
10911 10556
 			{
10912 10557
 				$restrictions_parent = array(new SimplePie_Restriction('allow', null, 'default'));
10913 10558
 			}
@@ -10922,8 +10567,7 @@  discard block
 block discarded – undo
10922 10567
 						$thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
10923 10568
 					}
10924 10569
 				}
10925
-			}
10926
-			elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
10570
+			} elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
10927 10571
 			{
10928 10572
 				foreach ($thumbnails as $thumbnail)
10929 10573
 				{
@@ -10941,8 +10585,7 @@  discard block
 block discarded – undo
10941 10585
 				{
10942 10586
 					$title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
10943 10587
 				}
10944
-			}
10945
-			elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title'))
10588
+			} elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title'))
10946 10589
 			{
10947 10590
 				if (isset($title_parent[0]['data']))
10948 10591
 				{
@@ -11035,8 +10678,7 @@  discard block
 block discarded – undo
11035 10678
 							if (isset($content['attribs']['']['duration']))
11036 10679
 							{
11037 10680
 								$duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
11038
-							}
11039
-							else
10681
+							} else
11040 10682
 							{
11041 10683
 								$duration = $duration_parent;
11042 10684
 							}
@@ -11116,8 +10758,7 @@  discard block
 block discarded – undo
11116 10758
 								{
11117 10759
 									$captions = array_values(array_unique($captions));
11118 10760
 								}
11119
-							}
11120
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
10761
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
11121 10762
 							{
11122 10763
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
11123 10764
 								{
@@ -11152,8 +10793,7 @@  discard block
 block discarded – undo
11152 10793
 								{
11153 10794
 									$captions = array_values(array_unique($captions));
11154 10795
 								}
11155
-							}
11156
-							else
10796
+							} else
11157 10797
 							{
11158 10798
 								$captions = $captions_parent;
11159 10799
 							}
@@ -11173,8 +10813,7 @@  discard block
 block discarded – undo
11173 10813
 									if (isset($category['attribs']['']['scheme']))
11174 10814
 									{
11175 10815
 										$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
11176
-									}
11177
-									else
10816
+									} else
11178 10817
 									{
11179 10818
 										$scheme = 'http://search.yahoo.com/mrss/category_schema';
11180 10819
 									}
@@ -11199,8 +10838,7 @@  discard block
 block discarded – undo
11199 10838
 									if (isset($category['attribs']['']['scheme']))
11200 10839
 									{
11201 10840
 										$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
11202
-									}
11203
-									else
10841
+									} else
11204 10842
 									{
11205 10843
 										$scheme = 'http://search.yahoo.com/mrss/category_schema';
11206 10844
 									}
@@ -11214,12 +10852,10 @@  discard block
 block discarded – undo
11214 10852
 							if (is_array($categories) && is_array($categories_parent))
11215 10853
 							{
11216 10854
 								$categories = array_values(array_unique(array_merge($categories, $categories_parent)));
11217
-							}
11218
-							elseif (is_array($categories))
10855
+							} elseif (is_array($categories))
11219 10856
 							{
11220 10857
 								$categories = array_values(array_unique($categories));
11221
-							}
11222
-							elseif (is_array($categories_parent))
10858
+							} elseif (is_array($categories_parent))
11223 10859
 							{
11224 10860
 								$categories = array_values(array_unique($categories_parent));
11225 10861
 							}
@@ -11238,8 +10874,7 @@  discard block
 block discarded – undo
11238 10874
 									$copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
11239 10875
 								}
11240 10876
 								$copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
11241
-							}
11242
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
10877
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
11243 10878
 							{
11244 10879
 								$copyright_url = null;
11245 10880
 								$copyright_label = null;
@@ -11252,8 +10887,7 @@  discard block
 block discarded – undo
11252 10887
 									$copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
11253 10888
 								}
11254 10889
 								$copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
11255
-							}
11256
-							else
10890
+							} else
11257 10891
 							{
11258 10892
 								$copyrights = $copyrights_parent;
11259 10893
 							}
@@ -11273,8 +10907,7 @@  discard block
 block discarded – undo
11273 10907
 									if (isset($credit['attribs']['']['scheme']))
11274 10908
 									{
11275 10909
 										$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
11276
-									}
11277
-									else
10910
+									} else
11278 10911
 									{
11279 10912
 										$credit_scheme = 'urn:ebu';
11280 10913
 									}
@@ -11288,8 +10921,7 @@  discard block
 block discarded – undo
11288 10921
 								{
11289 10922
 									$credits = array_values(array_unique($credits));
11290 10923
 								}
11291
-							}
11292
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
10924
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
11293 10925
 							{
11294 10926
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
11295 10927
 								{
@@ -11303,8 +10935,7 @@  discard block
 block discarded – undo
11303 10935
 									if (isset($credit['attribs']['']['scheme']))
11304 10936
 									{
11305 10937
 										$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
11306
-									}
11307
-									else
10938
+									} else
11308 10939
 									{
11309 10940
 										$credit_scheme = 'urn:ebu';
11310 10941
 									}
@@ -11318,8 +10949,7 @@  discard block
 block discarded – undo
11318 10949
 								{
11319 10950
 									$credits = array_values(array_unique($credits));
11320 10951
 								}
11321
-							}
11322
-							else
10952
+							} else
11323 10953
 							{
11324 10954
 								$credits = $credits_parent;
11325 10955
 							}
@@ -11328,12 +10958,10 @@  discard block
 block discarded – undo
11328 10958
 							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
11329 10959
 							{
11330 10960
 								$description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
11331
-							}
11332
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
10961
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
11333 10962
 							{
11334 10963
 								$description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
11335
-							}
11336
-							else
10964
+							} else
11337 10965
 							{
11338 10966
 								$description = $description_parent;
11339 10967
 							}
@@ -11352,8 +10980,7 @@  discard block
 block discarded – undo
11352 10980
 									if (isset($hash['attribs']['']['algo']))
11353 10981
 									{
11354 10982
 										$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
11355
-									}
11356
-									else
10983
+									} else
11357 10984
 									{
11358 10985
 										$algo = 'md5';
11359 10986
 									}
@@ -11363,8 +10990,7 @@  discard block
 block discarded – undo
11363 10990
 								{
11364 10991
 									$hashes = array_values(array_unique($hashes));
11365 10992
 								}
11366
-							}
11367
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
10993
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
11368 10994
 							{
11369 10995
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
11370 10996
 								{
@@ -11377,8 +11003,7 @@  discard block
 block discarded – undo
11377 11003
 									if (isset($hash['attribs']['']['algo']))
11378 11004
 									{
11379 11005
 										$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
11380
-									}
11381
-									else
11006
+									} else
11382 11007
 									{
11383 11008
 										$algo = 'md5';
11384 11009
 									}
@@ -11388,8 +11013,7 @@  discard block
 block discarded – undo
11388 11013
 								{
11389 11014
 									$hashes = array_values(array_unique($hashes));
11390 11015
 								}
11391
-							}
11392
-							else
11016
+							} else
11393 11017
 							{
11394 11018
 								$hashes = $hashes_parent;
11395 11019
 							}
@@ -11410,8 +11034,7 @@  discard block
 block discarded – undo
11410 11034
 								{
11411 11035
 									$keywords = array_values(array_unique($keywords));
11412 11036
 								}
11413
-							}
11414
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
11037
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
11415 11038
 							{
11416 11039
 								if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
11417 11040
 								{
@@ -11426,8 +11049,7 @@  discard block
 block discarded – undo
11426 11049
 								{
11427 11050
 									$keywords = array_values(array_unique($keywords));
11428 11051
 								}
11429
-							}
11430
-							else
11052
+							} else
11431 11053
 							{
11432 11054
 								$keywords = $keywords_parent;
11433 11055
 							}
@@ -11436,12 +11058,10 @@  discard block
 block discarded – undo
11436 11058
 							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
11437 11059
 							{
11438 11060
 								$player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
11439
-							}
11440
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
11061
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
11441 11062
 							{
11442 11063
 								$player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
11443
-							}
11444
-							else
11064
+							} else
11445 11065
 							{
11446 11066
 								$player = $player_parent;
11447 11067
 							}
@@ -11456,8 +11076,7 @@  discard block
 block discarded – undo
11456 11076
 									if (isset($rating['attribs']['']['scheme']))
11457 11077
 									{
11458 11078
 										$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
11459
-									}
11460
-									else
11079
+									} else
11461 11080
 									{
11462 11081
 										$rating_scheme = 'urn:simple';
11463 11082
 									}
@@ -11471,8 +11090,7 @@  discard block
 block discarded – undo
11471 11090
 								{
11472 11091
 									$ratings = array_values(array_unique($ratings));
11473 11092
 								}
11474
-							}
11475
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
11093
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
11476 11094
 							{
11477 11095
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
11478 11096
 								{
@@ -11481,8 +11099,7 @@  discard block
 block discarded – undo
11481 11099
 									if (isset($rating['attribs']['']['scheme']))
11482 11100
 									{
11483 11101
 										$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
11484
-									}
11485
-									else
11102
+									} else
11486 11103
 									{
11487 11104
 										$rating_scheme = 'urn:simple';
11488 11105
 									}
@@ -11496,8 +11113,7 @@  discard block
 block discarded – undo
11496 11113
 								{
11497 11114
 									$ratings = array_values(array_unique($ratings));
11498 11115
 								}
11499
-							}
11500
-							else
11116
+							} else
11501 11117
 							{
11502 11118
 								$ratings = $ratings_parent;
11503 11119
 							}
@@ -11528,8 +11144,7 @@  discard block
 block discarded – undo
11528 11144
 								{
11529 11145
 									$restrictions = array_values(array_unique($restrictions));
11530 11146
 								}
11531
-							}
11532
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
11147
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
11533 11148
 							{
11534 11149
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
11535 11150
 								{
@@ -11554,8 +11169,7 @@  discard block
 block discarded – undo
11554 11169
 								{
11555 11170
 									$restrictions = array_values(array_unique($restrictions));
11556 11171
 								}
11557
-							}
11558
-							else
11172
+							} else
11559 11173
 							{
11560 11174
 								$restrictions = $restrictions_parent;
11561 11175
 							}
@@ -11571,8 +11185,7 @@  discard block
 block discarded – undo
11571 11185
 								{
11572 11186
 									$thumbnails = array_values(array_unique($thumbnails));
11573 11187
 								}
11574
-							}
11575
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
11188
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
11576 11189
 							{
11577 11190
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
11578 11191
 								{
@@ -11582,8 +11195,7 @@  discard block
 block discarded – undo
11582 11195
 								{
11583 11196
 									$thumbnails = array_values(array_unique($thumbnails));
11584 11197
 								}
11585
-							}
11586
-							else
11198
+							} else
11587 11199
 							{
11588 11200
 								$thumbnails = $thumbnails_parent;
11589 11201
 							}
@@ -11592,12 +11204,10 @@  discard block
 block discarded – undo
11592 11204
 							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
11593 11205
 							{
11594 11206
 								$title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
11595
-							}
11596
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
11207
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
11597 11208
 							{
11598 11209
 								$title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
11599
-							}
11600
-							else
11210
+							} else
11601 11211
 							{
11602 11212
 								$title = $title_parent;
11603 11213
 							}
@@ -11657,8 +11267,7 @@  discard block
 block discarded – undo
11657 11267
 						if (isset($content['attribs']['']['duration']))
11658 11268
 						{
11659 11269
 							$duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
11660
-						}
11661
-						else
11270
+						} else
11662 11271
 						{
11663 11272
 							$duration = $duration_parent;
11664 11273
 						}
@@ -11740,8 +11349,7 @@  discard block
 block discarded – undo
11740 11349
 							{
11741 11350
 								$captions = array_values(array_unique($captions));
11742 11351
 							}
11743
-						}
11744
-						else
11352
+						} else
11745 11353
 						{
11746 11354
 							$captions = $captions_parent;
11747 11355
 						}
@@ -11761,8 +11369,7 @@  discard block
 block discarded – undo
11761 11369
 								if (isset($category['attribs']['']['scheme']))
11762 11370
 								{
11763 11371
 									$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
11764
-								}
11765
-								else
11372
+								} else
11766 11373
 								{
11767 11374
 									$scheme = 'http://search.yahoo.com/mrss/category_schema';
11768 11375
 								}
@@ -11776,16 +11383,13 @@  discard block
 block discarded – undo
11776 11383
 						if (is_array($categories) && is_array($categories_parent))
11777 11384
 						{
11778 11385
 							$categories = array_values(array_unique(array_merge($categories, $categories_parent)));
11779
-						}
11780
-						elseif (is_array($categories))
11386
+						} elseif (is_array($categories))
11781 11387
 						{
11782 11388
 							$categories = array_values(array_unique($categories));
11783
-						}
11784
-						elseif (is_array($categories_parent))
11389
+						} elseif (is_array($categories_parent))
11785 11390
 						{
11786 11391
 							$categories = array_values(array_unique($categories_parent));
11787
-						}
11788
-						else
11392
+						} else
11789 11393
 						{
11790 11394
 							$categories = null;
11791 11395
 						}
@@ -11804,8 +11408,7 @@  discard block
 block discarded – undo
11804 11408
 								$copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
11805 11409
 							}
11806 11410
 							$copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
11807
-						}
11808
-						else
11411
+						} else
11809 11412
 						{
11810 11413
 							$copyrights = $copyrights_parent;
11811 11414
 						}
@@ -11825,8 +11428,7 @@  discard block
 block discarded – undo
11825 11428
 								if (isset($credit['attribs']['']['scheme']))
11826 11429
 								{
11827 11430
 									$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
11828
-								}
11829
-								else
11431
+								} else
11830 11432
 								{
11831 11433
 									$credit_scheme = 'urn:ebu';
11832 11434
 								}
@@ -11840,8 +11442,7 @@  discard block
 block discarded – undo
11840 11442
 							{
11841 11443
 								$credits = array_values(array_unique($credits));
11842 11444
 							}
11843
-						}
11844
-						else
11445
+						} else
11845 11446
 						{
11846 11447
 							$credits = $credits_parent;
11847 11448
 						}
@@ -11850,8 +11451,7 @@  discard block
 block discarded – undo
11850 11451
 						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
11851 11452
 						{
11852 11453
 							$description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
11853
-						}
11854
-						else
11454
+						} else
11855 11455
 						{
11856 11456
 							$description = $description_parent;
11857 11457
 						}
@@ -11870,8 +11470,7 @@  discard block
 block discarded – undo
11870 11470
 								if (isset($hash['attribs']['']['algo']))
11871 11471
 								{
11872 11472
 									$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
11873
-								}
11874
-								else
11473
+								} else
11875 11474
 								{
11876 11475
 									$algo = 'md5';
11877 11476
 								}
@@ -11881,8 +11480,7 @@  discard block
 block discarded – undo
11881 11480
 							{
11882 11481
 								$hashes = array_values(array_unique($hashes));
11883 11482
 							}
11884
-						}
11885
-						else
11483
+						} else
11886 11484
 						{
11887 11485
 							$hashes = $hashes_parent;
11888 11486
 						}
@@ -11903,8 +11501,7 @@  discard block
 block discarded – undo
11903 11501
 							{
11904 11502
 								$keywords = array_values(array_unique($keywords));
11905 11503
 							}
11906
-						}
11907
-						else
11504
+						} else
11908 11505
 						{
11909 11506
 							$keywords = $keywords_parent;
11910 11507
 						}
@@ -11915,8 +11512,7 @@  discard block
 block discarded – undo
11915 11512
 							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'])) {
11916 11513
 								$player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
11917 11514
 							}
11918
-						}
11919
-						else
11515
+						} else
11920 11516
 						{
11921 11517
 							$player = $player_parent;
11922 11518
 						}
@@ -11931,8 +11527,7 @@  discard block
 block discarded – undo
11931 11527
 								if (isset($rating['attribs']['']['scheme']))
11932 11528
 								{
11933 11529
 									$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
11934
-								}
11935
-								else
11530
+								} else
11936 11531
 								{
11937 11532
 									$rating_scheme = 'urn:simple';
11938 11533
 								}
@@ -11946,8 +11541,7 @@  discard block
 block discarded – undo
11946 11541
 							{
11947 11542
 								$ratings = array_values(array_unique($ratings));
11948 11543
 							}
11949
-						}
11950
-						else
11544
+						} else
11951 11545
 						{
11952 11546
 							$ratings = $ratings_parent;
11953 11547
 						}
@@ -11978,8 +11572,7 @@  discard block
 block discarded – undo
11978 11572
 							{
11979 11573
 								$restrictions = array_values(array_unique($restrictions));
11980 11574
 							}
11981
-						}
11982
-						else
11575
+						} else
11983 11576
 						{
11984 11577
 							$restrictions = $restrictions_parent;
11985 11578
 						}
@@ -11997,8 +11590,7 @@  discard block
 block discarded – undo
11997 11590
 							{
11998 11591
 								$thumbnails = array_values(array_unique($thumbnails));
11999 11592
 							}
12000
-						}
12001
-						else
11593
+						} else
12002 11594
 						{
12003 11595
 							$thumbnails = $thumbnails_parent;
12004 11596
 						}
@@ -12007,8 +11599,7 @@  discard block
 block discarded – undo
12007 11599
 						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
12008 11600
 						{
12009 11601
 							$title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
12010
-						}
12011
-						else
11602
+						} else
12012 11603
 						{
12013 11604
 							$title = $title_parent;
12014 11605
 						}
@@ -12050,8 +11641,7 @@  discard block
 block discarded – undo
12050 11641
 					if (isset($link['attribs']['']['title']))
12051 11642
 					{
12052 11643
 						$title = $this->sanitize($link['attribs']['']['title'], SIMPLEPIE_CONSTRUCT_TEXT);
12053
-					}
12054
-					else
11644
+					} else
12055 11645
 					{
12056 11646
 						$title = $title_parent;
12057 11647
 					}
@@ -12142,8 +11732,7 @@  discard block
 block discarded – undo
12142 11732
 		if (!empty($this->data['enclosures']))
12143 11733
 		{
12144 11734
 			return $this->data['enclosures'];
12145
-		}
12146
-		else
11735
+		} else
12147 11736
 		{
12148 11737
 			return null;
12149 11738
 		}
@@ -12166,12 +11755,10 @@  discard block
 block discarded – undo
12166 11755
 		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
12167 11756
 		{
12168 11757
 			return (float) $return[0]['data'];
12169
-		}
12170
-		elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
11758
+		} elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
12171 11759
 		{
12172 11760
 			return (float) $match[1];
12173
-		}
12174
-		else
11761
+		} else
12175 11762
 		{
12176 11763
 			return null;
12177 11764
 		}
@@ -12194,16 +11781,13 @@  discard block
 block discarded – undo
12194 11781
 		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
12195 11782
 		{
12196 11783
 			return (float) $return[0]['data'];
12197
-		}
12198
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
11784
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
12199 11785
 		{
12200 11786
 			return (float) $return[0]['data'];
12201
-		}
12202
-		elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
11787
+		} elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
12203 11788
 		{
12204 11789
 			return (float) $match[2];
12205
-		}
12206
-		else
11790
+		} else
12207 11791
 		{
12208 11792
 			return null;
12209 11793
 		}
@@ -12220,8 +11804,7 @@  discard block
 block discarded – undo
12220 11804
 		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source'))
12221 11805
 		{
12222 11806
 			return $this->registry->create('Source', array($this, $return[0]));
12223
-		}
12224
-		else
11807
+		} else
12225 11808
 		{
12226 11809
 			return null;
12227 11810
 		}
@@ -12265,8 +11848,7 @@  discard block
 block discarded – undo
12265 11848
 			set_error_handler(array('SimplePie_Misc', 'silence_errors'));
12266 11849
 			$this->dom->loadHTML($this->file->body);
12267 11850
 			restore_error_handler();
12268
-		}
12269
-		else
11851
+		} else
12270 11852
 		{
12271 11853
 			$this->dom = null;
12272 11854
 		}
@@ -12344,17 +11926,14 @@  discard block
 block discarded – undo
12344 11926
 			if (in_array($sniffed, $mime_types))
12345 11927
 			{
12346 11928
 				return true;
12347
-			}
12348
-			else
11929
+			} else
12349 11930
 			{
12350 11931
 				return false;
12351 11932
 			}
12352
-		}
12353
-		elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL)
11933
+		} elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL)
12354 11934
 		{
12355 11935
 			return true;
12356
-		}
12357
-		else
11936
+		} else
12358 11937
 		{
12359 11938
 			return false;
12360 11939
 		}
@@ -12396,8 +11975,7 @@  discard block
 block discarded – undo
12396 11975
 		if (!empty($feeds))
12397 11976
 		{
12398 11977
 			return array_values($feeds);
12399
-		}
12400
-		else
11978
+		} else
12401 11979
 		{
12402 11980
 			return null;
12403 11981
 		}
@@ -12425,8 +12003,7 @@  discard block
 block discarded – undo
12425 12003
 				if ($this->base_location < $line)
12426 12004
 				{
12427 12005
 					$href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->base));
12428
-				}
12429
-				else
12006
+				} else
12430 12007
 				{
12431 12008
 					$href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base));
12432 12009
 				}
@@ -12473,8 +12050,7 @@  discard block
 block discarded – undo
12473 12050
 					if (method_exists($link, 'getLineNo') && $this->base_location < $link->getLineNo())
12474 12051
 					{
12475 12052
 						$href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->base));
12476
-					}
12477
-					else
12053
+					} else
12478 12054
 					{
12479 12055
 						$href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base));
12480 12056
 					}
@@ -12488,8 +12064,7 @@  discard block
 block discarded – undo
12488 12064
 					if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority'])
12489 12065
 					{
12490 12066
 						$this->local[] = $href;
12491
-					}
12492
-					else
12067
+					} else
12493 12068
 					{
12494 12069
 						$this->elsewhere[] = $href;
12495 12070
 					}
@@ -12534,8 +12109,7 @@  discard block
 block discarded – undo
12534 12109
 						$this->registry->call('Misc', 'absolutize_url',
12535 12110
 						                      array(trim($link->getAttribute('href')),
12536 12111
 						                            $this->base));
12537
-				}
12538
-				else
12112
+				} else
12539 12113
 				{
12540 12114
 					$href =
12541 12115
 						$this->registry->call('Misc', 'absolutize_url',
@@ -12575,8 +12149,7 @@  discard block
 block discarded – undo
12575 12149
 				if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
12576 12150
 				{
12577 12151
 					return array($feed);
12578
-				}
12579
-				else
12152
+				} else
12580 12153
 				{
12581 12154
 					unset($array[$key]);
12582 12155
 				}
@@ -12603,8 +12176,7 @@  discard block
 block discarded – undo
12603 12176
 				if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed))
12604 12177
 				{
12605 12178
 					return array($feed);
12606
-				}
12607
-				else
12179
+				} else
12608 12180
 				{
12609 12181
 					unset($array[$key]);
12610 12182
 				}
@@ -12681,8 +12253,7 @@  discard block
 block discarded – undo
12681 12253
 				if (strlen($matches[$i][3][0]) <= 2)
12682 12254
 				{
12683 12255
 					$return[$i]['self_closing'] = true;
12684
-				}
12685
-				else
12256
+				} else
12686 12257
 				{
12687 12258
 					$return[$i]['self_closing'] = false;
12688 12259
 					$return[$i]['content'] = $matches[$i][4][0];
@@ -12715,8 +12286,7 @@  discard block
 block discarded – undo
12715 12286
 		if ($element['self_closing'])
12716 12287
 		{
12717 12288
 			$full .= ' />';
12718
-		}
12719
-		else
12289
+		} else
12720 12290
 		{
12721 12291
 			$full .= ">$element[content]</$element[tag]>";
12722 12292
 		}
@@ -12781,16 +12351,13 @@  discard block
 block discarded – undo
12781 12351
 		if ($http === 2 && $parsed['scheme'] !== '')
12782 12352
 		{
12783 12353
 			return "feed:$url";
12784
-		}
12785
-		elseif ($http === 3 && strtolower($parsed['scheme']) === 'http')
12354
+		} elseif ($http === 3 && strtolower($parsed['scheme']) === 'http')
12786 12355
 		{
12787 12356
 			return substr_replace($url, 'podcast', 0, 4);
12788
-		}
12789
-		elseif ($http === 4 && strtolower($parsed['scheme']) === 'http')
12357
+		} elseif ($http === 4 && strtolower($parsed['scheme']) === 'http')
12790 12358
 		{
12791 12359
 			return substr_replace($url, 'itpc', 0, 4);
12792
-		}
12793
-		else
12360
+		} else
12794 12361
 		{
12795 12362
 			return $url;
12796 12363
 		}
@@ -12803,8 +12370,7 @@  discard block
 block discarded – undo
12803 12370
 			if (is_array($value))
12804 12371
 			{
12805 12372
 				$array1[$key] = SimplePie_Misc::array_merge_recursive($array1[$key], $value);
12806
-			}
12807
-			else
12373
+			} else
12808 12374
 			{
12809 12375
 				$array1[$key] = $value;
12810 12376
 			}            
@@ -12848,8 +12414,7 @@  discard block
 block discarded – undo
12848 12414
 		if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E)
12849 12415
 		{
12850 12416
 			return chr($integer);
12851
-		}
12852
-		else
12417
+		} else
12853 12418
 		{
12854 12419
 			return strtoupper($match[0]);
12855 12420
 		}
@@ -14306,16 +13871,13 @@  discard block
 block discarded – undo
14306 13871
 		if (is_array($curl = curl_version()))
14307 13872
 		{
14308 13873
 			$curl = $curl['version'];
14309
-		}
14310
-		elseif (substr($curl, 0, 5) === 'curl/')
13874
+		} elseif (substr($curl, 0, 5) === 'curl/')
14311 13875
 		{
14312 13876
 			$curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
14313
-		}
14314
-		elseif (substr($curl, 0, 8) === 'libcurl/')
13877
+		} elseif (substr($curl, 0, 8) === 'libcurl/')
14315 13878
 		{
14316 13879
 			$curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
14317
-		}
14318
-		else
13880
+		} else
14319 13881
 		{
14320 13882
 			$curl = 0;
14321 13883
 		}
@@ -14337,8 +13899,7 @@  discard block
 block discarded – undo
14337 13899
 			if (($end = strpos($data, '-->', $start)) !== false)
14338 13900
 			{
14339 13901
 				$data = substr_replace($data, '', 0, $end + 3);
14340
-			}
14341
-			else
13902
+			} else
14342 13903
 			{
14343 13904
 				$data = '';
14344 13905
 			}
@@ -14394,8 +13955,7 @@  discard block
 block discarded – undo
14394 13955
 					{
14395 13956
 						$position++;
14396 13957
 						continue;
14397
-					}
14398
-					elseif (isset($string[$position]))
13958
+					} elseif (isset($string[$position]))
14399 13959
 					{
14400 13960
 						switch ($string[$position])
14401 13961
 						{
@@ -14408,14 +13968,12 @@  discard block
 block discarded – undo
14408 13968
 								break;
14409 13969
 						}
14410 13970
 						$position++;
14411
-					}
14412
-					else
13971
+					} else
14413 13972
 					{
14414 13973
 						break;
14415 13974
 					}
14416 13975
 				}
14417
-			}
14418
-			else
13976
+			} else
14419 13977
 			{
14420 13978
 				$output .= '(';
14421 13979
 			}
@@ -14430,8 +13988,7 @@  discard block
 block discarded – undo
14430 13988
 		if (($pos = strpos($mime, ';')) === false)
14431 13989
 		{
14432 13990
 			return trim($mime);
14433
-		}
14434
-		else
13991
+		} else
14435 13992
 		{
14436 13993
 			return trim(substr($mime, 0, $pos));
14437 13994
 		}
@@ -14442,8 +13999,7 @@  discard block
 block discarded – undo
14442 13999
 		if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64'))
14443 14000
 		{
14444 14001
 			$mode = SIMPLEPIE_CONSTRUCT_BASE64;
14445
-		}
14446
-		else
14002
+		} else
14447 14003
 		{
14448 14004
 			$mode = SIMPLEPIE_CONSTRUCT_NONE;
14449 14005
 		}
@@ -14466,8 +14022,7 @@  discard block
 block discarded – undo
14466 14022
 				default:
14467 14023
 					return SIMPLEPIE_CONSTRUCT_NONE | $mode;
14468 14024
 			}
14469
-		}
14470
-		else
14025
+		} else
14471 14026
 		{
14472 14027
 			return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
14473 14028
 		}
@@ -14514,13 +14069,11 @@  discard block
 block discarded – undo
14514 14069
 			if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/')
14515 14070
 			{
14516 14071
 				return SIMPLEPIE_CONSTRUCT_NONE;
14517
-			}
14518
-			else
14072
+			} else
14519 14073
 			{
14520 14074
 				return SIMPLEPIE_CONSTRUCT_BASE64;
14521 14075
 			}
14522
-		}
14523
-		else
14076
+		} else
14524 14077
 		{
14525 14078
 			return SIMPLEPIE_CONSTRUCT_TEXT;
14526 14079
 		}
@@ -14563,24 +14116,19 @@  discard block
 block discarded – undo
14563 14116
 		if ($codepoint < 0)
14564 14117
 		{
14565 14118
 			return false;
14566
-		}
14567
-		else if ($codepoint <= 0x7f)
14119
+		} else if ($codepoint <= 0x7f)
14568 14120
 		{
14569 14121
 			return chr($codepoint);
14570
-		}
14571
-		else if ($codepoint <= 0x7ff)
14122
+		} else if ($codepoint <= 0x7ff)
14572 14123
 		{
14573 14124
 			return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
14574
-		}
14575
-		else if ($codepoint <= 0xffff)
14125
+		} else if ($codepoint <= 0xffff)
14576 14126
 		{
14577 14127
 			return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
14578
-		}
14579
-		else if ($codepoint <= 0x10ffff)
14128
+		} else if ($codepoint <= 0x10ffff)
14580 14129
 		{
14581 14130
 			return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
14582
-		}
14583
-		else
14131
+		} else
14584 14132
 		{
14585 14133
 			// U+FFFD REPLACEMENT CHARACTER
14586 14134
 			return "\xEF\xBF\xBD";
@@ -14608,8 +14156,7 @@  discard block
 block discarded – undo
14608 14156
 			{
14609 14157
 				list($name, $value) = explode('=', $section, 2);
14610 14158
 				$return[urldecode($name)][] = urldecode($value);
14611
-			}
14612
-			else
14159
+			} else
14613 14160
 			{
14614 14161
 				$return[urldecode($section)][] = null;
14615 14162
 			}
@@ -14771,8 +14318,7 @@  discard block
 block discarded – undo
14771 14318
 		if (file_exists($root . '/.git/index'))
14772 14319
 		{
14773 14320
 			return filemtime($root . '/.git/index');
14774
-		}
14775
-		elseif (file_exists($root . '/SimplePie'))
14321
+		} elseif (file_exists($root . '/SimplePie'))
14776 14322
 		{
14777 14323
 			$time = 0;
14778 14324
 			foreach (glob($root . '/SimplePie/*.php') as $file)
@@ -14783,12 +14329,10 @@  discard block
 block discarded – undo
14783 14329
 				}
14784 14330
 			}
14785 14331
 			return $time;
14786
-		}
14787
-		elseif (file_exists(dirname(__FILE__) . '/Core.php'))
14332
+		} elseif (file_exists(dirname(__FILE__) . '/Core.php'))
14788 14333
 		{
14789 14334
 			return filemtime(dirname(__FILE__) . '/Core.php');
14790
-		}
14791
-		else
14335
+		} else
14792 14336
 		{
14793 14337
 			return filemtime(__FILE__);
14794 14338
 		}
@@ -14804,8 +14348,7 @@  discard block
 block discarded – undo
14804 14348
 		if ($sp->error() !== null)
14805 14349
 		{
14806 14350
 			$info .= 'Error occurred: ' . $sp->error() . "\n";
14807
-		}
14808
-		else
14351
+		} else
14809 14352
 		{
14810 14353
 			$info .= "No error found.\n";
14811 14354
 		}
@@ -14835,8 +14378,7 @@  discard block
 block discarded – undo
14835 14378
 						$info .= '      Version ' . LIBXML_DOTTED_VERSION . "\n";
14836 14379
 						break;
14837 14380
 				}
14838
-			}
14839
-			else
14381
+			} else
14840 14382
 			{
14841 14383
 				$info .= "    $ext not loaded\n";
14842 14384
 			}
@@ -14893,16 +14435,14 @@  discard block
 block discarded – undo
14893 14435
 			if ($ip1 === '')
14894 14436
 			{
14895 14437
 				$c1 = -1;
14896
-			}
14897
-			else
14438
+			} else
14898 14439
 			{
14899 14440
 				$c1 = substr_count($ip1, ':');
14900 14441
 			}
14901 14442
 			if ($ip2 === '')
14902 14443
 			{
14903 14444
 				$c2 = -1;
14904
-			}
14905
-			else
14445
+			} else
14906 14446
 			{
14907 14447
 				$c2 = substr_count($ip2, ':');
14908 14448
 			}
@@ -14980,8 +14520,7 @@  discard block
 block discarded – undo
14980 14520
 		if ($ip_parts[1] !== '')
14981 14521
 		{
14982 14522
 			return implode(':', $ip_parts);
14983
-		}
14984
-		else
14523
+		} else
14985 14524
 		{
14986 14525
 			return $ip_parts[0];
14987 14526
 		}
@@ -15007,8 +14546,7 @@  discard block
 block discarded – undo
15007 14546
 			$ipv6_part = substr($ip, 0, $pos);
15008 14547
 			$ipv4_part = substr($ip, $pos + 1);
15009 14548
 			return array($ipv6_part, $ipv4_part);
15010
-		}
15011
-		else
14549
+		} else
15012 14550
 		{
15013 14551
 			return array($ip, '');
15014 14552
 		}
@@ -15033,35 +14571,39 @@  discard block
 block discarded – undo
15033 14571
 			foreach ($ipv6 as $ipv6_part)
15034 14572
 			{
15035 14573
 				// The section can't be empty
15036
-				if ($ipv6_part === '')
15037
-					return false;
14574
+				if ($ipv6_part === '') {
14575
+									return false;
14576
+				}
15038 14577
 
15039 14578
 				// Nor can it be over four characters
15040
-				if (strlen($ipv6_part) > 4)
15041
-					return false;
14579
+				if (strlen($ipv6_part) > 4) {
14580
+									return false;
14581
+				}
15042 14582
 
15043 14583
 				// Remove leading zeros (this is safe because of the above)
15044 14584
 				$ipv6_part = ltrim($ipv6_part, '0');
15045
-				if ($ipv6_part === '')
15046
-					$ipv6_part = '0';
14585
+				if ($ipv6_part === '') {
14586
+									$ipv6_part = '0';
14587
+				}
15047 14588
 
15048 14589
 				// Check the value is valid
15049 14590
 				$value = hexdec($ipv6_part);
15050
-				if (dechex($value) !== strtolower($ipv6_part) || $value < 0 || $value > 0xFFFF)
15051
-					return false;
14591
+				if (dechex($value) !== strtolower($ipv6_part) || $value < 0 || $value > 0xFFFF) {
14592
+									return false;
14593
+				}
15052 14594
 			}
15053 14595
 			if (count($ipv4) === 4)
15054 14596
 			{
15055 14597
 				foreach ($ipv4 as $ipv4_part)
15056 14598
 				{
15057 14599
 					$value = (int) $ipv4_part;
15058
-					if ((string) $value !== $ipv4_part || $value < 0 || $value > 0xFF)
15059
-						return false;
14600
+					if ((string) $value !== $ipv4_part || $value < 0 || $value > 0xFF) {
14601
+											return false;
14602
+					}
15060 14603
 				}
15061 14604
 			}
15062 14605
 			return true;
15063
-		}
15064
-		else
14606
+		} else
15065 14607
 		{
15066 14608
 			return false;
15067 14609
 		}
@@ -15660,8 +15202,7 @@  discard block
 block discarded – undo
15660 15202
 		if (is_callable($callback))
15661 15203
 		{
15662 15204
 			$this->user[] = $callback;
15663
-		}
15664
-		else
15205
+		} else
15665 15206
 		{
15666 15207
 			trigger_error('User-supplied function must be a valid callback', E_USER_WARNING);
15667 15208
 		}
@@ -15723,8 +15264,7 @@  discard block
 block discarded – undo
15723 15264
 				{
15724 15265
 					$timezone = 0 - $timezone;
15725 15266
 				}
15726
-			}
15727
-			else
15267
+			} else
15728 15268
 			{
15729 15269
 				$timezone = 0;
15730 15270
 			}
@@ -15733,8 +15273,7 @@  discard block
 block discarded – undo
15733 15273
 			$second = round((int)$match[6] + (int)$match[7] / pow(10, strlen($match[7])));
15734 15274
 
15735 15275
 			return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
15736
-		}
15737
-		else
15276
+		} else
15738 15277
 		{
15739 15278
 			return false;
15740 15279
 		}
@@ -15770,8 +15309,7 @@  discard block
 block discarded – undo
15770 15309
 					{
15771 15310
 						$position++;
15772 15311
 						continue;
15773
-					}
15774
-					elseif (isset($string[$position]))
15312
+					} elseif (isset($string[$position]))
15775 15313
 					{
15776 15314
 						switch ($string[$position])
15777 15315
 						{
@@ -15784,14 +15322,12 @@  discard block
 block discarded – undo
15784 15322
 								break;
15785 15323
 						}
15786 15324
 						$position++;
15787
-					}
15788
-					else
15325
+					} else
15789 15326
 					{
15790 15327
 						break;
15791 15328
 					}
15792 15329
 				}
15793
-			}
15794
-			else
15330
+			} else
15795 15331
 			{
15796 15332
 				$output .= '(';
15797 15333
 			}
@@ -15870,8 +15406,7 @@  discard block
 block discarded – undo
15870 15406
 			if ($match[4] < 50)
15871 15407
 			{
15872 15408
 				$match[4] += 2000;
15873
-			}
15874
-			elseif ($match[4] < 1000)
15409
+			} elseif ($match[4] < 1000)
15875 15410
 			{
15876 15411
 				$match[4] += 1900;
15877 15412
 			}
@@ -15880,15 +15415,13 @@  discard block
 block discarded – undo
15880 15415
 			if ($match[7] !== '')
15881 15416
 			{
15882 15417
 				$second = $match[7];
15883
-			}
15884
-			else
15418
+			} else
15885 15419
 			{
15886 15420
 				$second = 0;
15887 15421
 			}
15888 15422
 
15889 15423
 			return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
15890
-		}
15891
-		else
15424
+		} else
15892 15425
 		{
15893 15426
 			return false;
15894 15427
 		}
@@ -15945,15 +15478,13 @@  discard block
 block discarded – undo
15945 15478
 			if ($match[4] < 50)
15946 15479
 			{
15947 15480
 				$match[4] += 2000;
15948
-			}
15949
-			else
15481
+			} else
15950 15482
 			{
15951 15483
 				$match[4] += 1900;
15952 15484
 			}
15953 15485
 
15954 15486
 			return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
15955
-		}
15956
-		else
15487
+		} else
15957 15488
 		{
15958 15489
 			return false;
15959 15490
 		}
@@ -15994,8 +15525,7 @@  discard block
 block discarded – undo
15994 15525
 
15995 15526
 			$month = $this->month[strtolower($match[2])];
15996 15527
 			return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
15997
-		}
15998
-		else
15528
+		} else
15999 15529
 		{
16000 15530
 			return false;
16001 15531
 		}
@@ -16013,8 +15543,7 @@  discard block
 block discarded – undo
16013 15543
 		if ($strtotime === -1 || $strtotime === false)
16014 15544
 		{
16015 15545
 			return false;
16016
-		}
16017
-		else
15546
+		} else
16018 15547
 		{
16019 15548
 			return $strtotime;
16020 15549
 		}
@@ -16074,8 +15603,7 @@  discard block
 block discarded – undo
16074 15603
 		if (strtoupper($encoding) === 'US-ASCII')
16075 15604
 		{
16076 15605
 			$this->encoding = 'UTF-8';
16077
-		}
16078
-		else
15606
+		} else
16079 15607
 		{
16080 15608
 			$this->encoding = $encoding;
16081 15609
 		}
@@ -16114,8 +15642,7 @@  discard block
 block discarded – undo
16114 15642
 			{
16115 15643
 				$data = substr($data, $pos + 2);
16116 15644
 				$data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' ."\n". $this->declare_html_entities() . $data;
16117
-			}
16118
-			else
15645
+			} else
16119 15646
 			{
16120 15647
 				$this->error_string = 'SimplePie bug! Please report this!';
16121 15648
 				return false;
@@ -16155,8 +15682,7 @@  discard block
 block discarded – undo
16155 15682
 			$this->current_byte = xml_get_current_byte_index($xml);
16156 15683
 			xml_parser_free($xml);
16157 15684
 			return $return;
16158
-		}
16159
-		else
15685
+		} else
16160 15686
 		{
16161 15687
 			libxml_clear_errors();
16162 15688
 			$xml = new XMLReader();
@@ -16170,8 +15696,7 @@  discard block
 block discarded – undo
16170 15696
 						if ($xml->namespaceURI !== '')
16171 15697
 						{
16172 15698
 							$tagName = $xml->namespaceURI . $this->separator . $xml->localName;
16173
-						}
16174
-						else
15699
+						} else
16175 15700
 						{
16176 15701
 							$tagName = $xml->localName;
16177 15702
 						}
@@ -16182,8 +15707,7 @@  discard block
 block discarded – undo
16182 15707
 						if ($xml->namespaceURI !== '')
16183 15708
 						{
16184 15709
 							$tagName = $xml->namespaceURI . $this->separator . $xml->localName;
16185
-						}
16186
-						else
15710
+						} else
16187 15711
 						{
16188 15712
 							$tagName = $xml->localName;
16189 15713
 						}
@@ -16193,8 +15717,7 @@  discard block
 block discarded – undo
16193 15717
 							if ($xml->namespaceURI !== '')
16194 15718
 							{
16195 15719
 								$attrName = $xml->namespaceURI . $this->separator . $xml->localName;
16196
-							}
16197
-							else
15720
+							} else
16198 15721
 							{
16199 15722
 								$attrName = $xml->localName;
16200 15723
 							}
@@ -16220,8 +15743,7 @@  discard block
 block discarded – undo
16220 15743
 				$this->current_line = $error->line;
16221 15744
 				$this->current_column = $error->column;
16222 15745
 				return false;
16223
-			}
16224
-			else
15746
+			} else
16225 15747
 			{
16226 15748
 				return true;
16227 15749
 			}
@@ -16277,8 +15799,7 @@  discard block
 block discarded – undo
16277 15799
 				$this->xml_base[] = $base;
16278 15800
 				$this->xml_base_explicit[] = true;
16279 15801
 			}
16280
-		}
16281
-		else
15802
+		} else
16282 15803
 		{
16283 15804
 			$this->xml_base[] = end($this->xml_base);
16284 15805
 			$this->xml_base_explicit[] = end($this->xml_base_explicit);
@@ -16287,8 +15808,7 @@  discard block
 block discarded – undo
16287 15808
 		if (isset($attribs[SIMPLEPIE_NAMESPACE_XML]['lang']))
16288 15809
 		{
16289 15810
 			$this->xml_lang[] = $attribs[SIMPLEPIE_NAMESPACE_XML]['lang'];
16290
-		}
16291
-		else
15811
+		} else
16292 15812
 		{
16293 15813
 			$this->xml_lang[] = end($this->xml_lang);
16294 15814
 		}
@@ -16308,8 +15828,7 @@  discard block
 block discarded – undo
16308 15828
 				}
16309 15829
 				$this->data['data'] .= '>';
16310 15830
 			}
16311
-		}
16312
-		else
15831
+		} else
16313 15832
 		{
16314 15833
 			$this->datas[] =& $this->data;
16315 15834
 			$this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
@@ -16330,8 +15849,7 @@  discard block
 block discarded – undo
16330 15849
 		if ($this->current_xhtml_construct >= 0)
16331 15850
 		{
16332 15851
 			$this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
16333
-		}
16334
-		else
15852
+		} else
16335 15853
 		{
16336 15854
 			$this->data['data'] .= $cdata;
16337 15855
 		}
@@ -16389,8 +15907,7 @@  discard block
 block discarded – undo
16389 15907
 					$namespace = SIMPLEPIE_NAMESPACE_MEDIARSS;
16390 15908
 				}
16391 15909
 				$cache[$string] = array($namespace, $local_name);
16392
-			}
16393
-			else
15910
+			} else
16394 15911
 			{
16395 15912
 				$cache[$string] = array('', $string);
16396 15913
 			}
@@ -16410,8 +15927,7 @@  discard block
 block discarded – undo
16410 15927
 				$link = $data['properties']['url'][0];
16411 15928
 				if ($name === '') {
16412 15929
 					$name = $link;
16413
-				}
16414
-				else {
15930
+				} else {
16415 15931
 					// can't have commas in categories.
16416 15932
 					$name = str_replace(',', '', $name);
16417 15933
 				}
@@ -16437,19 +15953,24 @@  discard block
 block discarded – undo
16437 15953
 				break;
16438 15954
 			}
16439 15955
 			// Also look for h-feed or h-entry in the children of each top level item.
16440
-			if (!isset($mf_item['children'][0]['type'])) continue;
15956
+			if (!isset($mf_item['children'][0]['type'])) {
15957
+				continue;
15958
+			}
16441 15959
 			if (in_array('h-feed', $mf_item['children'][0]['type'])) {
16442 15960
 				$h_feed = $mf_item['children'][0];
16443 15961
 				// In this case the parent of the h-feed may be an h-card, so use it as
16444 15962
 				// the feed_author.
16445
-				if (in_array('h-card', $mf_item['type'])) $feed_author = $mf_item;
15963
+				if (in_array('h-card', $mf_item['type'])) {
15964
+					$feed_author = $mf_item;
15965
+				}
16446 15966
 				break;
16447
-			}
16448
-			else if (in_array('h-entry', $mf_item['children'][0]['type'])) {
15967
+			} else if (in_array('h-entry', $mf_item['children'][0]['type'])) {
16449 15968
 				$entries = $mf_item['children'];
16450 15969
 				// In this case the parent of the h-entry list may be an h-card, so use
16451 15970
 				// it as the feed_author.
16452
-				if (in_array('h-card', $mf_item['type'])) $feed_author = $mf_item;
15971
+				if (in_array('h-card', $mf_item['type'])) {
15972
+					$feed_author = $mf_item;
15973
+				}
16453 15974
 				break;
16454 15975
 			}
16455 15976
 		}
@@ -16462,8 +15983,7 @@  discard block
 block discarded – undo
16462 15983
 			if (isset($mf['items'][0]['properties']['author'][0])) {
16463 15984
 				$feed_author = $mf['items'][0]['properties']['author'][0];
16464 15985
 			}
16465
-		}
16466
-		else if (count($entries) === 0) {
15986
+		} else if (count($entries) === 0) {
16467 15987
 			$entries = $mf['items'];
16468 15988
 		}
16469 15989
 		for ($i = 0; $i < count($entries); $i++) {
@@ -16474,17 +15994,23 @@  discard block
 block discarded – undo
16474 15994
 				$description = '';
16475 15995
 				if (isset($entry['properties']['url'][0])) {
16476 15996
 					$link = $entry['properties']['url'][0];
16477
-					if (isset($link['value'])) $link = $link['value'];
15997
+					if (isset($link['value'])) {
15998
+						$link = $link['value'];
15999
+					}
16478 16000
 					$item['link'] = array(array('data' => $link));
16479 16001
 				}
16480 16002
 				if (isset($entry['properties']['uid'][0])) {
16481 16003
 					$guid = $entry['properties']['uid'][0];
16482
-					if (isset($guid['value'])) $guid = $guid['value'];
16004
+					if (isset($guid['value'])) {
16005
+						$guid = $guid['value'];
16006
+					}
16483 16007
 					$item['guid'] = array(array('data' => $guid));
16484 16008
 				}
16485 16009
 				if (isset($entry['properties']['name'][0])) {
16486 16010
 					$title = $entry['properties']['name'][0];
16487
-					if (isset($title['value'])) $title = $title['value'];
16011
+					if (isset($title['value'])) {
16012
+						$title = $title['value'];
16013
+					}
16488 16014
 					$item['title'] = array(array('data' => $title));
16489 16015
 				}
16490 16016
 				if (isset($entry['properties']['author'][0]) || isset($feed_author)) {
@@ -16495,12 +16021,10 @@  discard block
 block discarded – undo
16495 16021
 						$entry['properties']['author'][0] : $feed_author;
16496 16022
 					if (!is_string($author)) {
16497 16023
 						$author = $this->parse_hcard($author);
16498
-					}
16499
-					else if (strpos($author, 'http') === 0) {
16024
+					} else if (strpos($author, 'http') === 0) {
16500 16025
 						if (isset($author_cache[$author])) {
16501 16026
 							$author = $author_cache[$author];
16502
-						}
16503
-						else {
16027
+						} else {
16504 16028
 							$mf = Mf2\fetch($author);
16505 16029
 							foreach ($mf['items'] as $hcard) {
16506 16030
 								// Only interested in an h-card by itself in this case.
@@ -16550,8 +16074,7 @@  discard block
 block discarded – undo
16550 16074
 								'<img src="'.$photo_list[$j].'"></a>';
16551 16075
 						}
16552 16076
 						$description .= '<br><b>'.$count.' photos</b></p>';
16553
-					}
16554
-					else if ($count == 1) {
16077
+					} else if ($count == 1) {
16555 16078
 						$description = '<p><img src="'.$photo_list[0].'"></p>';
16556 16079
 					}
16557 16080
 				}
@@ -16568,8 +16091,7 @@  discard block
 block discarded – undo
16568 16091
 						$in_reply_to = '';
16569 16092
 						if (is_string($entry['properties']['in-reply-to'][0])) {
16570 16093
 							$in_reply_to = $entry['properties']['in-reply-to'][0];
16571
-						}
16572
-						else if (isset($entry['properties']['in-reply-to'][0]['value'])) {
16094
+						} else if (isset($entry['properties']['in-reply-to'][0]['value'])) {
16573 16095
 							$in_reply_to = $entry['properties']['in-reply-to'][0]['value'];
16574 16096
 						}
16575 16097
 						if ($in_reply_to !== '') {
@@ -16583,12 +16105,13 @@  discard block
 block discarded – undo
16583 16105
 					$category_csv = '';
16584 16106
 					// Categories can also contain h-cards.
16585 16107
 					foreach ($entry['properties']['category'] as $category) {
16586
-						if ($category_csv !== '') $category_csv .= ', ';
16108
+						if ($category_csv !== '') {
16109
+							$category_csv .= ', ';
16110
+						}
16587 16111
 						if (is_string($category)) {
16588 16112
 							// Can't have commas in categories.
16589 16113
 							$category_csv .= str_replace(',', '', $category);
16590
-						}
16591
-						else {
16114
+						} else {
16592 16115
 							$category_csv .= $this->parse_hcard($category, true);
16593 16116
 						}
16594 16117
 					}
@@ -16619,8 +16142,7 @@  discard block
 block discarded – undo
16619 16142
 		// Use the name given for the h-feed, or get the title from the html.
16620 16143
 		if ($feed_title !== '') {
16621 16144
 			$feed_title = array(array('data' => htmlspecialchars($feed_title)));
16622
-		}
16623
-		else if ($position = strpos($data, '<title>')) {
16145
+		} else if ($position = strpos($data, '<title>')) {
16624 16146
 			$start = $position < 200 ? 0 : $position - 200;
16625 16147
 			$check = substr($data, $start, 400);
16626 16148
 			$matches = array();
@@ -16705,8 +16227,7 @@  discard block
 block discarded – undo
16705 16227
 		if ($this->scheme !== null)
16706 16228
 		{
16707 16229
 			return $this->scheme;
16708
-		}
16709
-		else
16230
+		} else
16710 16231
 		{
16711 16232
 			return null;
16712 16233
 		}
@@ -16722,8 +16243,7 @@  discard block
 block discarded – undo
16722 16243
 		if ($this->value !== null)
16723 16244
 		{
16724 16245
 			return $this->value;
16725
-		}
16726
-		else
16246
+		} else
16727 16247
 		{
16728 16248
 			return null;
16729 16249
 		}
@@ -16865,8 +16385,7 @@  discard block
 block discarded – undo
16865 16385
 		if (!method_exists($class, '__construct'))
16866 16386
 		{
16867 16387
 			$instance = new $class;
16868
-		}
16869
-		else
16388
+		} else
16870 16389
 		{
16871 16390
 			$reflector = new ReflectionClass($class);
16872 16391
 			$instance = $reflector->newInstanceArgs($parameters);
@@ -16982,8 +16501,7 @@  discard block
 block discarded – undo
16982 16501
 		if ($this->relationship !== null)
16983 16502
 		{
16984 16503
 			return $this->relationship;
16985
-		}
16986
-		else
16504
+		} else
16987 16505
 		{
16988 16506
 			return null;
16989 16507
 		}
@@ -16999,8 +16517,7 @@  discard block
 block discarded – undo
16999 16517
 		if ($this->type !== null)
17000 16518
 		{
17001 16519
 			return $this->type;
17002
-		}
17003
-		else
16520
+		} else
17004 16521
 		{
17005 16522
 			return null;
17006 16523
 		}
@@ -17016,8 +16533,7 @@  discard block
 block discarded – undo
17016 16533
 		if ($this->value !== null)
17017 16534
 		{
17018 16535
 			return $this->value;
17019
-		}
17020
-		else
16536
+		} else
17021 16537
 		{
17022 16538
 			return null;
17023 16539
 		}
@@ -17071,8 +16587,7 @@  discard block
 block discarded – undo
17071 16587
 		if ($page)
17072 16588
 		{
17073 16589
 			$this->image_handler = (string) $page;
17074
-		}
17075
-		else
16590
+		} else
17076 16591
 		{
17077 16592
 			$this->image_handler = false;
17078 16593
 		}
@@ -17126,13 +16641,11 @@  discard block
 block discarded – undo
17126 16641
 			if (is_array($tags))
17127 16642
 			{
17128 16643
 				$this->strip_htmltags = $tags;
17129
-			}
17130
-			else
16644
+			} else
17131 16645
 			{
17132 16646
 				$this->strip_htmltags = explode(',', $tags);
17133 16647
 			}
17134
-		}
17135
-		else
16648
+		} else
17136 16649
 		{
17137 16650
 			$this->strip_htmltags = false;
17138 16651
 		}
@@ -17150,13 +16663,11 @@  discard block
 block discarded – undo
17150 16663
 			if (is_array($attribs))
17151 16664
 			{
17152 16665
 				$this->strip_attributes = $attribs;
17153
-			}
17154
-			else
16666
+			} else
17155 16667
 			{
17156 16668
 				$this->strip_attributes = explode(',', $attribs);
17157 16669
 			}
17158
-		}
17159
-		else
16670
+		} else
17160 16671
 		{
17161 16672
 			$this->strip_attributes = false;
17162 16673
 		}
@@ -17169,13 +16680,11 @@  discard block
 block discarded – undo
17169 16680
 			if (is_array($attribs))
17170 16681
 			{
17171 16682
 				$this->add_attributes = $attribs;
17172
-			}
17173
-			else
16683
+			} else
17174 16684
 			{
17175 16685
 				$this->add_attributes = explode(',', $attribs);
17176 16686
 			}
17177
-		}
17178
-		else
16687
+		} else
17179 16688
 		{
17180 16689
 			$this->add_attributes = false;
17181 16690
 		}
@@ -17234,8 +16743,7 @@  discard block
 block discarded – undo
17234 16743
 				if (preg_match('/(&(#(x[0-9a-fA-F]+|[0-9]+)|[a-zA-Z0-9]+)|<\/[A-Za-z][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E]*' . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . '>)/', $data))
17235 16744
 				{
17236 16745
 					$type |= SIMPLEPIE_CONSTRUCT_HTML;
17237
-				}
17238
-				else
16746
+				} else
17239 16747
 				{
17240 16748
 					$type |= SIMPLEPIE_CONSTRUCT_TEXT;
17241 16749
 				}
@@ -17323,8 +16831,7 @@  discard block
 block discarded – undo
17323 16831
 							if ($cache->load())
17324 16832
 							{
17325 16833
 								$img->setAttribute('src', $this->image_handler . $image_url);
17326
-							}
17327
-							else
16834
+							} else
17328 16835
 							{
17329 16836
 								$file = $this->registry->create('File', array($img->getAttribute('src'), $this->timeout, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen));
17330 16837
 								$headers = $file->headers;
@@ -17334,8 +16841,7 @@  discard block
 block discarded – undo
17334 16841
 									if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
17335 16842
 									{
17336 16843
 										$img->setAttribute('src', $this->image_handler . $image_url);
17337
-									}
17338
-									else
16844
+									} else
17339 16845
 									{
17340 16846
 										trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
17341 16847
 									}
@@ -17351,8 +16857,7 @@  discard block
 block discarded – undo
17351 16857
 				if (version_compare(PHP_VERSION, '5.3.6', '>='))
17352 16858
 				{
17353 16859
 					$data = trim($document->saveHTML($div));
17354
-				}
17355
-				else
16860
+				} else
17356 16861
 				{
17357 16862
 					$data = trim($document->saveXML($div));
17358 16863
 				}
@@ -17361,8 +16866,7 @@  discard block
 block discarded – undo
17361 16866
 				{
17362 16867
 					$data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '', $data);
17363 16868
 					$data = preg_replace('/<\/div>$/', '', $data);
17364
-				}
17365
-				else
16869
+				} else
17366 16870
 				{
17367 16871
 					$data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '<div>', $data);
17368 16872
 				}
@@ -17401,8 +16905,7 @@  discard block
 block discarded – undo
17401 16905
 			$html = '<div>' . $html . '</div>';
17402 16906
 			$ret .= '<!DOCTYPE html>';
17403 16907
 			$content_type = 'text/html';
17404
-		}
17405
-		else
16908
+		} else
17406 16909
 		{
17407 16910
 			$ret .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
17408 16911
 			$content_type = 'application/xhtml+xml';
@@ -17450,17 +16953,14 @@  discard block
 block discarded – undo
17450 16953
 				$match[1] = htmlspecialchars($match[1], ENT_COMPAT, 'UTF-8');
17451 16954
 				$match[2] = htmlspecialchars($match[2], ENT_COMPAT, 'UTF-8');
17452 16955
 				return "&lt;$match[1]$match[2]&gt;$match[3]&lt;/$match[1]&gt;";
17453
-			}
17454
-			else
16956
+			} else
17455 16957
 			{
17456 16958
 				return htmlspecialchars($match[0], ENT_COMPAT, 'UTF-8');
17457 16959
 			}
17458
-		}
17459
-		elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
16960
+		} elseif (isset($match[4]) && !in_array(strtolower($match[1]), array('script', 'style')))
17460 16961
 		{
17461 16962
 			return $match[4];
17462
-		}
17463
-		else
16963
+		} else
17464 16964
 		{
17465 16965
 			return '';
17466 16966
 		}
@@ -17523,8 +17023,7 @@  discard block
 block discarded – undo
17523 17023
 			}
17524 17024
 
17525 17025
 			return;
17526
-		}
17527
-		elseif (in_array($tag, array('script', 'style')))
17026
+		} elseif (in_array($tag, array('script', 'style')))
17528 17027
 		{
17529 17028
 			foreach ($elements as $element)
17530 17029
 			{
@@ -17532,8 +17031,7 @@  discard block
 block discarded – undo
17532 17031
 			}
17533 17032
 
17534 17033
 			return;
17535
-		}
17536
-		else
17034
+		} else
17537 17035
 		{
17538 17036
 			foreach ($elements as $element)
17539 17037
 			{
@@ -17610,8 +17108,7 @@  discard block
 block discarded – undo
17610 17108
 		if (isset($this->data['child'][$namespace][$tag]))
17611 17109
 		{
17612 17110
 			return $this->data['child'][$namespace][$tag];
17613
-		}
17614
-		else
17111
+		} else
17615 17112
 		{
17616 17113
 			return null;
17617 17114
 		}
@@ -17637,32 +17134,25 @@  discard block
 block discarded – undo
17637 17134
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
17638 17135
 		{
17639 17136
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
17640
-		}
17641
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
17137
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
17642 17138
 		{
17643 17139
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
17644
-		}
17645
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
17140
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
17646 17141
 		{
17647 17142
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
17648
-		}
17649
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
17143
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
17650 17144
 		{
17651 17145
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
17652
-		}
17653
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
17146
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
17654 17147
 		{
17655 17148
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
17656
-		}
17657
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
17149
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
17658 17150
 		{
17659 17151
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
17660
-		}
17661
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
17152
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
17662 17153
 		{
17663 17154
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
17664
-		}
17665
-		else
17155
+		} else
17666 17156
 		{
17667 17157
 			return null;
17668 17158
 		}
@@ -17674,8 +17164,7 @@  discard block
 block discarded – undo
17674 17164
 		if (isset($categories[$key]))
17675 17165
 		{
17676 17166
 			return $categories[$key];
17677
-		}
17678
-		else
17167
+		} else
17679 17168
 		{
17680 17169
 			return null;
17681 17170
 		}
@@ -17712,8 +17201,7 @@  discard block
 block discarded – undo
17712 17201
 			if (isset($category['attribs']['']['domain']))
17713 17202
 			{
17714 17203
 				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
17715
-			}
17716
-			else
17204
+			} else
17717 17205
 			{
17718 17206
 				$scheme = null;
17719 17207
 			}
@@ -17731,8 +17219,7 @@  discard block
 block discarded – undo
17731 17219
 		if (!empty($categories))
17732 17220
 		{
17733 17221
 			return array_unique($categories);
17734
-		}
17735
-		else
17222
+		} else
17736 17223
 		{
17737 17224
 			return null;
17738 17225
 		}
@@ -17744,8 +17231,7 @@  discard block
 block discarded – undo
17744 17231
 		if (isset($authors[$key]))
17745 17232
 		{
17746 17233
 			return $authors[$key];
17747
-		}
17748
-		else
17234
+		} else
17749 17235
 		{
17750 17236
 			return null;
17751 17237
 		}
@@ -17814,8 +17300,7 @@  discard block
 block discarded – undo
17814 17300
 		if (!empty($authors))
17815 17301
 		{
17816 17302
 			return array_unique($authors);
17817
-		}
17818
-		else
17303
+		} else
17819 17304
 		{
17820 17305
 			return null;
17821 17306
 		}
@@ -17827,8 +17312,7 @@  discard block
 block discarded – undo
17827 17312
 		if (isset($contributors[$key]))
17828 17313
 		{
17829 17314
 			return $contributors[$key];
17830
-		}
17831
-		else
17315
+		} else
17832 17316
 		{
17833 17317
 			return null;
17834 17318
 		}
@@ -17885,8 +17369,7 @@  discard block
 block discarded – undo
17885 17369
 		if (!empty($contributors))
17886 17370
 		{
17887 17371
 			return array_unique($contributors);
17888
-		}
17889
-		else
17372
+		} else
17890 17373
 		{
17891 17374
 			return null;
17892 17375
 		}
@@ -17898,8 +17381,7 @@  discard block
 block discarded – undo
17898 17381
 		if (isset($links[$key]))
17899 17382
 		{
17900 17383
 			return $links[$key];
17901
-		}
17902
-		else
17384
+		} else
17903 17385
 		{
17904 17386
 			return null;
17905 17387
 		}
@@ -17963,13 +17445,11 @@  discard block
 block discarded – undo
17963 17445
 					{
17964 17446
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
17965 17447
 						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
17966
-					}
17967
-					else
17448
+					} else
17968 17449
 					{
17969 17450
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
17970 17451
 					}
17971
-				}
17972
-				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
17452
+				} elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
17973 17453
 				{
17974 17454
 					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
17975 17455
 				}
@@ -17980,8 +17460,7 @@  discard block
 block discarded – undo
17980 17460
 		if (isset($this->data['links'][$rel]))
17981 17461
 		{
17982 17462
 			return $this->data['links'][$rel];
17983
-		}
17984
-		else
17463
+		} else
17985 17464
 		{
17986 17465
 			return null;
17987 17466
 		}
@@ -17992,40 +17471,31 @@  discard block
 block discarded – undo
17992 17471
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
17993 17472
 		{
17994 17473
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
17995
-		}
17996
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
17474
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
17997 17475
 		{
17998 17476
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
17999
-		}
18000
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
17477
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
18001 17478
 		{
18002 17479
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
18003
-		}
18004
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
17480
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
18005 17481
 		{
18006 17482
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
18007
-		}
18008
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
17483
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
18009 17484
 		{
18010 17485
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
18011
-		}
18012
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
17486
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
18013 17487
 		{
18014 17488
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
18015
-		}
18016
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
17489
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
18017 17490
 		{
18018 17491
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
18019
-		}
18020
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
17492
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
18021 17493
 		{
18022 17494
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
18023
-		}
18024
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
17495
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
18025 17496
 		{
18026 17497
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
18027
-		}
18028
-		else
17498
+		} else
18029 17499
 		{
18030 17500
 			return null;
18031 17501
 		}
@@ -18036,24 +17506,19 @@  discard block
 block discarded – undo
18036 17506
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
18037 17507
 		{
18038 17508
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
18039
-		}
18040
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
17509
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
18041 17510
 		{
18042 17511
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
18043
-		}
18044
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
17512
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
18045 17513
 		{
18046 17514
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
18047
-		}
18048
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
17515
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
18049 17516
 		{
18050 17517
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
18051
-		}
18052
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
17518
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
18053 17519
 		{
18054 17520
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
18055
-		}
18056
-		else
17521
+		} else
18057 17522
 		{
18058 17523
 			return null;
18059 17524
 		}
@@ -18064,20 +17529,16 @@  discard block
 block discarded – undo
18064 17529
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
18065 17530
 		{
18066 17531
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
18067
-		}
18068
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
17532
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
18069 17533
 		{
18070 17534
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
18071
-		}
18072
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
17535
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
18073 17536
 		{
18074 17537
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
18075
-		}
18076
-		elseif (isset($this->data['xml_lang']))
17538
+		} elseif (isset($this->data['xml_lang']))
18077 17539
 		{
18078 17540
 			return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
18079
-		}
18080
-		else
17541
+		} else
18081 17542
 		{
18082 17543
 			return null;
18083 17544
 		}
@@ -18088,12 +17549,10 @@  discard block
 block discarded – undo
18088 17549
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
18089 17550
 		{
18090 17551
 			return (float) $return[0]['data'];
18091
-		}
18092
-		elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
17552
+		} elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
18093 17553
 		{
18094 17554
 			return (float) $match[1];
18095
-		}
18096
-		else
17555
+		} else
18097 17556
 		{
18098 17557
 			return null;
18099 17558
 		}
@@ -18104,16 +17563,13 @@  discard block
 block discarded – undo
18104 17563
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
18105 17564
 		{
18106 17565
 			return (float) $return[0]['data'];
18107
-		}
18108
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
17566
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
18109 17567
 		{
18110 17568
 			return (float) $return[0]['data'];
18111
-		}
18112
-		elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
17569
+		} elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
18113 17570
 		{
18114 17571
 			return (float) $match[2];
18115
-		}
18116
-		else
17572
+		} else
18117 17573
 		{
18118 17574
 			return null;
18119 17575
 		}
@@ -18124,16 +17580,13 @@  discard block
 block discarded – undo
18124 17580
 		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
18125 17581
 		{
18126 17582
 			return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
18127
-		}
18128
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
17583
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
18129 17584
 		{
18130 17585
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
18131
-		}
18132
-		elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
17586
+		} elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
18133 17587
 		{
18134 17588
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
18135
-		}
18136
-		else
17589
+		} else
18137 17590
 		{
18138 17591
 			return null;
18139 17592
 		}
@@ -18233,8 +17686,7 @@  discard block
 block discarded – undo
18233 17686
 		if ($this->state === 'emit')
18234 17687
 		{
18235 17688
 			return true;
18236
-		}
18237
-		else
17689
+		} else
18238 17690
 		{
18239 17691
 			$this->version = '';
18240 17692
 			$this->encoding = '';
@@ -18291,8 +17743,7 @@  discard block
 block discarded – undo
18291 17743
 		if ($this->skip_whitespace())
18292 17744
 		{
18293 17745
 			$this->state = 'version_name';
18294
-		}
18295
-		else
17746
+		} else
18296 17747
 		{
18297 17748
 			$this->state = false;
18298 17749
 		}
@@ -18305,8 +17756,7 @@  discard block
 block discarded – undo
18305 17756
 			$this->position += 7;
18306 17757
 			$this->skip_whitespace();
18307 17758
 			$this->state = 'version_equals';
18308
-		}
18309
-		else
17759
+		} else
18310 17760
 		{
18311 17761
 			$this->state = false;
18312 17762
 		}
@@ -18319,8 +17769,7 @@  discard block
 block discarded – undo
18319 17769
 			$this->position++;
18320 17770
 			$this->skip_whitespace();
18321 17771
 			$this->state = 'version_value';
18322
-		}
18323
-		else
17772
+		} else
18324 17773
 		{
18325 17774
 			$this->state = false;
18326 17775
 		}
@@ -18334,13 +17783,11 @@  discard block
 block discarded – undo
18334 17783
 			if ($this->has_data())
18335 17784
 			{
18336 17785
 				$this->state = 'encoding_name';
18337
-			}
18338
-			else
17786
+			} else
18339 17787
 			{
18340 17788
 				$this->state = 'emit';
18341 17789
 			}
18342
-		}
18343
-		else
17790
+		} else
18344 17791
 		{
18345 17792
 			$this->state = false;
18346 17793
 		}
@@ -18353,8 +17800,7 @@  discard block
 block discarded – undo
18353 17800
 			$this->position += 8;
18354 17801
 			$this->skip_whitespace();
18355 17802
 			$this->state = 'encoding_equals';
18356
-		}
18357
-		else
17803
+		} else
18358 17804
 		{
18359 17805
 			$this->state = 'standalone_name';
18360 17806
 		}
@@ -18367,8 +17813,7 @@  discard block
 block discarded – undo
18367 17813
 			$this->position++;
18368 17814
 			$this->skip_whitespace();
18369 17815
 			$this->state = 'encoding_value';
18370
-		}
18371
-		else
17816
+		} else
18372 17817
 		{
18373 17818
 			$this->state = false;
18374 17819
 		}
@@ -18382,13 +17827,11 @@  discard block
 block discarded – undo
18382 17827
 			if ($this->has_data())
18383 17828
 			{
18384 17829
 				$this->state = 'standalone_name';
18385
-			}
18386
-			else
17830
+			} else
18387 17831
 			{
18388 17832
 				$this->state = 'emit';
18389 17833
 			}
18390
-		}
18391
-		else
17834
+		} else
18392 17835
 		{
18393 17836
 			$this->state = false;
18394 17837
 		}
@@ -18401,8 +17844,7 @@  discard block
 block discarded – undo
18401 17844
 			$this->position += 10;
18402 17845
 			$this->skip_whitespace();
18403 17846
 			$this->state = 'standalone_equals';
18404
-		}
18405
-		else
17847
+		} else
18406 17848
 		{
18407 17849
 			$this->state = false;
18408 17850
 		}
@@ -18415,8 +17857,7 @@  discard block
 block discarded – undo
18415 17857
 			$this->position++;
18416 17858
 			$this->skip_whitespace();
18417 17859
 			$this->state = 'standalone_value';
18418
-		}
18419
-		else
17860
+		} else
18420 17861
 		{
18421 17862
 			$this->state = false;
18422 17863
 		}
@@ -18445,13 +17886,11 @@  discard block
 block discarded – undo
18445 17886
 			if ($this->has_data())
18446 17887
 			{
18447 17888
 				$this->state = false;
18448
-			}
18449
-			else
17889
+			} else
18450 17890
 			{
18451 17891
 				$this->state = 'emit';
18452 17892
 			}
18453
-		}
18454
-		else
17893
+		} else
18455 17894
 		{
18456 17895
 			$this->state = false;
18457 17896
 		}
@@ -18676,8 +18115,7 @@  discard block
 block discarded – undo
18676 18115
 					// Set the extra field to the given data
18677 18116
 					$this->extra_field = substr($this->compressed_data, $this->position, $len);
18678 18117
 					$this->position += $len;
18679
-				}
18680
-				else
18118
+				} else
18681 18119
 				{
18682 18120
 					return false;
18683 18121
 				}
@@ -18696,8 +18134,7 @@  discard block
 block discarded – undo
18696 18134
 					// Set the original filename to the given string
18697 18135
 					$this->filename = substr($this->compressed_data, $this->position, $len);
18698 18136
 					$this->position += $len + 1;
18699
-				}
18700
-				else
18137
+				} else
18701 18138
 				{
18702 18139
 					return false;
18703 18140
 				}
@@ -18716,8 +18153,7 @@  discard block
 block discarded – undo
18716 18153
 					// Set the original comment to the given string
18717 18154
 					$this->comment = substr($this->compressed_data, $this->position, $len);
18718 18155
 					$this->position += $len + 1;
18719
-				}
18720
-				else
18156
+				} else
18721 18157
 				{
18722 18158
 					return false;
18723 18159
 				}
@@ -18737,13 +18173,11 @@  discard block
 block discarded – undo
18737 18173
 					if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
18738 18174
 					{
18739 18175
 						$this->position += 2;
18740
-					}
18741
-					else
18176
+					} else
18742 18177
 					{
18743 18178
 						return false;
18744 18179
 					}
18745
-				}
18746
-				else
18180
+				} else
18747 18181
 				{
18748 18182
 					return false;
18749 18183
 				}
@@ -18753,8 +18187,7 @@  discard block
 block discarded – undo
18753 18187
 			if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false)
18754 18188
 			{
18755 18189
 				return false;
18756
-			}
18757
-			else
18190
+			} else
18758 18191
 			{
18759 18192
 				$this->position = $this->compressed_size - 8;
18760 18193
 			}
@@ -18777,8 +18210,7 @@  discard block
 block discarded – undo
18777 18210
 
18778 18211
 			// Wow, against all odds, we've actually got a valid gzip string
18779 18212
 			return true;
18780
-		}
18781
-		else
18213
+		} else
18782 18214
 		{
18783 18215
 			return false;
18784 18216
 		}
Please login to merge, or discard this patch.