forked from leonardoxc/leonardoxc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FN_output.php
772 lines (633 loc) · 24.7 KB
/
FN_output.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
<?
//************************************************************************
// Leonardo XC Server, https://github.com/leonardoxc/leonardoxc
//
// Copyright (c) 2004-2010 by Andreadakis Manolis
//
// This program is free software. You can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License.
//
// $Id: FN_output.php,v 1.61 2012/10/04 05:59:26 manolis Exp $
//
//************************************************************************
require_once dirname(__FILE__)."/CL_html.php";
function sec2Time($secs,$no_seconds=false) {
if ($no_seconds)
return sprintf("%d:%02d",$secs/3600,($secs%3600)/60);
else
return '<span class="time_style">'.sprintf("%d:%02d:%02d",$secs/3600,($secs%3600)/60,$secs%60).'</span>';
}
function sec2Time24h($secs,$no_seconds=false) {
if ($no_seconds)
return sprintf("%02d:%02d",$secs/3600,($secs%3600)/60);
else
return sprintf("%02d:%02d:%02d",$secs/3600,($secs%3600)/60,$secs%60);
}
function fulldate2tm($dateStr) {
// expecting YYYY-MM-DD HH:MM:SS
$tm=0;
if (preg_match("/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/",$dateStr,$matches)) {
$tm=mktime($matches[4],$matches[5],$matches[6],$matches[2],$matches[3],$matches[1]);
}
return $tm;
}
function fulldate2tmUTC($dateStr) {
// expecting YYYY-MM-DD HH:MM:SS
$tm=0;
if (preg_match("/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/",$dateStr,$matches)) {
$tm=gmmktime($matches[4],$matches[5],$matches[6],$matches[2],$matches[3],$matches[1]);
}
return $tm;
}
function tm2fulldate($tm){
// return YYYY-MM-DD HH:MM:SS
return date("Y-m-d H:i:s",$tm);
}
function days2YearsMonths($days) {
$years=floor($days/365);
$months=ceil( ($days%365) / 30 );
return array($years,$months);
}
function formatURL($linkURL,$numChars=0) {
if ($numChars>0) {
if (strlen($linkURL) > $numChars - 3 )
$linkURL=substr($linkURL,0,$numChars)."...";
}
if ( substr($linkURL,0,7) == "http://" ) return $linkURL;
else return "http://".$linkURL;
}
function trimText($text,$numChars=0) {
global $CONF_use_utf;
if ($numChars>0) {
if ($CONF_use_utf) {
if (function_exists('mb_strlen') ) {
if (mb_strlen($text,'UTF-8') > $numChars - 3 )
$text=mb_substr($text,0,$numChars,'UTF-8')."...";
} else {
$numChars*=2;
if (strlen($text) > $numChars - 3 )
$text=substr($text,0,$numChars)."...";
}
} else {
if (strlen($text) > $numChars - 3 )
$text=substr($text,0,$numChars)."...";
}
}
return $text;
}
function formatDate($date,$html_output=true) {
// from 2002-07-14 -> 14/07/2004
$dt_str=sprintf("%02d/%02d/%4d",substr($date,8,2),substr($date,5,2),substr($date,0,4));
return $dt_str;
//if ($html_output)
// return '<font color=#224488>'.$dt_str.'</font>';
//else return $dt_str;
}
function formatOLCScoreType($type,$html_output=true) {
$ret="#".$type."#";
if ($type=="FREE_FLIGHT") $ret=_FREE_FLIGHT;
else if ($type=="FREE_TRIANGLE") $ret=_FREE_TRIANGLE;
else if ($type=="FAI_TRIANGLE") $ret=_FAI_TRIANGLE;
if ($html_output)
return '<span class="score_type_style">'.$ret.'</span>';
else return $ret;
}
function formatDistance($distance,$showUnits=false) { // in meters
global $PREFS;
// 1 kilometer = 0.62 mil
// 1 meter = 3.28 feet
if ($PREFS->metricSystem==2) {
$dis=($distance*0.62)/1000;
$units=_MI;
} else { // km
$dis=$distance/1000;
$units=_KM;
}
// return sprintf("%.2f km",$distance/1000);
return sprintf("%.1f %s",$dis,($showUnits)?$units:"");
}
function formatDistanceOpen($distance,$showKm=true) { // in meters
return formatDistance($distance,$showKm);
// return '<font color=#4400aa>'.formatDistance($distance,$showKm).'</font>';
}
function formatDistanceOLC($distance,$showKm=true) { // in meters
return '<span class="distance_style">'.formatDistance($distance,$showKm).'</span>';
}
function formatOLCScore($score,$html_output=true) {
return sprintf("%.2f",$score);
//if ($html_output) return '<font color=#0000ff>'.sprintf("%.1f",$score).'</font>';
//else return sprintf("%.1f",$score);
}
function formatAltitude($alt) {
global $PREFS;
// 1 kilometer = 0.62 mil
// 1 meter = 3.28 feet
if ($PREFS->metricSystem==2) {
$alt=$alt*3.28; //feet
$units=_FT;
} else {
$units=_M;
}
return '<span class="altitude_style">'.sprintf("%d %s",$alt,$units).'</span>';
}
function formatSpeed($speed) { // in km/h
global $PREFS;
// 1 kilometer = 0.62 mil
// 1 meter = 3.28 feet
if ($PREFS->metricSystem==2) {
$speed=$speed*0.62; // ml/h
$units=_MPH;
} else {
$units=_KM_PER_HR;
}
return '<span class="speed_style">'.sprintf("%.1f %s",$speed,$units).'</span>';
}
function formatVario($vario) { // in m/sec
global $PREFS;
// 1 kilometer = 0.62 mil
// 1 meter = 3.28 feet
if ($PREFS->metricSystem==2) {
$vario=$vario*3.28*60; // feet /min
$units=_FPM;
return '<span class="vario_style">'.sprintf("%.0f %s",$vario,$units).'</span>';
} else {
$units=_M_PER_SEC;
return '<span class="vario_style">'.sprintf("%.1f %s",$vario,$units).'</span>';
}
}
function formatLocation($name,$vinicity,$radious) {
global $PREFS;
if ($PREFS->metricSystem==2) $dis=($vinicity*0.62)/1000;
else $dis=$vinicity/1000;
if ($vinicity > 300000 ) $res_name="UNKNOWN";
else if ($vinicity > $radious )
$res_name=$name." [~".sprintf("%.1f",$dis)."]";
// $res_name=$name." [~".sprintf("%.1f",$vinicity/1000)." km]";
else $res_name=$name;
$res_name=str_replace("'","'",$res_name);
return $res_name;
}
function datetime2UnixTimestamp($datestamp) {
if ($datestamp!=0) {
list($date, $time)=split(" ", $datestamp);
list($year, $month, $day)=split("-", $date);
list($hour, $minute, $second)=split(":", $time);
$stampeddate=mktime($hour,$minute,$second,$month,$day,$year);
return $stampeddate ;
}
}
function processIGC($filePath) {
global $takeoffRadious;
//echo $filePath."<br>";
//echo filesize( $filePath)."<br>";
$lines = file ($filePath);
$points=0;
foreach($lines as $line) {
$line=trim($line);
if (strlen($line)==0) continue;
if ($line{0}=='B') {
$firstPoint=new gpsPoint($line);
//$res.=_TAKEOFF_COORDS." ";
//$res.=$firstPoint->lat." ";
//$res.=$firstPoint->lon."<br>";
$time=substr($line,1,6);
$zone= getUTMzoneLocal( $firstPoint->lon,$firstPoint->lat);
$timezone= ceil(-$firstPoint->lon / (180/12) );
$res.="<b>UTM zone:</b> ".$zone." ";
$res.="<b>Timezone:</b> ".$timezone." <b>First point time:</b> $time ";
break;
}
}
return $res;
}
function getUTMzoneLocal($lon, $lat) {
if ($lon < 0.0) $lonTmp = 180 - $lon ;
else $lonTmp = 180 - $lon ;
$UTMzone=ceil($lonTmp/6);
return $UTMzone;
}
function getUTMtimeOffset($lat,$lon, $theDate ) {
// $lon is the X (negative is EAST positive is WEST
// for now we return a very rough calculation
DEBUG('flight',1,"getUTMtimeOffset: date-> $theDate <BR>");
$timezone= ceil( -$lon / (180/12) );
return $timezone;
}
function getTZ($lat,$lon, $theDate) {
global $db,$waypointsTable;
global $CONF_use_date_for_TZ_detection;
// fall back to simple lon method in case of old php (4.4.1)
if (!$CONF_use_date_for_TZ_detection) return getUTMtimeOffset($lat,$lon, $theDate );
$query="SELECT lat,lon,ABS($lat-lat) as dlat , ABS($lon- lon ) as dlon ,countryCode from $waypointsTable
WHERE ABS($lat-lat) < 1 AND ABS($lon- lon ) < 1
ORDER BY dlat,dlon ASC";
DEBUG('getTZ',128,"getTZ: $query<BR>");
$res= $db->sql_query($query);
if($res <= 0){
DEBUG('getTZ',128,"getTZ: no waypont near by will try rough method<BR>");
return getUTMtimeOffset($lat,$lon, $theDate );
}
$i=0;
$minTakeoffDistance=1000000;
while ($row = mysql_fetch_assoc($res)) {
$i++;
$this_distance = gpsPoint::calc_distance($row["lat"],$row["lon"],$lat,$lon);
DEBUG('getTZ',128,"getTZ: ".$row["lat"]." , ".$row["lon"]." country-> ".$row["countryCode"]." distance-> $this_distance <BR>");
if ( $this_distance < $minTakeoffDistance ) {
$minTakeoffDistance = $this_distance;
$countryCode=$row["countryCode"];
}
}
if (!$i) {
DEBUG('getTZ',128,"getTZ: No waypont near by #2. Will try rough method<BR>");
return getUTMtimeOffset($lat,$lon, $theDate );
}
DEBUG('getTZ',128,"getTZ: Min dist: $minTakeoffDistance , country: $countryCode <BR>");
if ($minTakeoffDistance > 50000 ) {
DEBUG('getTZ',128,"getTZ: Nearest waypoint is too far. Will try rough method<BR>");
return getUTMtimeOffset($lat,$lon, $theDate );
}
// now we will try the getTZoffset()
// make $tm from YYYY-MM-DD
$tm=gmmktime(1,0,0,substr($theDate,5,2),substr($theDate,8,2),substr($theDate,0,4));
// this will return good results only for countries that have ONE timezone
// else '' will be returned
require_once dirname(__FILE__).'/FN_timezones.php';
// $TZone=getTZforCountry($countryCode);
global $Countries2timeZones;
$TZone= $Countries2timeZones[strtoupper($countryCode)];
if (strtoupper($countryCode)=='AU' ){
DEBUG('getTZ',128,"getTZ: Australia timezones<BR>");
/*
australia
http://www.statoids.com/tau.html
central - west is on 129E
central - east is on
lon > 141E for lat < -26 (S)
lon > 138E for lat > -26 (S)
east - > Australia/Sydney
west
central
*/
if ( $lon > -129 ) $TZone='Australia/Perth'; // West
else if ( $lon > -138 && $lat > -26 ) $TZone='Australia/Darwin'; // central north
else if ( $lon > -141 && $lat < -26 ) $TZone='Australia/Adelaide'; // central south
else if ( $lat > -29) $TZone='Australia/Brisbane'; // queensland - North East
else $TZone='Australia/Sydney'; // South-East
}
if ($TZone=='') {
DEBUG('getTZ',128,"getTZ: Country $countryCode has more than one timezones.. Back to rough method<BR>");
return getUTMtimeOffset($lat,$lon, $theDate );
}
return getTZoffset($TZone,$tm)/3600;
}
function getTZoffset($TZone,$tm) {
/*php 5.4 code */
$oldTZ=date_default_timezone_get();
date_default_timezone_set($TZone);
$offset=date('O',$tm);
DEBUG('getTZoffset',128,"getTZoffset: offset from GMT :$offset [getenv TZ= $tTZ] ".date("T/Z/I/O")."<BR>");
date_default_timezone_set($oldTZ);
/*
$oldTZ=getenv("TZ");
// echo "old:$oldTZ";
// DEBUG('getTZoffset',128,"getTZoffset: $TZone ($tm) [server TZ=$oldTZ] ".date("T/Z/I/O")."<BR>");
putenv("TZ=$TZone");
$offset=date('O',$tm);
putenv("TZ=$TZone");
$offset=date('O',$tm);
putenv("TZ=$TZone");
$offset=date('O',$tm);
$tTZ=getenv("TZ");
DEBUG('getTZoffset',128,"getTZoffset: offset from GMT :$offset [getenv TZ= $tTZ] ".date("T/Z/I/O")."<BR>");
putenv("TZ=$oldTZ");
*/
if ( preg_match("/([-+])(\d\d)(\d\d)/",$offset,$matches) ) {
$secs=$matches[2]*3600+$matches[3]*60;
if ($matches[1]=='-') $secs=-$secs;
} else {
echo "FATAL error in flight offset";
exit;
}
DEBUG('getTZoffset',128,"getTZoffset: $TZone ($tm) = ".($secs /3600)."<BR>");
return $secs;
}
function generate_flights_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE, $begin_end = 2, $from_middle = 2)
{
/*
By default, $begin_end is 3, and $from_middle is 1, so on page 6 in a 12 page view, it will look like this:
a, d = $begin_end = 3
b, c = $from_middle = 1
"begin" "middle" "end"
| | |
| a b | c d |
| | | | | | |
v v v v v v v
1, 2, 3 ... 5, 6, 7 ... 10, 11, 12
Change $begin_end and $from_middle to suit your needs appropriately
*/
// $begin_end = 2;
// $from_middle = 2;
$total_pages = ceil($num_items/$per_page);
if ( $total_pages == 1 )
{
return '';
}
$on_page = floor($start_item / $per_page) + 1;
$page_string = '';
if ( $total_pages > ((2*($begin_end + $from_middle)) + 2) )
{
// $init_page_max = ( $total_pages > 3 ) ? 3 : $total_pages;
$init_page_max = ( $total_pages > $begin_end ) ? $begin_end : $total_pages;
for($i = 1; $i < $init_page_max + 1; $i++)
{
// $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
$page_string .= ( $i == $on_page ) ? '<div class="activePageNum">' . $i . '</div>' : '<a href="' . append_sid($base_url . "&page_num=".$i ) . '">' . $i . '</a>';
if ( $i < $init_page_max )
{
$page_string .= ", ";
}
}
//if ( $total_pages > 3 )
if ( $total_pages > $begin_end )
{
if ( $on_page > 1 && $on_page < $total_pages ) {
//$page_string .= ( $on_page > 5 ) ? ' ... ' : ', ';
$page_string .= ( $on_page > ($begin_end + $from_middle + 1) ) ? ' ... ' : ', ';
//$init_page_min = ( $on_page > 4 ) ? $on_page : 5;
$init_page_min = ( $on_page > ($begin_end + $from_middle) ) ? $on_page : ($begin_end+ $from_middle + 1);
//$init_page_max = ( $on_page < $total_pages - 4 ) ? $on_page : $total_pages - 4;
$init_page_max = ( $on_page < $total_pages - ($begin_end + $from_middle) ) ? $on_page : $total_pages - ($begin_end + $from_middle);
//echo $init_page_min."#".$init_page_max."#".$on_page;
//for($i = $init_page_min - 1; $i < $init_page_max + 2; $i++)
for($i = $init_page_min - $from_middle; $i < $init_page_max + ($from_middle + 1); $i++)
{
$page_string .= ($i == $on_page) ? '<div class="activePageNum">' . $i . '</div>' : '<a href="' . append_sid($base_url . "&page_num=$i").'">'.$i. '</a>';
//if ( $i < $init_page_max + 1 )
if ( $i < $init_page_max + $from_middle )
{
$page_string .= ', ';
}
}
//$page_string .= ( $on_page < $total_pages - 4 ) ? ' ... ' : ', ';
$page_string .= ( $on_page < $total_pages - ($begin_end + $from_middle) ) ? ' ... ' : ', ';
} else {
$page_string .= ' ... ';
}
//for($i = $total_pages - 2; $i < $total_pages + 1; $i++)
for($i = $total_pages - ($begin_end - 1); $i < $total_pages + 1; $i++)
{
$page_string .= ( $i == $on_page ) ? '<div class="activePageNum">' . $i . '</div>' : '<a href="' . append_sid($base_url . "&page_num=$i").'">' . $i . '</a>';
if( $i < $total_pages )
$page_string .= ", ";
}
}
} else {
for($i = 1; $i < $total_pages + 1; $i++)
{
$page_string .= ( $i == $on_page ) ? '<div class="activePageNum">' . $i . '</div>': '<a href="' . append_sid($base_url . "&page_num=$i").'">'.$i.'</a>';
if ( $i < $total_pages )
$page_string .= ', ';
}
}
if ( $add_prevnext_text )
{
global $themeRelPath;
$imgNext=leoHtml::img("icon_page_next.gif",0,0,'border','','icons1');
$imgPrev=leoHtml::img("icon_page_next.gif",0,0,'border','','icons1');
if ( $on_page > 1 )
$page_string = ' <a href="' . append_sid($base_url . "&page_num=" . ( $on_page - 1 ) ) . '">'.$imgPrev.'</a> '.$page_string;
if ( $on_page < $total_pages )
$page_string .= ' <a href="' . append_sid($base_url . "&page_num=" . ($on_page+1) ) . '">'.$imgNext.'</a>';
}
$page_string = '<div class="numeration">'.$page_string.'</div>';
return $page_string;
}
function makeFlightActionsPopup() {
global $moduleRelPath,$opMode;
ob_start();
?>
<script language="javascript">
var flightActionTip = new TipObj('flightActionTip');
with (flightActionTip)
{
template = '<table bgcolor="#000000" cellpadding="0" cellspacing="0" width="%3%" border="0">' +
'<tr><td class="infoBoxHeader"><? echo "Actions"; ?></td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/change_icon.png' width='16' height='16' border='0' align='absmiddle'> <a href='<?=getLeonardoLink(array('op'=>'edit_flight','flightID'=>'%4%'))?>'><? echo 'Edit flight'; ?></a>"+
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/x_icon.gif' width='16' height='16' border='0' align='absmiddle'> <a href='<?=getLeonardoLink(array('op'=>'delete_flight','flightID'=>'%4%'))?>'><? echo 'Delete flight'; ?></a>"+
'</td></tr></table>';
tipStick = 0;
showDelay = 0;
hideDelay = 700;
doFades = false;
}
</script>
<div id="flightActionTipLayer" class="shadowBox" style="position: absolute; z-index: 10000;
visibility: hidden; left: 0px; top: 0px; width: 10px"> </div>
<?
$c=ob_get_contents();
ob_end_clean();
return $c;
}
function makeGoogleEarthPopup() {
global $moduleRelPath,$opMode,$CONF, $userID;
ob_start();
?>
<script language="javascript">
var geTip = new TipObj('geTip');
with (geTip)
{
var showTitle=true;
var title='<?=_choose_ge_module?>';
var arrowDir = "right";
var arrowLeft = -10;
var arrowTop = -3;
var shadowTop = -7;
var shadowLeft = -7;
arrowDir = "right";
// arrowLeft = tipWidth;
arrowTop = -1;
if(document.all)
arrowLeft -= 2;
template= "<div id='BT' class='BT_shadow0' >" +
"<div class='BT_shadow1'>"+
"<div class='BT_shadow2'>" +
"<div id='BT_main' style='width:%3%px; top:"+shadowTop+"px; left:"+shadowLeft+"px;'>" +
"<div id='BT_arrow_"+arrowDir+"' style='top: "+arrowTop+"px; left:%3%px;'></div>" +
(showTitle?"<div id='BT_title'>"+title+"</div>":"") +
"<div style='padding:5px'>" +
"<div id='BT_content' style='line-height:140%'>"+
<? $icon_bullet_greenStr=leoHtml::img("icon_bullet_green.gif",0,0,'absmiddle','','icons1');?>
<? if ($CONF['googleEarth']['igc2kmz']['active'] && ( $CONF['googleEarth']['igc2kmz']['visible'] || L_auth::isModerator($userID) ) ) { ?>
"<?=$icon_bullet_greenStr?><?=leoHtml::img("icon_new.png",0,0,'absmiddle','','icons1')?> <a href='<?=getDownloadLink(array('type'=>'kml_trk','an'=>'2','flightID'=>'%4%','lng'=>'%5%'))?>'><? echo 'IGC2KMZ '._ge_module_advanced_1; ?></a>"+
'<br>'+
<? } ?>
"<?=$icon_bullet_greenStr?> <a href='<?=getDownloadLink(array('type'=>'kml_trk','an'=>'1','flightID'=>'%4%','lng'=>'%5%'))?>'><? echo 'GPS2GE V2.0 '._ge_module_advanced_2; ?></a>"+
'<br>'+
"<?=$icon_bullet_greenStr?> <a href='<?=getDownloadLink(array('type'=>'kml_trk','an'=>'0','flightID'=>'%4%','lng'=>'%5%'))?>'><?=_ge_module_Simple ?></a>"+
"</div>" +
"</div>"+
"<div id='BT_bottom_arrow_"+arrowDir+"' style='display:none; top: 30px; left:"+arrowLeft+"px;'></div>" +
"</div></div></div></div>";
tipStick = 0;
showDelay = 0;
hideDelay = 500;
doFades = false;
}
</script>
<div id="geTipLayer" class="shadowBox" style="position: absolute; z-index: 10000;
visibility: hidden; left: 0px; top: 0px; width: 10px"> </div>
<?
$c=ob_get_contents();
ob_end_clean();
return $c;
}
function makePilotPopup() {
global $moduleRelPath,$opMode;
ob_start();
?>
<script language="javascript">
var pilotTip = new TipObj('pilotTip');
with (pilotTip)
{
template = '<table bgcolor="#000000" cellpadding="0" cellspacing="0" width="250" border="0">' +
'<tr><td class="infoBoxHeader">%5%</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_pilot.gif' border=0 align='absmiddle'> <a href='<?=getLeonardoLink(array('op'=>'pilot_profile','pilotIDview'=>'%4%') )?>'><? echo _Pilot_Profile ?></a>"+
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_magnify_small.gif' border=0 align='absmiddle'> <a href='<?=getLeonardoLink(array('op'=>'list_flights','pilotID'=>'%4%') ) ?>'><? echo _PILOT_FLIGHTS .' ('._MENU_FILTER.')'?></a>"+
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_magnify_small.gif' border=0 align='absmiddle'> <a href='<?=getLeonardoLink(array('op'=>'list_flights','pilotID'=>'%4%',
'year'=>'0','month'=>'0','takeoffID'=>'0','country'=>'0','cat'=>'0') ) ?>'><? echo _PILOT_FLIGHTS.' ('._ALL.')' ?></a>"+
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_stats.gif' border=0 align='absmiddle'> <a href='<?=getLeonardoLink(array('op'=>'pilot_profile_stats','pilotID'=>'%4%') )?>'><? echo _flights_stats ?></a>"+
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icons1/rss.gif' alt='RSS pilot feed' width=16 height=16 border=0 align='absmiddle'> <a href='<?=$moduleRelPath."/rss.php?op=latest&pilot=%4%"?>'><? echo _RSS_of_pilots_flights ?></a>"+
<? if ($opMode==2) { ?>// phpbb only
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_user.gif' alt='PM this user' width=16 height=16 border=0 align='absmiddle'> <a href='/privmsg.php?mode=post&u=%4%'><? echo "PM" ?></a>"+
<? } ?>
'</td></tr></table>';
tipStick = 0;
showDelay = 0;
hideDelay = 0;
doFades = false;
}
var pilotTipExt = new TipObj('pilotTipExt');
with (pilotTipExt)
{
template = '<table bgcolor="#000000" cellpadding="0" cellspacing="0" width="250" border="0">' +
'<tr><td class="infoBoxHeader">%5%</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_magnify_small.gif' border=0 align='absmiddle'> <a href='<?=getLeonardoLink(array('op'=>'list_flights','pilotID'=>'%4%') ) ?>'><? echo _PILOT_FLIGHTS .' ('._MENU_FILTER.')'?></a>"+
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_magnify_small.gif' border=0 align='absmiddle'> <a href='<?=getLeonardoLink(array('op'=>'list_flights','pilotID'=>'%4%',
'year'=>'0','month'=>'0','takeoffID'=>'0','country'=>'0','cat'=>'0') ) ?>'><? echo _PILOT_FLIGHTS.' ('._ALL.')' ?></a>"+
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_stats.gif' border=0 align='absmiddle'> <a href='<?=getLeonardoLink(array('op'=>'pilot_profile_stats','pilotIDview'=>'%4%') )?>'><? echo _flights_stats ?></a>"+
'</td></tr></table>';
tipStick = 0;
showDelay = 0;
hideDelay = 0;
doFades = false;
}
</script>
<div id="pilotTipLayer" class="shadowBox" style="position: absolute; z-index: 10000;
visibility: hidden; left: 0px; top: 0px; width: 10px"> </div>
<div id="pilotTipExtLayer" class="shadowBox" style="position: absolute; z-index: 10000;
visibility: hidden; left: 0px; top: 0px; width: 10px"> </div>
<?
$c=ob_get_contents();
ob_end_clean();
return $c;
}
function makeTakeoffPopup($ext=0,$userID=0) {
global $moduleRelPath;
ob_start();
?>
<script language="javascript">
var takeoffTip = new TipObj('takeoffTip');
with (takeoffTip)
{
template = '<table bgcolor="#000000" cellpadding="0" cellspacing="0" width="%3%" border="0">' +
'<tr><td class="infoBoxHeader">%5%</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_magnify_small.gif' align='absmiddle' border=0> <a href='<?=
getLeonardoLink(array('op'=>'list_flights','takeoffID'=>'%4%') )?>'><? echo _See_flights_near_this_point.' ('._MENU_FILTER.')' ?></a>"+
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_magnify_small.gif' align='absmiddle' border=0> <a href='<?=
getLeonardoLink(array('op'=>'list_flights','takeoffID'=>'%4%',
'year'=>'0','month'=>'0','pilotID'=>'0','country'=>'0','cat'=>'0') )?>'><? echo _See_flights_near_this_point.' ('._ALL.')' ?></a>"+
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_pin.png' align='absmiddle' border=0> <a href='<?=getLeonardoLink(array('op'=>'show_waypoint','waypointIDview'=>'%4%'))?>'><? echo _SITE_INFO ?></a>"+
'</td></tr>'+
'<tr><td class="infoBox">'+
"<img src='<?=$moduleRelPath?>/img/gearth_icon.png' align='absmiddle' border=0> <a href='<?=getDownloadLink(array('type'=>'kml_wpt','wptID'=>'%4%'))?>'><? echo _Navigate_with_Google_Earth ?></a>"+
<? if ( $ext && L_auth::isAdmin($userID) ) { ?>
'</td></tr><tr><td class="infoBox adminBox">'+
"<img src='<?=$moduleRelPath?>/img/icon_add.png' align='absmiddle' border=0> <a href='javascript:add_takeoff(%6%,%7%,%4%)'><?=_ADD_WAYPOINT?></a>"+
'</td></tr><tr><td class="infoBox adminBox">'+
"<img src='<?=$moduleRelPath?>/img/change_icon.png' align='absmiddle' border=0> <a href='javascript:edit_takeoff(%4%)'><?=_EDIT_WAYPOINT?></a>"+
'</td></tr><tr><td class="infoBox adminBox">'+
"<img src='<?=$moduleRelPath?>/img/x_icon.gif' align='absmiddle' border=0> <a href='javascript:delete_takeoff(%4%)'><?=_DELETE_WAYPOINT?></a>"+
<? } ?>
'</td></tr></table>';
tipStick = 0;
showDelay = 0;
hideDelay = 0;
doFades = false;
}
</script>
<div id="takeoffTipLayer" class="shadowBox" style="position: absolute; z-index: 10000; visibility: hidden; left: 0px; top: 0px; width: 10px"> </div>
<?
$c=ob_get_contents();
ob_end_clean();
return $c;
}
function prepare_for_js($name) {
$name=str_replace("'","'",$name);
$name=str_replace("\"","'",$name);
// $name=str_replace("'","\'",$name);
return $name;
}
function flush2Browser() {
// first version
/*
echo str_pad(" ",4096," ");
flush();
ob_flush();
while (@ ob_end_flush());
*/
// second version
// ob_implicit_flush(1) ;
/*for($i = 0; $i < 200; $i++){
print "<!-- bufferme -->\n";
}*/
// third version
?>
<script language="javascript">
for(i=0;i<100;i++) {
document.writeln("<!-- NULL -->");
}
</script>
<?
flush();
// this breaks in lighttpd
//while (@ob_end_flush());
//ob_end_flush();
// ob_start();
}
?>