Ejemplo n.º 1
0
 static function airspaceVisible($userID, $flightUserID, $flightUserserverID)
 {
     global $CONF, $CONF_airspaceChecks, $CONF_server_id;
     if ($CONF_airspaceChecks && (L_auth::isAdmin($userID) || $CONF['airspace']['view'] == 'public' || $CONF['airspace']['view'] == 'registered' && $userID > 0 || $CONF['airspace']['view'] == 'own' && $userID == $flightUserID && ($flightUserserverID == 0 || $flightUserserverID == $CONF_server_id))) {
         return 1;
     } else {
         return 0;
     }
 }
Ejemplo n.º 2
0
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;
}
	}
	$category=$_POST['category']+0;
	$gliderCertCategory=$_POST['gliderCertCategory']+0;

	if ($CONF['NAC']['clubPerFlight'] ) {
		$NACclubID=$_POST['NACclubID']+0;
		$NACid=$_POST['NACid']+0;
	} else {
		$NACclubID=-1;
		$NACid=-1;
	}
		
	if (strtolower(substr($filename,-4))!=".zip") addFlightError(_FILE_DOESNT_END_IN_ZIP);


	if ($_POST['insert_as_user_id'] >0 && L_auth::isAdmin($userID) ) $flights_user_id=$_POST['insert_as_user_id']+0;
	else $flights_user_id=$userID;

	$randName=sprintf("%05d",rand(1, 10000) );
	
	$tmpZIPfolder=LEONARDO_ABS_PATH.'/'.$CONF['paths']['tmpigc'].'/zipTmp_'.$flights_user_id.'_'.$randName ;
	// $tmpZIPfolder=$flightsAbsPath."/".$flights_user_id."/flights/zipTmp".$randName ;
	$tmpZIPPath=LEONARDO_ABS_PATH.'/'.$CONF['paths']['tmpigc'].'/zipFile'.$flights_user_id.'_'.$randName.'.zip';
	//$tmpZIPPath=$flightsAbsPath."/".$flights_user_id."/flights/zipFile".$randName.".zip";
	
	move_uploaded_file($_FILES['zip_datafile']['tmp_name'], $tmpZIPPath );

	//delDir($tmpZIPfolder);
	//exec("unzip -o -j ".$tmpZIPPath." -d '".$tmpZIPfolder."'" );

	makeDir($tmpZIPfolder);
    $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;
    $trackPossibleColors = array("FF0000", "00FF00", "0000FF", "FFFF00", "FF00FF", "00FFFF", "EF8435", "34A7F0", "33F1A3", "9EF133", "808080");
    $isAdmin = L_auth::isAdmin($userID);
}
$colotStr = '';
foreach ($trackPossibleColors as $color) {
    if ($colotStr) {
        $colotStr .= ',';
    }
    $colotStr .= " '#{$color}'";
}
$flightListStr = '';
foreach ($flightsList as $f) {
    if ($flightListStr) {
        $flightListStr .= ',';
    }
    $flightListStr .= "{$f}";
}

</div></td>
    </tr>
    <tr>
      <td valign="top" bgcolor="#E9EDF5"><div align="right"><?php 
echo _Last_Name;
?>
</div></td>
      <td valign="top"> 
			<?php 
$lastNameReadOnly = '';
if (strlen(str_replace(".", "", trim($pilot['LastName']))) >= 2 && !L_auth::isAdmin($userID) && !L_auth::isModerator($userID)) {
    $lastNameReadOnly = 'readonly="readonly"';
}
if (in_array('LastName', $readonly_fields) && !L_auth::isAdmin($userID) && !L_auth::isModerator($userID)) {
    $lastNameReadOnly = 'readonly="readonly"';
}
?>
			<input name="LastName" type="text" value="<?php 
echo $pilot['LastName'];
?>
" size="25" maxlength="120" <?php 
echo $lastNameReadOnly;
?>
 >
		</td>
      <td>&nbsp;</td>
    </tr>
    
    <tr>
Ejemplo n.º 6
0
<?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_group_admin.php,v 1.10 2010/03/14 20:56:11 manolis Exp $
//
//************************************************************************
if (!L_auth::isAdmin($userID)) {
    echo "go away";
    return;
}
require_once dirname(__FILE__) . '/CL_area.php';
$areaID = makeSane($_GET['areaID'], 1);
$pilotsList = array();
$pilotsID = array();
list($pilotsList, $pilotsID) = getPilotList();
list($takeoffs, $takeoffsID) = getTakeoffList();
list($countriesCodes, $countriesNames) = getCountriesList();
if ($_REQUEST["addTakeoffForm"]) {
    // form submitted
    $takeoffToAdd = $_POST['takeoff_select'] + 0;
    $query = "INSERT INTO {$areasTakeoffsTable}\t(areaID,takeoffID) VALUES ({$areaID},{$takeoffToAdd})";
    // echo $query;
    $res = $db->sql_query($query);
Ejemplo n.º 7
0
                $imgTarget = $imgBigRel;
            } else {
                if (file_exists($imgIcon)) {
                    list($width, $height, $type, $attr) = getimagesize($imgIcon);
                    list($width, $height) = CLimage::getJPG_NewSize($CONF['photos']['mid']['max_width'], $CONF['photos']['mid']['max_height'], $width, $height);
                    $imgTarget = $imgIconRel;
                }
            }
            echo " \tdrawPhoto(" . $photoInfo['lat'] . "," . $photoInfo['lon'] . ",{$photoNum},'{$imgIconRel}','{$imgTarget}',{$width},{$height}); \n";
        }
    }
}
?>
	
	<?php 
if ($CONF_airspaceChecks && (L_auth::isAdmin($userID) || $flight->belongsToUser($userID))) {
    ?>
	 // $("#airspaceShow").attr('checked', true);
	  // $("#airspaceShow").trigger('click');
	 // $("#airspaceShow").click();
		min_lat=<?php 
    echo $min_lat;
    ?>
;
		max_lat=<?php 
    echo $max_lat;
    ?>
;
		min_lon=<?php 
    echo $min_lon;
    ?>
<div class="gmap_controls" id="gmap_controls" >
	<div style="position:relative;">
		
		<div style="position:relative;  float:left; overflow:visible; height:20px; vertical-align:top; clear:none; margin-top:2px;">
        <form name="formFilter" id="formFilter">
		<fieldset id='layersBox' class="legendBox legendBoxHidden"><legend><?php 
echo _Layers;
?>
</legend>
		<span class='inner_legendBox'>
		<label><input type="checkbox" value="1" id='takeoffsShow' onClick="toggleTakeoffs()"><?php 
echo _MENU_TAKEOFFS;
?>
</label><hr>
		
		<? if ($CONF_airspaceChecks && L_auth::isAdmin($userID) ) { ?>
        	<label><input type="checkbox" value="1" id='airspaceShow' onClick="toggleAirspace('airspaceShow',true)"><?php 
echo _Show_Airspace;
?>
</label><hr>
		<?  } ?>		
		<? if ( $CONF['thermals']['enable'] ) { ?>	
         <div id='thermalLoad'><a href='javascript:loadThermals("<?php 
echo _Loading_thermals;
?>
<BR>")'><?php 
echo _Load_Thermals;
?>
</a></div>
         <div id='thermalLoading' style="display:none"></div>
         <div id='thermalControls' style="display:none"><?php 
Ejemplo n.º 9
0
    }
    $ord = "ASC";
} else {
    if ($sortOrder == "dateAdded") {
        $where_clause = " AND DATE_SUB(NOW(),INTERVAL 5 DAY) <  dateAdded  ";
    } else {
        if ($sortOrder == "DATE") {
            $sortOrderFinal = "DATE DESC, FLIGHT_POINTS ";
        } else {
            if ($sortOrder == "SCORE_SPEED") {
                $sortOrderFinal = "{$scoreSpeedSql} DESC, FLIGHT_POINTS ";
            }
        }
    }
}
if (!($pilotID > 0 && $pilotID == $userID) && !L_auth::isAdmin($userID)) {
    // only display to friends
    /*	$where_clause .= " AND (private=0 OR
    				(
    					private=4 AND userServerID=0 AND $userID IN
    						( SELECT friendUserID FROM leonardo_friends WHERE userID=" . $flightsTable . ".userID )
    				)
    			)";
    	*/
    // display 'friends only'  flights ot everybody but show limited info
    $where_clause .= " AND (private=0 OR private=4 ) ";
}
//----------------------------------------------------------
// Now the filter
//----------------------------------------------------------
$filter_clause = $_SESSION["filter_clause"];
Ejemplo n.º 10
0
?>
"><?php 
echo leoHtml::img("rss.gif", 0, 0, 'absmiddle', 'RSS', 'icons1');
?>
 RSS Feed</a></li>
<?	
	insertMenuItems('home','bottom'); 
	
	if (count($clubsList) >0) {
		echo "<li class='li_h1 long_li_h1'>.:: "._Clubs_Leagues." ::.</li>\n";
		foreach( $clubsList as $clubsItem) {
			if ( $clubsItem['id'] == $clubID ) $a_class="class='boldFont'";
			else $a_class="";
			echo "<li $a_class><a $a_class href='".getLeonardoLink(array('op'=>'list_flights','clubID'=>$clubsItem['id'],'nacclubid'=>'0','nacid'=>'0'))."'>".$clubsItem['desc']."</a></li>\n";
			if (  $clubsItem['id'] == $clubID && 
					(  ( $clubID  && (L_auth::isClubAdmin($userID,$clubID) )  || L_auth::isAdmin($userID))  	)	 
			    )  {  ?>
				<li style='background-color:#FF9933'><a href="<?php 
echo getLeonardoLink(array('op' => 'club_admin', 'club_to_admin_id' => $clubID));
?>
"><img 
				src="<?php 
echo $moduleRelPath;
?>
/img/icon_arrow_up.png" border=0 align="absmiddle" /> Administer this Club</a></li>		
			<? } 
		}
	}

	if (count($apList) >0) {
		echo "<li class='li_h1 long_li_h1'>.:: XC Leagues ::.</li>\n";
Ejemplo n.º 11
0
//
// $Id: EXT_flight.php,v 1.29 2012/10/17 09:45:24 manolis Exp $
//
//************************************************************************
require_once dirname(__FILE__) . "/EXT_config_pre.php";
require_once "config.php";
require_once "EXT_config.php";
require_once "CL_flightData.php";
require_once "FN_functions.php";
require_once "FN_UTM.php";
require_once "FN_waypoint.php";
require_once "FN_output.php";
require_once "FN_pilot.php";
require_once "FN_flight.php";
setDEBUGfromGET();
if ($_GET['deleted'] && L_auth::isAdmin($userID)) {
    $flightsTable = $deletedFlightsTable;
    $deletedFlights = 1;
}
$op = makeSane($_REQUEST['op']);
if (!$op) {
    $op = "list_flights";
}
if (!in_array($op, array("flight_info", "find_flights", "list_flights", "submit_flight", "list_flights_json", "get_info", "polylineURL", "get_task_json"))) {
    return;
}
$encoding = "iso-8859-1";
if ($op == "find_flights") {
    $lat = makeSane($_GET['lat'], 1);
    $lon = -makeSane($_GET['lon'], 1);
    $firstPoint = new gpsPoint();
Ejemplo n.º 12
0
				echo $pilot['json'];
			} else {
		    	echo $pilot['text'];
			}	
		    $i++;
		    if ($i>$count) break;
		}

		if ($_GET['json']) {
			echo "]} ";
		}
		return;

	}
	
	if ( !L_auth::isAdmin($userID) ) { echo "go away"; return; }

	if ($op=='mapPilot'){	
			$pilotID1=makeSane($_GET['pilotID1'],0);
			$pilotID2=makeSane($_GET['pilotID2'],0);

		  list($serverID1,$userID1)=explode('_',$pilotID1);
		  list($serverID2,$userID2)=explode('_',$pilotID2);
		  $query="INSERT INTO $remotePilotsTable (remoteServerID,remoteUserID,serverID,userID) VALUES 
		  			($serverID1,$userID1,$serverID2,$userID2 )";
		  $res= $db->sql_query($query);
		  if($res <= 0){   
			 echo("<H3> Error in mapping pilots: $query</H3>\n");
		  } else echo "Pilot Mapping successfull";
	} else if ($op=='copyRemoteToLocalInfo'){		  
		    $pilotID1=makeSane($_GET['pilotID1'],0);
Ejemplo n.º 13
0
function makeTakeoffPopup($ext = 0, $userID = 0)
{
    global $moduleRelPath;
    ob_start();
    ?>
<script language="javascript">
var takeoffTip = new TipObj('takeoffTip');
with (takeoffTip)
{
 template = '<table bgcolor="#000000" cellpadding="0" cellspacing="0" width="%3%" border="0">' +
  '<tr><td class="infoBoxHeader">%5%</td></tr>'+
  '<tr><td class="infoBox">'+
  
  
  	"<img src='<?php 
    echo $moduleRelPath;
    ?>
/img/icon_magnify_small.gif' align='absmiddle' border=0> <a href='<?php 
    echo getLeonardoLink(array('op' => 'list_flights', 'takeoffID' => '%4%'));
    ?>
'><?php 
    echo _See_flights_near_this_point . ' (' . _MENU_FILTER . ')';
    ?>
</a>"+
	'</td></tr>'+
    '<tr><td  class="infoBox">'+
	
	"<img src='<?php 
    echo $moduleRelPath;
    ?>
/img/icon_magnify_small.gif' align='absmiddle' border=0> <a href='<?php 
    echo getLeonardoLink(array('op' => 'list_flights', 'takeoffID' => '%4%', 'year' => '0', 'month' => '0', 'pilotID' => '0', 'country' => '0', 'cat' => '0'));
    ?>
'><?php 
    echo _See_flights_near_this_point . ' (' . _ALL . ')';
    ?>
</a>"+
	'</td></tr>'+
    '<tr><td  class="infoBox">'+
	
	"<img src='<?php 
    echo $moduleRelPath;
    ?>
/img/icon_pin.png' align='absmiddle' border=0> <a href='<?php 
    echo getLeonardoLink(array('op' => 'show_waypoint', 'waypointIDview' => '%4%'));
    ?>
'><?php 
    echo _SITE_INFO;
    ?>
</a>"+
	'</td></tr>'+
    '<tr><td  class="infoBox">'+
	"<img src='<?php 
    echo $moduleRelPath;
    ?>
/img/gearth_icon.png' align='absmiddle' border=0> <a href='<?php 
    echo getDownloadLink(array('type' => 'kml_wpt', 'wptID' => '%4%'));
    ?>
'><?php 
    echo _Navigate_with_Google_Earth;
    ?>
</a>"+
	<?php 
    if ($ext && L_auth::isAdmin($userID)) {
        ?>
    '</td></tr><tr><td class="infoBox adminBox">'+
	 "<img src='<?php 
        echo $moduleRelPath;
        ?>
/img/icon_add.png' align='absmiddle' border=0> <a href='javascript:add_takeoff(%6%,%7%,%4%)'><?php 
        echo _ADD_WAYPOINT;
        ?>
</a>"+

     '</td></tr><tr><td class="infoBox adminBox">'+
	 "<img src='<?php 
        echo $moduleRelPath;
        ?>
/img/change_icon.png' align='absmiddle' border=0> <a href='javascript:edit_takeoff(%4%)'><?php 
        echo _EDIT_WAYPOINT;
        ?>
</a>"+

     '</td></tr><tr><td class="infoBox adminBox">'+
	 "<img src='<?php 
        echo $moduleRelPath;
        ?>
/img/x_icon.gif' align='absmiddle' border=0> <a href='javascript:delete_takeoff(%4%)'><?php 
        echo _DELETE_WAYPOINT;
        ?>
</a>"+

	<?php 
    }
    ?>
	'</td></tr></table>';

 tipStick = 0;
 showDelay = 0;
 hideDelay = 0;
 doFades = false;
}
</script>
<div id="takeoffTipLayer" class="shadowBox" style="position: absolute; z-index: 10000; visibility: hidden; left: 0px; top: 0px; width: 10px">&nbsp;</div>
<?php 
    $c = ob_get_contents();
    ob_end_clean();
    return $c;
}
Ejemplo n.º 14
0
printHeaderTakeoffs(0, $sortOrder, "ServerItemID", "Server", $query_str);
printHeaderTakeoffs(80, $sortOrder, "userID", "userID", $query_str);
printHeaderTakeoffs(100, $sortOrder, "ItemType", "Type", $query_str);
printHeaderTakeoffs(100, $sortOrder, "ItemID", "ID", $query_str);
printHeaderTakeoffs(100, $sortOrder, "ActionID", "Action", $query_str);
echo '<td width="100" class="SortHeader">Details</td>';
printHeaderTakeoffs(100, $sortOrder, "Result", "Result", $query_str);
echo '<td width="100" class="SortHeader">ACTIONS</td>';
?>
	
	</tr>
<?php 
$currCountry = "";
$i = 1;
while ($row = $db->sql_fetchrow($res)) {
    if (L_auth::isAdmin($row['userID'])) {
        $admStr = "*ADMIN*";
    } else {
        $admStr = "";
    }
    if ($row['ServerItemID'] == 0) {
        $serverStr = "Local";
    } else {
        $serverStr = $row['ServerItemID'];
    }
    $i++;
    echo "<TR class='{$sortRowClass}'>";
    echo "<TD>" . ($i - 1 + $startNum) . " (" . $row['transactionID'] . ")</TD>";
    echo "<td>" . date("d/m/y H:i:s", $row['actionTime']) . "</td>\n";
    echo "<td>" . $serverStr . "</td>\n";
    echo "<td>" . $row['userID'] . "{$admStr}<br>(" . $row['effectiveUserID'] . ")</td>\n";
Ejemplo n.º 15
0
				</td>
			</tr>
			<? 
		} // end for 
		?>
	
	 <tr>
      <td><div align="right" class="style2"></div></td>
      <td>  <div align="center" class="style222">
        <div align="left"><?php 
echo _PHOTOS_GUIDELINES . $CONF_max_photo_size . ' Kb';
?>
</div>
      </div></td>
    </tr>
<? if ( L_auth::isAdmin($userID) ) {?>
    <tr>
      <td colspan=2 valign="top">        
	    <fieldset class="legendBox legend3">
		    <legend>ADMIN OPTION: Assign this flight to another pilot</legend>			
			 <input name="newUserID" type="text" size="10" value="">	
	    </fieldset>
		</td>
    </tr>
<? } ?>
    <tr>
      <td colspan=2 valign="top">&nbsp;       
	  </td></tR>
    <tr>
      <td>&nbsp;</td>
      <td><p><font face="Verdana, Arial, Helvetica, sans-serif">
Ejemplo n.º 16
0
<?php 
$takeoffs = array();
while ($row = $db->sql_fetchrow($res)) {
    $takeoffID = $row['ItemID'];
    $takeoffs[$takeoffID][$row['actionTime']]['ActionID'] = $row['ActionID'];
    $takeoffs[$takeoffID][$row['actionTime']]['userID'] = $row['userID'];
    $takeoffs[$takeoffID][$row['actionTime']]['intName'] = $row['intName'];
    $takeoffs[$takeoffID][$row['actionTime']]['intLocation'] = $row['intLocation'];
    $takeoffs[$takeoffID][$row['actionTime']]['countryCode'] = $row['countryCode'];
    $takeoffs[$takeoffID][$row['actionTime']]['ActionXML'] = $row['ActionXML'];
}
$i = 1;
foreach ($takeoffs as $takeoffID => $takeoff) {
    echo "<tr><td colspan=7><strong>{$takeoffID}</strong></td><tr>";
    foreach ($takeoff as $actionTime => $details) {
        if (L_auth::isAdmin($details['userID'])) {
            $admStr = "*ADMIN*";
        } else {
            $admStr = "";
        }
        $i++;
        echo "<TR class='{$sortRowClass}'>";
        echo "<TD>" . ($i - 1 + $startNum) . "</TD>";
        echo "<td>" . date("d/m/y H:i:s", $actionTime) . "</td>\n";
        echo "<td>" . $details['userID'] . "{$admStr}</td>\n";
        echo "<td>" . Logger::getActionDescription($details['ActionID']) . "</td>\n";
        echo "<td>" . $details['intName'] . " (" . $details['intLocation'] . ") [" . $details['countryCode'] . "]</td>\n";
        echo "<td>";
        echo "<div id='sh_details{$i}'><STRONG><a href='javascript:toggleVisibility(\"details{$i}\");'>Details</a></STRONG></div>";
        echo "<div id='details{$i}' style='display:none'><pre>" . $details['ActionXML'] . "</pre></div>";
        echo "</td>\n";
Ejemplo n.º 17
0
<?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 . " &nbsp;&nbsp; " . _THE_DATE . ": " . formatDate($flight->DATE) . "  &nbsp;&nbsp; " . _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();
}
Ejemplo n.º 18
0
 echo '<font color="#FF2222">***</font>';
 foreach ($CONF_NAC_list as $NACid => $NAC) {
     if ($NAC['description']) {
         echo "<div style='background:#d0d0d0; padding:10px; ' >" . $NAC['description'] . "</div> ";
     }
 }
 echo "<div id='mID' style='display:" . ($pilot['NACid'] == 0 ? "none" : "inline") . "'> ";
 $memberid_readonly = in_array('NACmemberID', $readonly_fields) ? 'readonly' : '';
 echo "<span style='white-space:nowrap'>" . _MemberID . ": <input size='5' type='text' name='NACmemberID' value='" . $pilot['NACmemberID'] . "' {$memberid_readonly}  /></span> ";
 echo '<font color="#FF2222">***</font>';
 echo "<div id='mIDselect' style='display:" . ($memberid_readonly ? "block" : "none") . "'> ";
 echo "[&nbsp;<a href='#' onclick=\"setID();return false;\">" . _EnterID . "</a>&nbsp;]";
 echo "</div>";
 echo "<div align=left id='mClubSelect' style='display:" . ($CONF_NAC_list[$pilot['NACid']]['use_clubs'] ? "block" : "none") . "' >" . _Club . " ";
 $NACclub = NACclub::getClubName($pilot['NACid'], $pilot['NACclubID']);
 if ($CONF_NAC_list[$pilot['NACid']]['club_change_period_active'] || $CONF_NAC_list[$pilot['NACid']]['add_to_club_period_active'] && !$pilot['NACclubID'] || L_auth::isAdmin($userID) || L_auth::isModerator($userID)) {
     $showChangeClubLink = "inline";
 } else {
     $showChangeClubLink = "none";
 }
 echo "<div id=\"mClubLink\" style=\"display: {$showChangeClubLink}\">[ <a href='#' onclick=\"setClub();return false;\">" . _Select_Club . "</a> ]</div>";
 /*
 
                 echo "[ <a href='#' onclick=\"setClub();return false;\">"._Select_CLub."</a> ]";
             } else {
                 echo "";
             }
 */
 echo "<br><input  type='hidden' name='NACclubID' value='" . $pilot['NACclubID'] . "' /> ";
 echo "<input  type='text' size='50' name='NACclub' value='" . $NACclub . "' readonly /></div> ";
 echo "</div>";
Ejemplo n.º 19
0
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);
}
Ejemplo n.º 20
0
,1)'>Update Local DB</a> 
<?php 
if ($serverIDview != 0) {
    ?>
:: <a href='javascript: getPilotInfo(<?php 
    echo $serverIDview . ',' . $pilotIDview;
    ?>
,2)'>Update Local DB (delete all current data)</a>
<?php 
}
?>
<div id="pilotInfoDiv" style="display:none;background-color:#EEECBF;width:100%;height:auto;">Results HERE</div>
</div>

<?php 
if (L_auth::isAdmin($userID) && $serverIDview != -1 && INLINE_VIEW != 1) {
    ?>
<script language="javascript">

function hidePilotDiv() {
	$("#pilotInfoDivExt").hide();
}

function getPilotInfo(serverID,pilotID,update) {
    $("#pilotInfoDiv").html("<img src='<?php 
    echo $moduleRelPath;
    ?>
/img/ajax-loader.gif'>").show();	
	$.get('<?php 
    echo $moduleRelPath;
    ?>
Ejemplo n.º 21
0
<?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_club_admin.php,v 1.11 2010/03/14 20:56:11 manolis Exp $
//
//************************************************************************
if (!L_auth::isClubAdmin($userID, $clubID) && !L_auth::isAdmin($userID)) {
    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);
Ejemplo n.º 22
0
"><?php 
echo leoHtml::img("rss.gif", 0, 0, 'absmiddle', 'RSS', 'icons1');
?>
 RSS Feed</a></li>
<?php 
insertMenuItems('home', 'bottom');
if (count($clubsList) > 0) {
    echo "<li class='li_h1 long_li_h1'>.:: " . _Clubs_Leagues . " ::.</li>\n";
    foreach ($clubsList as $clubsItem) {
        if ($clubsItem['id'] == $clubID) {
            $a_class = "class='boldFont'";
        } else {
            $a_class = "";
        }
        echo "<li {$a_class}><a {$a_class} href='" . getLeonardoLink(array('op' => 'list_flights', 'clubID' => $clubsItem['id'], 'nacclubid' => '0', 'nacid' => '0')) . "'>" . $clubsItem['desc'] . "</a></li>\n";
        if ($clubsItem['id'] == $clubID && ($clubID && L_auth::isClubAdmin($userID, $clubID) || L_auth::isAdmin($userID))) {
            ?>
				<li style='background-color:#FF9933'><a href="<?php 
            echo getLeonardoLink(array('op' => 'club_admin', 'club_to_admin_id' => $clubID));
            ?>
"><img 
				src="<?php 
            echo $moduleRelPath;
            ?>
/img/icon_arrow_up.png" border=0 align="absmiddle" /> Administer this Club</a></li>		
			<?php 
        }
    }
}
if (count($apList) > 0) {
    echo "<li class='li_h1 long_li_h1'>.:: XC Leagues ::.</li>\n";
Ejemplo n.º 23
0
    echo getLeonardoLink(array('op' => 'add_from_zip'));
    ?>
"><?php 
    echo _PRESS_HERE;
    ?>
 </a></em></div></td>
    </tr>
  </table>
  </form>
<?php 
} else {
    // form submited - add the flight
    set_time_limit(120);
    ignore_user_abort(true);
    // print_r($_POST); exit;
    if ($_POST['insert_as_user_id'] > 0 && L_auth::isAdmin($userID)) {
        $flights_user_id = $_POST['insert_as_user_id'] + 0;
    } else {
        $flights_user_id = $userID;
    }
    $is_private = 0;
    if ($_POST['is_private'] == 1) {
        $is_private = 1;
    }
    if ($_POST['is_friends_only'] == 1) {
        $is_private = 4;
    }
    $gliderCat = $_POST['gliderCat'] + 0;
    $tmpFilename = $_FILES['datafile']['tmp_name'];
    $tmpFormFilename = $_FILES['datafile']['name'];
    $suffix = strtolower(substr($tmpFormFilename, -4));
Ejemplo n.º 24
0
    $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 
$BirthdateHideMask = $pilot['BirthdateHideMask'];
$Birthdate = $pilot['Birthdate'];
if ($Birthdate) {
    $hiddenFields = 0;