$pconfig['bpath'] = ""; $pconfig['bremoteaddr'] = ""; } if ($_POST) { unset($input_errors); $pconfig = $_POST; if (isset($_POST['Cancel']) && $_POST['Cancel']) { header("Location: services_hast_resource.php"); exit; } // Input validation. $reqdfields = explode(" ", "name aname bname apath bpath aremoteaddr bremoteaddr"); $reqdfieldsn = array(gettext("Resource name"), gettext("Node Name"), gettext("Node Name"), gettext("Path"), gettext("Path"), gettext("Node B IP address"), gettext("Node A IP address")); $reqdfieldst = explode(" ", "alias string string string string string string"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); do_input_validation_type($_POST, $reqdfields, $reqdfieldsn, $reqdfieldst, $input_errors); if (empty($input_errors)) { $resource = array(); $resource['uuid'] = $_POST['uuid']; $resource['name'] = $_POST['name']; $resource['aname'] = $_POST['aname']; $resource['apath'] = $_POST['apath']; $resource['aremoteaddr'] = $_POST['aremoteaddr']; $resource['bname'] = $_POST['bname']; $resource['bpath'] = $_POST['bpath']; $resource['bremoteaddr'] = $_POST['bremoteaddr']; unset($resource['auxparam']); foreach (explode("\n", $_POST['auxparam']) as $auxparam) { $auxparam = trim($auxparam, "\t\n\r"); if (!empty($auxparam)) { $resource['auxparam'][] = $auxparam;
$disks = $_POST['disks']; $type = $_POST['type']; $minspace = $_POST['minspace']; $notinitmbr = isset($_POST['notinitmbr']) ? true : false; $aft4k = isset($_POST['aft4k']) ? true : false; $zfsgpt = isset($_POST['zfsgpt']) ? true : false; $volumelabels = explode(" ", trim($_POST['volumelabels'])); // Input validation. $reqdfields = explode(" ", "disks type"); $reqdfieldsn = array(gettext("Disk"), gettext("Type")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); foreach ($volumelabels as $volumelabel) { $reqdfields = explode(" ", "volumelabel"); $reqdfieldsn = array(gettext("Volume label")); $reqdfieldst = explode(" ", "alias"); do_input_validation_type(array('volumelabel' => $volumelabel), $reqdfields, $reqdfieldsn, $reqdfieldst, $input_errors); } if (count($volumelabels) > 1 && count($volumelabels) > count($disks)) { $input_errors[] = gettext("Wrong number of argument for Volume label"); } if (empty($input_errors)) { $do_format = array(); if (count($disks) > 0) { foreach ($disks as $key => $disk) { $do_format[$key] = true; // Check whether disk is mounted. if (disks_ismounted_ex($disk, "devicespecialfile")) { $errormsg = sprintf(gettext("The disk is currently mounted! <a href='%s'>Unmount</a> this disk first before proceeding."), "disks_mount_tools.php?disk={$disk}&action=umount"); $do_format[$key] = false; } // Check if user tries to format the OS disk.