$text\n";
#
# XXX these blanks look bad in lynx, but add required
# spacing between menu and body
#
echo " \n";
echo "
\n";
}
#
# WRITESIDEBAR(): Write the menu. The actual menu options the user
# sees depends on the login status and the DB status.
#
function WRITESIDEBAR() {
global $login_status, $login_uid;
global $TBBASE, $TBDOCBASE, $BASEPATH;
global $THISHOMEBASE;
#
# The document base cannot be a mix of secure and nonsecure.
#
echo "
Web Interface Options\n";
if ($login_status & CHECKLOGIN_LOGGEDIN) {
$freepcs = TBFreePCs();
echo " ($freepcs Free PCs)\n";
}
echo "
\n";
#
# Basically, we want to let admin people continue to use
# the web interface even when nologins set. But, we want to make
# it clear its disabled.
#
if (NOLOGINS()) {
WRITESIDEBARBUTTON(" ".
"Web Interface Temporarily Unavailable",
$TBDOCBASE, "nologins.php3");
if (!$login_uid || !ISADMIN($login_uid)) {
echo "
Please Try Again Later
\n";
}
}
if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
if ($login_status & CHECKLOGIN_ACTIVE) {
if ($login_status & CHECKLOGIN_PSWDEXPIRED) {
WRITESIDEBARBUTTON("Change Your Password",
$TBBASE, "moduserinfo.php3");
}
else {
WRITESIDEBARBUTTON("My $THISHOMEBASE",
$TBBASE,
"showuser.php3?target_uid=$login_uid");
if (ISADMIN($login_uid)) {
WRITESIDEBARBUTTON("New Project Approval",
$TBBASE, "approveproject_list.php3");
}
if ($login_status & CHECKLOGIN_TRUSTED) {
# Only project/group leaders can do these options
WRITESIDEBARBUTTON("New User Approval",
$TBBASE, "approveuser_form.php3");
}
#
# Since a user can be a member of more than one project,
# display this option, and let the form decide if the user is
# allowed to do this.
#
WRITESIDEBARBUTTON("Project List",
$TBBASE, "showproject_list.php3");
if (ISADMIN($login_uid)) {
WRITESIDEBARBUTTON("User List",
$TBBASE, "showuser_list.php3");
}
WRITESIDEBARBUTTON("Experiment List",
$TBBASE, "showexp_list.php3");
WRITESIDEBARBUTTON("Begin an Experiment",
$TBBASE, "beginexp.php3");
WRITESIDEBARBUTTON("OSIDs and ImageIDs",
$TBBASE, "showosid_list.php3");
WRITESIDEBARBUTTON("Update User Information",
$TBBASE, "moduserinfo.php3");
WRITESIDEBARBUTTON("Node Reservation Status",
$TBBASE, "nodecontrol_list.php3");
WRITESIDEBARBUTTON("Node Up/Down Status",
$TBDOCBASE, "updown.php3");
if ($login_status & CHECKLOGIN_CVSWEB) {
WRITESIDEBARBUTTON("CVS Repository",
$TBBASE, "cvsweb/cvsweb.php3");
}
}
}
elseif ($login_status & (CHECKLOGIN_UNVERIFIED|CHECKLOGIN_NEWUSER)) {
WRITESIDEBARBUTTON("New User Verification",
$TBBASE, "verifyusr_form.php3");
WRITESIDEBARBUTTON("Update User Information",
$TBBASE, "moduserinfo.php3");
}
elseif ($login_status & (CHECKLOGIN_UNAPPROVED)) {
WRITESIDEBARBUTTON("Update User Information",
$TBBASE, "moduserinfo.php3");
}
}
#
# Standard options for anyone.
#
if (! NOLOGINS()) {
WRITESIDEBARBUTTON("Start Project", $TBBASE, "newproject.php3");
WRITESIDEBARBUTTON("Join Project", $TBBASE, "joinproject.php3");
}
#
# Cons up a nice message.
#
switch ($login_status & CHECKLOGIN_STATUSMASK) {
case CHECKLOGIN_LOGGEDIN:
$login_message = "$login_uid Logged In";
if ($login_status & CHECKLOGIN_PSWDEXPIRED)
$login_message = "$login_message (Password Expired!)";
elseif ($login_status & CHECKLOGIN_UNAPPROVED)
$login_message = "$login_message (Unapproved!)";
break;
case CHECKLOGIN_TIMEDOUT:
$login_message = "Login Timed Out";
break;
default:
$login_message = 0;
break;
}
#
# Now the login/logout box. Remember, already inside a table.
# We want the links to the login/logout pages to always be https,
# but the images path depends on whether the page was loaded as
# http or https, since we do not want to mix them, since they
# cause warnings.
#
if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
echo "
\n";
}
elseif (!NOLOGINS()) {
echo "
\n";
}
if ($login_message) {
echo "
$login_message
\n";
}
#
# MOTD. Set this with the webcontrol script.
#
$query_result =
DBQueryFatal("SELECT message FROM loginmessage");
if (mysql_num_rows($query_result)) {
$row = mysql_fetch_row($query_result);
$message = $row[0];
echo "
$message
\n";
}
echo "
\n";
}
#
# WRITEBANNER(): write the page banner for a page.
# Called by _STARTPAGE
#
function WRITEBANNER($title) {
global $BANNERCOLOR, $THISPROJECT, $THISHOMEBASE, $BASEPATH;
global $login_uid;
echo "\n";
echo "
\n";
}
#
# _WRITETITLE(title): write the page title for a page.
# Called by _STARTPAGE
#
function WRITETITLE($title) {
global $TITLECOLOR, $BASEPATH;
echo "
\n";
#
# Insert a small logo here if you like.
#
echo "
$title
\n";
}
#
# Spit out a vanilla page header.
#
function PAGEHEADER($title) {
global $login_status, $login_uid, $TBBASE, $TBDOCBASE, $THISHOMEBASE;
global $BASEPATH, $SSL_PROTOCOL, $drewheader;
global $TBMAINSITE;
$drewheader = 1;
#
# Determine the proper basepath, which depends on whether the page
# was loaded as http or https. This lets us be consistent in the URLs
# we spit back, so that users do not get those pesky warnings. These
# warnings are generated when a page *loads* (say, images, style files),
# a mix of http and https. Links can be mixed, and in fact when there
# is no login active, we want to spit back http for the documentation,
# but https for the start/join pages.
#
if (isset($SSL_PROTOCOL)) {
$BASEPATH = $TBBASE;
}
else {
$BASEPATH = $TBDOCBASE;
}
#
# Figure out who is logged in, if anyone.
#
if (($known_uid = GETUID()) != FALSE) {
#
# Check to make sure the UID is logged in (not timed out).
#
$login_status = CHECKLOGIN($known_uid);
if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
$login_uid = $known_uid;
}
}
#
# Check for NOLOGINS.
# We want to allow admin types to continue using the web interface,
# and logout anyone else that is currently logged in!
#
if (NOLOGINS() && $login_uid && !ISADMIN($login_uid)) {
DOLOGOUT($login_uid);
$login_status = CHECKLOGIN_NOTLOGGEDIN;
$login_uid = 0;
}
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
if (1) {
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
}
else {
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 300) . " GMT");
}
echo "
$THISHOMEBASE - $title\n";
if ($TBMAINSITE) {
echo "
\n";
}
echo "
\n";
echo "\n";
WRITEBANNER($title);
WRITETITLE($title);
echo "
\n";
WRITESIDEBAR();
echo "
\n";
}
#
# ENDPAGE(): This terminates the table started above.
#
function ENDPAGE() {
echo "
\n";
}
#
# Spit out a vanilla page footer.
#
function PAGEFOOTER() {
global $TBDOCBASE, $TBMAILADDR, $THISHOMEBASE;
global $TBMAINSITE, $SSL_PROTOCOL;
ENDPAGE();
echo "
\n";
}
function PAGEERROR($msg) {
global $drewheader;
if (! $drewheader)
PAGEHEADER("");
echo "$msg\n";
PAGEFOOTER();
die("");
}
#
# Sub Page/Menu Stuff
#
function WRITESUBMENUBUTTON($text, $link) {
echo "
$text\n";
#
# XXX these blanks look bad in lynx, but add required
# spacing between menu and body
#
echo " \n";
echo "
\n";
}
#
# Start/End a page within a page.
#
function SUBPAGESTART() {
echo "
\n
\n
\n";
}
function SUBPAGEEND() {
echo "
\n
\n
\n";
}
#
# Start/End a sub menu, located in the upper left of the main frame.
# Note that these cannot be used outside of the SUBPAGE macros above.
#
function SUBMENUSTART($title) {
echo "