. # # }}} # chdir(".."); include("defs.php3"); include_once("webtask.php"); chdir("apt"); include("quickvm_sup.php"); include_once("profile_defs.php"); include_once("instance_defs.php"); $page_title = "Show Profile"; # # Get current user. # RedirectSecure(); $this_user = CheckLoginOrRedirect(CHECKLOGIN_WEBONLY); $this_idx = $this_user->uid_idx(); $isadmin = (ISADMIN() ? 1 : 0); # # Verify page arguments. # $optargs = OptionalPageArguments("uuid", PAGEARG_STRING, "profile",PAGEARG_STRING, "project",PAGEARG_PROJECT, "source", PAGEARG_BOOLEAN, "rspec", PAGEARG_BOOLEAN); if (isset($uuid)) { $profile = Profile::Lookup($uuid); } elseif (isset($project) && isset($profile)) { $profile = Profile::LookupByName($project, $profile); } else { SPITUSERERROR("Must provide a uuid or project/profile name!"); } if (!$profile) { SPITUSERERROR("No such profile!"); } if (!$profile->CanView($this_user) && !(ISADMIN() || ISFOREIGN_ADMIN())) { SPITUSERERROR("Not enough permission!"); } # For the download source button. if ($source || $rspec) { $filename = $profile->name() . ".xml"; $stuff = $profile->rspec(); if ($source && $profile->script() && $profile->script() != "") { $stuff = $profile->script(); $filename = $profile->name() . ".py"; } header("Content-Type: text/plain"); header("Content-Disposition: attachment; filename='${filename}'"); echo $stuff; return; } SPITHEADER(1); echo "
\n"; $profile_uuid = $profile->profile_uuid(); $version_uuid = $profile->uuid(); $ispp = ($profile->isParameterized() ? 1 : 0); $history = ($profile->HasHistory() ? 1 : 0); $canedit = ($profile->CanEdit($this_user) ? 1 : 0); $disabled = ($profile->isDisabled() ? 1 : 0); $defaults = array(); $defaults["profile_name"] = $profile->name(); $defaults["profile_rspec"] = $profile->rspec(); $defaults["profile_version"] = $profile->version(); $defaults["profile_creator"] = $profile->creator(); $defaults["profile_updater"] = $profile->updater(); $defaults["profile_pid"] = $profile->pid(); $defaults["profile_created"] = DateStringGMT($profile->created()); $defaults["profile_published"] = DateStringGMT($profile->published()); $defaults["profile_version_url"] = $profile->URL(); $defaults["profile_profile_url"] = $profile->ProfileURL(); if ($profile->script() && $profile->script() != "") { $defaults["profile_script"] = $profile->script(); } # Place to hang the toplevel template. echo "\n"; echo "\n"; echo "\n"; # I think this will take care of XSS prevention? echo "\n"; $am_array = Instance::DefaultAggregateList(); $amlist = array(); $amdefault = ""; if (($ISCLOUD || ISADMIN() || STUDLY())) { while (list($am) = each($am_array)) { $amlist[] = $am; } $amdefault = $DEFAULT_AGGREGATE; # Temporary override until constraint system in place. if ($profile->BestAggregate()) { $amdefault = $profile->BestAggregate(); } } echo "\n"; echo "\n"; echo "\n"; REQUIRE_UNDERSCORE(); REQUIRE_SUP(); REQUIRE_MOMENT(); REQUIRE_MARKED(); SPITREQUIRE("js/show-profile.js", "\n". ""); AddTemplateList(array("show-profile", "waitwait-modal", "renderer-modal", "showtopo-modal", "rspectextview-modal", "guest-instantiate", "instantiate-modal", "oops-modal", "share-modal")); SPITFOOTER(); ?>