Exemplo n.º 1
0
// Add filters, if any
switch ($export) {
    case "export":
    case "gcmap":
        // Full filter only for user flight searches
        if (!$route) {
            $sql = $sql . getFilterString($_GET);
        }
        break;
    case "backup":
        // do nothing;
        break;
    default:
        // Full filter only for user flight searches
        if (!$route) {
            $sql = $sql . getFilterString($_POST);
        }
        break;
}
if ($fid && $fid != "0") {
    $sql = $sql . " AND fid= " . mysql_real_escape_string($fid);
}
// And sort order
if ($route) {
    if ($type == "R") {
        $sql .= " ORDER BY d.iata ASC";
    } else {
        $sql .= " ORDER BY s.iata,d.iata ASC";
    }
} else {
    $sql .= " ORDER BY src_date DESC, src_time DESC";
Exemplo n.º 2
0
        }
    }
}
if ($user && $user != "0") {
    // Verify that we're allowed to view this user's flights
    $sql = "SELECT uid,public FROM users WHERE name='" . mysql_real_escape_string($user) . "'";
    $result = mysql_query($sql, $db);
    if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        if ($row["public"] == "N") {
            die('Error;' . _("This user's flights are not public."));
        } else {
            $uid = $row["uid"];
        }
    }
}
$filter = getFilterString($_POST);
// List top 10 routes
$sql = "SELECT DISTINCT s.iata AS siata,s.icao AS sicao,s.apid AS sapid,d.iata AS diata,d.icao AS dicao,d.apid AS dapid,{$mode} AS times FROM flights AS f, airports AS s, airports AS d WHERE f.src_apid=s.apid AND f.dst_apid=d.apid AND f.uid={$uid} {$filter} GROUP BY s.apid,d.apid ORDER BY times DESC LIMIT {$limit}";
$result = mysql_query($sql, $db);
$first = true;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    if ($first) {
        $first = false;
    } else {
        printf(":");
    }
    $src = format_apcode2($row["siata"], $row["sicao"]);
    $dst = format_apcode2($row["diata"], $row["dicao"]);
    printf("%s,%s,%s,%s,%s", $src, $row["sapid"], $dst, $row["dapid"], $row["times"]);
}
printf("\n");
Exemplo n.º 3
0
        foreach ($points as $loc) {
            if (!$loc) {
                continue;
            }
            // skip breaks
            print $loc["x"] . "," . $loc["y"] . "," . $loc["z"] . "\n";
        }
        print "      </coordinates>\n    </LineString>\n";
        print "  </MultiGeometry>\n</Placemark>\n";
    }
}
print "</Folder>\n";
print "<Folder><name>Airports</name>\n";
// Draw airports from largest to smallest
$airportColors = array("black", "gray", "purple", "cyan", "cyan", "green");
$sql = "SELECT DISTINCT x,y,elevation,iata,icao,name,city,country,count(name) AS visits FROM flights AS f, airports AS a WHERE (f.src_apid=a.apid OR f.dst_apid=a.apid) AND f.uid=" . $uid . getFilterString($_GET) . " GROUP BY name ORDER BY visits DESC";
$result = mysql_query($sql, $db);
$first = true;
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $count = $row["visits"];
    if ($first) {
        $maxFlights = $count;
        $first = false;
    }
    $colorIndex = floor($count / $maxFlights * sizeof($airportColors)) + 1;
    if ($count <= 2 || $colorIndex < 0) {
        $colorIndex = 0;
    }
    // More than two flights: at least 2nd smallest
    if ($count > 2) {
        $colorIndex = max(1, $colorIndex);