Exemplo n.º 1
0
function draw_usermap($type)
{
    global $GMAP_API_KEY, $USERMAP_JSONFILE, $USERMAP_TYPE_FULLSCREEN, $USERMAP_TYPE_EMBED, $USERMAP_TYPE_NORMAL, $USERMAP_LOC, $THISHOMEBASE, $USERMAP_SCRIPTHEADERS, $TBBASE;
    if ($GMAP_API_KEY == "") {
        if ($type == $USERMAP_TYPE_EMBED) {
            echo "<p><b>Google Map API key not set</b></p>";
        } else {
            PAGEERROR("Google Map API key not set");
        }
    }
    if (!file_exists($USERMAP_JSONFILE)) {
        if ($type == $USERMAP_TYPE_EMBED) {
            echo "<p><b>JSON data source not created</b></p>";
        } else {
            PAGEERROR("JSON data source not created");
        }
    }
    #
    # If in fullscreen mode, we don't emit the standard header, just emit the
    # HTML ourselves
    #
    if ($type == $USERMAP_TYPE_FULLSCREEN) {
        $divstyle = "width: 100%; height: 100%; margin: 0px; padding: 0px;";
        ?>

    <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title><?php 
        echo $THISHOMEBASE;
        ?>
 User Map</title>
        <script src="<?php 
        echo $TBBASE;
        ?>
/onload.js" type="text/javascript">
        </script>
        <?php 
        echo $USERMAP_SCRIPTHEADERS;
        ?>
    </head>
    <body style="margin: 0px; padding: 0px;">
    <?php 
    } else {
        $divstyle = "width: 850px; height: 400px; margin-right: auto; margin-left: auto";
        if ($type != $USERMAP_TYPE_EMBED) {
            PAGEHEADER("User Map", NULL, $USERMAP_SCRIPTHEADERS);
            echo "<p>This map shows the cities with registered users of this ";
            echo "testbed. Numbers on the markers give the numbers of users ";
            echo "in a region. You can zoom in to see more detail, and ";
            echo "clicking on a maker will bring up a list of the cities it ";
            echo "represents.</p>";
        }
    }
    #
    # The meat - where the map will get displayed
    #
    echo "<div id=\"map_canvas\" style=\"{$divstyle}\"></div>\n";
    if (isset($fullscreen)) {
        echo "</body></html>";
    } else {
        echo "<a href=\"{$USERMAP_LOC}/?fullscreen=true\">larger version</a>";
        if ($type != $USERMAP_TYPE_EMBED) {
            PAGEFOOTER();
        }
    }
}
Exemplo n.º 2
0
if (!isset($redirected) || $redirected == 0) {
    $uri = $_SERVER['REQUEST_URI'] . "&redirected=1";
    header("Location: https://{$WWWHOST}" . $uri);
    return;
}
#
# Check the login table for the user, and see if the key is really
# the md5 of the login hash. If so, do a login.
#
$target_uid = $user->uid();
$safe_key = addslashes($key);
$query_result = DBQueryFatal("select * from login " . "where uid='{$target_uid}' and hashhash='{$safe_key}' and " . "      timeout > UNIX_TIMESTAMP(now())");
if (!mysql_num_rows($query_result)) {
    # Short delay.
    sleep(1);
    PAGEERROR("Invalid peer login request");
}
# Delete the entry so it cannot be reused, even on failure.
DBQueryFatal("delete from login " . "where uid='{$target_uid}' and hashhash='{$safe_key}'");
#
# Now do the login, which can still fail.
#
$dologin_status = DOLOGIN($user->uid(), "", 0, 1);
if ($dologin_status == DOLOGIN_STATUS_WEBFREEZE) {
    # Short delay.
    sleep(1);
    PAGEHEADER("Login");
    echo "<h3>\n              Your account has been frozen due to earlier login attempt\n              failures. You must contact {$TBMAILADDR} to have your account\n              restored. <br> <br>\n              Please do not attempt to login again; it will not work!\n              </h3>\n";
    PAGEFOOTER();
    die("");
} else {