$errors["Metadata Value"] = "Missing Field";
    } elseif (!TBvalid_template_metadata_value($formfields["value"])) {
        $errors["Metadata Value"] = TBFieldErrorString();
    }
    if ($action == "modify" && $formfields["value"] == $metadata->value()) {
        $errors["Metadata Value"] = "New value identical to old value";
    }
}
#
# XXX Some metadata is special ...
#
if (isset($metadata_type)) {
    if ($metadata_type == "tid") {
        if ($action == "delete") {
            $errors["TID"] = "Not allowed to delete this";
        } elseif (!TBvalid_eid($formfields["value"])) {
            $errors["TID"] = TBFieldErrorString();
        }
    } elseif ($metadata_type == "template_description") {
        if ($action == "delete") {
            $errors["Description"] = "Not allowed to delete this";
        } elseif (!TBvalid_template_description($formfields["value"])) {
            $errors["Description"] = TBFieldErrorString();
        }
    } elseif ($metadata_type == "parameter_description") {
        if (!TBvalid_template_parameter_description($formfields["value"])) {
            $errors["Description"] = TBFieldErrorString();
        }
    } elseif ($metadata_type == "instance_description") {
        if (!TBvalid_template_instance_description($formfields["value"])) {
            $errors["Description"] = TBFieldErrorString();
    if (isset($formfields["gid"]) && $formfields["gid"] != "") {
        if (!TBvalid_gid($formfields["gid"])) {
            $errors["Group"] = TBFieldErrorString();
        } elseif (!($group = Group::LookupByPidGid($formfields["pid"], $formfields["gid"]))) {
            $errors["Group"] = "No such group in project'";
        }
    } else {
        $group = $project->DefaultGroup();
    }
}
#
# TID
#
if (!isset($formfields["tid"]) || $formfields["tid"] == "") {
    $errors["Template ID"] = "Missing Field";
} elseif (!TBvalid_eid($formfields["tid"])) {
    $errors["Template ID"] = TBFieldErrorString();
}
#
# Description:
#
if (!isset($formfields["description"]) || $formfields["description"] == "") {
    $errors["Description"] = "Missing Field";
} elseif (!TBvalid_template_description($formfields["description"])) {
    $errors["Description"] = TBFieldErrorString();
}
#
# The NS file. There is a bunch of stuff here for Netbuild.
#
$formfields["nsfile"] = "";
if (isset($formfields["guid"])) {
Example #3
0
} elseif ($type == "lockdown") {
    # must be admin
    if (!$isadmin) {
        USERERROR("You do not have permission to toggle {$type}!", 1);
    }
    if (!($experiment = Experiment::LookupByPidEid($pid, $eid))) {
        PAGEARGERROR("Experiment {$pid}/{$eid} is not a valid experiment!");
    }
    $zapurl = CreateURL("showexp", $experiment);
    $experiment->SetLockDown($value);
} elseif ($type == "skipvlans") {
    # Must validate the pid,eid since we allow non-admins to do this.
    if (!TBvalid_pid($pid)) {
        PAGEARGERROR("Invalid characters in {$pid}");
    }
    if (!TBvalid_eid($eid)) {
        PAGEARGERROR("Invalid characters in {$eid}");
    }
    if (!($isadmin || STUDLY() || OPSGUY())) {
        USERERROR("You do not have permission to toggle {$type}!", 1);
    }
    if (!($experiment = Experiment::LookupByPidEid($pid, $eid))) {
        PAGEARGERROR("Experiment {$pid}/{$eid} is not a valid experiment!");
    }
    if (!$isadmin && !TBMinTrust(TBGrpTrust($uid, $pid, $pid), $TBDB_TRUST_LOCALROOT)) {
        USERERROR("You do not have permission to toggle {$type}!", 1);
    }
    $zapurl = CreateURL("showexp", $experiment);
    $experiment->SetSkipVlans($value);
} elseif ($type == "imageglobal" || $type == "imagedoesxen") {
    include "imageid_defs.php";