Exemple #1
0
} else {
    $HTTP_GET_VARS["address"] = clean_param($HTTP_GET_VARS["address"], PARAM_HOST);
    $address = $HTTP_GET_VARS["address"];
    $local = 0;
}
// this is the most important function, gets lat/lon and description of location
$values = getstuff($address, $local) or die("Error in plot.inc");
if (isset($logging) && is_writable("plotlog.txt")) {
    $log = @fopen("plotlog.txt", "a") or print "";
    @fputs($log, $HTTP_SERVER_VARS["REMOTE_ADDR"] . "\t" . date("F j, Y, g:i a") . "\t{$address}\t{$values['address']}\t{$values['lat']}\t{$values['lon']}\n") or print "";
    @fclose($log);
}
if (isset($HTTP_COOKIE_VARS["atlasprefs"]) && validcookie($HTTP_COOKIE_VARS["atlasprefs"])) {
    list(, , , $imagething) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
    $imagething = clean_param($imagething, PARAM_FILE);
    $earthimage = isvalidimage($imagething, $earthimages, $defaultimage);
} else {
    $earthimage = $earthimages[$defaultimage];
}
if (strstr($earthimage, ":")) {
    list($earthimage, , , ) = split(":", $earthimage);
}
// check if we need to run it in css mode
if (!shouldrun($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
    list($width, $height) = getimagecoords($earthimages, $earthimage);
    // make sure some coords were found
    if ($values["lat"] == "" || $values["lon"] == "") {
        $display = " ";
        $extracss = "";
    } else {
        list($x, $y) = getlocationcoords($values["lat"], $values["lon"], $width, $height);
include "plotconf.inc";
include "plot.inc";
$form_vars = ${"HTTP_" . $HTTP_SERVER_VARS["REQUEST_METHOD"] . "_VARS"};
$lat = $form_vars['lat'];
$lon = $form_vars['lon'];
if (isset($HTTP_COOKIE_VARS["atlasprefs"]) && validcookie($HTTP_COOKIE_VARS["atlasprefs"])) {
    list($setshape, $setcolor, $setsize, $earthimage, , ) = split(":", $HTTP_COOKIE_VARS["atlasprefs"]);
} else {
    $setshape = "Diamond";
    $setcolor = "red";
    $setsize = "3";
    $earthimage = $earthimages[$defaultimage];
    list($earthimage, , , ) = split(":", $earthimage);
}
$earthimage = isvalidimage($earthimage, $earthimages, $defaultimage);
if (strstr($earthimage, ":")) {
    list($earthimage, , , ) = split(":", $earthimage);
}
list($width, $height) = getimagecoords($earthimages, $earthimage);
if ($setsize > 8 || $setsize < 2) {
    $setsize = 2;
}
$im = @ImageCreate($width, $height) or die("Cannot Initialize new GD image stream");
$background_color = ImageColorAllocate($im, 255, 255, 255);
// color table
if ($setcolor == "red") {
    $r = "255";
    $g = "0";
    $b = "0";
} elseif ($setcolor == "white") {