Beispiel #1
0
function getPilotList($clubID = 0)
{
    global $db;
    global $flightsTable;
    global $clubsPilotsTable, $pilotsTable;
    global $nativeLanguage, $currentlang, $opMode;
    if ($clubID) {
        $query = "SELECT *, {$clubsPilotsTable}.pilotID as userID , {$clubsPilotsTable}.pilotServerID as userServerID\n\t\t\tFROM  {$clubsPilotsTable}, {$pilotsTable}\n  \t\t\tWHERE {$clubsPilotsTable}.pilotID={$pilotsTable}.pilotID\n\t\t\t\t\tAND {$clubsPilotsTable}.pilotServerID={$pilotsTable}.serverID AND {$clubsPilotsTable}.clubID={$clubID}";
    } else {
        $query = "SELECT DISTINCT userID, userServerID FROM {$flightsTable} ";
    }
    // echo $query;
    $res = $db->sql_query($query);
    if ($res <= 0) {
        echo "ERROR in selecting pilots";
        //		echo $query;
        return array(array(), array());
    }
    $pilots = array();
    $pilotsID = array();
    while ($row = $db->sql_fetchrow($res)) {
        $name = getPilotRealName($row["userID"], $row["userServerID"], 0, 2);
        $name = strtoupper(substr($name, 0, 1)) . substr($name, 1);
        $pnames[$row["userServerID"] + 0 . '_' . $row["userID"]] = $name;
    }
    if (!empty($pnames)) {
        asort($pnames);
        foreach ($pnames as $userID => $name) {
            array_push($pilots, $name);
            array_push($pilotsID, $userID);
        }
    }
    return array($pilots, $pilotsID);
}
Beispiel #2
0
     }
     if (!strpos($filter_clause, $pilotsTable) === false) {
         $extra_tbl .= " LEFT JOIN {$pilotsTable} ON \n\t\t\t\t\t\t({$flightsTable}.userID={$pilotsTable}.pilotID AND \n\t\t\t\t\t\t{$flightsTable}.userServerID={$pilotsTable}.serverID) ";
     }
 }
 $query = "SELECT * FROM {$flightsTable} {$extra_tbl} WHERE \n\t\t\t\t firstLat>={$south} &&  firstLat<={$north} &&  \n\t\t\t\t firstLon>={$west} && firstLon<={$east} {$filter_clause}\n\t\t\t\t ORDER BY  FLIGHT_POINTS DESC LIMIT 100 ";
 //echo $query;
 $res = $db->sql_query($query);
 if ($res <= 0) {
     echo "<H3> Error in query! {$query} </H3>\n";
     exit;
 }
 $i = 0;
 $str = '';
 while ($row = mysql_fetch_assoc($res)) {
     $name = getPilotRealName($row["userID"], $row["userServerID"], 0, 0, 0);
     $link = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row['ID'])));
     $this_year = substr($row[DATE], 0, 4);
     $linkIGC = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getRelMainDir() . str_replace("%PILOTID%", getPilotID($row["userServerID"], $row["userID"]), str_replace("%YEAR%", $this_year, $CONF['paths']['igc'])) . '/' . $row['filename']);
     //$flightsRelPath."/".$row[userID]."/flights/".$this_year."/".$row[filename] );
     if ($row['takeoffVinicity'] > $takeoffRadious) {
         $location = getWaypointName($row['takeoffID']) . " [~" . sprintf("%.1f", $row['takeoffVinicity'] / 1000) . " km]";
     } else {
         $location = getWaypointName($row['takeoffID']);
     }
     $flight = new flight();
     $flight->getFlightFromDB($row['ID'], 0, $row);
     $extendedInfo = 0;
     $lineColor = "ff0000";
     $exaggeration = 1;
     $lineWidth = 2;
    echo "go away";
    return;
}
$pilotsList = array();
$pilotsID = array();
//list($takeoffs,$takeoffsID)=getTakeoffList();
//list($countriesCodes,$countriesNames)=getCountriesList();
if ($_POST['formPosted']) {
    //	$add_pilot_id=$_POST['add_pilot_id'];
    list($add_pilot_server_id, $add_pilot_id) = splitServerPilotStr($_POST['add_pilot_id']);
    $action = $_POST['AdminAction'];
    if ($add_pilot_id) {
        $action = "add_pilot";
    }
    if ($action == "add_pilot") {
        $pilotName = getPilotRealName($add_pilot_id, $add_pilot_server_id);
        $resText = "Pilot Name: {$pilotName} -> ";
        if ($pilotName) {
            $query = "INSERT INTO {$clubsPilotsTable} (clubID,pilotID,pilotServerID) VALUES ({$clubID},{$add_pilot_id},{$add_pilot_server_id} )";
            $res = $db->sql_query($query);
            if ($res <= 0) {
                $resText .= "This pilot is already in the club";
            }
            $resText .= "Pilot added ";
        } else {
            $resText .= "No such pilot ID ";
        }
    } else {
        if ($action == "remove_pilot") {
            // $pilotToRemove=$_POST['pilotToRemove'];
            list($pilotToRemoveServerID, $pilotToRemove) = splitServerPilotStr($_POST['pilotToRemove']);
function listFlights($res, $legend, $queryExtraArray = array(), $sortOrder = "DATE")
{
    global $db, $Theme;
    global $takeoffRadious;
    global $userID, $serverID;
    global $NACclubID;
    global $clubID, $clubFlights, $clubsList, $add_remove_mode;
    global $moduleRelPath;
    global $PREFS, $CONF;
    global $page_num, $pagesNum, $startNum, $itemsNum;
    global $currentlang, $nativeLanguage, $opMode;
    global $CONF_photosPerFlight, $CONF_use_validation, $CONF_airspaceChecks;
    global $CONF_new_flights_days_threshold;
    global $gliderCatList;
    $clubIcon = "<img src='" . $moduleRelPath . "/img/icon_club_small.gif' width=12 height=12 border=0 align='absmiddle' >";
    $removeFromClubIcon = "<img src='" . $moduleRelPath . "/img/icon_club_remove.gif' width=22 height=12 border=0 align='absmiddle' title='Remove flight from this league'>";
    $addToClubIcon = "<img src='" . $moduleRelPath . "/img/icon_club_add.gif' width=12 height=12 border=0 align='absmiddle' title='Add flight to this league'>";
    if ($clubID && (L_auth::isClubAdmin($userID, $clubID) || L_auth::isAdmin($userID))) {
        ?>

<script language="javascript">

function addClubFlight(clubID,flightID) {
	$("#updateDiv").load('<?php 
        echo $moduleRelPath;
        ?>
/EXT_club_functions.php?op=add&clubID='+clubID+'&flightID='+flightID);
	$('#fl_'+flightID).html("<a href=\"#\" onclick=\"removeClubFlight("+clubID+","+flightID+");return false;\"><?php 
        echo $removeFromClubIcon;
        ?>
</a>");
	
}

function removeClubFlight(clubID,flightID) {
	$("#updateDiv").load('<?php 
        echo $moduleRelPath;
        ?>
/EXT_club_functions.php?op=remove&clubID='+clubID+'&flightID='+flightID);
	$('#fl_'+flightID).html("<a href=\"#\" onclick=\"addClubFlight("+clubID+","+flightID+");return false;\"><?php 
        echo $addToClubIcon;
        ?>
</a>");
}
</script>

<?php 
        echo "<div class='tableInfo shadowBox'>You can administer this club ";
        if ($clubsList[$clubID]['addManual']) {
            if ($add_remove_mode) {
                $queryExtraArray['admClub'] = '0';
                echo "<a href='" . getLeonardoLink(array('op' => 'list_flights', 'sortOrder' => $sortOrder) + $queryExtraArray) . "'>Return to normal view</a>";
            } else {
                $queryExtraArray['admClub'] = '1';
                echo "<a href='" . getLeonardoLink(array('op' => 'list_flights', 'sortOrder' => $sortOrder) + $queryExtraArray) . "'>Add / remove flights</a>";
            }
        }
        echo "<div id='updateDiv' style='display:block'></div>";
        echo "</div>";
    }
    ?>
  	<table class='listTable' style='clear:both' width="100%" cellpadding="2" cellspacing="0">
	<tr> 
	  <td class='SortHeader indexCell' width="25"><?php 
    echo _NUM;
    ?>
</td>
		 <?php 
    printHeader(60, $sortOrder, "DATE", _DATE_SORT, $queryExtraArray);
    printHeader(160, $sortOrder, "pilotName", _PILOT, $queryExtraArray);
    printHeader(0, $sortOrder, "takeoffID", _TAKEOFF, $queryExtraArray);
    printHeader(40, $sortOrder, "DURATION", _DURATION_HOURS_MIN, $queryExtraArray);
    if ($CONF['list_flights']['fields']['scoring'][0] == 'LINEAR_DISTANCE') {
        printHeader(60, $sortOrder, "LINEAR_DISTANCE", _LINEAR_DISTANCE, $queryExtraArray);
    } else {
        printHeader(60, $sortOrder, "SCORE_SPEED", _MEAN_SPEED1, $queryExtraArray);
    }
    printHeader(60, $sortOrder, "FLIGHT_KM", _OLC_KM, $queryExtraArray);
    printHeader(65, $sortOrder, "FLIGHT_POINTS", _OLC_SCORE, $queryExtraArray);
    ?>
	  <td width="18" class='SortHeader'>&nbsp;</td>
  	  <td width="50" class='SortHeader'>&nbsp;</td>
	  <td width="70" class='SortHeader displayCell alLeft'><?php 
    echo _SHOW;
    ?>
</td>
  </tr>
<?php 
    $i = 1;
    $currDate = "";
    while ($row = $db->sql_fetchrow($res)) {
        $is_private = $row["private"];
        $flightID = $row['ID'];
        if ($pilotNames[$row["userServerID"] . '_' . $row["userID"]]) {
            $name = $pilotNames[$row["userServerID"] . '_' . $row["userID"]];
        } else {
            $name = getPilotRealName($row["userID"], $row["userServerID"], 1);
            $pilotNames[$row["userServerID"] . '_' . $row["userID"]] = $name;
        }
        $name = prepare_for_js($name);
        if ($takeoffNames[$row["flight_takeoffID"]]) {
            $takeoffName = $takeoffNames[$row["flight_takeoffID"]];
        } else {
            $takeoffName = prepare_for_js(getWaypointName($row["flight_takeoffID"], -1, 0, 20));
            $takeoffNames[$row["flight_takeoffID"]] = $takeoffName;
        }
        $takeoffVinicity = $row["takeoffVinicity"];
        $takeoffNameFrm = formatLocation($takeoffName, $takeoffVinicity, $takeoffRadious);
        $sortRowClass = $i % 2 ? "l_row1" : "l_row2";
        $i++;
        $days_from_submission = floor((mktime() - datetime2UnixTimestamp($row["dateAdded"])) / 86400);
        // 60*60*24 sec per day
        if (!$is_private) {
            $privateIcon = '&nbsp;';
        } else {
            $privateIcon = '';
            if ($is_private & 0x1) {
                $privateIcon .= "<img src='" . $moduleRelPath . "/img/icon_private.gif' align='absmiddle' width='13' height='13'>";
            }
            if ($is_private & 0x2) {
                $privateIcon .= "<img src='" . $moduleRelPath . "/img/icon_disabled.gif' align='absmiddle' width='13' height='13'>";
            }
            if ($is_private & 0x4) {
                $privateIcon .= "<img src='" . $moduleRelPath . "/img/locked.gif' align='absmiddle' width='13' height='13'>";
            }
        }
        if ($row["DATE"] != $currDate || $sortOrder != 'DATE') {
            $currDate = $row["DATE"];
            $dateStr = formatDate($row["DATE"]);
            $rowStr = " newDate ";
        } else {
            $dateStr = "<span class='dateHidden'>" . formatDate($row["DATE"]) . "</span>";
            $rowStr = "";
        }
        $date2row = "";
        if ($days_from_submission <= $CONF_new_flights_days_threshold) {
            $newSubmissionStr = _SUBMIT_FLIGHT . ': ' . $row["dateAdded"] . ' GMT';
            $date2row .= leoHtml::img("icon_new.png", 25, 12, 'absmiddle', $newSubmissionStr, 'icons1');
        }
        if ($row['excludeFrom'] & 0x1) {
            $date2row .= "*";
        }
        //$extLinkImgStr=getExternalLinkIconStr($row["serverID"],$row["originalURL"],3);
        //if ($extLinkImgStr) $extLinkImgStr="<a href='".$row["originalURL"]."' target='_blank'>$extLinkImgStr</a>";
        $date2row .= $extLinkImgStr;
        if ($date2row == '') {
            $date2row .= '&nbsp;';
        }
        echo "\n\n<tr class='{$sortRowClass} {$rowStr}' id='row_{$flightID}'>\n";
        $duration = sec2Time($row['DURATION'], 1);
        $linearDistance = formatDistanceOpen($row["LINEAR_DISTANCE"]);
        $olcDistance = formatDistanceOpen($row["FLIGHT_KM"]);
        $olcScore = formatOLCScore($row["FLIGHT_POINTS"]);
        $gliderType = $row["cat"];
        // 1=pg 2=hg flex 4=hg rigid 8=glider
        # Martin Jursa 20.05.2007
        $scoreSpeed = formatSpeed($row["SCORE_SPEED"]);
        // get the OLC score type
        $olcScoreType = $row['BEST_FLIGHT_TYPE'];
        if ($olcScoreType == "FREE_FLIGHT") {
            $olcScoreTypeImg = "icon_turnpoints.gif";
        } else {
            if ($olcScoreType == "FREE_TRIANGLE") {
                $olcScoreTypeImg = "icon_triangle_free.gif";
            } else {
                if ($olcScoreType == "FAI_TRIANGLE") {
                    $olcScoreTypeImg = "icon_triangle_fai.gif";
                } else {
                    $olcScoreTypeImg = "photo_icon_blank.gif";
                }
            }
        }
        $gliderBrandImg = brands::getBrandImg($row["gliderBrandID"], $row['flight_glider'], $gliderType);
        echo "\n<TD {$first_col_back_color} class='indexCell'><div>" . ($i - 1 + $startNum) . "</div>{$privateIcon}</TD>";
        echo "<TD class='dateString' valign='top'><div>{$dateStr}</div>{$date2row}";
        if ((L_auth::isClubAdmin($userID, $clubID) || L_auth::isAdmin($userID)) && $add_remove_mode) {
            // echo "<BR>";
            if (in_array($flightID, $clubFlights)) {
                echo "<div id='fl_{$flightID}' style='display:inline;margin:0px;padding:0px'><a href=\"#\" onclick=\"removeClubFlight({$clubID},{$flightID});return false;\">{$removeFromClubIcon}</a></div>";
            } else {
                echo "<div id='fl_{$flightID}' style='display:inline'><a href=\"#\" onclick=\"addClubFlight({$clubID},{$flightID});return false;\">{$addToClubIcon}</a></div>";
            }
        }
        echo "</TD>";
        echo "<TD  class='pilotTakeoffCell' colspan=2 " . $sortArrayStr["pilotName"] . $sortArrayStr["takeoffID"] . ">" . "<div id='p_{$i}' class='pilotLink'>";
        //echo "<span class='fl sprite-gr'></span>";
        //echo  getNationalityDescription($row["pilotCountryCode"],1,0);
        $thisPilot = new pilot($row["userServerID"], $row["userID"]);
        if ($thisPilot->isPilotLocal() || L_auth::isAdmin($userID)) {
            echo " <a href=\"javascript:pilotTip.newTip('inline', 0, 13, 'p_{$i}', 250, '" . $row["userServerID"] . "_" . $row["userID"] . "','" . addslashes($name) . "' )\"  onmouseout=\"pilotTip.hide()\">{$name}</a>\n";
        } else {
            echo " <a href=\"javascript:pilotTipExt.newTip('inline', 0, 13, 'p_{$i}', 200, '" . $row["userServerID"] . "_" . $row["userID"] . "','" . addslashes($name) . "' )\"  onmouseout=\"pilotTip.hide()\">{$name}</a>\n";
        }
        echo "</div>";
        echo "<div id='at_{$i}' class='takeoffLink'>";
        echo "<a id='t_{$i}' href=\"javascript:takeoffTip.newTip('inline',-25, 13,'t_{$i}', 250, '" . $row["takeoffID"] . "','" . addslashes($takeoffName) . "')\"  onmouseout=\"takeoffTip.hide()\">{$takeoffNameFrm}</a>\n";
        echo "</div></TD>" . "<TD>{$duration}</TD>";
        if ($CONF['list_flights']['fields']['scoring'][0] == 'LINEAR_DISTANCE') {
            echo "<TD class='distance'>{$linearDistance}</TD>";
        } else {
            echo "<TD class='speed'>{$scoreSpeed}</TD>";
        }
        echo "<TD class='distance'>{$olcDistance}</TD>";
        //P. Wild 22.03.2011 - Deutschland Flüge Fett hervorheben, Admin Farbkennzeichnung Luftraum
        $tmpairspaceName = $row['airspaceCheckMsg'];
        if (strrchr($tmpairspaceName, "Punkte")) {
            echo "<TD nowrap class='OLCScore'><b>{$olcScore}</b>&nbsp;" . leoHtml::img($olcScoreTypeImg, 16, 16, 'top', formatOLCScoreType($olcScoreType, 0), 'icons1');
        } else {
            echo "<TD nowrap class='OLCScore'>{$olcScore}&nbsp;" . leoHtml::img($olcScoreTypeImg, 16, 16, 'top', formatOLCScoreType($olcScoreType, 0), 'icons1');
        }
        if ($CONF_use_validation) {
            $isValidated = $row['validated'];
            if ($isValidated == -1) {
                $vImg = "icon_valid_nok.gif";
            } else {
                if ($isValidated == 0) {
                    $vImg = "icon_valid_unknown.gif";
                } else {
                    if ($isValidated == 1) {
                        $vImg = "icon_valid_ok.gif";
                    }
                }
            }
            $valStr = leoHtml::img($vImg, 12, 12, '', '', 'icons1 listIcons');
            echo $valStr;
        }
        echo "</TD>";
        echo "<TD><div class='catInfo'>";
        $gliderTypeDesc = $gliderCatList[$row["cat"]];
        if ($row["category"]) {
            $gliderTypeDesc .= " - " . $CONF['gliderClasses'][$row["cat"]]['classes'][$row["category"]];
            $categoryImg = "<div class='categoryListIconDiv'>" . leoHtml::img("icon_class_" . $row["category"] . ".png", 0, 0, 'top', $gliderTypeDesc, 'icons1', '') . "</div>";
        } else {
            $categoryImg = '';
        }
        echo leoHtml::img("icon_cat_" . $row["cat"] . ".png", 0, 0, 'top', $gliderTypeDesc, 'icons1 catListIcon') . $categoryImg;
        echo "</div></td>\n\t<TD><div align='center'>{$gliderBrandImg}</div></td>";
        if (L_auth::airspaceVisible($userID, $row["userID"], $row["userServerID"])) {
            /*
            		$CONF_airspaceChecks && 
            			( L_auth::isAdmin($userID) || $CONF['airspace']['view']=='public' ||   
            			( $CONF['airspace']['view']=='registered' && $userID >0 ) || 
            			( $CONF['airspace']['view']=='own' && $userID == $row["userID"] && $row["userServerID"]==$serverID )   
            		) 
            		) {*/
            if ($row['airspaceCheckFinal'] == -1) {
                //original: $airspaceProblem=' bgcolor=#F7E5C9 ';
                # peter Wild hack taking into account the deutschlandpokal-hack
                $tmpairspaceName = $row['airspaceCheckMsg'];
                if (strrchr($tmpairspaceName, "Punkte")) {
                    $airspaceProblem = ' bgcolor=#009cff ';
                    //Blue
                    if (strpos($tmpairspaceName, "HorDist")) {
                        $airspaceProblem = ' bgcolor=#FFFF00 ';
                        //Yellow
                    }
                    //mod.31.12.08 different colours for bad infringements. P. Wild
                    if (strpos($tmpairspaceName, 'CLASSC') !== false) {
                        $airspaceProblem = ' bgcolor=#FF0008 ';
                        //Red
                    }
                    if (strpos($tmpairspaceName, 'CLASSD') !== false) {
                        $airspaceProblem = ' bgcolor=#FF0008 ';
                    }
                } else {
                    $airspaceColor = '';
                    foreach ($CONF['aispace']['list']['colors'] as $className => $classColor) {
                        if (strpos($tmpairspaceName, $className) !== false) {
                            $airspaceColor = $classColor;
                            break;
                        }
                    }
                    if (!$airspaceColor) {
                        $airspaceColor = $CONF['aispace']['list']['colors']['ALLOTHER'];
                    }
                    $airspaceProblem = " bgcolor=#{$airspaceColor} ";
                }
                # end hack
            } else {
                $airspaceProblem = '';
            }
        }
        $isExternalFlight = $row['externalFlightType'];
        echo "<TD {$airspaceProblem} align=left valign='top'>";
        echo "<div class='smallInfo'>";
        if ($isExternalFlight == 0 || $isExternalFlight == 2 || $CONF['servers']['list'][$row['serverID']]['treat_flights_as_local']) {
            // add class='betterTip' for tooltip
            $flightLinkUrl = getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row["ID"]));
            global $deletedFlights;
            if ($deletedFlights) {
                $flightLinkUrl .= "&deleted=1";
            }
            echo "<a class='flightLink' id='tpa3_{$flightID}' href='" . $flightLinkUrl . "'>" . leoHtml::img("icon_look.gif", 0, 0, 'top', _SHOW, 'icons1 flightIcon', '', 1) . "</a>";
            echo "<a href='javascript:nop()' onclick=\"geTip.newTip('inline', -315, -5, 'ge_{$i}', 300, '" . $row["ID"] . "' , '{$currentlang}')\"  onmouseout=\"geTip.hide()\">" . leoHtml::img("geicon.gif", 0, 0, 'top', _Navigate_with_Google_Earth, 'icons1 geIcon', 'ge_' . $i) . "</a>";
        } else {
            echo "<a class='flightLink' href='" . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row["ID"])) . "'>" . leoHtml::img("icon_look.gif", 0, 0, 'top', _SHOW, 'icons1 flightIcon') . "</a>";
            $originalKML = $row["originalKML"];
            global $CONF;
            if ($CONF['servers']['list'][$row["serverID"]]['isLeo'] == 1) {
                if ($row["original_ID"]) {
                    $originalKML = 'http://' . $CONF['servers']['list'][$row["serverID"]]['url_base'] . '/download.php?type=kml_trk&flightID=' . $row["original_ID"];
                }
            }
            if ($originalKML) {
                echo "<a  href='" . $originalKML . "'>" . leoHtml::img("geicon.gif", 0, 0, 'top', _Navigate_with_Google_Earth, 'icons1 geIcon') . "</a>";
            } else {
                echo leoHtml::img("photo_icon_blank.gif", 16, 16, '', '', 'icons1 geIcon');
            }
        }
        $photosNum = $row["hasPhotos"];
        if ($photosNum) {
            echo "<span><a class='betterTip2' id='tpa1_{$flightID}' href='javascript:nop();'>" . leoHtml::img("icon_camera.gif", 0, 0, '', $photosNum . ' ' . _PHOTOS, 'icons1 photoIcon2') . "</a></span>";
        }
        if ($row["commentsNum"] > 0) {
            $hasComments = 1;
            if ($row["commentsNum"] > 1) {
                $commentsImgName = "icon_comments_many.gif";
            } else {
                $commentsImgName = "icon_comments.gif";
            }
        } else {
            $hasComments = 0;
        }
        if ($hasComments) {
            echo "<a class='betterTip' id='tpa2_{$flightID}' href='javascript:nop();'>" . leoHtml::img($commentsImgName, 0, 0, '', $row["commentsNum"] . ' ' . _COMMENTS, 'icons1 commentDiv', '', 1) . "</a>";
        }
        if (1) {
            echo "<span class='preview'><a class='betterTip' id='tpa0_{$flightID}' href='javascript:nop()'>" . leoHtml::img("icon_info.gif", 0, 0, 'top', _SHOW, 'icons1 previewDiv', '', 1) . "</a></span>";
        }
        if ($isExternalFlight && !$CONF['servers']['list'][$row['serverID']]['treat_flights_as_local']) {
            $extServerStr = $CONF['servers']['list'][$row['serverID']]['name'];
            $extServerStrShort = $CONF['servers']['list'][$row['serverID']]['short_name'];
            if ($isExternalFlight == 2) {
                echo leoHtml::img("icon_link_dark.gif", 0, 0, '', _External_Entry . ": {$extServerStr}", 'icons1 extLink');
                echo "<div class='extLinkName'>{$extServerStrShort}</div>";
            } else {
                if ($CONF['servers']['list'][$row['serverID']]['isLeo']) {
                    $url_flight = $CONF['servers']['list'][$row['serverID']]['url_flight'];
                    if ($url_flight) {
                        $extFlightLink = 'http://' . str_replace("%FLIGHT_ID%", $row['original_ID'], $url_flight) . "&lng={$currentlang}";
                    } else {
                        $extFlightLink = 'http://' . $CONF['servers']['list'][$row['serverID']]['url'] . '&op=show_flight&flightID=' . $row['original_ID'] . "&lng={$currentlang}";
                    }
                } else {
                    $extFlightLink = $row['originalURL'];
                }
                echo "<a href='{$extFlightLink}' target='_blank' class='extLinkDiv' title='{$extServerStr}: " . _Ext_text2 . "' >";
                // also put the direct link in the place of the photo
                echo "<img class='extServerLogo' src='" . $moduleRelPath . "/img/servers/" . sprintf("%03d", $row['serverID']) . ".gif' width='16' height='16'  border='0'/>";
                echo leoHtml::img("icon_link_dark.gif", 0, 0, '', '', 'icons1 extLinkIcon');
                echo "<div class='extLinkDescr'>{$extServerStrShort}</div>";
                //echo "<span class='extLinkDescr'>$extServerStrShort</span>";
                echo "</a>";
            }
        }
        # P.Wild, martin jursa: considering $CONF_new_flights_days_threshold
        global $CONF_new_flights_submit_window;
        //P. Wild - edited to submit window (old version false)
        $inWindow = empty($CONF_new_flights_submit_window) ? true : $days_from_submission <= $CONF_new_flights_submit_window;
        if ($row["userID"] == $userID && $inWindow || L_auth::isAdmin($userID)) {
            echo "<div id='ac_{$i}' class='actionLink'>";
            echo "<a href=\"javascript:flightActionTip.newTip('inline', -100, 13, 'ac_{$i}', 120, " . $row["ID"] . " )\"  onmouseout=\"flightActionTip.hide()\">" . leoHtml::img("icon_action_select.gif", 0, 0, 'bottom', '', 'icons1') . "</a>";
            echo "</div>";
        }
        $checkedByStr = '';
        if ($row['checkedBy'] && L_auth::isAdmin($userID)) {
            $checkedByArray = explode(" ", $row['checkedBy']);
            $checkedByStr = "<div class='checkedBy' align=right>" . $checkedByArray[0] . "</div>";
            echo $checkedByStr;
        }
        echo "</div>";
        echo "</TD>\n";
        echo "</TR>";
    }
    echo "</table>\n\n";
    $db->sql_freeresult($res);
}
<?php 
// caching pilot names in an array
$pilotNames = array();
if ($userID) {
    $imgBigRel = getPilotPhotoRelFilename($userServerID, $userID);
    $imgBig = getPilotPhotoFilename($userServerID, $userID);
    if (is_file($imgBig)) {
        list($width, $height, $type, $attr) = getimagesize($imgBig);
        list($width2, $height2) = CLimage::getJPG_NewSize($CONF['photos']['tiny']['max_width'], $CONF['photos']['tiny']['max_height'], $width, $height);
        echo "<a href='{$imgBigRel}' target='_blank'><img src='" . getPilotPhotoRelFilename($userServerID, $userID, 1) . "' width='{$width2}' height='{$height2}' align='absmiddle'  border=0></a>";
    } else {
        echo "<img src='{$moduleRelPath}/img/photo_no_profile_photo.jpg' width='50' height='50' align='absmiddle' border=0>";
    }
    $name = $pilotNames[$userID][$userServerID];
    if (!$name) {
        $name = getPilotRealName($userID, $userServerID + 0, 1, 1, 1);
        $pilotNames[$userID][$userServerID] = $name;
    }
    echo "&nbsp;" . _Logged_in_as . " {$name}";
    ?>
&nbsp;&nbsp;<input type="button" class="submit" value=" <?php 
    echo _Submit_Comment;
    ?>
 " />&nbsp;&nbsp;

<input type="hidden" id="userID" value="<?php 
    echo $userID;
    ?>
"/>
<input type="hidden" id="userServerID" value="<?php 
    echo $userServerID + 0;
        $str .= "<tr><td rowspan='2' width='65'  valign='top'><div class='commentHeader'>{$header}</div></td>";
        $str .= "<td valign='top'><div id='commentText{$commentID}' class='commentBody'>" . $commentData['text'] . "</div></td></tr>";
        //$str.="<div class='commentHeaderGuest'>".$commentData['guestName']."</div>";
        //$str.="<div class='commentBodyGuest'>".$commentData['text']."</div>";
    }
} else {
}
$langName = array_search($commentData['languageCode'], $lang2isoEditor);
$flagCode = $CONF['lang']['lang2countryFlag'][$langName];
// echo "flag_code: $flagCode";
$flagImg = leoHtml::img($flagCode . ".gif", 18, 12, 'absmiddle', _LANGUAGE, 'fl');
$str .= "<tr><td valign='bottom'>";
if ($commentData['userID']) {
    $name = $pilotNames[$commentData["userID"]][$commentData["userServerID"]];
    if (!$name) {
        $name = getPilotRealName($commentData["userID"], $commentData["userServerID"], 1, 1, 1);
        $pilotNames[$commentData["userID"]][$commentData["userServerID"]] = $name;
    }
    $name = prepare_for_js($name);
    if (!$print) {
        $userInfo = "<a href=\"javascript:pilotTip.newTip('inline', 0, 13, 'p_{$commentID}', 250, '" . $commentData["userServerID"] . "_" . $commentData["userID"] . "','" . addslashes($name) . "' )\"  onmouseout=\"pilotTip.hide()\">{$name}</a>\n";
    } else {
        $userInfo = "<span style='color:red;'>{$name}</span>";
    }
} else {
    $userInfo = "Guest: " . $commentData['guestName'] . " ";
}
if (!$print) {
    $translateText = "<span><a id='translate_" . $commentData['commentID'] . "' href='javascript:translateComment(" . $commentData['commentID'] . ",\"" . $commentData['languageCode'] . "\")'>" . _Translate . leoHtml::img("icon_arrow_down.gif", 0, 0, 'absmiddle', '', 'icons1') . "</a></span>";
} else {
    $translateText = '';
            }
        }
    }
}
$countryLegend = "";
$allCountriesDisplay = 0;
if ($country) {
    $countryLegend = $countries[$country];
} else {
    $countryLegend = _WORLD_WIDE;
    $allCountriesDisplay = 1;
}
$pilotLegend = "";
$allPilotsDisplay = 0;
if ($pilotID) {
    $pilotLegend = getPilotRealName($pilotID, $serverID);
} else {
    $pilotLegend = _ALL_PILOTS;
    $allPilotsDisplay = 1;
}
$takeoffLegend = "";
$allTakeoffDisplay = 0;
if ($takeoffID) {
    $takeoffLegend = getWaypointName($takeoffID);
} else {
    $takeoffLegend = _ALL_TAKEOFFS;
    $allTakeoffDisplay = 1;
}
# Martin Jursa, 22.05.2007
$showNacClubSelection = !empty($CONF_use_NAC) && empty($dontShowNacClubSelection);
if ($showNacClubSelection) {
//
// 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: GUI_pilot_flights.php,v 1.4 2010/03/14 20:56:11 manolis Exp $
//
//************************************************************************
$query = 'SELECT * ' . ' FROM ' . $flightsTable . ' WHERE ' . $flightsTable . '.userID = ' . $pilotIDview . ' AND ' . $flightsTable . '.userServerID = ' . $serverID;
$res = $db->sql_query($query);
if ($res <= 0) {
    echo "<H3> Error in pilot stats query </H3>\n";
    return;
}
$row = mysql_fetch_assoc($res);
$realName = getPilotRealName($pilotIDview, $serverID);
$legend = "<b>{$realName}</b> " . _flights_stats;
$legendRight = "<a href='" . CONF_MODULE_ARG . "&op=list_flights&pilotID=" . $serverID . "_{$pilotIDview}&year=0&country='>" . _PILOT_FLIGHTS . "</a>";
$legendRight .= " | <a href='" . CONF_MODULE_ARG . "&op=pilot_profile&pilotIDview=" . $serverID . "_{$pilotIDview}'>" . _Pilot_Profile . "</a>";
?>

<link rel="stylesheet" type="text/css" href="<?php 
echo $moduleRelPath;
?>
/js/extJS/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="<?php 
echo $moduleRelPath;
?>
/js/extJS/resources/css/xtheme-default.css" />
<link rel="stylesheet" type="text/css" href="<?php 
echo $moduleRelPath;
Beispiel #9
0
function listFlights($res, $legend, $query_str = "", $sortOrder = "DATE")
{
    global $Theme;
    global $module_name;
    global $takeoffRadious;
    global $userID;
    global $moduleRelPath;
    global $admin_users;
    global $PREFS;
    global $page_num, $pagesNum, $startNum, $itemsNum;
    global $currentlang, $nativeLanguage, $opMode;
    $legendRight = "";
    if ($pagesNum > 1) {
        if ($page_num > 1) {
            $legendRight .= "<a href='?name={$module_name}&op=list_flights&sortOrder={$sortOrder}{$query_str}&page_num=" . ($page_num - 1) . "'><<</a>&nbsp;";
        } else {
            $legendRight .= "<<&nbsp;";
        }
        for ($k = 1; $k <= $pagesNum; $k++) {
            if ($k != $page_num) {
                $legendRight .= "<a href='?name={$module_name}&op=list_flights&sortOrder={$sortOrder}{$query_str}&page_num={$k}'>{$k}</a>&nbsp;";
            } else {
                $legendRight .= "{$k}&nbsp;";
            }
        }
        if ($page_num < $pagesNum) {
            $legendRight .= "<a href='?name={$module_name}&op=list_flights&sortOrder={$sortOrder}{$query_str}&page_num=" . ($page_num + 1) . "'>>></a>&nbsp;";
        } else {
            $legendRight .= ">>&nbsp;";
        }
    }
    $endNum = $startNum + $PREFS->itemsPerPage;
    if ($endNum > $itemsNum) {
        $endNum = $itemsNum;
    }
    $legendRight .= " [ " . ($startNum + 1) . "-" . $endNum . " " . _From . " " . $itemsNum . " ]";
    if ($itemsNum == 0) {
        $legendRight = "[ 0 ]";
    }
    $headerSelectedBgColor = "#F2BC66";
    open_inner_table("<table class=main_text width=100%><tr><td>{$legend}</td><td valign=top width=400 align=right bgcolor=#eeeeee>{$legendRight}</td></tr></table>", 750, -1);
    ?>
  <td width="25" bgcolor="<?php 
    echo $Theme->color1;
    ?>
"><div align=left><?php 
    echo _NUM;
    ?>
</div></td>
 <?php 
    printHeader(80, $headerSelectedBgColor, $Theme->color0, $sortOrder, "DATE", _DATE_SORT, $query_str);
    printHeader(160, $headerSelectedBgColor, $Theme->color0, $sortOrder, "pilotName", _PILOT, $query_str);
    printHeader(0, $headerSelectedBgColor, $Theme->color1, $sortOrder, "takeoffID", _TAKEOFF, $query_str);
    printHeader(40, $headerSelectedBgColor, $Theme->color2, $sortOrder, "DURATION", _DURATION_HOURS_MIN, $query_str);
    printHeader(65, $headerSelectedBgColor, $Theme->color3, $sortOrder, "LINEAR_DISTANCE", _LINEAR_DISTANCE, $query_str);
    printHeader(65, $headerSelectedBgColor, $Theme->color3, $sortOrder, "FLIGHT_KM", _OLC_KM, $query_str);
    printHeader(40, $headerSelectedBgColor, $Theme->color3, $sortOrder, "FLIGHT_POINTS", _OLC_SCORE, $query_str);
    ?>
  <td width="18" bgcolor="<?php 
    echo $Theme->color4;
    ?>
">&nbsp;</td>
  <td width="72" bgcolor="<?php 
    echo $Theme->color4;
    ?>
"><div align=left><?php 
    echo _SHOW;
    ?>
</div></td></tr>
<?php 
    $i = 1;
    while ($row = mysql_fetch_assoc($res)) {
        $is_private = $row["private"];
        $name = getPilotRealName($row["userID"], $row["serverID"]);
        $takeoffName = getWaypointName($row["takeoffID"]);
        $takeoffVinicity = $row["takeoffVinicity"];
        $takeoffNameFrm = formatLocation($takeoffName, $takeoffVinicity, $takeoffRadious);
        $sortRowBgColor = $i % 2 ? "#CCCACA" : "#E7E9ED";
        $i++;
        open_tr();
        $days_from_submission = floor((mktime() - datetime2UnixTimestamp($row["dateAdded"])) / 86400);
        // 60*60*24 sec per day
        if ($is_private) {
            $first_col_back_color = " bgcolor=#33dd33 ";
        } else {
            $first_col_back_color = "";
        }
        echo "<TD {$first_col_back_color} ><div align=left>" . ($i - 1 + $startNum) . "</div></TD>      \n\t   <TD " . ($sortOrder == "DATE" ? "bgcolor=" . $sortRowBgColor : "") . ">\n\t\t\t<div align=right>";
        if ($days_from_submission <= 3) {
            echo "<img src='" . $moduleRelPath . "/img/icon_new.png' >";
        }
        echo formatDate($row["DATE"]) . "</div></TD>" . "<TD width=300 colspan=2 valign=top " . ($sortOrder == "pilotName" || $sortOrder == "takeoffID" ? "bgcolor=" . $sortRowBgColor : "") . ">" . "<div align=left>" . "<a href='?name={$module_name}&op=pilot_profile&pilotIDview=" . $row["userID"] . "'><img src='" . $moduleRelPath . "/img/icon_magnify_small.gif' border=0></a>" . "<a href='?name={$module_name}&op=pilot_profile_stats&pilotIDview=" . $row["userID"] . "'><img src='" . $moduleRelPath . "/img/icon_stats.gif' border=0></a>&nbsp;" . "<a href='?name={$module_name}&op=list_flights&pilotID=" . $row["userID"] . "'>{$name}</a>" . "</div><div align=right>" . "<a href='?name={$module_name}&op=list_flights&takeoffID=" . $row["takeoffID"] . "'>{$takeoffNameFrm}</a>&nbsp;" . "<a href='?name={$module_name}&op=show_waypoint&waypointIDview=" . $row["takeoffID"] . "'><img src='" . $moduleRelPath . "/img/icon_magnify_small.gif' border=0></a>" . "<a href='" . $moduleRelPath . "/download.php?type=kml_wpt&wptID=" . $row["takeoffID"] . "'><img src='" . $moduleRelPath . "/img/gearth_icon.png' border=0></a>" . "</div></TD>" . "<TD " . ($sortOrder == "DURATION" ? "bgcolor=" . $sortRowBgColor : "") . "><div align=right>" . sec2Time($row['DURATION'], 1) . "</div></TD>\n\t   <TD " . ($sortOrder == "LINEAR_DISTANCE" ? "bgcolor=" . $sortRowBgColor : "") . "><div align=right>" . formatDistanceOpen($row["LINEAR_DISTANCE"]) . "</div></TD>\t\n\t   <TD " . ($sortOrder == "FLIGHT_KM" ? "bgcolor=" . $sortRowBgColor : "") . "><div align=right>" . formatDistanceOpen($row["FLIGHT_KM"]) . "</div></TD>\t\n\t   <TD " . ($sortOrder == "FLIGHT_POINTS" ? "bgcolor=" . $sortRowBgColor : "") . "><div align=right>" . formatOLCScore($row["FLIGHT_POINTS"]) . "</div></TD>" . "<td><img src='" . $moduleRelPath . "/img/icon_cat_" . $row["cat"] . ".png' border=0></td>" . "<TD align=left><a href='?name={$module_name}&op=show_flight&flightID=" . $row["ID"] . "'><img src='" . $moduleRelPath . "/img/icon_magnify_small.gif' border=0></a>";
        echo "<a href='" . $moduleRelPath . "/download.php?type=kml_trk&flightID=" . $row["ID"] . "'><img src='" . $moduleRelPath . "/img/gearth_icon.png' border=0></a>";
        if ($row["photo1Filename"]) {
            echo "<img src='" . $moduleRelPath . "/img/photo_icon.jpg' width=16 height=16>";
        } else {
            echo "<img src='" . $moduleRelPath . "/img/photo_icon_blank.gif' width=16 height=16>";
        }
        if ($row["userID"] == $userID || in_array($userID, $admin_users)) {
            // admin IDS in $admin_users
            echo "<a href='?name={$module_name}&op=delete_flight&flightID=" . $row["ID"] . "'><img src='" . $moduleRelPath . "/img/x_icon.gif' width=16 height=16 border=0 align=bottom></a>";
            echo "<a href='?name={$module_name}&op=edit_flight&flightID=" . $row["ID"] . "'><img src='" . $moduleRelPath . "/img/change_icon.png' width=16 height=16 border=0 align=bottom></a>";
        }
        echo "</TD>";
        close_tr();
    }
    close_inner_table();
    mysql_freeResult($res);
}
Beispiel #10
0
 function getFlightFromDB($flightID, $updateTakeoff = 1, $row = array())
 {
     global $db, $CONF_photosPerFlight;
     global $flightsTable;
     global $nativeLanguage, $currentlang;
     if (count($row)) {
         $useData = true;
     } else {
         $useData = false;
     }
     if (!$useData) {
         $query = "SELECT * FROM {$flightsTable}  WHERE ID=" . $flightID . " ";
         $res = $db->sql_query($query);
         # Error checking
         if ($res <= 0) {
             echo "<H3> Error in getFlightFromDB() query! {$query}</H3>\n";
             exit;
         }
         if (!($row = $db->sql_fetchrow($res))) {
             // echo "###### ERRROR ####$query###";
             return 0;
         }
     }
     $this->flightID = $flightID;
     $name = getPilotRealName($row["userID"], $row["userServerID"]);
     $this->userName = $name;
     $this->serverID = $row["serverID"];
     $this->excludeFrom = $row["excludeFrom"];
     $this->originalURL = $row["originalURL"];
     $this->originalKML = $row["originalKML"];
     $this->original_ID = $row["original_ID"];
     $this->originalUserID = $row["originalUserID"];
     $this->userServerID = $row["userServerID"];
     $this->NACclubID = $row["NACclubID"];
     /// Martin Jursa, 17.05.2007
     $this->NACid = $row["NACid"];
     $this->cat = $row["cat"];
     $this->subcat = $row["subcat"];
     $this->category = $row["category"];
     $this->active = $row["active"];
     $this->private = $row["private"];
     $this->gliderCertCategory = $row["gliderCertCategory"];
     $this->startType = $row["startType"];
     $this->validated = $row["validated"];
     $this->grecord = $row["grecord"];
     $this->validationMessage = $row["validationMessage"];
     $this->airspaceCheck = $row["airspaceCheck"] + 0;
     $this->airspaceCheckFinal = $row["airspaceCheckFinal"] + 0;
     $this->airspaceCheckMsg = $row["airspaceCheckMsg"];
     $this->checkedBy = $row["checkedBy"];
     $this->timesViewed = $row["timesViewed"];
     $this->dateAdded = $row["dateAdded"];
     $this->dateUpdated = $row["dateUpdated"];
     $this->timezone = $row["timezone"];
     $this->filename = $row["filename"];
     $this->userID = $row["userID"];
     $this->comments = $row["comments"];
     $this->commentsNum = $row["commentsNum"] + 0;
     $this->commentsEnabled = $row["commentsEnabled"] + 0;
     $this->glider = $row["glider"];
     $this->gliderBrandID = $row["gliderBrandID"];
     $this->linkURL = $row["linkURL"];
     $this->hasPhotos = $row["hasPhotos"];
     /*
     		for($i=1;$i<=$CONF_photosPerFlight;$i++) {
     			$var_name="photo".$i."Filename";
     			$this->$var_name=$row[$var_name];
     		}
     */
     $this->takeoffID = $row["takeoffID"];
     $this->takeoffVinicity = $row["takeoffVinicity"];
     $this->landingID = $row["landingID"];
     $this->landingVinicity = $row["landingVinicity"];
     $this->DATE = $row["DATE"];
     $this->MAX_SPEED = $row["MAX_SPEED"];
     $this->MEAN_SPEED = $row["MEAN_SPEED"];
     $this->MAX_ALT = $row["MAX_ALT"];
     $this->MIN_ALT = $row["MIN_ALT"];
     $this->TAKEOFF_ALT = $row["TAKEOFF_ALT"];
     $this->MAX_VARIO = $row["MAX_VARIO"];
     $this->MIN_VARIO = $row["MIN_VARIO"];
     $this->LINEAR_DISTANCE = $row["LINEAR_DISTANCE"];
     $this->START_TIME = $row["START_TIME"];
     $this->END_TIME = $row["END_TIME"];
     $this->DURATION = $row["DURATION"];
     $this->MAX_LINEAR_DISTANCE = $row["MAX_LINEAR_DISTANCE"];
     $this->BEST_FLIGHT_TYPE = $row["BEST_FLIGHT_TYPE"];
     $this->FLIGHT_KM = $row["FLIGHT_KM"];
     $this->FLIGHT_POINTS = $row["FLIGHT_POINTS"];
     $this->autoScore = $row["autoScore"];
     $this->externalFlightType = $row["externalFlightType"];
     $this->isLive = $row["isLive"];
     $this->firstPointTM = $row["firstPointTM"];
     $this->firstLat = $row["firstLat"];
     $this->firstLon = $row["firstLon"];
     $this->lastPointTM = $row["lastPointTM"];
     $this->lastLat = $row["lastLat"];
     $this->lastLon = $row["lastLon"];
     $this->forceBounds = $row["forceBounds"];
     $this->hash = $row["hash"];
     //to be deleted START
     //		$this->FIRST_POINT=$row["FIRST_POINT"];
     //		$this->LAST_POINT=$row["LAST_POINT"];
     /*
     		$this->turnpoint1=$row["turnpoint1"];
     		$this->turnpoint2=$row["turnpoint2"];
     		$this->turnpoint3=$row["turnpoint3"];
     		$this->turnpoint4=$row["turnpoint4"];
     		$this->turnpoint5=$row["turnpoint5"];
     */
     //		$this->olcRefNum=$row["olcRefNum"];
     //		$this->olcFilename=$row["olcFilename"];
     //		$this->olcDateSubmited =$row["olcDateSubmited"];
     //to be deleted END
     // now recompute the
     // $this->originalURL
     // $this->originalKML
     $this->getOriginalKML();
     $this->getOriginalURL();
     if (!$useData) {
         $db->sql_freeresult($res);
     }
     if ($this->filename && $updateTakeoff) {
         $this->updateTakeoffLanding();
     }
     return 1;
 }
Beispiel #11
0
function flights_find($arg)
{
    global $db, $flightsTable;
    global $takeoffRadious, $CONF;
    require_once "FN_pilot.php";
    $sitePass = $arg[0];
    $lat = $arg[1];
    $lon = -$arg[2];
    $limit = $arg[3];
    if (!securityCheck($sitePass)) {
        return new IXR_Error(4000, 'Access Denied');
    }
    $firstPoint = new gpsPoint();
    $firstPoint->lat = $lat;
    $firstPoint->lon = $lon;
    // calc TAKEOFF - LANDING PLACES
    if (count($waypoints) == 0) {
        $waypoints = getWaypoints(0, 1);
    }
    $takeoffIDTmp = 0;
    $minTakeoffDistance = 10000000;
    $i = 0;
    foreach ($waypoints as $waypoint) {
        $takeoff_distance = $firstPoint->calcDistance($waypoint);
        if ($takeoff_distance < $minTakeoffDistance) {
            $minTakeoffDistance = $takeoff_distance;
            $takeoffIDTmp = $waypoint->waypointID;
        }
        $i++;
    }
    $nearestWaypoint = new waypoint($takeoffIDTmp);
    $nearestWaypoint->getFromDB();
    //$nearestWaypoint;
    //$minTakeoffDistance;
    if ($limit > 0) {
        $lim = "LIMIT {$limit}";
    } else {
        $lim = "";
    }
    $where_clause = "AND takeoffID={$nearestWaypoint->waypointID}";
    $query = "SELECT * FROM {$flightsTable} WHERE private=0 {$where_clause} ORDER BY FLIGHT_POINTS  DESC {$lim} ";
    //echo $query;
    $res = $db->sql_query($query);
    if ($res <= 0) {
        return new IXR_Error(4000, 'Error in query! ' . $query);
    }
    $flights = array();
    $i = 0;
    while ($row = mysql_fetch_assoc($res)) {
        $name = getPilotRealName($row["userID"], $row["serverID"]);
        $link = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $row['ID'])));
        $this_year = substr($row['DATE'], 0, 4);
        $linkIGC = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getRelMainDir() . str_replace("%PILOTID%", getPilotID($row["userServerID"], $row["userID"]), str_replace("%YEAR%", $this_year, $CONF['paths']['igc'])) . '/' . $row['filename']);
        //$flightsRelPath."/".$row[userID]."/flights/".$this_year."/".$row[filename] );
        if ($row['takeoffVinicity'] > $takeoffRadious) {
            $location = getWaypointName($row['takeoffID']) . " [~" . sprintf("%.1f", $row['takeoffVinicity'] / 1000) . " km]";
        } else {
            $location = getWaypointName($row['takeoffID']);
        }
        $flights[$i]['pilot'] = htmlspecialchars($name);
        $flights[$i]['takeoff'] = htmlspecialchars($location);
        $flights[$i]['date'] = $row['DATE'];
        $flights[$i]['duration'] = $row['DURATION'];
        $flights[$i]['openDistance'] = $row['MAX_LINEAR_DISTANCE'];
        $flights[$i]['OLCkm'] = $row['FLIGHT_KM'];
        $flights[$i]['OLCScore'] = $row['FLIGHT_POINTS'];
        $flights[$i]['OLCtype'] = $row['BEST_FLIGHT_TYPE'];
        $flights[$i]['displayLink'] = $link;
        $i++;
    }
    return array($i, $flights);
    //return array($i,0);
}
function listPilots($res, $legend, $queryExtraArray = array(), $sortOrder = "bestDistance", $is_comp = 0)
{
    global $db, $Theme;
    global $moduleRelPath;
    global $PREFS;
    global $page_num, $pagesNum, $startNum, $itemsNum;
    global $op, $opMode, $CONF;
    global $currentlang, $nativeLanguage;
    ?>
    <table class='listTable' width="100%"  cellpadding="2" cellspacing="0">
	<tr> 
		<td width="25" class='SortHeader'><?php 
    echo _NUM;
    ?>
</td>
   <?php 
    // was _TOTAL_KM -> bug
    if ($PREFS->metricSystem == 1) {
        $OPEN_DISTANCE_str = _TOTAL_DISTANCE . " " . _KM;
    } else {
        $OPEN_DISTANCE_str = _TOTAL_DISTANCE . " " . _MI;
    }
    printHeaderPilotsTotals(0, $sortOrder, "pilotName", _PILOT, $queryExtraArray, $is_comp);
    printHeaderPilotsTotals(60, $sortOrder, "totalFlights", _NUMBER_OF_FLIGHTS, $queryExtraArray, $is_comp);
    printHeaderPilotsTotals(80, $sortOrder, "bestDistance", _BEST_DISTANCE, $queryExtraArray, $is_comp);
    if (!is_comp) {
        printHeaderPilotsTotals(60, $sortOrder, "mean_distance", _MEAN_KM, $queryExtraArray, $is_comp);
    }
    printHeaderPilotsTotals(80, $sortOrder, "totalDistance", $OPEN_DISTANCE_str, $queryExtraArray, $is_comp);
    printHeaderPilotsTotals(80, $sortOrder, "totalDuration", _TOTAL_DURATION_OF_FLIGHTS, $queryExtraArray, $is_comp);
    if (!is_comp) {
        printHeaderPilotsTotals(60, $sortOrder, "mean_duration", _MEAN_DURATION, $queryExtraArray, $is_comp);
    }
    if (!is_comp) {
        printHeaderPilotsTotals(60, $sortOrder, "totalOlcKm", _TOTAL_OLC_KM, $queryExtraArray, $is_comp);
    }
    printHeaderPilotsTotals(60, $sortOrder, "totalOlcPoints", _TOTAL_OLC_SCORE, $queryExtraArray, $is_comp);
    printHeaderPilotsTotals(60, $sortOrder, "bestOlcScore", _BEST_OLC_SCORE, $queryExtraArray, $is_comp);
    echo "</tr>";
    $i = 1;
    while ($row = $db->sql_fetchrow($res)) {
        $name = getPilotRealName($row["userID"], $row["userServerID"], 1, 1, 1);
        $name = prepare_for_js($name);
        $mean_duration = $row["totalDuration"] / $row["totalFlights"];
        $mean_distance = $row["totalDistance"] / $row["totalFlights"];
        $sortRowClass = $i % 2 ? "l_row1" : "l_row2";
        $i++;
        echo "\n\n<tr class='{$sortRowClass}'>";
        echo "<TD>" . ($i - 1 + $startNum) . "</TD>";
        echo "<TD><div align=left id='p_{$i}' class='pilotLink'>";
        // echo getNationalityDescription($row["countryCode"],1,0);
        echo "<a class='betterTip' id='tpa0_" . $row["userServerID"] . "u" . $row["userID"] . "' href=\"javascript:pilotTip.newTip('inline',0,13, 'p_{$i}', 200,'" . $row["userServerID"] . "_" . $row["userID"] . "','" . addslashes($name) . "' )\"  \n\t\t onmouseout=\"pilotTip.hide()\">{$name}</a>";
        // echo "#".$row['NACid'].$row['NACmemberID'].$row['NACclubID']."#";
        if ($row['NACid'] && $row['NACmemberID'] && $row['NACclubID'] && $CONF['NAC']['display_club_details_on_pilot_list']) {
            echo "&nbsp;<a class='betterTip' id='tpa1_" . $row["userServerID"] . "u" . $row["userID"] . "' href=\"javascript:nop();\"><img src='{$moduleRelPath}/img/icon_nac_member.gif' align='absmiddle' border=0></a>";
        }
        echo "</div></TD>";
        echo "<TD>" . $row["totalFlights"] . "</TD>" . "<TD>" . formatDistanceOpen($row["bestDistance"]) . "</TD>";
        if (!is_comp) {
            echo " <TD>" . formatDistanceOpen($mean_distance) . "</TD>";
        }
        echo "<TD>" . formatDistanceOpen($row["totalDistance"]) . "</TD>" . "<TD>" . sec2Time($row["totalDuration"]) . "</TD>";
        if (!is_comp) {
            echo "<TD>" . sec2Time($mean_duration) . "</TD>";
        }
        if (!is_comp) {
            echo "<TD>" . formatDistanceOLC($row["totalOlcKm"]) . "</TD>";
        }
        echo "<TD>" . formatOLCScore($row["totalOlcPoints"]) . "</TD>" . "<TD>" . formatOLCScore($row["bestOlcScore"]) . "</TD>";
        echo "</TR>";
    }
    echo "</table>";
    $db->sql_freeresult($res);
}
Beispiel #13
0
   $pilotNames=array();
   $pilotGliders=array();   
   $pilotGlidersMax=array();
   
	$arrayName= $leagueCategories[$leagueCategory]['arrayName'];
	global ${$arrayName};
	${$arrayName}=array();

   while ($row = $db->sql_fetchrow($res)) { 
	 $uID=$row["userServerID"].'_'.$row["userID"];
	 $serverID=$row["userServerID"];

	$flights[$row['ID']]=array('ext'=>($row['filename']?0:1) );

	 if (!isset($pilotNames[$uID])){
		 $name=getPilotRealName($row["userID"],$serverID,1); 
		 $name=prepare_for_js($name);
		 $pilotNames[$uID]=$name;
	 } 
	 
	 // $flightBrandID=guessBrandID($row['cat'],$row['glider']);
	 $flightBrandID=$row['gliderBrandID'];
	 if ($flightBrandID) {
		 if ( ! is_array($pilotGliders[$uID]) ) $pilotGliders[$uID]=array();
		 $pilotGliders[$uID][$flightBrandID]++;
	 }

	 
	if ( ! is_array( ${$arrayName}[$uID] ) )  ${$arrayName}[$uID]=array();

	${$arrayName}[$uID][$row["ID"]]=$row[$leagueCategories[$leagueCategory]['select_as']];
Beispiel #14
0
<?php

global $prefix, $db, $sitename, $user, $cookie, $flightsTable, $module_name;
$count = 1;
$numToshow = 10;
// Content
$content = "<A name= \"scrollingCode\"></A>";
// Marquee Tag
$content .= "<MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"250\" scrollamount= \"2\" scrolldelay= \"20\" onmouseover='this.stop()' onmouseout='this.start()'>";
$content .= "<center><font color=\"#666666\"><b>Latest {$numToshow} flights</b></font> ";
$query = "SELECT * ,{$flightsTable}.ID as ID FROM {$flightsTable} WHERE (1=1) ORDER BY DATE DESC LIMIT  {$numToshow} ";
$result1 = $db->sql_query($query);
$content .= "<br>";
// Listing Topics
while ($row = $db->sql_fetchrow($result1)) {
    $flightID = $row["ID"];
    $name = getPilotRealName($row["userID"], $row["serverID"]);
    $takeoffName = getWaypointName($row["takeoffID"]);
    $takeoffVinicity = $row["takeoffVinicity"];
    $takeoffNameFrm = formatLocation($takeoffName, $takeoffVinicity, $takeoffRadious);
    $flightDurationFrm = sec2Time($row['DURATION'], 1);
    $content .= "<a href='" . CONF_MODULE_ARG . "&op=show_flight&flightID={$flightID}' STYLE='text-decoration: none'> ";
    $content .= "<b> {$name} </b></a><br><font color=\"#666666\">\n\t\t\t\t\t<i>[ {$takeoffName} ] <br><b>" . formatDate($row["DATE"]) . "</b><br>" . _DURATION . ": {$flightDurationFrm}<br>" . _OLC_SCORING . ":" . formatOLCScore($row['FLIGHT_POINTS']) . "</i></font><br><br>";
    $count = $count + 1;
}
$content .= "<br></center>";
echo $content;
?>

Beispiel #15
0
function listClubs($legend, $header, $category, $key, $formatFunction = "")
{
    global $clubs, $NACid;
    global $Theme, $countries;
    global $moduleRelPath;
    global $CONF_compItemsPerPage;
    global $page_num, $pagesNum, $startNum, $itemsNum;
    global $op, $cat;
    global $countHowManyFlights, $pilotsMax, $pilotsMin;
    global $tabID;
    global $sort_funcs_pilots;
    require_once dirname(__FILE__) . "/CL_NACclub.php";
    $clubNamesList = NACclub::getClubs($NACid);
    $legendRight = "";
    // show all pilots up to  $CONF_compItemsPerPage
    // $legend.=" (".$countHowMany." "._N_BEST_FLIGHTS.")";
    echo "<table class='listTable listTableTabber listTable2' cellpadding='2' cellspacing='0'>\n   \t\t\t<tr><td class='tableTitleExtra' colspan='" . ($pilotsMax + 3) . "'>{$legend}</td></tr>";
    ?>
   <tr>
   <td class="SortHeader" width="30"><?php 
    echo _NUM;
    ?>
</td>
   <td class="SortHeader"><div align=left><?php 
    echo _Club;
    ?>
</div></td>
   <?php 
    for ($ii = 1; $ii <= $pilotsMax; $ii++) {
        ?>
   <td class="SortHeader" width="55"><div align=left><?php 
        echo _PILOT . " #{$ii}";
        ?>
</div></td>
   <?php 
    }
    ?>
   <td class="SortHeader" width="70"><?php 
    echo $header;
    ?>
</td>
   </tr>
   <?php 
    $i = 1;
    foreach ($clubs as $clubID => $club) {
        // if ($i>$CONF_compItemsPerPage) break;
        if (!$club['sum']) {
            continue;
        }
        $sortRowClass = $i % 2 ? "l_row1" : "l_row2";
        if ($i == 1) {
            $bg = " class='compFirstPlace'";
        } else {
            if ($i == 2) {
                $bg = " class='compSecondPlace'";
            } else {
                if ($i == 3) {
                    $bg = " class='compThirdPlace'";
                } else {
                    $bg = " class='{$sortRowClass}'";
                }
            }
        }
        $i++;
        echo "<TR {$bg}>";
        echo "<TD>" . ($i - 1 + $startNum) . "</TD>";
        echo "<TD width='25%'><div align=left >" . $clubNamesList[$clubID] . "</div></TD>";
        unset($pilotBrands);
        $pilotBrands = array();
        $j = 0;
        foreach ($club as $pilotID => $pilot) {
            $k = 0;
            $pilotIDparts = split('_', $pilotID, 2);
            if (!is_numeric($pilotIDparts[1])) {
                continue;
            }
            // echo "#".$pilotID."#";
            $pilotName = getPilotRealName($pilotIDparts[1], $pilotIDparts[0], 1);
            $pilotName = prepare_for_js($pilotName);
            $pilotIDinfo = str_replace("_", "u", $pilotID);
            echo "<TD width='20%'>";
            echo "<table width='100%' cellpadding='0' cellspacing='0' class='listTable3'><TR><TD colspan=3 id='{$arrayName}" . "_{$pilotID}' class='pilotLink'>" . "<a class='clubPilot betterTip' id='tpa0_{$pilotIDinfo}' href=\"javascript:pilotTip.newTip('inline', 0, 13, '{$arrayName}" . "_{$pilotID}', 200, '" . $pilotID . "','" . addslashes($pilotName) . "' )\"  onmouseout=\"pilotTip.hide()\">" . $pilotName . "</a>" . "</td></tr><tr>";
            foreach ($pilot['flights_sel'] as $flightID) {
                $val = $pilot['flights'][$flightID]['score'];
                $glider = $pilot['flights'][$flightID]['glider'];
                $country = $countries[$pilot['flights'][$flightID]['country']];
                $thisFlightBrandID = $pilot['flights'][$flightID]['brandID'];
                if ($thisFlightBrandID) {
                    $pilotBrands[$thisFlightBrandID]++;
                }
                if (!$val) {
                    $outVal = "&nbsp;";
                } else {
                    if ($formatFunction) {
                        $outVal = $formatFunction($val);
                    } else {
                        $outVal = $val;
                    }
                }
                // $descr=_PILOT.": $pilotName, "._GLIDER.": $glider, "._COUNTRY.": $country";
                $descr = _GLIDER . ": {$glider}, " . _COUNTRY . ": {$country}";
                $descr = '';
                if ($val) {
                    echo "<TD width='33%'><a class='betterTip' id='tpa2_{$flightID}' href='" . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $flightID)) . "' alt='{$descr}'  title='{$descr}'>" . $outVal . "</a></TD>";
                } else {
                    echo "<TD width='33%'>" . $outVal . "</TD>";
                }
                $k++;
                if ($k >= $countHowManyFlights) {
                    break;
                }
            }
            if ($k != $countHowManyFlights) {
                for ($kk = $k; $kk < $countHowManyFlights; $kk++) {
                    echo "<TD >&nbsp;</TD>";
                }
            }
            echo "</tr></table></td>";
            $j++;
            if ($j >= $pilotsMax) {
                break;
            }
        }
        if ($j != $pilotsMax) {
            for ($jj = $j; $jj < $pilotsMax; $jj++) {
                echo "<TD width='20%'>-</TD>";
                //				for($jjj=0;$jjj<$countHowManyFlights;$jjj++) {
                //					echo "<TD>-</TD>";
                //				}
            }
        }
        if ($formatFunction) {
            $outVal = $formatFunction($club["sum"]);
        } else {
            $outVal = $club["sum"];
        }
        echo "<TD>" . $outVal . "</TD>";
        echo "</tr>";
    }
    // next club
    echo "</table>";
    //	echo '</div>';
}
    }
}
$pilot = mysql_fetch_assoc($res);
if ($op == 'info_nac') {
    $nacQuery = "SELECT * FROM {$NACclubsTable} WHERE NAC_ID=" . $pilot['NACid'] . " AND clubID=" . $pilot['NACclubID'];
    $res2 = $db->sql_query($nacQuery);
    if ($res2 <= 0) {
        echo "<H3>Error in nac club query</H3>\n";
        return;
    }
    $row = mysql_fetch_assoc($res2);
    // echo _MEMBER_OF."<BR>".$row['clubName'];
    echo $row['clubName'];
    exit;
}
$pilotName = getPilotRealName($pilotIDview, $serverID, 1);
$legend = _Pilot_Profile . ": <b>{$pilotName}</b>";
$legendRight = "<a href='" . getLeonardoLink(array('op' => 'list_flights', 'pilotID' => $serverID . '_' . $pilotIDview, 'year' => '0', 'country' => '')) . "'>" . _PILOT_FLIGHTS . "</a>";
$legendRight .= " | <a href='" . getLeonardoLink(array('op' => 'pilot_profile_stats', 'pilotIDview' => $serverID . '_' . $pilotIDview)) . "'>" . _pilot_stats . "</a>";
if ($pilotIDview == $userID || L_auth::isAdmin($userID) && $serverID == 0) {
    $legendRight .= " | <a href='" . getLeonardoLink(array('op' => 'pilot_profile_edit', 'pilotIDview' => $pilotIDview)) . "'>" . _edit_profile . "</a>";
} else {
    $legendRight .= "";
}
echo "<table><tr>";
echo "<td>";
?>
 
<table  class=main_text  width="100%" border="0">

<?php