diff --git a/www/approveproject.php3 b/www/approveproject.php3 index 4d109b92cb74321be0377c533148e10843fc67fc..49ebff2bd9bedaeb2eba923803298856792755eb 100644 --- a/www/approveproject.php3 +++ b/www/approveproject.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("New Project Approved"); - # # Only known and logged in users can do this. # @@ -26,11 +21,17 @@ $optargs = OptionalPageArguments("head_uid", PAGEARG_STRING, "silent", PAGEARG_BOOLEAN, "pcplab_okay", PAGEARG_BOOLEAN, "ron_okay", PAGEARG_BOOLEAN); + $sendemail = 1; if (isset($silent) && $silent) { $sendemail = 0; } +# +# Standard Testbed Header +# +PAGEHEADER("New Project Approved"); + # # Of course verify that this uid has admin privs! # diff --git a/www/approveproject_form.php3 b/www/approveproject_form.php3 index e23ed672205d667d89cc505055f47b7ea60766cd..114ad94d28f56166d7c6df5cee92db5a441cbd5d 100755 --- a/www/approveproject_form.php3 +++ b/www/approveproject_form.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("New Project Approval"); - # # Only known and logged in users can do this. # @@ -46,6 +41,11 @@ if (! ($this_project = $reqargs["project"])) { $pid = $this_project->pid(); $projleader = $this_project->GetLeader(); +# +# Standard Testbed Header +# +PAGEHEADER("New Project Approval"); + echo "

You have the following choices:

diff --git a/www/approveproject_list.php3 b/www/approveproject_list.php3 index 86058fc9e567c6a5d96bd6453983fe391ca3db9d..55060b798630e20fc141c664f81edb0de9895663 100755 --- a/www/approveproject_list.php3 +++ b/www/approveproject_list.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("New Project Approval List"); - # # Only known and logged in users can do this. uid came in with the URI. # @@ -30,6 +25,11 @@ if (! $isadmin) { # $reqargs = RequiredPageArguments(); +# +# Standard Testbed Header +# +PAGEHEADER("New Project Approval List"); + # # Look in the projects table to see which projects have not been approved. # Present a menu of options to either approve or deny the projects. diff --git a/www/approveuser.php3 b/www/approveuser.php3 index 753a2ee336742e88addfe38ba0d3ad78da7767c9..1da2cbb186c34099cd04b32edccec6f296e2a2cb 100644 --- a/www/approveuser.php3 +++ b/www/approveuser.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("New Users Approved"); - # # Only known and logged in users. # @@ -22,6 +17,11 @@ $uid = $this_user->uid(); # $reqargs = RequiredPageArguments(); +# +# Standard Testbed Header +# +PAGEHEADER("New Users Approved"); + # Local used below. $projectchecks = array(); diff --git a/www/approveuser_form.php3 b/www/approveuser_form.php3 index 31d71429b7ac704fa80e37feb0386186baf18f17..b12d53c5740c28a042d48df9df3297901c6b3d98 100755 --- a/www/approveuser_form.php3 +++ b/www/approveuser_form.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("New User Approval"); - # # Only known and logged in users can be verified. # @@ -34,6 +29,11 @@ if (count($approvelist) == 0) { USERERROR("You have no new project members who need approval.", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("New User Approval"); + echo "

Approve new users in your Project or Group

diff --git a/www/approvewauser.php3 b/www/approvewauser.php3 index 0254350ab2b6cd5899bb608cd99a2df7773db498..670652bea5f20446c537db955bf0c76e9e08e04e 100644 --- a/www/approvewauser.php3 +++ b/www/approvewauser.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Widearea Accounts Approval Form"); - # # Only known and logged in users can be verified. # @@ -109,6 +104,11 @@ while (list ($header, $value) = each ($HTTP_POST_VARS)) { } } +# +# Standard Testbed Header +# +PAGEHEADER("Widearea Accounts Approval Form"); + reset($HTTP_POST_VARS); # diff --git a/www/approvewauser_form.php3 b/www/approvewauser_form.php3 index b904d80c175cfae7380bce676682de79e172f815..e2d3ce9314242f9a2c84269a425f4a904b3929d2 100755 --- a/www/approvewauser_form.php3 +++ b/www/approvewauser_form.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Widearea Accounts Approval Form"); - # # Only admin types can use this page. # @@ -22,6 +17,11 @@ if (! $isadmin) { USERERROR("Only testbed administrators people can access this page!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Widearea Accounts Approval Form"); + echo "

Approve local accounts on specific widearea nodes

diff --git a/www/archive_tag.php3 b/www/archive_tag.php3 index 92be3f0398aa173a16684def49a4fc308c221f3c..a5cceec3d33d4af35fbbc34e52d1dfd1a98cac8e 100644 --- a/www/archive_tag.php3 +++ b/www/archive_tag.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Commit and Tag"); - # # Only known and logged in users can look at experiments. # @@ -37,6 +32,11 @@ if (!$isadmin && "archive in $pid/$eid!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Commit and Tag"); + function SPITFORM($formfields, $errors) { global $experiment, $TBDB_ARCHIVE_TAGLEN, $referrer; diff --git a/www/archive_tags.php3 b/www/archive_tags.php3 index e402491cdf3c777c2f2d9c074ab19a29cca4ac2b..4e15493c95f1205069010ecc2a22a25f9c5a0410 100644 --- a/www/archive_tags.php3 +++ b/www/archive_tags.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Archive Tags"); - # # Only known and logged in users can end experiments. # @@ -92,6 +87,11 @@ else { PAGEARGERROR("Must provide a current or former experiment index"); } +# +# Standard Testbed Header +# +PAGEHEADER("Archive Tags"); + # Show just the last N records unless request is different. if (!isset($records)) { $records = 100; diff --git a/www/buildui/bui.php3 b/www/buildui/bui.php3 index 4cd603f8fca2700a605fac192b4d79fe131c3eae..91da27f5b8d682d98e19a947974bec3fd340288d 100644 --- a/www/buildui/bui.php3 +++ b/www/buildui/bui.php3 @@ -8,8 +8,6 @@ chdir(".."); require("defs.php3"); chdir("buildui"); -PAGEHEADER("NetBuild"); - # # Only known and logged in users can do this. # @@ -32,6 +30,11 @@ if (isset($action) && $action == "modify") { echo "

Modifying $pid/$eid:

"; } +# +# Standard Testbed Header +# +PAGEHEADER("NetBuild"); + ?> diff --git a/www/clientui.php3 b/www/clientui.php3 index ca397d878f9871820850faa78f74d4c4c0443b03..c935896b5e5dd301c70ab049331e518d8023e1ef 100644 --- a/www/clientui.php3 +++ b/www/clientui.php3 @@ -15,8 +15,6 @@ $view = array( 'hide_copyright' => 1 ); -PAGEHEADER("Experiment Creation GUI", $view); - # # Only known and logged in users can do this. # @@ -30,6 +28,8 @@ $isadmin = ISADMIN(); $optargs = OptionalPageArguments("experiment", PAGEARG_EXPERIMENT, "fallback", PAGEARG_BOOLEAN); + +PAGEHEADER("Experiment Creation GUI", $view); ?>

Note: See the Help menu for quickstart and tips

diff --git a/www/defs.php3.in b/www/defs.php3.in index 1f8d518ad2e8763ced25b57f93bf97273ff7920c..d23c8321921323300f8d96e236b568f0ca5f2350 100644 --- a/www/defs.php3.in +++ b/www/defs.php3.in @@ -258,9 +258,14 @@ function TBERROR ($message, $death, $xmp = 0) { } # -# General user errors should print something warm and fuzzy -# -function USERERROR($message, $death = 1) { +# General user errors should print something warm and fuzzy. If a +# header is not already printed and the dealth paramater is true, then +# assume the error is a precheck error and send an appropriate HTTP +# response to prevent robots from indexing the page. This currently +# defaults to a "400 Bad Request", but that may change in the future. +# +function USERERROR($message, $death = 1, + $status_code = HTTP_400_BAD_REQUEST) { global $TBMAILADDR; global $session_interactive, $session_errorhandler; @@ -286,7 +291,7 @@ function USERERROR($message, $death = 1) { \n"; if ($death) { - PAGEERROR($msg); + PAGEERROR($msg, $status_code); } else echo "$msg\n"; @@ -310,7 +315,7 @@ function PAGEARGERROR($msg = 0) { if ($msg) { $default = "$default

$msg"; } - USERERROR($default, 1); + USERERROR($default, 1, HTTP_400_BAD_REQUEST); } # diff --git a/www/delaycontrol.php3 b/www/delaycontrol.php3 index 94a440b9a0dcf01649ea79186cbb1732114625e1..cf9ac96836f97a7cdf365c16d371591facaeb596 100644 --- a/www/delaycontrol.php3 +++ b/www/delaycontrol.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Delay Control"); - # # Only known and logged in users can do this. # @@ -32,6 +27,11 @@ $gid = $experiment->gid(); $state = $experiment->state(); $unix_gid = $experiment->UnixGID(); +# +# Standard Testbed Header +# +PAGEHEADER("Delay Control"); + # # Look for transition and exit with error. # diff --git a/www/deletegroup.php3 b/www/deletegroup.php3 index 85e91b421139721bcc51f86da957d5ce9f0a08f9..4c2ff4a75cf681ddabdb4192e88e49155535a9f6 100644 --- a/www/deletegroup.php3 +++ b/www/deletegroup.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Delete a Group"); - # # Only known and logged in users. # @@ -47,6 +42,11 @@ if (! $project->AccessCheck($this_user, $TB_PROJECT_DELGROUP)) { 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Delete a Group"); + # # Check to see if there are any active experiments. Abort if there are. # diff --git a/www/deleteimageid.php3 b/www/deleteimageid.php3 index 670afa1261f0dd845802633b7ade90b869524066..05da13b7ec35423f93dc3867c1af86b6b3489baf 100644 --- a/www/deleteimageid.php3 +++ b/www/deleteimageid.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include("imageid_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Delete an Image Descriptor"); - # # Only known and logged in users can end experiments. # @@ -38,6 +33,11 @@ if (! $image->AccessCheck($this_user, $TB_IMAGEID_DESTROY)) { USERERROR("You do not have permission to destroy ImageID $imageid!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Delete an Image Descriptor"); + # # Check to see if the imageid is being used in various places # diff --git a/www/deletenodelog.php3 b/www/deletenodelog.php3 index e13605fb44751fd6df1700ae64ba1f1f6bab0897..4d0635daf918f0d42749a8e52fc8873f51743a31 100644 --- a/www/deletenodelog.php3 +++ b/www/deletenodelog.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include_once("node_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Delete a Node Log Entry"); - # # Only known and logged in users can end experiments. # @@ -37,6 +32,11 @@ if (! ($isadmin || OPSGUY())) { # Need these below $node_id = $node->node_id(); +# +# Standard Testbed Header +# +PAGEHEADER("Delete a Node Log Entry"); + # # We run this twice. The first time we are checking for a confirmation # by putting up a form. The next time through the confirmation will be diff --git a/www/deleteosid.php3 b/www/deleteosid.php3 index 8678d838c5f1fb681674333583bd57d6803ac297..c165d9184039442dfe6685555d1411998bcdbade 100644 --- a/www/deleteosid.php3 +++ b/www/deleteosid.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include_once("osinfo_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Delete an OS Descriptor"); - # # Only known and logged in users can end experiments. # @@ -38,6 +33,11 @@ if (!$osinfo->AccessCheck($this_user, $TB_OSID_DESTROY)) { USERERROR("You do not have permission to delete OS Descriptor $osid!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Delete an OS Descriptor"); + $conflicts = 0; # diff --git a/www/deleteproject.php3 b/www/deleteproject.php3 index f2a9cd318ce49d89b5ea33fb82ade42e17ff6b40..6a7980d6f777708c4e7e769ed27e9e3fd463b4bb 100644 --- a/www/deleteproject.php3 +++ b/www/deleteproject.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Terminating Project and Remove all Trace"); - # # Only known and logged in users can end experiments. # @@ -36,6 +31,12 @@ $optargs = OptionalPageArguments("canceled", PAGEARG_BOOLEAN, # Need these below. $pid = $project->pid(); + +# +# Standard Testbed Header +# +PAGEHEADER("Terminating Project and Remove all Trace"); + # # Check to see if there are any active experiments. Abort if there are. # diff --git a/www/deleteuser.php3 b/www/deleteuser.php3 index 5a1aa0f1e772b92510d8bdcba384ffa5c6836651..965a737cf8676325cbfa7a5222a9a99b1ca0ac41 100644 --- a/www/deleteuser.php3 +++ b/www/deleteuser.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Remove User"); - # # Only known and logged in users allowed. # @@ -32,6 +27,11 @@ $optargs = OptionalPageArguments("target_project", PAGEARG_PROJECT, $target_dbuid = $target_user->uid(); $target_uid = $target_user->uid(); +# +# Standard Testbed Header +# +PAGEHEADER("Remove User"); + # # Requesting? Fire off email and we are done. # diff --git a/www/editgroup.php3 b/www/editgroup.php3 index d6c97f0f10fbb13c8ca13bfe08f9005117276fc6..1757e495d44754ccccf0dd11e7183a7e86db7bcb 100644 --- a/www/editgroup.php3 +++ b/www/editgroup.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Edit Group Membership"); - # # Only known and logged in users. # @@ -42,6 +37,11 @@ if (! $group->AccessCheck($this_user, $TB_PROJECT_EDITGROUP)) { "project $pid!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Edit Group Membership"); + # # See if user is allowed to add non-members to group. # diff --git a/www/editimageid.php3 b/www/editimageid.php3 index 4e495940c0b03b62e7d3647ea35bb83de7661e21..43cf230b72ef11a4c455c65a1e79fadd9d417978 100644 --- a/www/editimageid.php3 +++ b/www/editimageid.php3 @@ -9,11 +9,6 @@ include_once("osiddefs.php3"); include_once("imageid_defs.php"); include_once("osinfo_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Edit Image Descriptor"); - # # Only known and logged in users. # @@ -38,6 +33,11 @@ if (!$image->AccessCheck($this_user, $TB_IMAGEID_MODIFYINFO)) { USERERROR("You do not have permission to access ImageID $imageid!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Edit Image Descriptor"); + # # Need a list of node types. We join this over the nodes table so that # we get a list of just the nodes that currently in the testbed, not diff --git a/www/editsitevars.php3 b/www/editsitevars.php3 index 220b8fea76d82b83c1480d2d21915b4ee6859c26..cab7a07343bc66e6a7b09000d17a1b022a593f79 100644 --- a/www/editsitevars.php3 +++ b/www/editsitevars.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Edit Site Variables"); - # # Only known and logged in users can do this. # @@ -33,6 +28,11 @@ $optargs = OptionalPageArguments(# Edit greenballs pull up an Edit subform. "edited", PAGEARG_STRING, "canceled", PAGEARG_STRING); +# +# Standard Testbed Header +# +PAGEHEADER("Edit Site Variables"); + function SPIT_MSGS($message, $errors) { if ($message !== "") { diff --git a/www/form_example.php b/www/form_example.php index 921634161191505cbdc4bd06c58a7d0cd8deb70a..28c14ba94ca9b03f2d16e44c1b6882bf1ead8e6b 100644 --- a/www/form_example.php +++ b/www/form_example.php @@ -7,8 +7,6 @@ include("defs.php3"); include("form_defs.php"); -PAGEHEADER("Silly Forms example"); - # # Only known and logged in users. # @@ -18,6 +16,8 @@ $uid = $this_user->uid(); $optargs = OptionalPageArguments("submit", PAGEARG_STRING, "formfields", PAGEARG_ARRAY); +PAGEHEADER("Silly Forms example"); + # The form attributes: $form = array('#id' => 'form1', '#caption' => 'My Form', diff --git a/www/freenode.php3 b/www/freenode.php3 index 2dd3ec14e1acf100aed292acf3a8d264f5a773de..d0a27ccf5023c06a359a76aa000b584ea08c8e47 100644 --- a/www/freenode.php3 +++ b/www/freenode.php3 @@ -7,8 +7,6 @@ include("defs.php3"); include_once("node_defs.php"); -PAGEHEADER("Free Node"); - # # Only known and logged in users can do this. # @@ -44,6 +42,11 @@ if (! ($isadmin || (OPSGUY()) && $pid == $TBOPSPID)) { USERERROR("Not enough permission to free nodes!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Free Node"); + # # We run this twice. The first time we are checking for a confirmation # by putting up a form. The next time through the confirmation will be diff --git a/www/freezeuser.php3 b/www/freezeuser.php3 index 82a103ea428b5c340d88a35fa6b36d88b9dde5c5..e81745da56260c4bf1c8bc4b231ee6ea21a8369d 100644 --- a/www/freezeuser.php3 +++ b/www/freezeuser.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Freeze User Account"); - # # Only known and logged in users allowed. # @@ -66,6 +61,11 @@ if (!strcmp($action, "freeze")) { } } +# +# Standard Testbed Header +# +PAGEHEADER("Freeze User Account"); + # # Requesting? Fire off email and we are done. # diff --git a/www/kb-show.php3 b/www/kb-show.php3 index b4516af558b9232e7ed03eda452e5e9a7009a9bb..48a62b3b17dd3aac5879e33469139efdc41df5c2 100644 --- a/www/kb-show.php3 +++ b/www/kb-show.php3 @@ -18,14 +18,15 @@ if (isset($xref_tag) && $xref_tag != "") { DBQueryFatal("select * from knowledge_base_entries ". "where xref_tag='$xref_tag'"); if (! mysql_num_rows($query_result)) { - USERERROR("No such knowledge_base entry: $xref_tag", 1); + USERERROR("No such knowledge_base entry: $xref_tag", 1, + HTTP_404_NOT_FOUND); } $row = mysql_fetch_array($query_result); $idx = $row['idx']; } if (isset($idx)) { - header("Location: $WIKIDOCURL/kb${idx}"); + header("Location: $WIKIDOCURL/kb${idx}", TRUE, 301); } else { - header("Location: $WIKIDOCURL/KnowledgeBase"); + header("Location: $WIKIDOCURL/KnowledgeBase", TRUE, 301); } diff --git a/www/linkmon_list.php3 b/www/linkmon_list.php3 index e11665e3aa91c0d4ae9f253f84cbb5daab3375d4..73c89bc1d1628cdd983f2648f85a0638635391f6 100644 --- a/www/linkmon_list.php3 +++ b/www/linkmon_list.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Link Monitoring"); - # # Only known and logged in users. # @@ -52,6 +47,11 @@ if (mysql_num_rows($query_result) == 0) { USERERROR("No links are being traced/monitored in $eid/$pid!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Link Monitoring"); + echo $experiment->PageHeader(); echo "

\n"; diff --git a/www/login.php3 b/www/login.php3 index d1a76c8261d6070e762bcc51477955e61b094247..80f03c869fb9a4c5d372638c506c1476c7e1e5ea 100644 --- a/www/login.php3 +++ b/www/login.php3 @@ -17,7 +17,8 @@ $optargs = OptionalPageArguments("login", PAGEARG_STRING, "simple", PAGEARG_BOOLEAN, "adminmode",PAGEARG_BOOLEAN, "refer", PAGEARG_BOOLEAN, - "referrer", PAGEARG_STRING); + "referrer", PAGEARG_STRING, + "error", PAGEARG_STRING); # Allow adminmode to be passed along to new login. Handy for letting admins # log in when NOLOGINS() is on. @@ -31,8 +32,8 @@ if (! isset($simple)) { if (! isset($key)) { $key = null; } -if (! isset($referrer)) { - $referrer = null; +if (! isset($error)) { + $error = null; } # See if referrer page requested that it be passed along so that it can be @@ -45,6 +46,10 @@ if (isset($refer) && # the user may have visited the last page with http. If they did, send them # back through https $referrer = preg_replace("/^http:/i","https:",$referrer); +} else if (isset($referrer)) { + $refer = true; +} else { + $referrer = null; } # @@ -90,23 +95,39 @@ if (($this_user = CheckLogin($status))) { # # The uid can be an email address, and in fact defaults to that now. # -function SPITFORM($uid, $key, $referrer, $failed, $adminmode, $simple, $view) +function SPITFORM($uid, $key, $referrer, $error, $adminmode, $simple, $view) { global $TBDB_UIDLEN, $TBBASE; PAGEHEADER("Login",$view); - - if ($failed) { - echo "
- - Login attempt failed! Please try again. - -

\n"; + + $premessage = "Please login to our secure server."; + + if ($error) { + echo "
"; + echo ""; + switch ($error) { + case "failed": + echo "Login attempt failed! Please try again."; + break; + case "notloggedin": + echo "You do not appear to be logged in!"; + $premessage = "Please log in again."; + break; + case "timedout": + echo "Your login has timed out!"; + $premessage = "Please log in again."; + break; + default: + echo "Unknown Error ($error)!"; + } + echo ""; + echo "

\n"; } echo "
- Please login to our secure server.
+ $premessage
(You must have cookies enabled)
\n"; @@ -164,8 +185,8 @@ if (! isset($login)) { else { $login_id = REMEMBERED_ID(); } - - SPITFORM($login_id, $key, $referrer, 0, $adminmode, $simple, $view); + + SPITFORM($login_id, $key, $referrer, $error, $adminmode, $simple, $view); PAGEFOOTER($view); return; } @@ -196,7 +217,7 @@ else { # Failed, then try again with an error message. # if ($login_status == $STATUS_LOGINFAIL) { - SPITFORM($uid, $key, $referrer, 1, $adminmode, $simple, $view); + SPITFORM($uid, $key, $referrer, "failed", $adminmode, $simple, $view); PAGEFOOTER($view); return; } diff --git a/www/menu.php3 b/www/menu.php3 index 06224944ba7d5870bf54f0e932a3aa7d30247d8f..4456c97e03e3dd932eb698f77f6404906b19c8e3 100644 --- a/www/menu.php3 +++ b/www/menu.php3 @@ -1261,9 +1261,16 @@ function PAGEFOOTER($view = NULL) { echo "\n"; } -function PAGEERROR($msg) { +define("HTTP_400_BAD_REQUEST", 400); +define("HTTP_403_FORBIDDEN", 403); +define("HTTP_404_NOT_FOUND", 404); + +function PAGEERROR($msg, $status_code = 0) { global $drewheader, $noheaders; + if (! $drewheader && $status_code != 0) + header(' ', true, $status_code); + if (! $drewheader && ! $noheaders) { PAGEHEADER("Page Error"); } diff --git a/www/modnodeattributes.php3 b/www/modnodeattributes.php3 index cabc52346fbc0fb90c7946f1d80c00000d58462e..309e5c1ef7052e70a9b81c92f546d795d1201b85 100644 --- a/www/modnodeattributes.php3 +++ b/www/modnodeattributes.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include_once("node_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Modify Node Attributes Form"); - # # Only known and logged in users can do this. # @@ -41,6 +36,11 @@ $optargs = OptionalPageArguments("refer", PAGEARG_STRING, $node_id = $node->node_id(); $type = $node->type(); +# +# Standard Testbed Header +# +PAGEHEADER("Modify Node Attributes Form"); + # # Get current set of attributes for node - used in comparison below # diff --git a/www/modnodeattributes_form.php3 b/www/modnodeattributes_form.php3 index a46710202a7b1f6088f15610f6f674d9bbc09f7c..27a5be7e1f8fcc6f4f3ceb87a2ed6c8684349f59 100644 --- a/www/modnodeattributes_form.php3 +++ b/www/modnodeattributes_form.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include_once("node_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Modify Node Attributes Form"); - # # Only known and logged in users can do this. # @@ -43,6 +38,11 @@ if (isset($refer)) { $url .= "&refer=$refer"; } +# +# Standard Testbed Header +# +PAGEHEADER("Modify Node Attributes Form"); + # # Get any node attributes that might exist # diff --git a/www/newgroup.php3 b/www/newgroup.php3 index 58cbc88daefa04975ca1c80747fcec79af513bdb..9e87f90d456dade109e7e69bebe776f954810ca6 100644 --- a/www/newgroup.php3 +++ b/www/newgroup.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Create a Project Group"); - # # Only known and logged in users. # @@ -47,6 +42,11 @@ else { } } +# +# Standard Testbed Header +# +PAGEHEADER("Create a Project Group"); + # # Spit the form out using the array of data. # diff --git a/www/newimageid.php3 b/www/newimageid.php3 index 04c93320ad8c08e8b5c82737ccbe730cf341eaf3..15a06a2840583e3e705822a51cd825fa954d1bba 100644 --- a/www/newimageid.php3 +++ b/www/newimageid.php3 @@ -10,11 +10,6 @@ include_once("osinfo_defs.php"); include_once("node_defs.php"); include("osiddefs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Create a new Image Descriptor (long form)"); - # # Only known and logged in users. # @@ -39,6 +34,11 @@ if (! count($projlist)) { "you have permission to create new Image descriptors.", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Create a new Image Descriptor (long form)"); + # # Need a list of node types. We join this over the nodes table so that # we get a list of just the nodes that currently in the testbed, not diff --git a/www/newnode_edit.php3 b/www/newnode_edit.php3 index abe14485e367ec41080ccd417f409a70b0345615..9f394cb359cb98f6761d29a45cbf6d7c3d74fb10 100644 --- a/www/newnode_edit.php3 +++ b/www/newnode_edit.php3 @@ -11,11 +11,6 @@ require("defs.php3"); # testbed # -# -# Standard Testbed Header -# -PAGEHEADER("New Testbed Node"); - # # Only admins can see this page # @@ -33,6 +28,11 @@ $optargs = OptionalPageArguments("node_id", PAGEARG_STRING, "IP", PAGEARG_STRING, "identifier", PAGEARG_STRING); +# +# Standard Testbed Header +# +PAGEHEADER("New Testbed Node"); + # # If we had any update information passed to us, do the update now # diff --git a/www/newnodelog.php3 b/www/newnodelog.php3 index 602e05a9a983273150e55351317532b424f2c923..fa0bb4cfbe96bde72f15298375243621c52bc6e6 100644 --- a/www/newnodelog.php3 +++ b/www/newnodelog.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include_once("node_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Enter Node Log Entry"); - # # Only known and logged in users. # @@ -49,6 +44,11 @@ $log_type = escapeshellarg($log_type); $log_entry = escapeshellarg($log_entry); $node_id = $node->node_id(); +# +# Standard Testbed Header +# +PAGEHEADER("Enter Node Log Entry"); + # # Run the external script. # diff --git a/www/newnodelog_form.php3 b/www/newnodelog_form.php3 index 55ef973bed156f10396cf44ff20e82eeb22689c0..fbe4fce8fbe34f7b77261f4d1913065be28b727c 100644 --- a/www/newnodelog_form.php3 +++ b/www/newnodelog_form.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include_once("node_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Enter Node Log Entry"); - # # Only known and logged in users can do this. # @@ -32,6 +27,11 @@ if (! ($isadmin || OPSGUY())) { USERERROR("You do not have permission to enter log entries!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Enter Node Log Entry"); + echo "
diff --git a/www/newnodes_list.php3 b/www/newnodes_list.php3 index 6d1e94a729c748df9ab0aa364423c9055705a56f..e343c4f65a4f351e8f0b529b3c373b0316af27a4 100644 --- a/www/newnodes_list.php3 +++ b/www/newnodes_list.php3 @@ -12,11 +12,6 @@ require("newnode-defs.php3"); # testbed # -# -# Standard Testbed Header -# -PAGEHEADER("New Testbed Nodes"); - # # Only admins can see this page # @@ -44,6 +39,11 @@ $optargs = OptionalPageArguments("selected", PAGEARG_ARRAY, "addnumber", PAGEARG_STRING, "renumber", PAGEARG_STRING); +# +# Standard Testbed Header +# +PAGEHEADER("New Testbed Nodes"); + # # XXX - a hack # diff --git a/www/newosid.php3 b/www/newosid.php3 index c2d798d31ade59ae17df8be78fbf1518265e9c03..d60cca48ad451b655a6c07c1ceb4fdcc01b00eb7 100644 --- a/www/newosid.php3 +++ b/www/newosid.php3 @@ -9,11 +9,6 @@ include_once("osinfo_defs.php"); include("osiddefs.php3"); include("form_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Create a new OS Descriptor"); - # # Only known and logged in users. # @@ -42,6 +37,11 @@ while (list($project) = each($projlist)) { $projselection[$project] = $project; } +# +# Standard Testbed Header +# +PAGEHEADER("Create a new OS Descriptor"); + # # Define the form. # diff --git a/www/nodecontrol.php3 b/www/nodecontrol.php3 index 19c7a4dd3aa11688bd74fa479a024650aa585b68..fe67b36b57ac32ea00b08bdc01cfe51d3a72ca8b 100644 --- a/www/nodecontrol.php3 +++ b/www/nodecontrol.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include_once("node_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Node Control Form"); - # # Only known and logged in users can do this. # @@ -44,6 +39,11 @@ if (!$isadmin && USERERROR("You do not have permission to modify node parameters!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Node Control Form"); + # # Check each parameter. Also note that when setting/clearing values, # send the argument to the backend script *only when changed* diff --git a/www/nodecontrol_form.php3 b/www/nodecontrol_form.php3 index 12cd45f7362b62a2dc54c78db389bde9f25227fb..54b3c6e4fa6050e964254f04e3dd1bdeb8dc4438 100644 --- a/www/nodecontrol_form.php3 +++ b/www/nodecontrol_form.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include_once("node_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Node Control Form"); - # # Only known and logged in users can do this. # @@ -36,6 +31,11 @@ if (!$isadmin && USERERROR("You do not have permission to modify node $node_id!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Node Control Form"); + $node_id = $node->node_id(); $type = $node->type(); $def_boot_osid = $node->def_boot_osid(); diff --git a/www/nodecontrol_list.php3 b/www/nodecontrol_list.php3 index ac3bc9cdb4774a7f70cf58c9c1a0fb8d5c847b43..b3a1a7a1d9f2b7b1ebadb919f3675febf70919a3 100644 --- a/www/nodecontrol_list.php3 +++ b/www/nodecontrol_list.php3 @@ -13,11 +13,6 @@ include_once("node_defs.php"); # $isadmin tests. # -# -# Standard Testbed Header -# -PAGEHEADER("Node Control Center"); - # # Only known and logged in users can do this. # @@ -45,6 +40,11 @@ else { $target_user = $this_user; } +# +# Standard Testbed Header +# +PAGEHEADER("Node Control Center"); + echo "Show: summary, pcs, wireless maps, diff --git a/www/nodeutilization.php b/www/nodeutilization.php index 4bce21491683c56d35bf21a632b6ef819cbb7838..0e166bca2b4d1de53add049270ed702e862cc4e4 100644 --- a/www/nodeutilization.php +++ b/www/nodeutilization.php @@ -7,11 +7,6 @@ include("defs.php3"); include_once("node_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Node Control Center"); - # # Only known and logged in users can do this. # @@ -28,6 +23,11 @@ if (!$isadmin && !STUDLY()) { # $optargs = OptionalPageArguments("type", PAGEARG_STRING); +# +# Standard Testbed Header +# +PAGEHEADER("Node Control Center"); + $query_result = DBQueryFatal("select n.inception,util.*, ". " UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(n.inception) as age ". diff --git a/www/nscheck_form.php3 b/www/nscheck_form.php3 index 3f4c0f29a30d24b8deaaed38f17e0ac3559e465d..1c56a4ac6cc2cff2e17d5fe566c433f4c4b7cee4 100644 --- a/www/nscheck_form.php3 +++ b/www/nscheck_form.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Syntax Check your NS file"); - # # Only known and logged in users can begin experiments. # @@ -18,6 +13,11 @@ $this_user = CheckLoginOrDie(); $uid = $this_user->uid(); $isadmin = ISADMIN(); +# +# Standard Testbed Header +# +PAGEHEADER("Syntax Check your NS file"); + ?> diff --git a/www/obstacle_list.php3 b/www/obstacle_list.php3 index ee8244dcdf03d721fadf9598e4dc7848d15251f7..e991e59e4c87300c314fc6b6ce0ca7a58607cf08 100644 --- a/www/obstacle_list.php3 +++ b/www/obstacle_list.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Obstacle List"); - # # # Only known and logged in users allowed. @@ -19,6 +14,11 @@ $this_user = CheckLoginOrDie(); $uid = $this_user->uid(); $isadmin = ISADMIN(); +# +# Standard Testbed Header +# +PAGEHEADER("Obstacle List"); + # # Spit out all the obstacles. At some point this page should take # optional building/floor params. diff --git a/www/pagenotworking.php b/www/pagenotworking.php index 58a8db604e4874ddebf7052b73ec31103704c125..bb2b8467ef25adebd0c71a34f64fa6be21d9c680 100644 --- a/www/pagenotworking.php +++ b/www/pagenotworking.php @@ -6,18 +6,17 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Page Not Working Properly!"); - $optargs = OptionalPageArguments("confirmed", PAGEARG_BOOLEAN, "description", PAGEARG_STRING, "referrer", PAGEARG_STRING); - $this_user = CheckLogin($check_status); $referrer = (isset($referrer) ? $referrer : $_SERVER['HTTP_REFERER']); +# +# Standard Testbed Header +# +PAGEHEADER("Page Not Working Properly!"); + if ($this_user) { if (!isset($confirmed)) { echo "
"; diff --git a/www/plabmetrics.php3 b/www/plabmetrics.php3 index 3d4e5622c22256e2da3e6510268c1e62b92552e2..5f654bda77478de6ede28eff1b610c91c204b356 100644 --- a/www/plabmetrics.php3 +++ b/www/plabmetrics.php3 @@ -14,144 +14,6 @@ $DEF_NUMPAGENO = 10; $FLEXLAB_XMLRPC_SRV = 'ops.emulab.net'; $FLEXLAB_XMLRPC_SRV_PORT = 3993; -# -# Standard Testbed Header -# -# Cheat and use the page args to influence the view. -$view = array(); -if (isset($_REQUEST['pagelayout']) && $_REQUEST['pagelayout'] == "minimal") { - $view = array ('hide_banner' => 1, 'hide_sidebar' => 1 ); -} - -PAGEHEADER("PlanetLab Metrics",$view); - -# -# Some javascript to help us out. -# -?> - - - 1, 'hide_sidebar' => 1 ); +} + +PAGEHEADER("PlanetLab Metrics",$view); + +# +# Some javascript to help us out. +# +?> + + +


Operation canceled! diff --git a/www/request_idleinfo.php3 b/www/request_idleinfo.php3 index a744e4d24975daea711b1775cc9c8dc4563bc36e..93ff20a2afde9ed3b82f6ef0ae3e152572efb6e6 100644 --- a/www/request_idleinfo.php3 +++ b/www/request_idleinfo.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Request info about possibly Idle experiment"); - # # Only known and logged in users. # @@ -33,6 +28,11 @@ $optargs = OptionalPageArguments("message", PAGEARG_STRING, "canceled", PAGEARG_STRING, "confirmed", PAGEARG_STRING); +# +# Standard Testbed Header +# +PAGEHEADER("Request info about possibly Idle experiment"); + # # Need these below # diff --git a/www/request_swapexp.php3 b/www/request_swapexp.php3 index 9a623784744aeb41c9c3361ac6ca77e0192b1b85..3ce31b771c6eb57d4e134d3f8d2afed9a936cd97 100644 --- a/www/request_swapexp.php3 +++ b/www/request_swapexp.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Request a Swap/Terminate"); - # # Only known and logged in users. # @@ -33,6 +28,11 @@ $optargs = OptionalPageArguments("canceled", PAGEARG_STRING, "confirmed", PAGEARG_STRING, "force", PAGEARG_BOOLEAN); +# +# Standard Testbed Header +# +PAGEHEADER("Request a Swap/Terminate"); + # # Need these below # diff --git a/www/robotmap.php3 b/www/robotmap.php3 index fb9d350926392278e8127357edf228777c8b36d8..045ebdd0324f379476b17969b72ace9018db39e0 100755 --- a/www/robotmap.php3 +++ b/www/robotmap.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Robot Map"); - # # Only logged in people at the moment; might open up at some point. # @@ -87,6 +82,11 @@ else { unset($map_y); } +# +# Standard Testbed Header +# +PAGEHEADER("Robot Map"); + # # Assume a single image for the robot map. When user clicks, pixel # coords correspond to building and floor. diff --git a/www/robotrack/robotrack.php3 b/www/robotrack/robotrack.php3 index 00dd91f11582c9289463a0d5d75a4b9ec0e9b102..f7ba7d1fb52a55cf8d6c20b1d2ff5932fcd661e0 100644 --- a/www/robotrack/robotrack.php3 +++ b/www/robotrack/robotrack.php3 @@ -7,8 +7,6 @@ chdir(".."); include("defs.php3"); -PAGEHEADER("Real Time Robot Tracking Applet"); - $this_user = CheckLoginOrDie(); $uid = $this_user->uid(); $isadmin = ISADMIN(); @@ -119,6 +117,11 @@ if (isset($withwebcams) && $withwebcams) { } } +# +# Standard Testbed Header +# +PAGEHEADER("Real Time Robot Tracking Applet"); + # # Draw the legend and some explanatory text. # diff --git a/www/robotrack/selector.php3 b/www/robotrack/selector.php3 index 2e52c5b1c4ec35cf020eb67001e5fce7213ab4f8..99ef347d9a520b132f38fdc839d4779acb606d5e 100644 --- a/www/robotrack/selector.php3 +++ b/www/robotrack/selector.php3 @@ -7,8 +7,6 @@ chdir(".."); include("defs.php3"); -PAGEHEADER("Node Selector Applet"); - $this_user = CheckLoginOrDie(); $uid = $this_user->uid(); $isadmin = ISADMIN(); @@ -62,6 +60,11 @@ if (! mysql_num_rows($query_result)) { USERERROR("No such building/floor", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Node Selector Applet"); + # # Draw the legend and some explanatory text. # diff --git a/www/sendtestmsg.php3 b/www/sendtestmsg.php3 index d5b879dd6e7ef29e4841a63c17bef80408b3fcef..b0e794a6c725965921b74f7ae6be3d4c2c015d91 100644 --- a/www/sendtestmsg.php3 +++ b/www/sendtestmsg.php3 @@ -6,8 +6,6 @@ # include("defs.php3"); -PAGEHEADER("Send a Test Message"); - # # Only known and logged in users can do this. # @@ -29,6 +27,8 @@ $target_uid = $target_user->uid(); $usr_name = $target_user->name(); $usr_email = $target_user->email(); +PAGEHEADER("Send a Test Message"); + # Send the email. TBMAIL("$usr_name '$target_uid' <$usr_email>", "This is a test", diff --git a/www/showevents.php b/www/showevents.php index 2fe367389ce3896a0ea0afc2906fa159f1a2ad75..332973ff2c617a804e887397757457abc531c660 100644 --- a/www/showevents.php +++ b/www/showevents.php @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Watch Event Log"); - # # Only known and logged in users. # @@ -35,6 +30,11 @@ if (!$experiment->AccessCheck($this_user, $TB_EXPT_READINFO)) { USERERROR("You do not have permission to view events for $pid/$eid!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Watch Event Log"); + echo $experiment->PageHeader(); echo "
\n"; echo "
\n"; diff --git a/www/showexp_list.php3 b/www/showexp_list.php3 index 17c1d6c6fbdc30a685d03bad40cf98e05ceb4ab6..306498e85cff8b6858ed485294c55772ccde5fea 100644 --- a/www/showexp_list.php3 +++ b/www/showexp_list.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Experiment Information Listing"); - # # Only known and logged in users. # @@ -26,6 +21,11 @@ $optarg = OptionalPageArguments("showtype", PAGEARG_STRING, "thumb", PAGEARG_INTEGER, "noignore", PAGEARG_BOOLEAN); +# +# Standard Testbed Header +# +PAGEHEADER("Experiment Information Listing"); + $clause = 0; $having = ""; $active = 0; diff --git a/www/showexpstats.php3 b/www/showexpstats.php3 index a6f0f3e28589c80fab987ec22e9d1b6d3183b974..a6473b9af40babc7c3b637d3147cea1f00a60d35 100644 --- a/www/showexpstats.php3 +++ b/www/showexpstats.php3 @@ -11,11 +11,6 @@ include("defs.php3"); # Its a hack job at the moment. # -# -# Standard Testbed Header -# -PAGEHEADER("Show Experiment Information"); - # # Only known and logged in users. # @@ -28,6 +23,11 @@ $isadmin = ISADMIN(); # $optargs = OptionalPageArguments("record", PAGEARG_INTEGER); +# +# Standard Testbed Header +# +PAGEHEADER("Show Experiment Information"); + # # Right now we show just the last N records entered, unless the user # requested a specific record. diff --git a/www/showimageid.php3 b/www/showimageid.php3 index 3c5ea56e294f1e949ebf8fe508017c1093acb1df..42bfde6287621bf28908716289db244f487ca9e9 100644 --- a/www/showimageid.php3 +++ b/www/showimageid.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include("imageid_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Image Descriptor"); - # # Only known and logged in users. # @@ -24,6 +19,11 @@ $isadmin = ISADMIN(); # $reqargs = RequiredPageArguments("image", PAGEARG_IMAGE); +# +# Standard Testbed Header +# +PAGEHEADER("Image Descriptor"); + # Need these below. $imageid = $image->imageid(); diff --git a/www/showimageid_list.php3 b/www/showimageid_list.php3 index 7608efe510fa81ccede8e1d0f407c97e81b8e2e7..e0c797a062b23f0053e59adc2f5f6c9b55eed810 100644 --- a/www/showimageid_list.php3 +++ b/www/showimageid_list.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Image List"); - # # # Only known and logged in users allowed. @@ -26,6 +21,11 @@ $isadmin = ISADMIN(); $optargs = OptionalPageArguments("creator", PAGEARG_USER); $extraclause = ""; +# +# Standard Testbed Header +# +PAGEHEADER("Image List"); + # # Allow for creator restriction # diff --git a/www/showlasterror.php3 b/www/showlasterror.php3 index 865a0b559c287c22b3fd8237d4c55c92a99926ca..3e0e8f44ef4f4f9d2f3e6fb7a0812fc941368c1d 100644 --- a/www/showlasterror.php3 +++ b/www/showlasterror.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Last Error"); - # # Only known and logged in users. # @@ -24,6 +19,11 @@ $isadmin = ISADMIN(); $reqargs = RequiredPageArguments("experiment", PAGEARG_EXPERIMENT); $exptidx = $experiment->idx(); +# +# Standard Testbed Header +# +PAGEHEADER("Last Error"); + # # Must have permission to view experiment details. # diff --git a/www/showmmlists.php3 b/www/showmmlists.php3 index e192fc374ad36c2c3ea9ae0390b5ef93bca3232e..e6f8749f642bd5e5ab16939ca49d5227667370a1 100644 --- a/www/showmmlists.php3 +++ b/www/showmmlists.php3 @@ -6,12 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Mailman Lists"); - -# # # Only known and logged in users allowed. # @@ -27,6 +21,11 @@ $optargs = OptionalPageArguments("sortby", PAGEARG_STRING, "showallmm", PAGEARG_BOOLEAN, "target_user", PAGEARG_USER); +# +# Standard Testbed Header +# +PAGEHEADER("Mailman Lists"); + if (! isset($sortby)) { $sortby = "listname"; } diff --git a/www/shownodehistory.php3 b/www/shownodehistory.php3 index 7ec949b9d35f847ae14f8c0684e773801c5cc7f1..d8a87fa3a1cb919a204ac3f2ccbcfccffa4c19f7 100644 --- a/www/shownodehistory.php3 +++ b/www/shownodehistory.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include_once("node_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Node History"); - # # Only known and logged in users can do this. # @@ -31,6 +26,11 @@ $optargs = OptionalPageArguments("showall", PAGEARG_BOOLEAN, "count", PAGEARG_INTEGER, "node", PAGEARG_NODE); +# +# Standard Testbed Header +# +PAGEHEADER("Node History"); + if (!isset($showall)) { $showall = 0; } diff --git a/www/shownodelog.php3 b/www/shownodelog.php3 index b0f871bad3a7cee70e2b709843ce6504daee5050..bf3cc65c315f852ac310a015d113523cd21746a9 100644 --- a/www/shownodelog.php3 +++ b/www/shownodelog.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include("node_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Node Log"); - # # Only known and logged in users can do this. # @@ -24,6 +19,11 @@ $isadmin = ISADMIN(); # $reqargs = RequiredPageArguments("node", PAGEARG_NODE); +# +# Standard Testbed Header +# +PAGEHEADER("Node Log"); + # # Perm check. # diff --git a/www/shownodetype.php3 b/www/shownodetype.php3 index e0a21cd07496f105c08504bda90c7b23667ede2f..ada42abd14e8518a352b99d281d4c23fa7986e6d 100644 --- a/www/shownodetype.php3 +++ b/www/shownodetype.php3 @@ -7,11 +7,6 @@ include("defs.php3"); include("imageid_defs.php"); -# -# Standard Testbed Header -# -PAGEHEADER("Node Type Information"); - # # Anyone can access this info, its a PUBLIC PAGE! # @@ -22,6 +17,11 @@ if (!preg_match("/^[-\w]+$/", $node_type)) { PAGEARGERROR("Invalid characters in arguments."); } +# +# Standard Testbed Header +# +PAGEHEADER("Node Type Information"); + $query_result = DBQueryFatal("select * from node_types ". "where type='$node_type'"); diff --git a/www/shownsfile.php3 b/www/shownsfile.php3 index 93529b994015942e54e53a3a41004670a7332086..2a326f92987e35abf1bc0a13432a9782b55feb56 100644 --- a/www/shownsfile.php3 +++ b/www/shownsfile.php3 @@ -6,17 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -if (!isset($justns)) { - $justns = 0; -} - -if (!$justns) { - PAGEHEADER("Visualization, NS File, and Details"); -} - # # Only known and logged in users. # @@ -33,6 +22,17 @@ $optargs = OptionalPageArguments("zoom", PAGEARG_NUMERIC, "showevents", PAGEARG_BOOLEAN, "justns", PAGEARG_BOOLEAN); +# +# Standard Testbed Header +# +if (!isset($justns)) { + $justns = 0; +} + +if (!$justns) { + PAGEHEADER("Visualization, NS File, and Details"); +} + # # Need these below # diff --git a/www/showobstacle.php3 b/www/showobstacle.php3 index 69c81a67a37d1d789a12626bc31399f2661957e5..ee2df4d5592a36c537d713666180a71573581db3 100644 --- a/www/showobstacle.php3 +++ b/www/showobstacle.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Obstacle Information"); - # # # Only known and logged in users allowed. @@ -24,6 +19,11 @@ $isadmin = ISADMIN(); # $reqargs = RequiredPageArguments("id", PAGEARG_INTEGER); +# +# Standard Testbed Header +# +PAGEHEADER("Obstacle Information"); + $query_result = DBQueryFatal("select o.*,f.pixels_per_meter from obstacles as o ". "left join floorimages as f on f.floor=o.floor and ". diff --git a/www/showosid_list.php3 b/www/showosid_list.php3 index 11e0687fad7f21b5e8b15597aeff686ef629528a..cb8f3aaa924a43c075709442950a0d4c0cdb5ba6 100644 --- a/www/showosid_list.php3 +++ b/www/showosid_list.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("OS Descriptor List"); - # # # Only known and logged in users allowed. @@ -25,6 +20,11 @@ $isadmin = ISADMIN(); # $optargs = OptionalPageArguments("creator", PAGEARG_USER); +# +# Standard Testbed Header +# +PAGEHEADER("OS Descriptor List"); + # # Allow for creator restriction # diff --git a/www/showpolicies.php3 b/www/showpolicies.php3 index cc7a57f2502c4b5d81a4ba9ec9ea1fc3a694d96a..33182a22891a80d02b1eb749e48f5373e809564d 100644 --- a/www/showpolicies.php3 +++ b/www/showpolicies.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Experiment Admission Control Policies"); - # # # Only known and logged in users allowed. @@ -19,6 +14,11 @@ $this_user = CheckLoginOrDie(); $uid = $this_user->uid(); $isadmin = ISADMIN(); +# +# Standard Testbed Header +# +PAGEHEADER("Experiment Admission Control Policies"); + # # Only admin people can see this page. # diff --git a/www/showproject_list.php3 b/www/showproject_list.php3 index 8350b7730affe442239b1efcec434ec57cbeccb7..c1f8908afb4a56f037edb5b6619175a361e15c7c 100644 --- a/www/showproject_list.php3 +++ b/www/showproject_list.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Project Information List"); - # # Only known and logged in users can do this. # @@ -23,6 +18,11 @@ $isadmin = ISADMIN(); # $optargs = OptionalPageArguments("splitview", PAGEARG_BOOLEAN); +# +# Standard Testbed Header +# +PAGEHEADER("Project Information List"); + # # Admin users can see all projects, while normal users can only see # projects for which they are the leader. diff --git a/www/showstats.php3 b/www/showstats.php3 index 226b731174b87395502be607f6fb5295e2e43712..0916afa96e15cdd8d9835cb1830d4916df6717ab 100644 --- a/www/showstats.php3 +++ b/www/showstats.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Testbed Wide Stats"); - # # Only known and logged in users can end experiments. # @@ -26,6 +21,12 @@ $optargs = OptionalPageArguments("showby", PAGEARG_STRING, "target_project", PAGEARG_PROJECT, "exptidx", PAGEARG_INTEGER, "records", PAGEARG_INTEGER); + +# +# Standard Testbed Header +# +PAGEHEADER("Testbed Wide Stats"); + if (! isset($verbose)) { $verbose = 0; } diff --git a/www/showsumstats.php3 b/www/showsumstats.php3 index 5967cfd747171c50c33125b7b0f44f4bf397d0d3..4accdcbe5694ce148705594b4aced9d4af2b427f 100644 --- a/www/showsumstats.php3 +++ b/www/showsumstats.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Testbed Summary Stats"); - # # Only known and logged in users can end experiments. # @@ -34,6 +29,11 @@ $optargs = OptionalPageArguments("showby", PAGEARG_STRING, "range", PAGEARG_STRING, "experiment", PAGEARG_EXPERIMENT); +# +# Standard Testbed Header +# +PAGEHEADER("Testbed Summary Stats"); + # Page args, if (! isset($showby)) { $showby = "users"; diff --git a/www/showuser_list.php3 b/www/showuser_list.php3 index 929485d487f5c17cec5008729973c6efb3a096bd..85642340567f603e6cd6b8cd3ea297c204f8208b 100644 --- a/www/showuser_list.php3 +++ b/www/showuser_list.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("User List"); - # # # Only known and logged in users allowed. @@ -39,6 +34,12 @@ if (!isset($searchfor)) { $searchfor = ""; } +# +# Standard Testbed Header +# +PAGEHEADER("User List"); + + echo "Show: loggedin, recent, widearea, diff --git a/www/tbauth.php3 b/www/tbauth.php3 index 1f348ad796cafa0000f0380290089812db6cb582..1e9f2418cbeeeb2fb6cbe883a4b75cbf96335782 100644 --- a/www/tbauth.php3 +++ b/www/tbauth.php3 @@ -450,6 +450,17 @@ function LoginStatus() { function LOGGEDINORDIE($uid, $modifier = 0, $login_url = NULL) { global $TBBASE, $BASEPATH; global $TBAUTHTIMEOUT, $CHECKLOGIN_HASHKEY, $CHECKLOGIN_IDX; + global $drewheader; + + if ($drewheader) { + trigger_error( + "PAGEHEADER called before LOGGEDINORDIE ". + "(called by CheckLoginOrDie). ". + "Won't be able to redirect to the login page or ". + "return proper HTTP status code on Error ". + "in ". $_SERVER['SCRIPT_FILENAME'] . ",", + E_USER_WARNING); + } # # We now ignore the $uid argument and let LoginStatus figure it out. @@ -458,8 +469,15 @@ function LOGGEDINORDIE($uid, $modifier = 0, $login_url = NULL) { # # Allow the caller to specify a different URL to direct the user to # + $redirect_url = null; if (!$login_url) { $login_url = "$TBBASE/login.php3?refer=1"; + if ($uid || REMEMBERED_ID()) { + # HTTP_REFERER will not work reliably when redirecting so + # pass in the URI for this page as an argument + $redirect_url = "$TBBASE/login.php3?referrer=". + urlencode($_SERVER['REQUEST_URI']); + } } $link = "\nPlease ". @@ -469,15 +487,27 @@ function LOGGEDINORDIE($uid, $modifier = 0, $login_url = NULL) { switch ($status & CHECKLOGIN_STATUSMASK) { case CHECKLOGIN_NOTLOGGEDIN: - USERERROR("You do not appear to be logged in! $link", 1); + if ($redirect_url) { + header("Location: $redirect_url&error=notloggedin"); + exit; + } else { + USERERROR("You do not appear to be logged in! $link", + 1, HTTP_403_FORBIDDEN); + } break; case CHECKLOGIN_TIMEDOUT: - USERERROR("Your login has timed out! $link", 1); + if ($redirect_url) { + header("Location: $redirect_url&error=timedout"); + exit; + } else { + USERERROR("Your login has timed out! $link", + 1, HTTP_403_FORBIDDEN); + } break; case CHECKLOGIN_MAYBEVALID: USERERROR("Your login cannot be verified. Are cookies turned on? ". "Are you using https? Are you logged in using another ". - "browser or another machine? $link", 1); + "browser or another machine? $link", 1, HTTP_403_FORBIDDEN); break; case CHECKLOGIN_LOGGEDIN: # @@ -505,17 +535,23 @@ function LOGGEDINORDIE($uid, $modifier = 0, $login_url = NULL) { # if ($status & CHECKLOGIN_PSWDEXPIRED) USERERROR("Your password has expired. ". - "Please change it now!", 1); + "Please change it now!", + 1, HTTP_403_FORBIDDEN); if ($status & CHECKLOGIN_FROZEN) - USERERROR("Your account has been frozen!", 1); + USERERROR("Your account has been frozen!", + 1, HTTP_403_FORBIDDEN); if ($status & (CHECKLOGIN_UNVERIFIED|CHECKLOGIN_NEWUSER)) - USERERROR("You have not verified your account yet!", 1); + USERERROR("You have not verified your account yet!", + 1, HTTP_403_FORBIDDEN); if ($status & CHECKLOGIN_UNAPPROVED) - USERERROR("Your account has not been approved yet!", 1); + USERERROR("Your account has not been approved yet!", + 1, HTTP_403_FORBIDDEN); if (($status & CHECKLOGIN_WEBONLY) && ! ISADMIN()) - USERERROR("Your account does not permit you to access this page!", 1); + USERERROR("Your account does not permit you to access this page!", + 1, HTTP_403_FORBIDDEN); if (($status & CHECKLOGIN_WIKIONLY) && ! ISADMIN()) - USERERROR("Your account does not permit you to access this page!", 1); + USERERROR("Your account does not permit you to access this page!", + 1, HTTP_403_FORBIDDEN); # # Lastly, check for nologins here. This heads off a bunch of other diff --git a/www/url_defs.php b/www/url_defs.php index 1a958ae02ff989c30be0e6a349b5d3a1c369f375..1343703997c649634da6de0f2ce26da730bf1c0d 100644 --- a/www/url_defs.php +++ b/www/url_defs.php @@ -345,6 +345,17 @@ function OptionalPageArguments() function VerifyPageArguments($argspec, $required) { + global $drewheader; + + if ($drewheader) { + trigger_error( + "PAGEHEADER called before VerifyPageArguments ". + "(called by RequiredPageArguments or OptionalPageArguments). ". + "Won't be able to return proper HTTP status code on Error ". + "in ". $_SERVER['SCRIPT_FILENAME'] . ",", + E_USER_WARNING); + } + $result = array(); while ($argspec and count($argspec) > 1) { diff --git a/www/verifyusr.php3 b/www/verifyusr.php3 index e5173e12f5d418d2fceff1fced1b215b48a61613..0f9d62f59d424f2582673c7be726763943ac9801 100644 --- a/www/verifyusr.php3 +++ b/www/verifyusr.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Confirm Verification"); - # # Only known and logged in users can be verified. # @@ -28,6 +23,11 @@ if (!isset($key) || strcmp($key, "") == 0) { "Please go back and fill out the \"key\" field!", 1); } +# +# Standard Testbed Header +# +PAGEHEADER("Confirm Verification"); + # # Grab the status and do the modification. # diff --git a/www/verifyusr_form.php3 b/www/verifyusr_form.php3 index 1079b6d7b00397cc08ce47f7903a03717dc27b26..b270d758900e6a73c07f3f96f1d809894bea8ee7 100644 --- a/www/verifyusr_form.php3 +++ b/www/verifyusr_form.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("New User Verification"); - # # Only known and logged in users can be verified. # @@ -18,6 +13,11 @@ $this_user = CheckLoginOrDie(CHECKLOGIN_UNVERIFIED|CHECKLOGIN_NEWUSER| CHECKLOGIN_WEBONLY|CHECKLOGIN_WIKIONLY); $uid = $this_user->uid(); +# +# Standard Testbed Header +# +PAGEHEADER("New User Verification"); + echo "

The purpose of this page is to verify, for security purposes, that information given in your application is authentic. If you never diff --git a/www/webcam.php3 b/www/webcam.php3 index 7eff6eb13e4e2dac485ac4bee7417c5c3206a4eb..505a4d3e91b20e8a4d04d645c006fdd704dcc5a7 100644 --- a/www/webcam.php3 +++ b/www/webcam.php3 @@ -6,11 +6,6 @@ # include("defs.php3"); -# -# Standard Testbed Header -# -PAGEHEADER("Robot Web Cams"); - # # Only known and logged in users. # @@ -28,7 +23,14 @@ $optargs = OptionalPageArguments("camheight", PAGEARG_INTEGER, "camera", PAGEARG_INTEGER, "applet", PAGEARG_BOOLEAN); +# +# Standard Testbed Header +# +PAGEHEADER("Robot Web Cams"); + +# # Helper function. +# function MyError($msg) { # No Data. Spit back a stub image.