Пример #1
0
include "showlogfile_sup.php3";
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("view_style", PAGEARG_STRING, "beginexp", PAGEARG_STRING, "formfields", PAGEARG_ARRAY, "nsref", PAGEARG_INTEGER, "guid", PAGEARG_INTEGER, "copyid", PAGEARG_INTEGER);
#
# Handle pre-defined view styles
#
unset($view);
if (isset($view_style) && $view_style == "plab") {
    $view['hide_proj'] = $view['hide_group'] = $view['hide_swap'] = $view['hide_preload'] = $view['hide_batch'] = $view['hide_linktest'] = $view['quiet'] = $view['plab_ns_message'] = $view['plab_descr'] = 1;
}
include "beginexp_form.php3";
# Need this below;
$idleswaptimeout = TBGetSiteVar("idle/threshold");
$autoswap_max = TBGetSiteVar("general/autoswap_max");
#
# See what projects the uid can create experiments in. Must be at least one.
#
$projlist = $this_user->ProjectAccessList($TB_PROJECT_CREATEEXPT);
if (!count($projlist)) {
    USERERROR("You do not appear to be a member of any Projects in which " . "you have permission to create new experiments.", 1);
}
#
# On first load, display virgin form and exit.
#
if (!isset($beginexp)) {
    # Allow initial formfields data.
    if (isset($formfields)) {
        $defaults = $formfields;
    } else {
Пример #2
0
    if (!isset($formfields["exp_noidleswap_reason"]) || !strcmp($formfields["exp_noidleswap_reason"], "")) {
        if (!$isadmin) {
            $errors["Not Idle-Swappable"] = "No justification provided";
        } else {
            $formfields["exp_noidleswap_reason"] = "ADMIN";
        }
    } elseif (!TBvalid_description($formfields["exp_noidleswap_reason"])) {
        $errors["Not Idle-Swappable"] = TBFieldErrorString();
    } else {
        $command_options .= " -L " . escapeshellarg($formfields["exp_noidleswap_reason"]);
    }
} else {
    $formfields["exp_idleswap"] = 1;
    $formfields["exp_noidleswap_reason"] = "";
    # Need this below;
    $idleswaptimeout = TBGetSiteVar("idle/threshold");
    # Proper idleswap timeout must be provided.
    if (!isset($formfields["exp_idleswap_timeout"]) || !preg_match("/^[\\d]+\$/", $formfields["exp_idleswap_timeout"]) || $formfields["exp_idleswap_timeout"] + 0 <= 0 || $formfields["exp_idleswap_timeout"] + 0 > $idleswaptimeout) {
        $errors["Idleswap"] = "Invalid time provided - " . "must be non-zero and less than {$idleswaptimeout}";
    }
    $command_options .= " -l " . 60 * $formfields["exp_idleswap_timeout"];
}
#
# Autoswap.
#
if (!isset($formfields["exp_autoswap"]) || strcmp($formfields["exp_autoswap"], "1")) {
    $formfields["exp_autoswap"] = 0;
} else {
    $formfields["exp_autoswap"] = 1;
    if (!isset($formfields["exp_autoswap_timeout"]) || !preg_match("/^[\\d]+\$/", $formfields["exp_idleswap_timeout"]) || $formfields["exp_autoswap_timeout"] + 0 <= 0) {
        $errors["Max. Duration"] = "No or invalid time provided";