function set_from_flight(flight $flight, $num = 6, $split = false) { $this->max_flights = $num; $this->name = $flight->p_name; $this->club = $flight->c_name; $this->glider = $flight->g_name; $this->score += $flight->score; $this->total += $flight->score; $this->number_of_flights = 1; $this->flights[] = $flight->to_print()->get(); if ($flight->defined) { $this->defined = true; } else { if ($flight->ftid == 1) { $this->undefined = true; } } if ($split) { $this->class = $flight->class; } else { $this->class = 1; } $this->id = $flight->ClassID; $this->name = $flight->p_name; }
function movePilotFlights($newServerID, $newUserID) { $newPilot = new pilot($newServerID, $newUserID); if (!$newPilot->pilotExists()) { echo "movePilotFlights({$newServerID},{$newUserID}): The target pilot does not exist<BR>"; return 0; } global $db, $flightsTable; // first see if a mapping exists $query = "SELECT ID FROM {$flightsTable} WHERE userID=" . $this->pilotID . " AND userServerID=" . $this->serverID . " "; $res = $db->sql_query($query); if ($res <= 0) { echo "<H3> Error in movePilotFlights query! {$query}</H3>\n"; return 0; } while ($row = $db->sql_fetchrow($res)) { echo "moving flight " . $row['ID'] . '<BR>'; // continue; $flight2move = new flight(); $flight2move->getFlightFromDB($row['ID']); $flight2move->changeUser($newUserID, $newServerID); } }
require_once dirname(__FILE__) . "/CL_flightData.php"; require_once dirname(__FILE__) . "/FN_functions.php"; require_once dirname(__FILE__) . "/FN_UTM.php"; require_once dirname(__FILE__) . "/FN_waypoint.php"; require_once dirname(__FILE__) . "/FN_output.php"; require_once dirname(__FILE__) . "/FN_pilot.php"; require_once dirname(__FILE__) . "/FN_flight.php"; require_once dirname(__FILE__) . "/templates/" . $PREFS->themeName . "/theme.php"; setDEBUGfromGET(); require_once dirname(__FILE__) . "/language/" . CONF_LANG_ENCODING_TYPE . "/lang-" . $currentlang . ".php"; require_once dirname(__FILE__) . "/language/" . CONF_LANG_ENCODING_TYPE . "/countries-" . $currentlang . ".php"; $flightID = makeSane($_GET['flightID'], 1); if ($flightID <= 0) { exit; } $flight = new flight(); $flight->getFlightFromDB($flightID); if (!$flight->belongsToUser($userID) && !L_auth::isModerator($userID)) { echo "go away"; return; } if ($_POST['setTimes'] == 1) { // set new bounds !!! $startTime = makeSane($_REQUEST['timeTextSecs1'], 1); // in secs $endTime = makeSane($_REQUEST['timeTextSecs2'], 1); $flight->forceBounds = 1; // must be in these time bounds $flight->START_TIME = $startTime; $flight->END_TIME = $endTime; $waypointsWebPath = moduleRelPath(0) . "/" . $waypointsRelPath;
if ($CONF['NAC']['clubPerFlight']) { $NACclubID = $_POST['NACclubID'] + 0; $NACid = $_POST['NACid'] + 0; } else { $NACclubID = -1; $NACid = -1; } list($result, $flightID) = addFlightFromFile($filename, true, $flights_user_id, array('gliderBrandID' => $gliderBrandID, 'private' => $is_private, '$linkURL' => $linkURL, 'comments' => $comments, 'glider' => $glider, 'category' => $category, 'cat' => $gliderCat, 'allowDuplicates' => 1, 'gliderCertCategory' => $gliderCertCategory, 'startType' => $_POST["startType"] + 0, 'NACclubID' => $NACclubID, 'NACid' => $NACid, 'commentsEnabled' => $_POST['commentsEnabled'] + 0)); } if ($result != 1) { // we must log the failure for debuging purposes @unlink($filename); $errMsg = getAddFlightErrMsg($result, $flightID); addFlightError($errMsg); } else { $flight = new flight(); $flight->getFlightFromDB($flightID); if ($flight->takeoffVinicity > $takeoffRadious * 2) { ?> <script language="javascript"> function user_add_takeoff(lat,lon,id) { MWJ_changeContents('takeoffBoxTitle',"Register Takeoff"); document.getElementById('addTakeoffFrame').src='<?php echo $moduleRelPath; ?> /GUI_EXT_user_waypoint_add.php?refresh=0&lat='+lat+'&lon='+lon+'&takeoffID='+id; MWJ_changeSize('addTakeoffFrame',720,345); MWJ_changeSize( 'takeoffAddID', 725,365 ); toggleVisible('takeoffAddID','takeoffAddPos',-10,-50,725,435); } </script>
echo "<table width='400'>"; $fieldNum = count($row); $i = 0; foreach ($row as $var_name => $var_value) { echo "<tr>"; echo "<td >{$var_name}</td><td >{$var_value}</td>"; echo "</tr>\n"; $i++; } echo "</table>"; echo "</td></tr></table>\n"; } else { if ($op == 'takeoffInfo') { //$flightID=makeSane($_REQUEST['flightID'],1); //$flightID+=0; $flight = new flight(); if (!$flight->getFlightFromDB($flightID)) { echo "<br><div align='center'>No such flight exists</div><br><BR>"; return; } // $firstPoint=new gpsPoint($flight->FIRST_POINT,$flight->timezone); $firstPoint = new gpsPoint('', $flight->timezone); $firstPoint->setLat($flight->firstLat); $firstPoint->setLon($flight->firstLon); $firstPoint->gpsTime = $flight->firstPointTM; //------------------------------------------------------------------- // get from paraglidingearth.com //------------------------------------------------------------------- $takoffsList = getExtrernalServerTakeoffs(1, $firstPoint->lat, -$firstPoint->lon, 50, 5); if (count($takoffsList) > 0) { $linkToInfoHdr1 = "<a href='http://www.paraglidingearth.com/en-html/sites_around.php?lng=" . -$firstPoint->lon . "&lat=" . $firstPoint->lat . "&dist=20' target=_blank>";
<?php //************************************************************************ // Leonardo XC Server, http://www.leonardoxc.net // // 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: GUI_flight_delete.php,v 1.12 2010/03/14 20:56:11 manolis Exp $ // //************************************************************************ $flightID = makeSane($_REQUEST["flightID"], 1); $confirmed = makeSane($_REQUEST["confirmed"]); $flight = new flight(); $flight->getFlightFromDB($flightID); if ($confirmed && ($flight->belongsToUser($userID) || L_auth::isAdmin($userID))) { $flight->deleteFlight(); echo "<br><span class='ok'>" . _THE_FLIGHT_HAS_BEEN_DELETED . "</span><br><br>"; echo "<a href='" . getLeonardoLink(array('op' => 'list_flights')) . "'>" . _RETURN . "</a><br></div>"; } else { $location = formatLocation(getWaypointName($flight->takeoffID), $flight->takeoffVinicity, $takeoffRadious); openMain(_CAUTION_THE_FLIGHT_WILL_BE_DELETED, 0, "delete_icon.png"); echo "<div align=center><br><b>" . _PILOT . ": " . $flight->userName . " " . _THE_DATE . ": " . formatDate($flight->DATE) . " " . _TAKEOFF_LOCATION . ": " . $location . "</b> "; echo "<br><br><a href='" . getLeonardoLink(array('op' => 'delete_flight', 'flightID' => $flightID, 'confirmed' => '1')) . "'>" . _YES . "</a> | <a href='javascript:history.go(-1)'>" . _NO . "</a>"; echo "<br></div>"; closeMain(); }
// 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_flight_show.php,v 1.111 2012/09/17 22:33:49 manolis Exp $ // //************************************************************************ require_once $LeoCodeBase . "/CL_image.php"; require_once $LeoCodeBase . "/CL_template.php"; $Ltemplate = new LTemplate($LeoCodeBase . '/templates/' . $PREFS->themeName); global $flightsTable, $deletedFlightsTable; if ($_GET['deleted'] && L_auth::isAdmin($userID)) { $flightsTable = $deletedFlightsTable; $deletedFlights = 1; } $flightID += 0; $flight = new flight(); if (!$flight->getFlightFromDB($flightID)) { echo "<br><div align='center'>No such flight exists</div><br><BR>"; return; } //echo $flight->private." & ".$flight->flightIsViewableByUser($userID)." $$"; if ($flight->private && $flight->private != 4 && !$flight->belongsToUser($userID) && !L_auth::isAdmin($userID)) { echo "<br><div align=center><h3>" . _FLIGHT_IS_PRIVATE . "</h3></div><br><BR>"; return; } //debug //$mapUrl=$flight->createStaticMap(1); $flight->incViews(); //show limited info to non friends if ($flight->private == 4 && !$flight->flightIsViewableByUser($userID)) { require dirname(__FILE__) . '/GUI_flight_show_ext.php';
function computeGeoInfo() { $changed=0; $gotTrack=0; foreach ( $this->photos as $photoNum=>$photoInfo) { if ($photoInfo['tm']==1) { // 1 -> we have alredy tried to get geotag info but failed continue; } if (!$photoInfo['tm']) { // no attemp was made to get GeoInfo $imgPath=$this->getPhotoAbsPath($photoNum); $gpsData = CLimage::getGPS($imgPath); $this->photos[$photoNum]['lat']=$gpsData[0]; $this->photos[$photoNum]['lon']=$gpsData[1]; $this->photos[$photoNum]['tm']=$gpsData[2]; // warning tm in local time ... $changed=1; // we got at least the tm } if (!$this->photos[$photoNum]['tm']) { $this->photos[$photoNum]['tm']=1; $changed=1; continue; } if (!$this->photos[$photoNum]['lat'] && !$this->photos[$photoNum]['lon']) { // try to get lat/lon depending on the position in track if (!$gotTrack) { //echo "getting track!"; $flight=new flight(); $flight->getFlightFromDB($this->flightID,0); //dont update takeoffs list($trackLat,$trackLon,$trackTms,$trackAlt)=$flight->getXYValues(1,1); // get also TM and ALT $gotTrack=1; } //correct the tm of the photo that we got from EXIF by subtracking up the timezone offset $this->photos[$photoNum]['tm']-=$flight->timezone*3600; //we will use this to add to every time entry we gto from getXYValues() $startTm=strtotime($flight->DATE); //echo "Flight start time is ".$flight->DATE." -> ".$startTm; $lastTm=$startTm; $photoTm=$this->photos[$photoNum]['tm']; //echo " starttime:$lastTm photo : $photoTm<BR>".count($trackTms); foreach($trackTms as $i=>$tm) { $thisTm=$startTm+$tm; if ( $photoTm<$thisTm && $photoTm>$lastTm ) { //echo "found position!!! tm=$thisTm<BR>"; $this->photos[$photoNum]['lat']=$trackLat[$i]; $this->photos[$photoNum]['lon']=-$trackLon[$i]; $this->photos[$photoNum]['alt']=$trackAlt[$i]; $changed=1; break; } } } } if ($changed) { $this->putToDB(0); // dont update the flights table } }
function delete() { global $userID, $CONF_server_id, $waypointsTable, $db, $flightsTable; // we get the info from db in order to log it if (!$this->name) { $this->getFromDB(); } $query = "DELETE from {$waypointsTable} WHERE ID=" . $this->waypointID . " "; $res = $db->sql_query($query); $log = new Logger(); $log->userID = $userID; $log->ItemType = 4; // waypoint; $log->ItemID = $this->waypointID; $log->ServerItemID = $CONF_server_id; $log->ActionID = 4; //4 =>delete $log->ActionXML = $this->exportXML(); $log->Modifier = 0; $log->ModifierID = 0; $log->ServerModifierID = 0; $log->Result = $res <= 0 ? 0 : 1; $log->ResultDescription = ""; if (!$log->put()) { echo "Problem in logger<BR>"; } if ($res <= 0) { echo "Error deleting waypoint from DB<BR>"; return 0; } $query = "SELECT ID FROM {$flightsTable} WHERE takeoffID=" . $this->waypointID . " OR landingID=" . $this->waypointID . " "; // echo $query; $res = $db->sql_query($query); if ($res <= 0) { echo "Error getting flights with deleted waypoint <BR>"; return 0; } global $waypoints; if (!$waypoints) { $waypoints = getWaypoints(); } while ($row = $db->sql_fetchrow($res)) { $flightID = $row['ID']; $flight = new flight(); $flight->getFlightFromDB($flightID, 1); // this computes takeoff/landing also //$flight->updateTakeoffLanding(); //$flight->putFlightToDB(1); unset($flight); } return 1; }
$actionID = 1; } else { $actionID = 2; // 1-> add , 2->update, 4->delete } } // prepare an array of files to send as well if ($getIGCfiles) { if ($actionID == 1) { // type is flight and action is add if (!in_array($row['ID'], $flightsToServe)) { array_push($flightsToServe, $row['ID']); } } } $flight = new flight(); $flight->getFlightFromDB($row['ID'], 0, $row); if ($item_num > 0) { $RSS_str .= ' , '; } $RSS_str .= ' { "item": { "transactionID": "' . sprintf("%020d", $actionTm) . '", "actionTimeUTC": "' . $actionTimeStr . '", "actionTmUTC": ' . $actionTm . ', "serverUTCoffset": "' . date('Z') . '", "type": 1, "id": ' . $row['ID'] . ', "serverID": ' . $row['serverID'] . ', "action": ' . $actionID . ', "userID": ' . $row['userID'] . ', "actionData": ' . $flight->toXML('JSON') . '
$commentData['guestEmail'] = makeSane($_POST['guestEmail']); $commentData['guestPass'] = makeSane($_POST['guestPass']); $commentData['text'] = $_POST['commentText']; $commentData['userServerID'] = makeSane($_POST['userServerID']); $commentData['languageCode'] = makeSane($_POST['languageCode']); $newCommentDepth = makeSane($_POST['depth']) + 0; $flightComments = new flightComments($flightID); $newCommentID = $flightComments->addComment(array('parentID' => $commentData['parentID'], 'userID' => $commentData['userID'], 'userServerID' => $commentData['userServerID'], 'guestName' => $commentData['guestName'], 'guestPass' => $commentData['guestPass'], 'guestEmail' => $commentData['guestEmail'], 'text' => $commentData['text'], 'languageCode' => $commentData['languageCode'])); $str = ''; $now = gmdate("Y-m-d H:i:s"); $commentData['dateUpdated'] = $now; // $commentData['dateAdded']= $commentData['commentID'] = $newCommentID; $commentID = $newCommentID; $commentDepth = $newCommentDepth; $flight = new flight(); $flight->getFlightFromDB($commentData['flightID']); if ($flight->userID != $userID) { global $LeoCodeBase; require_once dirname(__FILE__) . '/CL_user.php'; require_once dirname(__FILE__) . '/CL_mail.php'; // send email notification to user $userEmail = leoUser::getEmail($flight->userID); // echo " userEmail= $userEmail"; $link = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $commentData['flightID']))); $email_body = sprintf(_New_comment_email_body, $CONF['site']['name'], $link, $commentData['text']); LeonardoMail::sendMail("[Leonardo] " . $CONF['site']['name'] . " - " . sprintf(_You_have_a_new_comment, $_SERVER['SERVER_NAME']), $email_body, $userEmail, addslashes($userEmail), '', '', true); // echo "<pre>$email_body</pre>"; } include dirname(__FILE__) . '/INC_comment_row.php'; echo $str;
// 1=pg 2=hg flex 4=hg rigid 8=glider $gliderBrandImg = brands::getBrandImg($row["gliderBrandID"], $row['flight_glider'], $gliderType); $gliderTypeDesc = $gliderCatList[$row["cat"]]; if ($row["category"]) { $gliderTypeDesc .= " - " . $CONF['gliderClasses'][$row["cat"]]['classes'][$row["category"]]; $categoryImg = leoHtml::img("icon_class_" . $row["category"] . ".png", 0, 0, 'top', $gliderTypeDesc, 'icons1', '', 0); } else { $categoryImg = ''; } $gliderCat = leoHtml::img("icon_cat_" . $row["cat"] . ".png", 0, 0, 'top', $gliderTypeDesc, 'icons1 catListIcon', '', 0); $MAX_ALT = formatAltitude($row['MAX_ALT']); $MAX_VARIO = formatVario($row['MAX_VARIO']); $MIN_VARIO = formatVario($row['MIN_VARIO']); if ($singleFlight) { $flightID = $row['ID'] + 0; $flight = new flight(); $flight->getFlightFromDB($flightID, 0); //$flight->makeJSON(0); // no force $mapUrl = $flight->createStaticMap(0); } // $pref="http://xc.dhv.de/xc/modules/leonardo"; $pref = "http://" . $_SERVER['SERVER_NAME']; $JSON_str .= ' {"flightID": "' . $row["ID"] . '", "date": "' . json::prepStr($row["DATE"]) . '", ' . '"DURATION": "' . json::prepStr($duration) . '", ' . '"START_TIME": "' . json::prepStr($START_TIME) . '", ' . '"END_TIME": "' . json::prepStr($END_TIME) . '", ' . '"MAX_ALT": "' . json::prepStr($MAX_ALT) . '", ' . '"MAX_VARIO": "' . json::prepStr($MAX_VARIO) . '", '; '"MIN_VARIO": "' . json::prepStr($MIN_VARIO) . '", '; if ($singleFlight) { $JSON_str .= '"g1": "' . json::prepStr($pref . substr($flight->getChartRelPath('alt', 1, 0), 0)) . '", ' . '"g2": "' . json::prepStr($pref . substr($flight->getChartRelPath('vario', 1, 0), 0)) . '" , ' . '"g3": "' . json::prepStr($pref . substr($flight->getChartRelPath('speed', 1, 0), 0)) . '" , ' . '"g4": "' . json::prepStr($pref . substr($flight->getChartRelPath('takeoff_distance', 1, 0), 0)) . '" , ' . '"firstLat": "' . json::prepStr($row["firstLat"]) . '", ' . '"firstLon": "' . json::prepStr($row["firstLon"]) . '", ' . '"lastLat": "' . json::prepStr($row["lastLat"]) . '", ' . '"lastLon": "' . json::prepStr($row["lastLon"]) . '", ' . '"map": "' . json::prepStr($pref . substr($mapUrl, 0)) . '" , '; } $JSON_str .= '"linearDistance": "' . json::prepStr($linearDistance) . '", ' . '"olcDistance": "' . json::prepStr($olcDistance) . '", ' . '"olcScore": "' . json::prepStr($olcScore) . '", ' . '"scoreSpeed": "' . json::prepStr($scoreSpeed) . '", ' . '"olcScoreType": "' . json::prepStr($olcScoreType) . '", ' . '"glider": "' . json::prepStr($row['glider']) . '", ' . '"gliderBrandImg": "' . json::prepStr($gliderBrandImg) . '", ' . '"gliderCat": "' . json::prepStr($gliderCat) . '", ' . '"categoryImg": "' . json::prepStr($categoryImg) . '", ' . '"pilotName": "' . json::prepStr($name) . '", ' . '"takeoff": "' . json::prepStr($location) . '" } '; $i++; } //$JSON_str='{"totalCount":"'.$i.'","flights":[ '. $JSON_str." ] } ";
if ($flightID <= 0) { exit; } $flight = new flight(); $flight->flightID = $flightID; //$flight->getFlightFromDB($flightID,0); echo $flight->gMapsGetTaskJS(); } else { if ($op == "flight_info") { require_once dirname(__FILE__) . '/CL_flightData.php'; require_once dirname(__FILE__) . '/lib/json/CL_json.php'; $flightID = $_REQUEST['flightID'] + 0; if (!$flightID) { return; } $flight = new flight(); $flight->getFlightFromDB($flightID, 0); $flight->makeJSON(0); // no force $flight->createEncodedPolyline(0); // no force $i = 0; $JSON_str = ""; if (1) { //$nearestWaypoint=new waypoint($takeoffIDTmp); //$nearestWaypoint->getFromDB(); $name = getPilotRealName($flight->userID, $flight->userServerID); $link = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $flightID))); $this_year = substr($flight->DATE, 0, 4); $linkIGC = htmlspecialchars("http://" . $_SERVER['SERVER_NAME'] . getRelMainDir() . str_replace("%PILOTID%", getPilotID($flight->userServerID, $flight->userID), str_replace("%YEAR%", $this_year, $CONF['paths']['igc'])) . '/' . $flight->filename); //$flightsRelPath."/".$row[userID]."/flights/".$this_year."/".$row[filename] );
set_time_limit(30); } } echo "Migrated $photoNumTotal photos<BR>"; echo "<BR><br><br>DONE !!!<BR>"; } else if ($admin_op=="clearBatchBit") { clearBatchBit(); } else if ($admin_op=="updateMaps") { $query="SELECT ID from $flightsTable WHERE 1 ORDER BY ID ASC"; $res= $db->sql_query($query); if($res > 0) { while ($row = mysql_fetch_assoc($res)) { $flight=new flight(); $flight->getFlightFromDB($row["ID"],0); set_time_limit(300); // @unlink($flight->getMapFilename() ); $flight->getMapFromServer(); echo "<BR>DONE id:".$row["ID"]; } } echo "<BR><br><br>DONE !!!<BR>"; } else if ($admin_op=="updateFilePerm") { $path1=dirname(__FILE__)."/flights"; // echo "<br>chmod to ".$path1."<br>"; echo "<br>Changing all files in flights/ to 0777"; chmodDir($path1,0777); echo "<BR><br><BR>DONE !!!<BR>";
//************************************************************************ require_once dirname(__FILE__) . "/EXT_config_pre.php"; require_once dirname(__FILE__) . "/config.php"; $CONF_use_utf = 1; require_once dirname(__FILE__) . "/EXT_config.php"; require_once dirname(__FILE__) . "/CL_flightData.php"; require_once dirname(__FILE__) . "/FN_functions.php"; require_once dirname(__FILE__) . "/FN_waypoint.php"; require_once dirname(__FILE__) . "/FN_output.php"; require_once dirname(__FILE__) . "/FN_pilot.php"; // setDEBUGfromGET(); $flightID = makeSane($_GET['id'], 1); if ($flightID <= 0) { exit; } $flight = new flight(); $flight->getFlightFromDB($flightID, 0); $flight->updateCharts(0, 1); // no force update, raw charts if ($flight->is3D() && is_file($flight->getChartfilename("alt", $PREFS->metricSystem, 1))) { $chart1 = $flight->getChartRelPath("alt", $PREFS->metricSystem, 1); $title1 = "Altitude"; } else { if (is_file($flight->getChartfilename("takeoff_distance", $PREFS->metricSystem, 1))) { $chart1 = $flight->getChartRelPath("takeoff_distance", $PREFS->metricSystem, 1); $title1 = "Distance from takeoff"; } } $hlines = $flight->getRawHeader(); foreach ($hlines as $line) { if (strlen($line) == 0) {
//************************************************************************ // Leonardo XC Server, http://www.leonardoxc.net // // 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: GUI_flight_edit.php,v 1.52 2010/11/21 14:26:01 manolis Exp $ // //************************************************************************ require_once dirname(__FILE__).'/CL_image.php'; require_once dirname(__FILE__)."/CL_NACclub.php"; require_once dirname(__FILE__)."/CL_user.php"; $flight=new flight(); $flight->getFlightFromDB($flightID); if ( $flight->belongsToUser($userID) || L_auth::isModerator($userID) ) { require_once dirname(__FILE__)."/CL_flightScore.php"; $flightScore=new flightScore($flight->flightID); $flightScore->getFromDB(); if ($_REQUEST["changeFlight"]) { // make changes $newUserIDStr=$_POST["newUserID"]; if ($newUserIDStr) { // move this flight to a new userID $newUserIDStrPart=split('_',$newUserIDStr); $newUserServerID=0; if (count($newUserIDStrPart)>1) {
AXSP3EL LXSPNSOARING PILOT IGC OUTPUT AXSY L ACTIVE LOG LXSY Version 3.0 digitally signed 4/28/2005 11:48:18 AM LCU::HPPLTPILOT:Simon Foley LCU::HPGTYGLIDERTYPE:Sky Atis LCU::HPGIDGLIDERID: LCU::HPCCLCOMPETITIONCLASS:Paraglider Open LSEEYOU PureGlider=False */ if ($res > 0) { echo "<br><br>"; $flight = new flight(); $f = 1; while ($row = mysql_fetch_assoc($res)) { // $flight=new flight(); $flight->getFlightFromDB($row["ID"]); if (is_file($flight->getIGCFilename())) { $buffer = $flight->getIGCFilename() . "<BR>"; $lines = file($flight->getIGCFilename()); $found = 0; for ($i = count($lines) - 1; $i >= 0; $i--) { $line =& $lines[$i]; if (strtoupper($line[0] == "L") || strtoupper($line[0] == "A")) { $buffer .= $line . "<BR>"; foreach ($prList as $pr => $str_list) { foreach ($str_list as $str) { // echo "$line $pr $str<BR>";
require_once dirname(__FILE__) . "/FN_waypoint.php"; require_once dirname(__FILE__) . "/FN_output.php"; require_once dirname(__FILE__) . "/FN_pilot.php"; require_once dirname(__FILE__) . "/FN_flight.php"; require_once dirname(__FILE__) . "/templates/" . $PREFS->themeName . "/theme.php"; setDEBUGfromGET(); require_once dirname(__FILE__) . "/language/" . CONF_LANG_ENCODING_TYPE . "/lang-" . $currentlang . ".php"; require_once dirname(__FILE__) . "/language/" . CONF_LANG_ENCODING_TYPE . "/countries-" . $currentlang . ".php"; $filename = makeSane($_REQUEST['file'], 2); $flightID = makeSane($_REQUEST['flightID'], 1); if ($flightID <= 0 && !$filename) { exit; } $clientIP = getClientIpAddr(); if ($flightID) { $flight = new flight(); $flight->getFlightFromDB($flightID); $authOK = 0; if ($flight->belongsToUser($userID) || L_auth::isModerator($userID) || L_auth::canDownloadIGC($clientIP)) { $authOK = 1; } } else { if ($filename) { $authOK = 0; $base_name = basename($filename); // echo $base_name."#"; if (L_auth::isModerator($userID) || L_auth::canDownloadIGC($clientIP) || $_SESSION['di' . $base_name]) { $authOK = 1; } } }
// 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_flight_show.php,v 1.111 2012/09/17 22:33:49 manolis Exp $ // //************************************************************************ require_once $LeoCodeBase."/CL_image.php"; require_once $LeoCodeBase."/CL_template.php"; $Ltemplate = new LTemplate($LeoCodeBase.'/templates/'.$PREFS->themeName); $flightID+=0; $flight=new flight(); if ( ! $flight->getFlightFromDB($flightID) ) { echo "<br><div align='center'>No such flight exists</div><br><BR>"; return; } if ( $flight->private && ! $flight->belongsToUser($userID) && ! L_auth::isAdmin($userID) ) { echo "<TD align=center>"._FLIGHT_IS_PRIVATE."</td>"; return; } //debug $mapUrl=$flight->createStaticMap(1); $flight->incViews();
Flight::set('moneysupplyproc', Flight::controller()->get_percentage(Flight::get('getinfo')['moneysupply'], Flight::get('getinfo')['balance'], FORMATTING)); Flight::set('interestproc', Flight::controller()->get_percentage(Flight::get('getinfo')['balance'], Flight::get('interest'), FORMATTING)); Flight::set('balancecalc', number_format(Flight::get('getinfo')['balance'] * $_SESSION['reddex'][Flight::get('currency')], 8) . ' ' . Flight::get('currencySym')); Flight::set('interestcalc', Flight::get('interest') * $_SESSION['reddex'][Flight::get('currency')] . ' ' . Flight::get('currencySym')); Flight::set('chart', NULL); Flight::set('txCount', count(Flight::get('transactions'))); if (file_exists(Flight::get('dbPath') . '/stats.dat') && SHOWCHART && Flight::get('getstaking')['staking']) { $array = unserialize(file_get_contents(Flight::get('dbPath') . '/stats.dat')); if (!empty($array)) { flight::set('chart', $array); } } if (isset(Flight::request()->data->chart)) { flight::set('chartSelect', Flight::request()->data->chart); } else { flight::set('chartSelect', CHART); } include "tpl/header.phtml"; include "tpl/overview.phtml"; include "tpl/footer.phtml"; }); Flight::route('/myaccounts', function () { include "tpl/header.phtml"; include "tpl/myaccounts.phtml"; include "tpl/footer.phtml"; }); Flight::route('/myaddresses/@account(/@address)', function ($account, $address) { if ($account == 'Default') { $account = ''; } Flight::set('addresses', Flight::reddcoin()->getaddressesbyaccount($account));
<?php //************************************************************************ // Leonardo XC Server, http://www.leonardoxc.net // // 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: GUI_validation_review.php,v 1.9 2010/03/14 20:56:11 manolis Exp $ // //************************************************************************ if (L_auth::isAdmin($userID)) { $flight = new flight(); $flight->getFlightFromDB($flightID); if ($_REQUEST["changeFlight"]) { // make changes $flight->cat = makeSane($_REQUEST["gliderCat"]); $flight->glider = $_REQUEST["glider"]; $flight->comments = $_REQUEST["comments"]; $flight->linkURL = $_REQUEST["linkURL"]; if (substr($flight->linkURL, 0, 7) == "http://") { $flight->linkURL = substr($flight->linkURL, 7); } if ($_REQUEST['is_private'] == "1") { $flight->private = 1; } else { $flight->private = 0; }
$flightID += 0; if ($flightID) { $flightsList[] = $flightID; } $i++; if ($i > 20) { break; } } $flightsNum = count($flightsList); sort($flightsList); if ($flightsNum == 0) { exit; } if ($flightsNum == 1) { $flight = new flight(); $flight->getFlightFromDB($flightsList[0], 0); $flightID = $flightsList[0]; if ($flight->is3D()) { $title1 = _Altitude . ' (' . ($PREFS->metricSystem == 1 ? _M : _FT) . ')'; } else { $title1 = _Distance_from_takeoff . ' (' . ($PREFS->metricSystem == 1 ? _KM_PER_HR : _MPH) . ')'; } // print_r($flight);exit; $takeoffID = $flight->takeoffID; $isAdmin = L_auth::isAdmin($userID) || $flight->belongsToUser($userID); $trackPossibleColors = array("AB7224", "3388BE", "FF0000", "00FF00", "0000FF", "FFFF00", "FF00FF", "00FFFF", "EF8435", "34A7F0", "33F1A3", "9EF133", "808080"); } else { $title1 = _Altitude . ' (' . ($PREFS->metricSystem == 1 ? _M : _FT) . ')'; $flightID = 0; $takeoffID = 0;
function processEntry($serverID, $e, $sync_mode = SYNC_INSERT_FLIGHT_LINK) { global $CONF; global $DBGcat, $DBGlvl; if ($DBGlvl > 0) { echo "<PRE>"; print_r($e); echo "</PRE>"; } if (is_array($e['ActionXML'])) { $actionData =& $e['ActionXML']; } else { if (is_array($e['actionData'])) { $actionData =& $e['actionData']; } else { if (is_array($e['flight'])) { $actionData =& $e; } else { return array(0, "logReplicator::processEntry : actionData section not found"); } } } // if this log entry is not for a flight of the specific server // then check if we are allowesd to accpet these flights from this server if (isset($actionData['flight']['serverID'])) { $thisEntryServerID = $actionData['flight']['serverID']; } else { if (isset($e['serverID'])) { $thisEntryServerID = $e['serverID']; } else { return array(0, "logReplicator::processEntry : ServerID for Log entry could not be determined "); } } if ($thisEntryServerID != $serverID) { $wrongServer = 1; if (is_array($CONF['servers']['list'][$serverID]['accept_also_servers'])) { if (in_array($thisEntryServerID, $CONF['servers']['list'][$serverID]['accept_also_servers'])) { $wrongServer = 0; } } if ($wrongServer) { return array(0, "logReplicator::processEntry : We dont accept flights originally from server " . $thisEntryServerID); } } if ($e['type'] == '1') { // flight if ($e['action'] == 4) { // delete $flightIDlocal = logReplicator::findFlight($actionData['flight']['serverID'], $actionData['flight']['id']); if (!$flightIDlocal) { return array(0, "logReplicator::processEntry : Flight with serverID " . $actionData['flight']['serverID'] . " and original ID : " . $actionData['flight']['id'] . " is not found in the local DB -> Wont delete it"); } // echo "Will delete flight $flightIDlocal<BR>"; $extFlight = new flight(); $extFlight->getFlightFromDB($flightIDlocal, 0); $extFlight->deleteFlight(); return array(1, "Flight with local ID: {$flightIDlocal} DELETED"); } if ($e['action'] == 16) { // rename tracklog $flightIDlocal = logReplicator::findFlight($e['serverID'], $e['id']); if (!$flightIDlocal) { return array(0, "logReplicator::processEntry : Flight with serverID " . $e['serverID'] . " and original ID : " . $e['id'] . " is not found in the local DB -> Wont rename tracklog<BR>"); } $extFlight = new flight(); $extFlight->getFlightFromDB($flightIDlocal, 0); $extFlight->renameTracklog($actionData['newFilename'], $actionData['oldFilename']); return array(1, "Flight tracklog renamed for local ID {$flightIDlocal}"); } if ($e['action'] == 8) { // scoring info $flightIDlocal = logReplicator::findFlight($e['serverID'], $e['id']); if (!$flightIDlocal) { return array(0, "logReplicator::processEntry : Flight with serverID " . $e['serverID'] . " and original ID : " . $e['id'] . " is not found in the local DB -> Wont update scoring<BR>"); } // echo "Will update scoring info for flight $flightIDlocal<BR>"; // no need to pull flight info //$extFlight=new flight(); //$extFlight->getFlightFromDB($flightIDlocal,0); require_once dirname(__FILE__) . '/CL_flightScore.php'; $flightScore = new flightScore($flightIDlocal); // we have the score array in $actionData['score'] $sArr =& $actionData['score']; $flightScore->fromSyncArray($sArr); //put also in scores table, the flight is sure to be present in flights table $flightScore->putToDB(1, 1); return array(1, "Flight Score was *pulled* for local ID {$flightIDlocal}"); } // now deal with add/update $getValidationData = 1; $getScoreData = 1; // check 'alien' pilot and insert him or update him anyway $userServerID = $actionData['flight']['serverID']; if ($userServerID == 0) { $userServerID = $serverID; } // echo "logReplicator::checkPilot"; list($effectiveServerID, $effectiveUserID) = logReplicator::checkPilot($userServerID, $actionData['flight']['pilot']); //echo "effectiveServerID: $effectiveServerID, effectiveUserID: $effectiveUserID // userServerID: $userServerID, userID: ".$actionData['flight']['pilot']['userID']."<BR>"; // check if a maping took place and LOG it!! if ($effectiveServerID != $userServerID || $effectiveUserID != $actionData['flight']['pilot']['userID']) { $orgUserIDstr = $userServerID + 0 . '_' . $actionData['flight']['pilot']['userID']; } else { $orgUserIDstr = ''; } // $userIDstr=$userServerID.'_'.$actionData['flight']['pilot']['userID']; $userIDstr = $effectiveServerID . '_' . $effectiveUserID; list($nearestTakeoffID, $nearestDistance) = logReplicator::checkLocation($userServerID, $actionData['flight']['location'], $actionData['flight']['bounds']); list($nearestLandingID, $nearestLandingDistance) = findNearestWaypoint($actionData['flight']['bounds']['lastLat'], $actionData['flight']['bounds']['lastLon']); // get only the first 2 bits $externalFlightType = $sync_mode & 0x3; $addFlightNote = ''; // if action ==update check to see if the flight exists ! if ($e['action'] == 2) { $flightIDlocal = logReplicator::findFlight($actionData['flight']['serverID'], $actionData['flight']['id']); if (!$flightIDlocal) { // we then INSERT IT instead echo " [Not found,will insert] "; $e['action'] = 1; } } else { if ($e['action'] == 1) { // if action == insert we make an extra check to see if the fligh is there, if yes we UPDATE instead $flightIDlocal = logReplicator::findFlight($actionData['flight']['serverID'], $actionData['flight']['id']); if ($flightIDlocal) { // we then UPDATE IT instead echo " [Already here,will update] "; $e['action'] = 2; } } } if ($e['action'] == 1) { // add $igcFilename = $actionData['flight']['filename']; $igcFileURL = $actionData['flight']['linkIGC']; $igcZipFileURL = $actionData['flight']['linkIGCzip']; $tempFilename = LEONARDO_ABS_PATH . '/' . $CONF['paths']['tmpigc'] . '/' . $igcFilename; $hash = $actionData['flight']['validation']['hash']; $sameHashIDarray = flight::findSameHash($hash); if (count($sameHashIDarray) > 0) { $isFlightDup = 0; $markFlightAsDisabled = 1; $msg = ''; if ($CONF['servers']['list'][$actionData['flight']['serverID']]['allow_duplicate_flights']) { foreach ($sameHashIDarray as $sameHashFlightInfo) { if ($sameHashFlightInfo['serverID'] == $actionData['flight']['serverID']) { // from same server $isFlightDup = 1; $msg .= " local flight: " . $sameHashFlightInfo['serverID'] . '_' . $sameHashFlightInfo['ID'] . " , new entry:" . $actionData['flight']['serverID'] . '_' . $actionData['flight']['id']; break; } else { // we have a flight with same hash that is not from this specific server. // HERE we must make the decision whether to mark this flight as DISABLED // WE always mark this new flight as DISABLED because : // the local flight takes precedence anyway. // ONE case // we are DHV mirror , the new flight is from DHV and there is a dup from XContest // we should insert, // SO INSERT TAKES PRECEDENCE OVER LINKED FLIGHTS } } } else { $isFlightDup = 1; } if ($isFlightDup) { return array(-1, "Flight already exists : {$msg}"); } } /* if ($CONF['servers']['list'][$actionData['flight']['serverID']]['allow_duplicate_flights']) { $sameHashIDarray=flight::findSameHash( $hash , $actionData['flight']['serverID'] ); if (count($sameHashIDarray)>0 ) { return array(-1,"Flight already exists in local with ID: $sameHashID (dups allowed)"); continue; } else { // $addFlightNote="*(Duplicate Flight)*"; } } else { $sameHashIDarray=flight::findSameHash( $hash ); if (count($sameHashIDarray)>0 ) { return array(-1,"Flight already exists in local with ID: $sameHashID"); continue; } } */ } else { if ($e['action'] == 2) { // update // This is not needed , we have found $flightIDlocal earlier and if it didnt exist we will insert it instead /* $flightIDlocal=logReplicator::findFlight($actionData['flight']['serverID'],$actionData['flight']['id']); if (!$flightIDlocal) { return array(0,"logReplicator::processEntry : Flight with serverID ".$actionData['flight']['serverID']." and original ID : ". $actionData['flight']['id']." is not found in the local DB -> Wont update<BR>"); } */ // echo "Will update flight $flightIDlocal<BR>"; } } $thisCat = $actionData['flight']['info']['cat'] + 0; // when we get data from leonardo servers, we just ignore these fields // since they can be computed on the fly $originalURL = htmlDecode($actionData['flight']['linkDisplay']); $originalKML = htmlDecode($actionData['flight']['linkGE']); if ($actionData['flight']['serverID'] != 0) { global $CONF; if ($CONF['servers']['list'][$actionData['flight']['serverID']]['isLeo'] == 1) { $originalURL = ''; $originalKML = ''; } } $argArray = array("private" => $actionData['flight']['info']['private'] + 0, "cat" => $actionData['flight']['info']['gliderCat'] + 0, "linkURL" => $actionData['flight']['info']['linkURL'], "comments" => $actionData['flight']['info']['comments'], "glider" => $actionData['flight']['info']['glider'], "gliderBrandID" => $actionData['flight']['info']['gliderBrandID'] + 0, "category" => $thisCat >= 0 ? $thisCat : 0, "dateAdded" => $actionData['flight']['dateAdded'], "originalURL" => $originalURL, "originalKML" => $originalKML, "original_ID" => $actionData['flight']['id'], "serverID" => $actionData['flight']['serverID'], "userServerID" => $actionData['flight']['serverID'], "originalUserID" => $orgUserIDstr, "externalFlightType" => $externalFlightType, "allowDuplicates" => $CONF['servers']['list'][$actionData['flight']['serverID']]['allow_duplicate_flights'] + 0); // print_r($argArray); if ($e['action'] == 1 && $sync_mode & SYNC_INSERT_FLIGHT_LOCAL & SYNC_INSERT_FLIGHT_REPROCESS_LOCALLY) { if (!($igcFileStr = fetchURL($igcFileURL, 20))) { return array(0, "logReplicator::processEntry() : Cannot Fetch {$igcFileURL}"); } writeFile($tempFilename, $igcFileStr); list($res, $flightID) = addFlightFromFile($tempFilename, 0, $userIDstr, $argArray); if ($res != 1) { return array(-128, "Problem: " . getAddFlightErrMsg($res, $flightID)); } return array(1, "Flight *pulled* OK with local ID {$flightID}"); } else { // if ( ( $e['action']==1 && $sync_mode & SYNC_INSERT_FLIGHT_LINK ) || $e['action']==2 ){ // inserting in LINK / LOCAL mode or updates - NOT reproccess if ($e['action'] == 1) { $extFlight = new flight(); // get igc if required if ($sync_mode & SYNC_INSERT_FLIGHT_LOCAL) { echo " Geting IGC file : "; if (!$e['tmpDir']) { $e['tmpDir'] = '/tmp'; } $igcFileTmp = $e['tmpDir'] . '/' . $actionData['flight']['id'] . '.igc'; if (!is_file($igcFileTmp)) { echo "igc file: {$igcFileURL}<BR>\n"; echo "tmpfile: {$igcFileTmp}<BR>\n"; echo "NOT in zip -> will fetch ..."; if (!($igcFileStr = fetchURL($igcFileURL, 20))) { return array(0, "logReplicator::processEntry() : Cannot Fetch {$igcFileURL}"); } writeFile($igcFileTmp, $igcFileStr); } else { echo "IN zip -> will use that ..."; } } } else { $extFlight = new flight(); $extFlight->getFlightFromDB($flightIDlocal, 0); } $igcFilename = $actionData['flight']['filename']; $igcFileURL = $actionData['flight']['linkIGC']; if ($CONF['servers']['list'][$actionData['flight']['serverID']]['exclude_from_list']) { $extFlight->excludeFrom |= 3; } if ($CONF['servers']['list'][$actionData['flight']['serverID']]['exclude_from_league']) { $extFlight->excludeFrom |= 2; } foreach ($argArray as $fieldName => $fieldValue) { // if the flight is already present // we must tkae care to honor ONLY // the 1st bit of 'private' , the others are used locally !! if ($fieldName == 'private') { if ($fieldValue & 0x1) { $fieldValue = $extFlight->private | 0x1; } else { if ($fieldValue & 0x4) { // visible to friends $fieldValue = $extFlight->private | 0x4; } else { $fieldValue = $extFlight->private & 0xfa; } } } $extFlight->{$fieldName} = $fieldValue; } // echo " gliderBrandID : $extFlight->gliderBrandID #<BR>"; $extFlight->takeoffID = $nearestTakeoffID; $extFlight->takeoffVinicity = $nearestDistance; $extFlight->landingID = $nearestLandingID; $extFlight->landingVinicity = $nearestLandingDistance; // no userid will be assgined to this flight since it will not be inserted locally // so userID= userServerID; // $extFlight->userID=$extFlight->originalUserID; // now we take care of mapping between users $extFlight->userID = $effectiveUserID; $extFlight->userServerID = $effectiveServerID; $extFlight->dateAdded = $actionData['flight']['dateAdded']; $extFlight->DATE = $actionData['flight']['time']['date']; $extFlight->timezone = $actionData['flight']['time']['Timezone'] + 0; $extFlight->START_TIME = $actionData['flight']['time']['StartTime'] + 0; $extFlight->DURATION = $actionData['flight']['time']['Duration'] + 0; $extFlight->END_TIME = $extFlight->START_TIME + $extFlight->DURATION; $extFlight->forceBounds = $actionData['flight']['bounds']['forceBounds'] + 0; $extFlight->firstLon = $actionData['flight']['bounds']['firstLon'] + 0; $extFlight->firstLat = $actionData['flight']['bounds']['firstLat'] + 0; $extFlight->firstPointTM = $actionData['flight']['bounds']['firstTM'] + 0; $extFlight->lastLon = $actionData['flight']['bounds']['lastLon'] + 0; $extFlight->lastLat = $actionData['flight']['bounds']['lastLat'] + 0; $extFlight->lastPointTM = $actionData['flight']['bounds']['lastTM'] + 0; $firstPoint = new gpsPoint(); $firstPoint->setLon($actionData['flight']['bounds']['firstLon']); $firstPoint->setLat($actionData['flight']['bounds']['firstLat']); $firstPoint->gpsTime = $actionData['flight']['bounds']['firstTM'] % 86400; $lastPoint = new gpsPoint(); $lastPoint->setLon($actionData['flight']['bounds']['lastLon']); $lastPoint->setLat($actionData['flight']['bounds']['lastLat']); $lastPoint->gpsTime = $actionData['flight']['bounds']['lastTM'] % 86400; // $extFlight->FIRST_POINT=$firstPoint->to_IGC_Record(); // $extFlight->LAST_POINT=$lastPoint->to_IGC_Record(); // not used!! /* if ( is_array($actionData['flight']['turnpoints']) ) { foreach ($actionData['flight']['turnpoints'] as $i=>$tp){ $tpNum=$tp['id']; $tpPoint=new gpsPoint(); $tpPoint->setLon($tp['lon']); $tpPoint->setLat($tp['lat']); $varname="turnpoint$tpNum" ; $extFlight->$varname = $tpPoint->getLatMin().' '.$tpPoint->getLonMin() ; } } */ if ($getValidationData) { $extFlight->validated = $actionData['flight']['validation']['validated']; $extFlight->grecord = $actionData['flight']['validation']['grecord']; $extFlight->hash = $actionData['flight']['validation']['hash']; $extFlight->validationMessage = $actionData['flight']['validation']['validationMessage']; $extFlight->airspaceCheck = $actionData['flight']['validation']['airspaceCheck'] + 0; $extFlight->airspaceCheckFinal = $actionData['flight']['validation']['airspaceCheckFinal'] + 0; $extFlight->airspaceCheckMsg = $actionData['flight']['validation']['airspaceCheckMsg']; } $getScoreDataExtra = 0; $getScoreDataExtraMissing = 0; if ($getScoreData) { // we should get these from the [score] section also $extFlight->BEST_FLIGHT_TYPE = $actionData['flight']['stats']['FlightType']; $extFlight->FLIGHT_KM = $actionData['flight']['stats']['XCdistance']; $extFlight->FLIGHT_POINTS = $actionData['flight']['stats']['XCscore']; $extFlight->LINEAR_DISTANCE = $actionData['flight']['stats']['StraightDistance'] + 0; $extFlight->MAX_LINEAR_DISTANCE = $actionData['flight']['stats']['MaxStraightDistance'] + 0; $extFlight->MEAN_SPEED = $actionData['flight']['stats']['MeanGliderSpeed'] + 0; $extFlight->MAX_SPEED = $actionData['flight']['stats']['MaxSpeed'] + 0; $extFlight->MAX_VARIO = $actionData['flight']['stats']['MaxVario'] + 0; $extFlight->MIN_VARIO = $actionData['flight']['stats']['MinVario'] + 0; $extFlight->MAX_ALT = $actionData['flight']['stats']['MaxAltASL'] + 0; $extFlight->MIN_ALT = $actionData['flight']['stats']['MinAltASL'] + 0; $extFlight->TAKEOFF_ALT = $actionData['flight']['stats']['TakeoffAlt'] + 0; if (is_array($actionData['flight']['score']) && count($actionData['flight']['score']) > 0) { require_once dirname(__FILE__) . '/CL_flightScore.php'; $flightScore = new flightScore($extFlight->flightID); // we have the score array in $actionData['score'] $sArr =& $actionData['flight']['score']; $flightScore->fromSyncArray($sArr); $extFlight->flightScore = $flightScore; $getScoreDataExtra = 1; $extFlight->BEST_FLIGHT_TYPE = $flightScore->bestScoreType; $extFlight->FLIGHT_KM = $flightScore->bestDistance * 1000; $extFlight->FLIGHT_POINTS = $flightScore->bestScore; // check for missing linear distance if ($extFlight->LINEAR_DISTANCE == 0 && $extFlight->MAX_LINEAR_DISTANCE > 0) { // echo "compute MAxtakeoffDistance"; $extFlight->LINEAR_DISTANCE = $flightScore->computeMaxTakeoffDistance($firstPoint); } //put also in scores table, the flight is sure to be present in flights table if ($e['action'] == 2) { // update so we already know the flightID $flightScore->putToDB(1, 1); } } else { $getScoreDataExtraMissing = 1; } } // we also have [gliderBrand] => GRADIENT $extFlight->checkGliderBrand($actionData['flight']['info']['gliderBrand']); if ($e['action'] == 1) { if ($sync_mode & SYNC_INSERT_FLIGHT_LOCAL) { $tmpPilot = new pilot($effectiveServerID, $effectiveUserID); $tmpPilot->createDirs(); $extFlight->filename = $igcFilename; $extFlight->checkDirs(); if ($DBGlvl > 0) { echo "Moving file into place: " . $extFlight->getIGCFilename() . "<BR>"; } while (is_file($extFlight->getIGCFilename())) { if ($DBGlvl > 0) { echo "Same filename is already present<BR>"; } $extFlight->filename = '_' . $extFlight->filename; } @rename($igcFileTmp, $extFlight->getIGCFilename()); $opString = '*inserted*'; } else { $opString = '*linked*'; } // insert flight $extFlight->putFlightToDB(0); // take care of sme flights (hide /unhide) $extFlight->hideSameFlights(); if ($getScoreData && $getScoreDataExtra) { $flightScore->flightID = $extFlight->flightID; $flightScore->putToDB(1, 1); } else { if ($getScoreDataExtraMissing && $CONF['servers']['list'][$actionData['flight']['serverID']]['rescore_if_missing'] && $sync_mode & SYNC_INSERT_FLIGHT_LOCAL) { echo " [Re-score] "; $extFlight->computeScore(); } } return array(1, "Flight {$opString} OK {$addFlightNote} with local ID {$extFlight->flightID}"); } else { //update flight $extFlight->putFlightToDB(1); if ($getScoreDataExtraMissing && $CONF['servers']['list'][$actionData['flight']['serverID']]['rescore_if_missing'] && $sync_mode & SYNC_INSERT_FLIGHT_LOCAL) { echo " [Re-score] "; require_once dirname(__FILE__) . '/CL_flightScore.php'; $flightScore = new flightScore($extFlight->flightID); $flightScore->getFromDB(); if ($flightScore->gotValues) { echo "[not needed] "; } else { $extFlight->computeScore(); } } return array(1, "Flight with local ID {$flightIDlocal} UPDATED OK"); } } return array(0, "Unknown error, we should have returned by this far..."); } // if type==1 }
} else { echo "<BR><BR>All Airspace entries were deleted from DB<BR><BR>"; } } else { if ($_GET['act'] == 'check_flights') { $airspaceChunk = $_GET['num']; if (!$airspaceChunk) { $airspaceChunk = 50; } DEBUG('AdminAirspace', 1, "Checking all flights for airspace violations<BR>"); echo "Checking all flights for airspace violations<BR>"; $query = "SELECT ID,active from {$flightsTable} WHERE airspaceCheck=0 OR airspaceCheckFinal=0 "; $res = $db->sql_query($query); if ($res > 0) { echo "<br><br>"; $flight = new flight(); $i = 0; while ($row = mysql_fetch_assoc($res)) { // $flight=new flight(); $flight->getFlightFromDB($row["ID"]); if (!is_file($flight->getIGCFilename())) { echo "[" . $row['ID'] . "] IGC not found<BR>"; } else { echo "[" . $row['ID'] . "] "; flush2Browser(); $flight->checkAirspace(1); echo " Checked: " . $flight->airspaceCheckMsg . "<BR>"; flush2Browser(); } $i++; if ($i > $airspaceChunk) {
require_once dirname(__FILE__) . "/CL_flightData.php"; require_once dirname(__FILE__) . "/FN_functions.php"; require_once dirname(__FILE__) . "/FN_UTM.php"; require_once dirname(__FILE__) . "/FN_waypoint.php"; require_once dirname(__FILE__) . "/FN_output.php"; require_once dirname(__FILE__) . "/FN_pilot.php"; require_once dirname(__FILE__) . "/FN_flight.php"; require_once dirname(__FILE__) . "/templates/" . $PREFS->themeName . "/theme.php"; setDEBUGfromGET(); require_once dirname(__FILE__) . "/language/" . CONF_LANG_ENCODING_TYPE . "/lang-" . $currentlang . ".php"; require_once dirname(__FILE__) . "/language/" . CONF_LANG_ENCODING_TYPE . "/countries-" . $currentlang . ".php"; $flightID = makeSane($_GET['flightID'], 1); if ($flightID <= 0) { exit; } $flight = new flight(); $flight->getFlightFromDB($flightID); $flightComments = new flightComments($flight->flightID); $flightComments->getFromDB(); $commentsEnabled = $flight->commentsEnabled + 0; // now the access rights : $moderatorRights = false; if ($flight->userID == $userID && $flight->userServerID == $userServerID || L_auth::isModerator($userID)) { $moderatorRights = true; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php
function addFlightFromFile($filename, $calledFromForm, $userIDstr, $argArray = array()) { global $CONF_default_cat_add, $CONF_photosPerFlight, $CONF; global $CONF_NAC_list, $CONF_use_NAC, $CONF_use_validation, $CONF_airspaceChecks, $CONF_server_id; global $userID, $CONF_new_flights_submit_window; global $flightsTable; set_time_limit(120); global $CONF_server_id; list($thisServerID, $userIDforFlight) = splitServerPilotStr($userIDstr); if (!$thisServerID) { $thisServerID = $CONF_server_id; } require_once dirname(__FILE__) . '/CL_actionLogger.php'; $log = new Logger(); $log->userID = $userID + 0; // the userId that is logged in , not the one that the flight will be atrributed to $log->ItemType = 1; // flight; $log->ItemID = 0; // 0 at start will fill in later if successfull $log->ServerItemID = $thisServerID; $log->ActionID = 1; //1 => add 2 => edit; $log->ActionXML = ''; $log->Modifier = 0; $log->ModifierID = 0; $log->ServerModifierID = 0; $log->Result = 0; $log->ResultDescription = ""; if (!$filename) { $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_YOU_HAVENT_SUPPLIED_A_FLIGHT_FILE, 0); if (!$log->put()) { echo "Problem in logger<BR>"; } return array(ADD_FLIGHT_ERR_YOU_HAVENT_SUPPLIED_A_FLIGHT_FILE, 0); } // now is the time to remove bad chars from the filename! $newFilename = str_replace("'", " ", $filename); $newFilename = toLatin1($newFilename); if ($newFilename != $filename) { rename($filename, $newFilename); $filename = $newFilename; } if (!is_file($filename)) { $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_NO_SUCH_FILE, 0); if (!$log->put()) { echo "Problem in logger<BR>"; } return array(ADD_FLIGHT_ERR_NO_SUCH_FILE, 0); } if (strtolower(substr($filename, -4)) != ".igc") { $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_FILE_DOESNT_END_IN_IGC, 0); if (!$log->put()) { echo "Problem in logger<BR>"; } return array(ADD_FLIGHT_ERR_FILE_DOESNT_END_IN_IGC, 0); } $tmpIGCPath = $filename; $flight = new flight(); if ($thisServerID != $CONF_server_id) { $flight->userServerID = $thisServerID; } $flight->userID = $userIDforFlight; /* $flight->cat=$gliderCat; $flight->private=$is_private; $flight->category=$category; $flight->comments=$comments; $flight->glider=$glider; $flight->linkURL=$linkURL; */ foreach ($argArray as $varName => $varValue) { if ($varName == 'NACclubID' || $varName == 'NACid' || $varName == 'comments') { continue; } $flight->{$varName} = $varValue; } $comments = $argArray['comments']; if ($comments) { $flight->commentsNum = 1; } if (strtolower(substr($flight->linkURL, 0, 7)) == "http://") { $flight->linkURL = substr($flight->linkURL, 7); } if ($flight->cat == -1) { $flight->cat = $CONF_default_cat_add; } # martin jursa 22.06.2008: # in case the glider is not given otherwise, try to extract it from the IGC file if (empty($flight->glider)) { $flight->glider = extractGlider($lines); } // if no brand was given , try to detect $flight->checkGliderBrand(); // we must cope with some cases here // 1. more flights in the igc // 2. garmin saved paths -> zero time difference -> SOLVED! if (!$flight->getFlightFromIGC($tmpIGCPath)) { $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_THIS_ISNT_A_VALID_IGC_FILE, 0); if (!$log->put()) { echo "Problem in logger<BR>"; } return array(ADD_FLIGHT_ERR_THIS_ISNT_A_VALID_IGC_FILE, 0); } // Compute hash now $lines = file($tmpIGCPath); $hash = md5(implode('', $lines)); $flight->hash = $hash; unset($lines); // check for mac newlines -> NOT USED NOW // we now use auto_detect_line_endings=true; /* if ( count ($lines)==1) { if ($lines[0]=preg_replace("/\r([^\n])/","\r\n\\1",$lines[0])) { DEBUG('addFlightFromFile',1,"addFlightFromFile: MAC newlines found<BR>"); if (!$handle = fopen($tmpIGCPath, 'w')) { print "Cannot open file ($filename)"; exit; } if (!fwrite($handle, $lines[0])) { print "Cannot write to file ($filename)"; exit; } fclose($handle); } } */ // echo $flight->DATE ." > ". date("Y-m-d",time()+3600*10) ."<BR>"; // check for dates in the furure if ($flight->DATE > date("Y-m-d", time() + 3600 * 10)) { @unlink($flight->getIGCFilename(1)); @unlink($tmpIGCPath . ".olc"); @unlink($tmpIGCPath); $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_DATE_IN_THE_FUTURE, 0); if (!$log->put()) { echo "Problem in logger<BR>"; } return array(ADD_FLIGHT_ERR_DATE_IN_THE_FUTURE, 0); } // Two week time limit check - P.Wild /// Modification martin jursa 08.05.2007 cancel the upload if flight is too old if ($CONF_new_flights_submit_window > 0) { if (!L_auth::isAdmin($userID)) { if ($flight->DATE < date("Y-m-d", time() - $CONF_new_flights_submit_window * 24 * 3600)) { @unlink($flight->getIGCFilename(1)); @unlink($tmpIGCPath . ".olc"); @unlink($tmpIGCPath); $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_OUTSIDE_SUBMIT_WINDOW, 0); if (!$log->put()) { echo "Problem in logger<BR>"; } return array(ADD_FLIGHT_ERR_OUTSIDE_SUBMIT_WINDOW, 0); } } } // end martin / peter $sameFilenameID = $flight->findSameFilename(basename($filename)); if ($sameFilenameID > 0) { if ($flight->allowDuplicates) { while (is_file($flight->getIGCFilename())) { $flight->filename = '_' . $flight->filename; } } else { @unlink($flight->getIGCFilename(1)); @unlink($tmpIGCPath . ".olc"); @unlink($tmpIGCPath); $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_SAME_FILENAME_FLIGHT, 0); if (!$log->put()) { echo "Problem in logger<BR>"; } return array(ADD_FLIGHT_ERR_SAME_FILENAME_FLIGHT, $sameFilenameID); } } $sameFlightsArray = $flight->findSameTime(); if (count($sameFlightsArray) > 0) { if ($flight->allowDuplicates) { // we allow duplicates if they are from another server $dupFound = 0; foreach ($sameFlightsArray as $k => $fArr) { if ($fArr['serverID'] == $flight->serverID) { // if a same flight from this server is present we dont re-insert $dupFound = 1; break; } else { // fill in ids of flights to 'disable' $disableFlightsList[$fArr['ID']]++; } } } else { $dupFound = 1; } if ($dupFound) { @unlink($flight->getIGCFilename(1)); @unlink($tmpIGCPath . ".olc"); @unlink($tmpIGCPath); $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_SAME_DATE_FLIGHT, 0); if (!$log->put()) { echo "Problem in logger<BR>"; } // return array( ADD_FLIGHT_ERR_SAME_DATE_FLIGHT,$sameFlightsArray[0]['serverID'].'_'. $sameFlightsArray[0]['ID']); return array(ADD_FLIGHT_ERR_SAME_DATE_FLIGHT, $sameFlightsArray[0]['ID']); } else { DEBUG("FLIGHT", 1, "addFlightFromFile: Duplicate DATE/TIME flight will be inserted<br>"); } } $sameFlightsArray = $flight->findSameHash($hash); if (count($sameFlightsArray) > 0) { if ($flight->allowDuplicates) { // we allow duplicates if they are from another server //echo "searching in dups "; //print_r($sameFlightsArray); $dupFound = 0; $flightPilot = new pilot($flight->userServerID + 0, $flight->userID + 0); $flightPilotMapTable = $flightPilot->pilotMapping(); // print_r($flightPilotMapTable); foreach ($sameFlightsArray as $k => $fArr) { if ($fArr['serverID'] == $flight->serverID) { // if a same flight from this server is present we dont re-insert $dupFound = 1; break; } else { // check that the existing flight belongs to a pilot that is 'mapped' to // $flight->userID + $flight->userServerID if (!$flightPilotMapTable[$fArr['userServerID']][$fArr['userID']]) { DEBUG("FLIGHT", 1, "addFlightFromFile: Same hash from external Server BUT from the pilot was not mapped into local <br>"); // We allow the flight to be submitted but then we must check and disable all duplicates but one //$dupFound=1; //break; } // fill in ids of flights to 'disable' $disableFlightsList[$fArr['ID']]++; } } } else { // echo "no dups allowesd"; $dupFound = 1; } if ($dupFound) { @unlink($flight->getIGCFilename(1)); @unlink($tmpIGCPath . ".olc"); @unlink($tmpIGCPath); $log->ResultDescription = getAddFlightErrMsg(ADD_FLIGHT_ERR_SAME_HASH_FLIGHT, 0); if (!$log->put()) { echo "Problem in logger<BR>"; } return array(ADD_FLIGHT_ERR_SAME_HASH_FLIGHT, $sameFlightsArray[0]['ID']); } else { DEBUG("FLIGHT", 1, "addFlightFromFile: Duplicate HASH flight will be inserted<br>"); // echo "addFlightFromFile: Duplicate HASH flight will be inserted<br>"; } } // print_r($disableFlightsList); /* if ( ! $flight->allowDuplicates ) { $sameHashIDArray=$flight->findSameHash( $hash ); if (count($sameHashIDArray)>0) { @unlink($flight->getIGCFilename(1)); @unlink($tmpIGCPath.".olc"); @unlink($tmpIGCPath); $log->ResultDescription=getAddFlightErrMsg(ADD_FLIGHT_ERR_SAME_HASH_FLIGHT,0); if (!$log->put()) echo "Problem in logger<BR>"; return array(ADD_FLIGHT_ERR_SAME_HASH_FLIGHT,$sameHashIDArray[0]['serverID'].'_'.$sameHashIDArray[0]['ID']); } } */ //****************************************************** // PASSED ALL TESTS , NOW DO SOME WORK WITH OUR FLIGHT //****************************************************** // move the flight to corresponding year $flight->checkDirs(); //$yearPath=$flightsAbsPath."/".$userIDstr."/flights/".$flight->getYear(); //$maps_dir=$flightsAbsPath."/".$userIDstr."/maps/".$flight->getYear(); //$charts_dir=$flightsAbsPath."/".$userIDstr."/charts/".$flight->getYear(); //$photos_dir=$flightsAbsPath."/".$userIDstr."/photos/".$flight->getYear(); //if (!is_dir($yearPath)) mkdir($yearPath,0755); //if (!is_dir($maps_dir)) mkdir($maps_dir,0755); //if (!is_dir($charts_dir)) mkdir($charts_dir,0755); //if (!is_dir($photos_dir)) mkdir($photos_dir,0755); /** * Martin Jursa; to avoid error log flooding */ if (file_exists($tmpIGCPath)) { @rename($tmpIGCPath, $flight->getIGCFilename()); } // in case an olc file was created too if (file_exists($tmpIGCPath . ".olc")) { @rename($tmpIGCPath . ".olc", $flight->getIGCFilename() . ".olc"); } // these commands seem redundant: //@unlink($tmpIGCPath.".olc"); //@unlink($tmpIGCPath); /*old: @rename($tmpIGCPath, $flight->getIGCFilename() ); // in case an olc file was created too @rename($tmpIGCPath.".olc", $flight->getIGCFilename().".olc" ); @unlink($tmpIGCPath.".olc"); @unlink($tmpIGCPath); */ // if we use NACclubs // get the NACclubID for userID // and see if the flight is in the current year (as defined in the NAclist array if ($CONF_use_NAC) { require_once dirname(__FILE__) . "/CL_NACclub.php"; list($pilotNACID, $pilotNACclubID) = NACclub::getPilotClub($userIDforFlight); DEBUG("FLIGHT", 1, "addFlightFromFile: pilotNACID:{$pilotNACID}, pilotNACclubID: {$pilotNACclubID}<br>"); if ($CONF_NAC_list[$pilotNACID]['use_clubs']) { DEBUG("FLIGHT", 1, "addFlightFromFile: use_clubs is on<br>"); if ($argArray['NACclubID'] > 0 && $argArray['NACid'] > 0) { $flight->NACclubID = $argArray['NACclubID']; $flight->NACid = $argArray['NACid']; DEBUG("FLIGHT", 1, "addFlightFromFile: using arguments NACclubID NACid<br>"); } else { DEBUG("FLIGHT", 1, "addFlightFromFile: calculating NACclubID NACid<br>"); // check year -> we only put the club for the current season , so that results for previous seasons cannot be affected $currSeasonYear = $CONF_NAC_list[$pilotNACID]['current_year']; DEBUG("FLIGHT", 1, "addFlightFromFile: currSeasonYear: {$currSeasonYear}<br>"); if ($CONF_NAC_list[$pilotNACID]['periodIsNormal']) { $seasonStart = $currSeasonYear - 1 . "-12-31"; $seasonEnd = $currSeasonYear . "-12-31"; } else { $seasonStart = $currSeasonYear - 1 . $CONF_NAC_list[$pilotNACID]['periodStart']; $seasonEnd = $currSeasonYear . $CONF_NAC_list[$pilotNACID]['periodStart']; } DEBUG("FLIGHT", 1, "addFlightFromFile: seasonStart:{$seasonStart} , seasonEnd:{$seasonEnd}<br>"); if ($flight->DATE > $seasonStart && $flight->DATE <= $seasonEnd) { DEBUG("FLIGHT", 1, "addFlightFromFile: inside Season !!<br>"); $flight->NACclubID = $pilotNACclubID; $flight->NACid = $pilotNACID; } } } } if ($CONF_use_validation) { $ok = $flight->validate(0); // dont update DB } if ($CONF_airspaceChecks) { $flight->checkAirspace(0); // dont update DB } $flight->putFlightToDB(0); // now do the photos if ($calledFromForm) { require_once dirname(__FILE__) . "/CL_flightPhotos.php"; $flightPhotos = new flightPhotos($flight->flightID); // $flightPhotos->getFromDB(); $j = 0; for ($i = 0; $i < $CONF_photosPerFlight; $i++) { $var_name = "photo" . $i . "Filename"; $photoName = $_FILES[$var_name]['name']; $photoFilename = $_FILES[$var_name]['tmp_name']; if ($photoName) { if (CLimage::validJPGfilename($photoName) && CLimage::validJPGfile($photoFilename)) { // $newPhotoName=toLatin1($photoName); // Fix for same photo filenames 2009.02.03 //global $flightsAbsPath; global $CONF; $newPhotoName = flightPhotos::getSafeName(LEONARDO_ABS_PATH . '/' . str_replace("%PILOTID%", $flight->getPilotID(), str_replace("%YEAR%", $flight->getYear(), $CONF['paths']['photos'])), $photoName); //$flightsAbsPath.'/'.$flight->getPilotID()."/photos/".$flight->getYear() , //$photoName ) ; $phNum = $flightPhotos->addPhoto($j, $flight->getPilotID() . "/photos/" . $flight->getYear(), $newPhotoName, $description); $photoAbsPath = $flightPhotos->getPhotoAbsPath($j); if (move_uploaded_file($photoFilename, $photoAbsPath)) { CLimage::resizeJPG($CONF['photos']['thumbs']['max_width'], $CONF['photos']['thumbs']['max_height'], $photoAbsPath, $photoAbsPath . ".icon.jpg", $CONF['photos']['compression']); CLimage::resizeJPG($CONF['photos']['normal']['max_width'], $CONF['photos']['normal']['max_height'], $photoAbsPath, $photoAbsPath, $CONF['photos']['compression']); $flight->hasPhotos++; $j++; } else { //upload not successfull $flightPhotos->deletePhoto($j); } } } } // also try to get geotag info $flightPhotos->computeGeoInfo(); } // took care of photos // tkae care of comments if ($comments) { global $lang2isoGoogle, $currentlang; $flightComments = new flightComments($flight->flightID); $commentInsertResult = $flightComments->addComment(array('parentID' => 0, 'userID' => $flight->userID + 0, 'userServerID' => $flight->userServerID + 0, 'guestName' => '', 'guestPass' => '', 'guestEmail' => '', 'text' => $comments, 'languageCode' => $lang2isoGoogle[$currentlang]), 0); } // now is a good time to disable duplicate flights we have found from other servers // AND are from the same user (using pilot's mapping table to find that out) global $db; if (0) { foreach ($disableFlightsList as $dFlightID => $num) { $query = "UPDATE {$flightsTable} SET private = private | 0x02 WHERE ID={$dFlightID} "; $res = $db->sql_query($query); # Error checking if ($res <= 0) { echo "<H3> Error in query: {$query}</H3>\n"; } } } //or $flight->hideSameFlights(); set_time_limit(200); $flight->computeScore(); $flight->updateTakeoffLanding(); // echo "TakeoffID:".$flight->takeoffID."<BR>"; if (in_array($flight->takeoffID, $CONF['takeoffs']['private'])) { $flight->private = 1; } $flight->putFlightToDB(1); // update return array(1, $flight->flightID); // ALL OK; }
//************************************************************************ require_once dirname(__FILE__) . "/EXT_config_pre.php"; require_once dirname(__FILE__) . "/config.php"; $CONF_use_utf = 1; require_once dirname(__FILE__) . "/EXT_config.php"; require_once dirname(__FILE__) . "/CL_flightData.php"; require_once dirname(__FILE__) . "/FN_functions.php"; require_once dirname(__FILE__) . "/FN_waypoint.php"; require_once dirname(__FILE__) . "/FN_output.php"; require_once dirname(__FILE__) . "/FN_pilot.php"; // setDEBUGfromGET(); $flightID = makeSane($_GET['id'], 1); if ($flightID <= 0) { exit; } $flight = new flight(); $flight->getFlightFromDB($flightID, 0); $flight->makeJSON(0); // no force // we dont use png files any more //$flight->updateCharts(0,1); // no force update, raw charts if ($flight->is3D() && is_file($flight->getChartfilename("alt", $PREFS->metricSystem, 1))) { $chart1 = $flight->getChartRelPath("alt", $PREFS->metricSystem, 1); $title1 = _Altitude . ' (' . ($PREFS->metricSystem == 1 ? _M : _FT) . ')'; } else { if (is_file($flight->getChartfilename("takeoff_distance", $PREFS->metricSystem, 1))) { $chart1 = $flight->getChartRelPath("takeoff_distance", $PREFS->metricSystem, 1); $title1 = _Distance_from_takeoff . ' (' . ($PREFS->metricSystem == 1 ? _KM_PER_HR : _MPH) . ')'; } } $hlines = $flight->getRawHeader();
echo "<H3> Error in query: {$query}</H3>\n"; exit; } echo "<pre>"; echo "<table>"; echo "<tr><td>#</td><td>FlightID</td><td>user</td><td>Name</td><td>localUser</td><td>Name</td></tr>\n"; $i = 1; while ($row = $db->sql_fetchrow($res)) { $pilotID1 = $row['serverID'] . '_' . $row['userID']; fillPilotInfo($pilotID1, $row['serverID'], $row['userID']); $pilotID2 = $row['localServerID'] . '_' . $row['localUserID']; fillPilotInfo($pilotID2, $row['localServerID'], $row['localUserID']); echo "<tr><td>{$i}</td>\n\t\t\t\t<td><a href='" . CONF_MODULE_ARG . "&op=show_flight&flightID=" . $row['ID'] . "'>" . $row['ID'] . "</a></td>\n\t\t\t\t<td>" . $pilotID1 . "</td>\n\t\t\t\n\t\t\t<td><a href='" . CONF_MODULE_ARG . "&op=list_flights&year=0&month=0&pilotID={$pilotID1}'>" . $pilotNames[$pilotID1]['lname'] . " " . $pilotNames[$pilotID1]['fname'] . " [ " . $pilotNames[$pilotID1]['country'] . " ] CIVLID: " . $pilotNames[$pilotID1]['CIVL_ID'] . "</td>\n\t\t\t<td>" . $pilotID2 . "</td>\t\t\n\t\t\t<td><a href='" . CONF_MODULE_ARG . "&op=list_flights&year=0&month=0&pilotID={$pilotID2}'>" . $pilotNames[$pilotID2]['lname'] . " " . $pilotNames[$pilotID2]['fname'] . " [ " . $pilotNames[$pilotID2]['country'] . " ] CIVLID: " . $pilotNames[$pilotID2]['CIVL_ID'] . "</td>\n</tr>\n\t\t\n"; // move the flight from one pilot to another: if ($confirmMove) { $flight2move = new flight(); $flight2move->getFlightFromDB($row['ID']); $flight2move->changeUser($row['localUserID'], $row['localServerID']); if ($i > 1000) { echo 'We are doing this in batches of 1000 , repeat unitil none left, exiting now !'; exit; } } $i++; } echo "</table><BR><BR>"; echo "</pre>"; closeMain(); return; } //-----------------------------------------------------------------------------------------------------------
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; $getFlightKML = $flight->getFlightKML() . "&c={$lineColor}&w={$lineWidth}&an={$extendedInfo}"; $desc = $flight->kmlGetDescription($extendedInfo, $getFlightKML, 1); $snippet = "<![CDATA[" . formatDistance($flight->FLIGHT_KM, 1) . ", " . _DURATION . ": " . sec2Time($flight->DURATION, 1) . "]]>"; $str .= "<Placemark>\n\t\t\t\t<name><![CDATA[{$location}]]></name>\n\t\t\t\t<styleUrl>#marker_cat_" . $row['cat'] . "</styleUrl>\n\t\t\t\t<Snippet maxLines='1'>{$snippet}</Snippet>\n\t\t\t\t" . $desc . "\n\t\t\t\t<Point>\n\t\t\t\t<coordinates>" . $row['firstLon'] . ',' . $row['firstLat'] . "</coordinates>\n\t\t\t\t</Point>\n\t\t\t\t</Placemark>\t\t\t\n\t\t\t"; $i++; } $trackNum = $i; $incWaypoints = 1; if ($cameraAlt > 100000) { $incWaypoints = 0;
$seat_bokked = ''; $sql3 = mysqli_query($con, "UPDATE flight_availability SET depart_date='{$date}',flight_depart='{$flight_depart}',flight_arrive='{$flight_arrive}',seat_booked='{$seat_bokked}' WHERE flight_id='{$flight_id}'"); return true; } public function delete_flight_details($con, $flight_id) { $sql = mysqli_query($con, "DELETE FROM flight_details WHERE flight_id='{$flight_id}'"); $sql1 = mysqli_query($con, "DELETE from flight_availability WHERE flight_id='{$flight_id}'"); if ($sql && $sql1) { return true; } else { return false; } } } $user_object = new flight(); if (isset($_POST['flight_status'])) { $flight_id = $_POST['id']; $status = $user_object->flight_status($con, $flight_id); //echo mysqli_num_rows($status); if (mysqli_num_rows($status) == 0) { echo "Flight not available."; } else { $row = mysqli_fetch_array($status); $flight_status = $row['status']; $id = $row['flight_id']; $_SESSION['flight_id'] = $id; $_SESSION['flight_status'] = $flight_status; echo $_SESSION['flight_status']; $sql1 = mysqli_query($con, "SELECT * FROM flight_details WHERE flight_id='{$id}'"); $row1 = mysqli_fetch_array($sql1);