示例#1
0
function SPITFORM($target_user, $new_uid, $error)
{
    global $TBDB_UIDLEN;
    $target_uid = $target_user->uid();
    $target_webid = $target_user->webid();
    $new_uid = CleanString($new_uid);
    #
    # Standard Testbed Header.
    #
    PAGEHEADER("Change login UID for user");
    if ($error) {
        # XSS prevention.
        $error = CleanString($error);
        echo "<center>\n              <font size=+1 color=red>{$error}</font>\n              </center><br>\n";
    } else {
        echo "<center>\n              <font size=+1>\n              Please enter the new UID for user '{$target_uid}'<br><br>\n              </font>\n              </center>\n";
    }
    echo "<table align=center border=1>\n          <form action=changeuid.php method=post>\n          <tr>\n              <td>New UID:</td>\n              <td><input type=text\n                         name=\"new_uid\"\n                         value=\"{$new_uid}\"\n\t                 size={$TBDB_UIDLEN}\n\t                 maxlength={$TBDB_UIDLEN}></td>\n          </tr>\n          <tr>\n             <td align=center colspan=2>\n                 <b><input type=submit value=\"Change UID\"\n                           name=submit></b>\n             </td>\n          </tr>\n\t  <input type=hidden name=user value={$target_webid}>\n          </form>\n          </table>\n";
    echo "<br><br>\n";
    echo "<center>\n";
    $target_user->Show();
    echo "</center>\n";
    PAGEFOOTER();
    return;
}
示例#2
0
function EXPERROR()
{
    global $formfields, $errors;
    SPITFORM($formfields, $errors);
    PAGEFOOTER();
    die("");
}
    # do with the error. Also reports to tbops.
    #
    if ($retval < 0) {
        SUEXECERROR(SUEXEC_ACTION_CONTINUE);
    }
    # User error. Tell user and exit.
    SUEXECERROR(SUEXEC_ACTION_USERERROR);
    return;
}
#
# Parse the last line of output. Ick.
#
if (preg_match("/^Template\\s+(\\w+)\\/(\\w+)\\s+is being/", $suexec_output_array[count($suexec_output_array) - 1], $matches)) {
    $guid = $matches[1];
    $vers = $matches[2];
    $template = Template::Lookup($guid, $vers);
    if (!$template) {
        TBERROR("Could not lookup template object for {$guid}/{$vers}", 1);
        return;
    }
    echo $template->PageHeader();
    echo "<br><br>\n";
    STARTLOG($template);
} else {
    SUEXECERROR(SUEXEC_ACTION_DIE);
}
#
# Standard Testbed Footer
#
PAGEFOOTER();
示例#4
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();
        }
    }
}