Esempio n. 1
0
 function createUiContainers()
 {
     $subtypesMap = $this->subtypes();
     $subtypes = array_values($subtypesMap);
     if (isset($subtypesMap[$this->values["subtype"]])) {
         $subtypeIndex = array_search($subtypesMap[$this->values["subtype"]], $subtypes);
         $customSubtype = "";
     } else {
         $subtypeIndex = count($subtypes) - 1;
         $customSubtype = $this->values["subtype"];
     }
     $isCustomSubtype = $subtypeIndex == count($subtypes) - 1 ? "checked" : "";
     $subtypeComboBox = new ExtendedSelectItem($this->pn("subtype"));
     $subtypeComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("subtypediv") . "',state);\"");
     $subtypeComboBox->setElements(array_values($subtypes));
     $subtypeComboBox->setElementsVal(array_keys($subtypes));
     $t1 = new Table();
     $t1->add($this->_createNameElement(_T("Owner name"), true, "/(@|[a-z0-9][a-z0-9-_.]*[a-z0-9]\$)/"), array("value" => $this->hostname, "required" => True));
     $t1->add(new TrFormElement(_T("Subtype"), $subtypeComboBox), array("value" => $subtypeIndex));
     $subtypeDiv = new Div(array("id" => $this->pn("subtypediv")));
     $subtypeDiv->setVisibility($isCustomSubtype);
     $t2 = new Table();
     $t2->add(new TrFormElement(_T("Custom subtype"), new InputTpl($this->pn("customsubtype"), '/^([0-5]?\\d?\\d?\\d?\\d|6[0-4]\\d\\d\\d|65[0-4]\\d\\d|655[0-2]\\d|6553[0-5])$/'), array("tooltip" => _T("Custom subtype ranges from 0 to 65535"))), array("value" => $customSubtype));
     $t3 = new Table();
     $t3->add(new TrFormElement(_T("Domain name of a host that has a server for the cell named by the owner name"), new InputTpl($this->pn("ownernamehost")), $this->_dnRulesTooltip()), array("value" => $this->values["ownernamehost"], "required" => True));
     return array($this->stackedUi($t1), $this->stackedUi($subtypeDiv, 0), $this->stackedUi($t2, 2), $this->stackedUi($t3));
 }
Esempio n. 2
0
/**
 * Form on user edit page
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _sshlpk_baseEdit($FH, $mode)
{
    // default value
    $show = false;
    if ($mode == 'edit' && hasSshKeyObjectClass($FH->getArrayOrPostValue("uid"))) {
        $show = true;
    } else {
        if ($FH->getValue("showsshkey") == "on") {
            $show = true;
        }
    }
    $f = new DivForModule(_T("Public SSH keys management", "sshlpk"), "#DDF");
    $f->push(new Table());
    $f->add(new TrFormElement(_T("Enable SSH keys management", "sshlpk"), new CheckboxTpl("showsshkey")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'sshkeydiv\');"'));
    $f->pop();
    $sshkeydiv = new Div(array("id" => "sshkeydiv"));
    $sshkeydiv->setVisibility($show);
    $f->push($sshkeydiv);
    $sshkeylist = array();
    if ($FH->getArrayOrPostValue("uid")) {
        if ($show && $mode == "edit") {
            $sshkeylist = getAllSshKey($FH->getArrayOrPostValue("uid"));
        }
    }
    if (count($sshkeylist) == 0) {
        $sshkeylist = array("0" => "");
    }
    $f->add(new TrFormElement('', new MultipleInputTpl("sshkeylist", _T("Public SSH Key", "sshlpk"))), $sshkeylist);
    $f->pop();
    return $f;
}
Esempio n. 3
0
/**
 * Form on user edit page
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _radius_baseEdit($FH, $mode)
{
    // default value
    $show = false;
    if ($mode == 'edit' && hasRadiusObjectClass($FH->getArrayOrPostValue("uid"))) {
        $show = true;
    } else {
        if ($FH->getValue("showradius") == "on") {
            $show = true;
        }
    }
    $f = new DivForModule(_T("Radius management", "radius"), "#E0FFDF");
    $f->push(new Table());
    $f->add(new TrFormElement(_T("Enable Radius management", "radius"), new CheckboxTpl("showradius")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'radiusdiv\');"'));
    $f->pop();
    $radiusdiv = new Div(array("id" => "radiusdiv"));
    $radiusdiv->setVisibility($show);
    $f->push($radiusdiv);
    $radiusCallingStationId = $FH->getArrayOrPostValue('radiusCallingStationId', 'array');
    $f->add(new TrFormElement('', new MultipleInputTpl("radiusCallingStationId", _T("Calling Station ID", "radius"))), $radiusCallingStationId);
    $f->pop();
    return $f;
}
Esempio n. 4
0
 function createUiContainers()
 {
     $isDefaultType = $this->values["type"] == "1" ? "checked" : "";
     $algorithmsMap = $this->algorithms();
     $algorithms = array_values($algorithmsMap);
     if (isset($algorithmsMap[$this->values["algorithm"]])) {
         $algorithmIndex = array_search($algorithmsMap[$this->values["algorithm"]], $algorithms);
         $customAlgorithm = "";
     } else {
         $algorithmIndex = count($algorithms) - 1;
         $customAlgorithm = $this->values["algorithm"];
     }
     $isCustomAlgorithm = $algorithmIndex == count($algorithms) - 1 ? "checked" : "";
     $algorithmComboBox = new ExtendedSelectItem($this->pn("algorithm"));
     $algorithmComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("algorithmdiv") . "',state);\"");
     $algorithmComboBox->setElements(array_values($algorithms));
     $algorithmComboBox->setElementsVal(array_keys($algorithms));
     $fingerprintTextarea = new TextareaTpl($this->pn("fingerprint"));
     $fingerprintTextarea->setCols(43);
     $t1 = new Table();
     $t1->add($this->_createNameElement(_T("Domain name")), array("value" => $this->hostname, "required" => True));
     $t1->add(new TrFormElement(_T("SHA-1 fingerprint"), new CheckboxTpl($this->pn("isdefaulttype"))), array("value" => $isDefaultType, "extraArg" => 'onclick="toggleVisibility(\'' . $this->pn("typediv") . '\');"'));
     $typeDiv = new Div(array("id" => $this->pn("typediv")));
     $typeDiv->setVisibility($isDefaultType ? "" : "checked");
     $t2 = new Table();
     $t2->add(new TrFormElement(_T("Custom fingerprint type"), new InputTpl($this->pn("customtype"), '/^\\d+$/'), array("tooltip" => _T("Fingerprint type ranges from 0 to 255"))), array("value" => $this->values["type"]));
     $t3 = new Table();
     $t3->add(new TrFormElement(_T("Algorithm"), $algorithmComboBox), array("value" => $algorithmIndex));
     $algorithmDiv = new Div(array("id" => $this->pn("algorithmdiv")));
     $algorithmDiv->setVisibility($isCustomAlgorithm);
     $t4 = new Table();
     $t4->add(new TrFormElement(_T("Custom algorithm"), new InputTpl($this->pn("customalgorithm"), '/^([01]?\\d?\\d|2[0-4]\\d|25[0-5])$/'), array("tooltip" => _T("Algorithm ranges from 0 to 255"))), array("value" => $customAlgorithm));
     $t5 = new Table();
     $t5->add(new TrFormElement(_T("Fingerprint"), $fingerprintTextarea, array("tooltip" => _T("The Fingerprint MUST be represented as a sequence of case-insensitive hexadecimal digits"))), array("value" => $this->values["fingerprint"]));
     return array($this->stackedUi($t1), $this->stackedUi($typeDiv, 0), $this->stackedUi($t2, 2), $this->stackedUi($t3), $this->stackedUi($algorithmDiv, 0), $this->stackedUi($t4, 2), $this->stackedUi($t5));
 }
Esempio n. 5
0
    function createUiContainers(){
                                                                                         
	$recordTypes = supportedRecordsTypes("all");
	$typeIndex = array_search(strtoupper($this->values["type"]),$recordTypes);
	if ($typeIndex === false){
    	    $typeIndex = count($recordTypes)-1;
            $customType = $this->values["type"];
        } else {
            $customType = "";
            //$typeIndex = 0;
        }
	$isCustomType = ($typeIndex == (count($recordTypes) - 1)) ? "checked" : ""; 
	
	$algorithmsMap = $this->algorithms();
	$algorithms = array_values($algorithmsMap);
	if (isset($algorithmsMap[$this->values["algorithm"]])){
	    $algorithmIndex = array_search($algorithmsMap[$this->values["algorithm"]], $algorithms);
	    $customAlgorithm = "";
	} else {
	    $algorithmIndex = count($algorithms) - 1;
	    $customAlgorithm = $this->values["algorithm"];
	}
	$isCustomAlgorithm = ($algorithmIndex == (count($algorithms) - 1)) ? "checked" : ""; 

	
        $typeComboBox = new ExtendedSelectItem($this->pn("type"));
 	$typeComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("typediv"). "',state);\"");
	$typeComboBox->setElements(array_values($recordTypes));
	$typeComboBox->setElementsVal(array_keys($recordTypes));
	
	$algorithmComboBox = new ExtendedSelectItem($this->pn("algorithm"));
 	$algorithmComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("algorithmdiv"). "',state);\"");
	$algorithmComboBox->setElements(array_values($algorithms));
	$algorithmComboBox->setElementsVal(array_keys($algorithms));
		
	$signatureTextarea = new TextareaTpl($this->pn("signature"));
	$signatureTextarea->setCols(43);
	
	
	$t1 = new Table();
	$t1->add($this->_createNameElement(_T("Domain name")),
		array("value" => $this->hostname, "required" => True));
	$t1->add(new TrFormElement(	_T("Domain name of the signer, generating this SIG"), 
					new InputTpl($this->pn("signer")), 
					$this->_dnRulesTooltip()),
		array("value" => $this->values["signer"], "required" => True));
	$t1->add(new TrFormElement(_T("Record type covered by this SIG"), $typeComboBox),
		array("value"=>$typeIndex));
	
	$typeDiv = new Div(array("id" => $this->pn("typediv")));
        $typeDiv->setVisibility($isCustomType);
	
	$t2 = new Table();
	$t2->add(new TrFormElement(_T("Custom record type"), new InputTpl($this->pn("customtype"),'/\w+/')),
		array("value"=>$customType));
		
	$t3 = new Table();
			
	$t3->add(new TrFormElement(_T("Algorithm"), $algorithmComboBox),
		array("value"=>$algorithmIndex));
		
	$algorithmDiv = new Div(array("id" => $this->pn("algorithmdiv")));
        $algorithmDiv->setVisibility($isCustomAlgorithm);
	
	$t4 = new Table();
	$t4->add(new TrFormElement(
		    _T("Custom algorithm"), 
		    new InputTpl($this->pn("customalgorithm"), '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'), 
		    array("tooltip" => _T("Algorithm ranges from 0 to 255"))
		    ),
		 array("value"=>$customAlgorithm));
	
	$t5 = new Table();
	$t5->add(new TrFormElement(
		    _T("Labels"), 
		    new InputTpl($this->pn("labels"), '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'),
		    array("tooltip" => _T("Define an unsigned count of how many labels there are in the original SIG record owner name not counting the null label for root and not counting any initial \"*\" for a wildcard.") . "<br>" .
   	        		       _T("Labels count ranges from 0 to 255"))
		    ),
		array("value" => $this->values["labels"], "required" => True));
		
	$t5->add(new TrFormElement(_T("Original TTL"), new BindRemainingTimeTpl($this->pn("ttl"))),
		array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["ttl"])));
	$t5->add(new TrFormElement(_T("Signature inception time"), new ExtendedDateTpl($this->pn("inception"))),
		array("value"=>$this->bindTimeToDateTplTime($this->values["inception"])));
	$t5->add(new TrFormElement(_T("Signature expiration time"), new ExtendedDateTpl($this->pn("expiration"))),
		array("value"=>$this->bindTimeToDateTplTime($this->values["expiration"])));
	$t5->add(new TrFormElement(
		    _T("Key tag"), 
		    new InputTpl($this->pn("keytag"), '/^([0-5]?\d?\d?\d?\d|6[0-4]\d\d\d|65[0-4]\d\d|655[0-2]\d|6553[0-5])$/'),
		    array("tooltip" => _T("Key tag is a decimal number that ranges from 0 to 65535"))
		    ),
		array("value" => $this->values["keytag"], "required" => True));
	$t5->add(new TrFormElement(_T("Signature"), $signatureTextarea),
		array("value" => $this->values["signature"]));
		
	
	return array($this->stackedUi($t1), $this->stackedUi($typeDiv,0), $this->stackedUi($t2,2),
		     $this->stackedUi($t3), $this->stackedUi($algorithmDiv,0), $this->stackedUi($t4,2),
		     $this->stackedUi($t5));
	
    }
Esempio n. 6
0
    function createUiContainers(){
                                                                                         
	$typesMap = $this->types();
	$types = array_values($typesMap);
	if (isset($typesMap[$this->values["type"]])){
	    $typeIndex = array_search($typesMap[$this->values["type"]], $types);
	    $customType = "";
	} else {
	    $typeIndex = count($types) - 1;
	    $customType = $this->values["type"];
	}
	$isCustomType = ($typeIndex == (count($types) - 1)) ? "checked" : ""; 
	
	$algorithmsMap = $this->algorithms();
	$algorithms = array_values($algorithmsMap);
	if (isset($algorithmsMap[$this->values["algorithm"]])){
	    $algorithmIndex = array_search($algorithmsMap[$this->values["algorithm"]], $algorithms);
	    $customAlgorithm = "";
	} else {
	    $algorithmIndex = count($algorithms) - 1;
	    $customAlgorithm = $this->values["algorithm"];
	}
	$isCustomAlgorithm = ($algorithmIndex == (count($algorithms) - 1)) ? "checked" : ""; 

	
        $typeComboBox = new ExtendedSelectItem($this->pn("type"));
 	$typeComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("typediv"). "',state);\"");
	$typeComboBox->setElements(array_values($types));
	$typeComboBox->setElementsVal(array_keys($types));
	
	$algorithmComboBox = new ExtendedSelectItem($this->pn("algorithm"));
 	$algorithmComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("algorithmdiv"). "',state);\"");
	$algorithmComboBox->setElements(array_values($algorithms));
	$algorithmComboBox->setElementsVal(array_keys($algorithms));
		
	$certificateTextarea = new TextareaTpl($this->pn("certificate"));
	$certificateTextarea->setCols(43);
	
	
	$t1 = new Table();
	$t1->add($this->_createNameElement(_T("Domain name")),
		array("value" => $this->hostname, "required" => True));
	$t1->add(new TrFormElement(_T("Type"), $typeComboBox),
		array("value"=>$typeIndex));
	
	$typeDiv = new Div(array("id" => $this->pn("typediv")));
        $typeDiv->setVisibility($isCustomType);
	
	$t2 = new Table();
	$t2->add(new TrFormElement(
		    _T("Custom type"), 
		    new InputTpl($this->pn("customtype"),'/^([0-5]?\d?\d?\d?\d|6[0-4]\d\d\d|65[0-4]\d\d|655[0-2]\d|6553[0-5])$/'),
		    array("tooltip" => _T("Type ranges from 0 to 65535"))
		    ),
		array("value"=>$customType));
		
	$t3 = new Table();
			
	$t3->add(new TrFormElement(_T("Algorithm"), $algorithmComboBox),
		array("value"=>$algorithmIndex));
		
	$algorithmDiv = new Div(array("id" => $this->pn("algorithmdiv")));
        $algorithmDiv->setVisibility($isCustomAlgorithm);
	
	$t4 = new Table();
	$t4->add(new TrFormElement(
		    _T("Custom algorithm"), 
		    new InputTpl($this->pn("customalgorithm"), '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'), 
		    array("tooltip" => _T("Algorithm ranges from 0 to 255"))
		    ),
		 array("value"=>$customAlgorithm));
	
	$t5 = new Table();
	
	 $t5->add(new TrFormElement(
	                 _T("Key tag"), 
	                 new InputTpl($this->pn("keytag"), '/^([0-5]?\d?\d?\d?\d|6[0-4]\d\d\d|65[0-4]\d\d|655[0-2]\d|6553[0-5])$/'),
	                 array("tooltip" => _T("Key tag is a decimal number that ranges from 0 to 65535"))
	                ),
	        array("value" => $this->values["keytag"], "required" => True));
	                                                                                                 
	
	$t5->add(new TrFormElement(_T("Certificate"), $certificateTextarea),
		array("value" => $this->values["certificate"]));
		
	
	return array($this->stackedUi($t1), $this->stackedUi($typeDiv,0), $this->stackedUi($t2,2),
		     $this->stackedUi($t3), $this->stackedUi($algorithmDiv,0), $this->stackedUi($t4,2),
		     $this->stackedUi($t5));
	
    }
Esempio n. 7
0
File: index.php Progetto: psyray/mmc
#        new TrFormElement(_T("This server is a WINS server"),new CheckboxTpl("wins support")),
#        array("value" => getCheckedState($smb, "wins support"))
#);
$value = "";
#if ($smb["hashomes"]) $value = "checked";
$f->add(new TrFormElement(_T("Share user's homes"), new CheckboxTpl("hashomes")), array("value" => $value));
$value = "";
$hasProfiles = false;
// if ($smb['logon path']) {
//     $value = "checked";
//     $hasProfiles = true;
// }
$f->add(new TrFormElement(_T("Use network profiles for users"), new CheckboxTpl("hasprofiles"), array("tooltip" => _T("Activate roaming profiles for all users.", "samba"))), array("value" => $value, "extraArg" => 'onclick=toggleVisibility("profilespath")'));
$f->pop();
$pathdiv = new Div(array("id" => "profilespath"));
$pathdiv->setVisibility($hasProfiles);
$f->push($pathdiv);
$f->push(new Table());
# default value for profile path
$value = "\\\\%N\\profiles\\%U";
if ($hasProfiles) {
    $value = $smb['logon path'];
}
$f->add(new TrFormElement(_T("Network path for profiles"), new InputTpl("logon path"), array("tooltip" => _T("The share must exist and be world-writable.", "samba"))), array("value" => $value));
$f->pop();
$f->pop();
$f->push(new DivExpertMode());
$f->push(new Table());
$syncTpl = new SelectItem("ldap passwd sync");
$labels = array(_T('Yes'), _T('No'), _T('Only (for smbk5pwd)'));
$values = array('yes', 'no', 'only');
Esempio n. 8
0
 function createUiContainers($editMode = false)
 {
     if (preg_match("/_?(.*)\\._(.*)/", $this->hostname, $vals)) {
         $service = $vals[1];
         $protoIndex = array_search(strtoupper($vals[2]), $this->protocols());
         if ($protoIndex === false) {
             $protoIndex = count($this->protocols()) - 1;
             $customProto = $vals[2];
         }
     } else {
         $service = "";
         $protoIndex = 0;
     }
     $isAnyService = "";
     if ($service == "*") {
         $service = "";
         $isAnyService = "checked";
     }
     $hasTarget = "checked";
     if ($this->values["target"] == ".") {
         $hasTarget = "";
         $this->values["target"] = "";
     }
     $isCustomProto = $protoIndex == count($this->protocols()) - 1 ? "checked" : "";
     $protoComboBox = new ExtendedSelectItem($this->pn("proto"));
     $protoComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("protodiv") . "',state);\"");
     $protoComboBox->setElements(array_values($this->protocols()));
     $protoComboBox->setElementsVal(array_keys($this->protocols()));
     $t1 = new Table();
     $t1->add(new TrFormElement(_T("It can be an any service, if checked"), new CheckboxTpl($this->pn("isAnyService"))), array("value" => $isAnyService, "extraArg" => 'onclick="toggleVisibility(\'' . $this->pn("servicediv") . '\');"'));
     $servicediv = new Div(array("id" => $this->pn("servicediv")));
     $servicediv->setVisibility(!$isAnyService);
     $t2 = new Table();
     $t2->add(new TrFormElement(_T("Service"), new InputTpl($this->pn("service"))), array("value" => $service));
     $t3 = new Table();
     $t3->add(new TrFormElement(_T("Protocol"), $protoComboBox), array("value" => $protoIndex));
     $protodiv = new Div(array("id" => $this->pn("protodiv")));
     $protodiv->setVisibility($isCustomProto);
     $t4 = new Table();
     $t4->add(new TrFormElement(_T("Custom protocol name"), new InputTpl($this->pn("customProto"))), array("value" => $customProto));
     $t5 = new Table();
     $t5->add(new TrFormElement(_T("There is a host that will provide this service, if checked"), new CheckboxTpl($this->pn("hasTarget"))), array("value" => $hasTarget, "extraArg" => 'onclick="toggleVisibility(\'' . $this->pn("targetdiv") . '\');"'));
     $targetdiv = new Div(array("id" => $this->pn("targetdiv")));
     $targetdiv->setVisibility($hasTarget);
     $t6 = new Table();
     $t6->add(new TrFormElement(_T("Host that will provide this service"), new InputTpl($this->pn("target"))), array("value" => $this->values["target"]));
     $t7 = new Table();
     $t7->add(new TrFormElement(_T("Port"), new InputTpl($this->pn("port"), '/\\d+/')), array("value" => $this->values["port"], "required" => True));
     $t7->add(new TrFormElement(_T("Priority"), new InputTpl($this->pn("priority"), '/\\d+/')), array("value" => $this->values["priority"], "required" => True));
     $t7->add(new TrFormElement(_T("Weight"), new InputTpl($this->pn("weight"), '/\\d+/')), array("value" => $this->values["weight"], "required" => True));
     return array($this->stackedUi($t1), $this->stackedUi($servicediv, 0), $this->stackedUi($t2, 2), $this->stackedUi($t3), $this->stackedUi($protodiv, 0), $this->stackedUi($t4, 2), $this->stackedUi($t5), $this->stackedUi($targetdiv, 0), $this->stackedUi($t6, 2), $this->stackedUi($t7));
 }
Esempio n. 9
0
 $disk = $disk + 1;
 $msg = sprintf(_T("Hard disk number: %d", "imaging"), $disk);
 $inputvar = "check_disk[{$disk}][0]";
 if (isset($parts["exclude"])) {
     $value = "";
     unset($parts["exclude"]);
 } else {
     $value = "CHECKED";
 }
 $divid = "disk_div{$disk}";
 $f->push(new DivForModule($msg, "#FFF"));
 $f->push(new Table());
 $f->add(new TrFormElement(_T("Select this hard disk", "imaging"), new CheckboxTpl($inputvar)), array("value" => $value, "extraArg" => 'onclick="jQuery(\'' . $divid . '\').toggle();"'));
 $f->pop();
 $diskdiv = new Div(array("id" => $divid));
 $diskdiv->setVisibility($value == "CHECKED");
 $f->push($diskdiv);
 $f->push(new Table());
 ksort($parts);
 foreach ($parts as $part) {
     $partnum = $part['num'] + 1;
     $ptype = $parttype[$part['type']];
     $length = humanSize($part['length'] * 512);
     $msg = sprintf(_T("Partition number: %d", "imaging"), $partnum);
     $inputvar = "check_disk[{$disk}][{$partnum}]";
     $text = "{$ptype} {$length}";
     if (isset($part["exclude"])) {
         $value = "";
         unset($part["exclude"]);
     } else {
         $value = "CHECKED";
Esempio n. 10
0
/**
 * Form on user edit page
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _samba_baseEdit($FH, $mode)
{
    // default values
    $hasSmb = false;
    $show = true;
    // get smb config info
    $smbInfo = xmlCall("samba.getSmbInfo", null);
    // fetch ldap updated info if we can
    if ($mode == 'edit') {
        $uid = $FH->getArrayOrPostValue("uid");
        if (hasSmbAttr($uid)) {
            $hasSmb = true;
        } else {
            $show = false;
        }
        // show Samba plugin in case of error
        if ($FH->getValue("isSamba") == "on") {
            $show = true;
        }
    } else {
        if ($FH->getValue("isSamba") == "off") {
            $show = false;
        }
    }
    if ($hasSmb && userPasswdHasExpired($uid)) {
        $em = new ErrorMessage(_T("Samba properties", "samba") . ' : ' . _T("The password of this account has expired.", "samba"));
        $em->display();
    }
    if ($hasSmb && isLockedUser($uid)) {
        $em = new ErrorMessage(_T("Samba properties", "samba") . ' : ' . _T("This account is locked.", "samba"));
        $em->display();
    }
    $f = new DivForModule(_T("Samba properties", "samba"), "#EFE");
    $f->push(new Table());
    $f->add(new TrFormElement(_T("Samba access", "samba"), new CheckboxTpl("isSamba")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'smbdiv\');"'));
    $f->pop();
    $smbdiv = new Div(array("id" => "smbdiv"));
    $smbdiv->setVisibility($show);
    $f->push($smbdiv);
    $f->push(new Table());
    $checked = "";
    if ($hasSmb && !isEnabledUser($uid) || $FH->getArrayOrPostValue('isSmbDesactive') == 'on') {
        $checked = "checked";
        // Display an error message on top of the page
        $em = new ErrorMessage(_T("Samba properties", "samba") . ' : ' . _T("This account is disabled", "samba"));
        $em->display();
    }
    $f->add(new TrFormElement(_T("User is disabled, if checked", "samba"), new CheckboxTpl("isSmbDesactive"), array("tooltip" => _T("Disable samba user account", 'samba'))), array("value" => $checked));
    $checked = "";
    if ($hasSmb && isLockedUser($uid) || $FH->getArrayOrPostValue('isSmbLocked') == 'on') {
        $checked = "checked";
    }
    $f->add(new TrFormElement(_T("User is locked, if checked", "samba"), new CheckboxTpl("isSmbLocked"), array("tooltip" => _T("Lock samba user access<p>User can be locked after too many failed log.</p>", 'samba'))), array("value" => $checked));
    # display this options only if we are PDC
    if ($smbInfo["pdc"]) {
        # if no global profile set, we can set a roaming profile for this user
        if (!$smbInfo["logon path"]) {
            $hasProfile = false;
            $checked = "";
            $value = "";
            if ($FH->getArrayOrPostValue("sambaProfilePath")) {
                $hasProfile = true;
                $checked = "checked";
                $value = $FH->getArrayOrPostValue('sambaProfilePath');
            }
            $f->add(new TrFormElement(_T("Use network profile, if checked", "samba"), new CheckboxTpl("hasProfile")), array("value" => $checked, "extraArg" => 'onclick="toggleVisibility(\'pathdiv\')"'));
            $f->pop();
            $pathdiv = new Div(array('id' => 'pathdiv'));
            $pathdiv->setVisibility($hasProfile);
            $f->push($pathdiv);
            $f->push(new Table());
            $f->add(new TrFormElement(_T("Network path for user's profile", "samba"), new InputTpl("sambaProfilePath")), array("value" => $value));
            $f->pop();
            $f->pop();
            $f->push(new Table());
        }
        $checked = "";
        if (($FH->getArrayOrPostValue('sambaPwdMustChange') == "0" || $FH->getArrayOrPostValue('sambaPwdMustChange') == "on") && $FH->getArrayOrPostValue('sambaPwdLastSet') == "0") {
            $checked = "checked";
        }
        $f->add(new TrFormElement(_T("User must change password on next logon, <br/>if checked", "samba"), new CheckboxTpl("sambaPwdMustChange")), array("value" => $checked));
        $value = "";
        if ($FH->getArrayOrPostValue('sambaKickoffTime')) {
            $value = strftime("%Y-%m-%d %H:%M:%S", $FH->getArrayOrPostValue('sambaKickoffTime'));
        }
        $f->add(new TrFormElement(_T("Account expiration", "samba"), new DynamicDateTpl("sambaKickoffTime"), array("tooltip" => _T("Specifies the date when the user will be locked down and cannot login any longer. If this attribute is omitted, then the account will never expire.", 'samba'))), array("value" => $value, "ask_for_never" => 1));
        $f->pop();
        // Expert mode display
        $f->push(new DivExpertMode());
        $f->push(new Table());
        $d = array(_T("Opening script session", "samba") => "sambaLogonScript", _T("Base directory path", "samba") => "sambaHomePath", _T("Connect base directory on network drive", "samba") => "sambaHomeDrive");
        foreach ($d as $description => $field) {
            $f->add(new TrFormElement($description, new InputTpl($field)), array("value" => $FH->getArrayOrPostValue($field)));
        }
        $f->pop();
    }
    $f->pop();
    $f->pop();
    return $f;
}
Esempio n. 11
0
File: edit.php Progetto: psyray/mmc
            new NotifyWidgetSuccess(_T("SSH public keys updated.", "sshlpk"));
        }
    } else {
        if (!$showSshkeys && hasSshKeyObjectClass($uid)) {
            delSSHKeyObjectClass($uid);
            if (!isXMLRPCError()) {
                new NotifyWidgetSuccess(_T("SSH public keys attributes deleted.", "sshlpk"));
            }
        }
    }
    redirectTo(urlStrRedirect('base/users/sshkeys'));
}
$p = new PageGenerator(_T("Change your SSH keys", "sshlpk"));
$p->setSideMenu($sidemenu);
$p->display();
$show = hasSshKeyObjectClass($uid);
$f = new ValidatingForm();
$f->push(new Table());
$f->add(new TrFormElement(_T("Enable SSH keys management", "sshlpk"), new CheckboxTpl("showusersshkey")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'sshkeydiv\');"'));
$f->pop();
$sshkeydiv = new Div(array("id" => "sshkeydiv"));
$sshkeydiv->setVisibility($show);
$f->push($sshkeydiv);
if ($show) {
    $sshkeys = getAllSshKey($uid);
} else {
    $sshkeys = array("0" => "");
}
$f->add(new TrFormElement('', new MultipleInputTpl("sshuserkeys", _T("Public SSH Key", "sshlpk"))), $sshkeys);
$f->addValidateButton("bssh");
$f->display();
Esempio n. 12
0
/**
 * Form on user edit page
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _mail_baseEdit($FH, $mode)
{
    $attrs = getMailAttributes();
    $f = new DivForModule(_T("Mail properties", "mail"), "#FFD");
    // Show plugin details by default
    $show = true;
    // User has not mail attributes by default
    $hasMail = false;
    // User is not disabled by default
    $disabledMail = false;
    if ($mode == "edit") {
        // check user actual values
        $uid = $FH->getArrayOrPostValue('uid');
        if (hasMailObjectClass($uid)) {
            $hasMail = true;
        } else {
            $show = false;
        }
        if ($FH->getArrayOrPostValue($attrs['mailenable']) == "NONE") {
            $disabledMail = true;
            // Display an error message on top of the page
            $em = new ErrorMessage(_T("Mail properties", "samba") . ' : ' . _T("Mail delivery is disabled", "samba"));
            $em->display();
        }
    }
    if ($mode == "add" && $FH->getValue('mailaccess') == 'off') {
        $show = false;
    }
    $f->push(new Table());
    $f->add(new TrFormElement(_T("Mail access", "mail"), new CheckboxTpl("mailaccess")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'maildiv\');"'));
    $f->pop();
    $maildiv = new Div(array("id" => "maildiv"));
    $maildiv->setVisibility($show);
    $f->push($maildiv);
    $f->push(new Table());
    $f->add(new TrFormElement(_T("Mail delivery is disabled, if checked", "mail"), new CheckboxTpl("maildisable")), array("value" => $disabledMail ? "checked" : ""));
    $f->add(new TrFormElement(_T("Mail quota (in kB)", "mail"), new QuotaTpl($attrs['mailuserquota'], '/^[0-9]*$/')), array("value" => $FH->getArrayOrPostValue($attrs['mailuserquota'])));
    $f->pop();
    if (hasVDomainSupport()) {
        $m = new MultipleInputTpl("maildrop", _T("Forward to", "mail"));
        /* In virtual domain mode, maildrop must be an email address */
        $m->setRegexp('/^[0-9a-zA-Z_.+\\-]+@[0-9a-zA-Z.\\-]+$/');
    } else {
        $m = new MultipleInputTpl($attrs['maildrop'], _T("Mail drop", "mail"));
        $m->setRegexp('/^([0-9a-zA-Z_.+@\\-])+$/');
    }
    $f->add(new FormElement(_T("Mail drop", "mail"), $m), $FH->getArrayOrPostValue($attrs['maildrop'], 'array'));
    $m = new MultipleInputTpl($attrs['mailalias'], _T("Mail alias", "mail"));
    $m->setRegexp('/^([0-9a-zA-Z@_.+\\-])+$/');
    $f->add(new FormElement(_T("Mail alias", "mail"), $m), $FH->getArrayOrPostValue($attrs['mailalias'], 'array'));
    if (hasVDomainSupport()) {
        $f->push(new DivExpertMode());
        $f->push(new Table());
        $f->add(new TrFormElement(_T("Mail delivery path", "mail"), new InputTpl($attrs['mailbox'])), array("value" => $FH->getArrayOrPostValue($attrs['mailbox'])));
        $f->add(new TrFormElement(_T("Mail server host", "mail"), new IA5InputTpl($attrs['mailhost'])), array("value" => $FH->getArrayOrPostValue($attrs['mailhost'])));
        $f->pop();
        $f->pop();
    }
    if (hasZarafaSupport()) {
        $f->push(new DivForModule(_T("Zarafa properties", "mail"), "#FFD"));
        $f->push(new Table());
        $checked = false;
        if ($FH->getArrayOrPostValue('zarafaAdmin') == "on" || $FH->getArrayOrPostValue('zarafaAdmin') == "1") {
            $checked = true;
        }
        $f->add(new TrFormElement(_T("Administrator of Zarafa", "mail"), new CheckboxTpl("zarafaAdmin")), array("value" => $checked ? "checked" : ""));
        $checked = false;
        if ($FH->getArrayOrPostValue('zarafaSharedStoreOnly') == "on" || $FH->getArrayOrPostValue('zarafaSharedStoreOnly') == "1") {
            $checked = true;
        }
        $f->add(new TrFormElement(_T("Shared store", "mail"), new CheckboxTpl("zarafaSharedStoreOnly")), array("value" => $checked ? "checked" : ""));
        $checked = false;
        if ($FH->getArrayOrPostValue('zarafaAccount') == "on" || $FH->getArrayOrPostValue('zarafaAccount') == "1") {
            $checked = true;
        }
        $f->add(new TrFormElement(_T("Zarafa account", "mail"), new CheckboxTpl("zarafaAccount")), array("value" => $checked == "on" ? "checked" : ""));
        $checked = false;
        if ($FH->getArrayOrPostValue('zarafaHidden') == "on" || $FH->getArrayOrPostValue('zarafaHidden') == "1") {
            $checked = true;
        }
        $f->add(new TrFormElement(_T("Hide from Zarafa address book", "mail"), new CheckboxTpl("zarafaHidden")), array("value" => $checked ? "checked" : ""));
        $f->pop();
        $sendas = new MultipleInputTpl("zarafaSendAsPrivilege", _T("Zarafa send as user list", "mail"));
        $sendas->setRegexp('/^([0-9a-zA-Z@_.\\-])+$/');
        $f->add(new FormElement("", $sendas), $FH->getArrayOrPostValue("zarafaSendAsPrivilege", "array"));
        $f->pop();
    }
    $f->pop();
    if ($mode == 'add' && !hasVDomainSupport()) {
        //suggest only on add user
        ?>
        <script type="text/javascript" language="javascript">
        var autoCreate = function(e) {
            $('maildrop[0]').value = $F('uid').toLowerCase();
        };
        Event.observe(window, 'load', function() {
            $('uid').observe('keyup', autoCreate);
        });
        </script>
        <?php 
    }
    return $f;
}
Esempio n. 13
0
        $resultPopup->add('<div class="alert alert-success">' . $result . '</div>');
        handleServicesModule($resultPopup, array($services[1] => "DHCP"));
    }
    if (!$error) {
        header("Location: " . urlStrRedirect("network/network/services"));
        exit;
    }
}
$f = new ValidatingForm();
$f->addValidateButton("bdhcpfailover");
$f->addCancelButton("breset");
$f->push(new Table());
$f->add(new TrFormElement(_T("Enable DHCP failover"), new CheckboxTpl("dhcp_failover")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'dhcpfailoverdiv\');"'));
$f->pop();
$dhcpfailoverdiv = new Div(array("id" => "dhcpfailoverdiv"));
$dhcpfailoverdiv->setVisibility($show);
$f->push($dhcpfailoverdiv);
$f->push(new Table());
$f->add(new TrFormElement(_T("Primary DHCP server name"), new HiddenTpl("primary")), array("value" => $FH->getArrayOrPostValue("primary")));
$f->add(new TrFormElement(_T("Primary DHCP IP address"), new IPInputTpl("primaryIp")), array("value" => $FH->getArrayOrPostValue("primaryIp"), "required" => true));
$f->pop();
$f->push(new DivExpertMode());
$f->push(new Table());
$f->add(new TrFormElement(_T("Primary DHCP failover port"), new InputTpl("primaryPort"), array("tooltip" => _T("TCP port where the server listen to failover messages", "network"))), array("value" => $FH->getArrayOrPostValue("primaryPort"), "required" => true));
$f->pop();
$f->pop();
$f->push(new Table());
$f->add(new TrFormElement(_T("Secondary DHCP server name"), new InputTpl("secondary")), array("value" => $FH->getArrayOrPostValue("secondary"), "required" => true));
$f->add(new TrFormElement(_T("Secondary DHCP IP address"), new IPInputTpl("secondaryIp")), array("value" => $FH->getArrayOrPostValue("secondaryIp"), "required" => true));
$f->pop();
$f->push(new DivExpertMode());
Esempio n. 14
0
$tooltip .= "%s";
$tooltip .= _T("(DHCP option number 66)");
$tooltip = sprintf($tooltip, "<br/>");
$f->add(new TrFormElement(_T("TFTP server name"), new IA5InputTpl("tftp-server-name"), array("tooltip" => $tooltip)), array("value" => $options["tftp-server-name"]));
$f->pop();
$f->push(new Table());
$f->add(new TrFormElement(_T("DHCP client lease time (in seconds)"), new HiddenTpl("")));
$f->add(new TrFormElement(_T("Minimum lease time"), new NumericInputTpl("min-lease-time"), array("tooltip" => _T("Minimum length in seconds that will be assigned to a lease."))), array("value" => $statements["min-lease-time"]));
$f->add(new TrFormElement(_T("Default lease time"), new NumericInputTpl("default-lease-time"), array("tooltip" => _T("Lengh in seconds that will be assigned to a lease if the client requesting the lease does not ask for a specific expiration time."))), array("value" => $statements["default-lease-time"]));
$f->add(new TrFormElement(_T("Maximum lease time"), new NumericInputTpl("max-lease-time"), array("tooltip" => _T("Maximum length in seconds that will be assigned to a lease."))), array("value" => $statements["max-lease-time"]));
$f->pop();
$f->push(new Table());
$f->add(new TrFormElement(_T("Dynamic pool(s) for non-registered DHCP clients", "network"), new CheckboxTpl("hassubnetpools")), array("value" => $hasSubnetPools, "extraArg" => 'onclick="toggleVisibility(\'poolsdiv\');"'));
$f->pop();
$poolsdiv = new Div(array("id" => "poolsdiv"));
$poolsdiv->setVisibility($hasSubnetPools);
$f->push($poolsdiv);
$f->push(new Table());
$f->add(new TrFormElement(_T("Dynamic pools"), new MultipleRangeInputTpl("subnetpools")), array("value" => $poolsRanges));
$f->pop();
// pop table
$f->pop();
// pop div
$f->pop();
// pop the form
if ($_GET["action"] == "subnetadd") {
    $f->addButton("badd", _("Create"));
} else {
    $f->addButton("bedit", _("Confirm"));
}
$f->display();
Esempio n. 15
0
File: key.php Progetto: neoclust/mmc
    function createUiContainers(){

	$protocolsMap = $this->protocols();
	$protocols = array_values($protocolsMap);
	if (isset($protocolsMap[$this->values["protocol"]])){
	    $protocolIndex = array_search($protocolsMap[$this->values["protocol"]], protocols);
	    $customProtocol = "";
	} else {
	    $protocolIndex = count($protocols) - 1;
	    $customProtocol = $this->values["protocol"];
	}
	$isCustomProtocol = ($protocolIndex == (count($protocols) - 1)) ? "checked" : ""; 

	
	$algorithmsMap = $this->algorithms();
	$algorithms = array_values($algorithmsMap);
	if (isset($algorithmsMap[$this->values["algorithm"]])){
	    $algorithmIndex = array_search($algorithmsMap[$this->values["algorithm"]], $algorithms);
	    $customAlgorithm = "";
	} else {
	    $algorithmIndex = count($algorithms) - 1;
	    $customAlgorithm = $this->values["algorithm"];
	}
	$isCustomAlgorithm = ($algorithmIndex == (count($algorithms) - 1)) ? "checked" : ""; 

	$fh = new FlagsHandler($this->values["flags"]);
	
	$usePolicyIndex = $fh->usePolicy();
	$usePolicies = $fh->usePolicies();
	$hasSignature = ($usePolicyIndex < (count($usePolicies) - 1)) ? "checked" : ""; 

	$nameTypeIndex = $fh->nameType();
	$nameTypes = $fh->nameTypes();
	
	$hasUpdate = $fh->zoneUpdate() ? "checked" : "";
	$hasStrongUpdate = $fh->strongUpdate() ? "checked" : "";	
	$hasUniqueNameUpdate = $fh->nameUpdate() ? "checked" : "";	
	
        $protocolComboBox = new ExtendedSelectItem($this->pn("protocol"));
 	$protocolComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("protocoldiv"). "',state);\"");
	$protocolComboBox->setElements(array_values($protocols));
	$protocolComboBox->setElementsVal(array_keys($protocols));
	
	$algorithmComboBox = new ExtendedSelectItem($this->pn("algorithm"));
 	$algorithmComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("algorithmdiv"). "',state);\"");
	$algorithmComboBox->setElements(array_values($algorithms));
	$algorithmComboBox->setElementsVal(array_keys($algorithms));
	
	$usePolicyComboBox = new ExtendedSelectItem($this->pn("usepolicy"));
 	$usePolicyComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex < this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("signaturediv"). "',state);\"");
	$usePolicyComboBox->setElements(array_values($usePolicies));
	$usePolicyComboBox->setElementsVal(array_keys($usePolicies));
	
	$nameTypeComboBox = new ExtendedSelectItem($this->pn("nametype"));
	$nameTypeComboBox->setElements(array_values($nameTypes));
	$nameTypeComboBox->setElementsVal(array_keys($nameTypes));
 	
	
		
	$signatureTextarea = new TextareaTpl($this->pn("signature"));
	$signatureTextarea->setCols(43);
	
	$t1 = new Table();
	$t1->add($this->_createNameElement(_T("Domain name")),
		array("value" => $this->hostname, "required" => True));
		
	$t1->add(new TrFormElement(_T("Protocol"), $protocolComboBox),
		array("value"=>$protocolIndex));
	
	$protocolDiv = new Div(array("id" => $this->pn("protocoldiv")));
        $protocolDiv->setVisibility($isCustomProtocol);
	
	$t2 = new Table();
	$t2->add(new TrFormElement(
		    _T("Custom protocol"), 
		    new InputTpl($this->pn("customprotocol"), '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'),
		    array("tooltip" => _T("Protocol ranges from 0 to 255"))
		    ),
		array("value"=>$customProtocol));
		
	$t3 = new Table();
			
	$t3->add(new TrFormElement(_T("Algorithm"), $algorithmComboBox),
		array("value"=>$algorithmIndex));
		
	$algorithmDiv = new Div(array("id" => $this->pn("algorithmdiv")));
        $algorithmDiv->setVisibility($isCustomAlgorithm);
	
	$t4 = new Table();
	$t4->add(new TrFormElement(
		    _T("Custom algorithm"), 
		    new InputTpl($this->pn("customalgorithm"), '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'), 
		    array("tooltip" => _T("Algorithm ranges from 0 to 255"))
		    ),
		 array("value"=>$customAlgorithm));
	
	$t5 = new Table();
	
	$t5->add(new TrFormElement( _T("Use policy"), $usePolicyComboBox),
		array("value" => $usePolicyIndex));
	
	$t5->add(new TrFormElement( _T("Name type"), $nameTypeComboBox),
		array("value" => $nameTypeIndex));
	
	$t5->add(new TrFormElement(
		    _T("Update mode for this zone"), 
		    new CheckboxTpl($this->pn("zoneupdate")),
		    array("tooltip" => _T("If checked, this key is authorized to attach, detach, and move zones by creating and deleting NS, glue A, and zone record(s).  If unchecked, the key can not authorize any update that would effect such records"))
		                  ),
		array("value" => $hasUpdate));

	$t5->add(new TrFormElement( 
		    _T("Strong update"), 
		    new CheckboxTpl($this->pn("strongupdate")),
		    array("tooltip" => _T("If checked, this key is authorized to add and delete records even if there are other records with the same owner name and class that are authenticated by a SIG signed with a different dynamic update KEY. If unchecked, the key can only authorize updates where any existing records of the same owner and class are authenticated by a SIG using the same key."))
		    ),
		array("value" => $hasStrongUpdate));
		
	$t5->add(new TrFormElement( 
		    _T("Unique name update"), 
		    new CheckboxTpl($this->pn("uniquenameupdate")),
		    array("tooltip" => _T("If checked, this key is authorized to add and update records for only a single owner name."))  
		    ),
		array("value" => $hasUniqueNameUpdate));
	
	$signatureDiv = new Div(array("id" => $this->pn("signaturediv")));
        $signatureDiv->setVisibility($hasSignature);
	
	$t6 = new Table();
	$t6->add(new TrFormElement(_T("Signature"), $signatureTextarea),
		array("value" => $this->values["signature"]));
		
	
	return array($this->stackedUi($t1), $this->stackedUi($protocolDiv,0), $this->stackedUi($t2,2),
		     $this->stackedUi($t3), $this->stackedUi($algorithmDiv,0), $this->stackedUi($t4,2),
		     $this->stackedUi($t5), $this->stackedUi($signatureDiv,0), $this->stackedUi($t6,2));
	
    }
Esempio n. 16
0
// Add rule form
print '<script type="text/javascript" src="modules/shorewall/includes/functions.js"></script><br />';
$t = new TitleElement(_T("Add port forwarding rule"), 2);
$t->display();
$f = new ValidatingForm(array("id" => "rule"));
$f->push(new Table());
$macros = getServices();
$services = array("", _T("Custom...")) + $macros;
$servicesVals = array("", "custom") + $macros;
$serviceTpl = new SelectItem("service", "toggleCustom");
$serviceTpl->setElements($services);
$serviceTpl->setElementsVal($servicesVals);
$f->add(new TrFormElement(_T("Service"), $serviceTpl));
$f->pop();
$customDiv = new Div(array("id" => "custom"));
$customDiv->setVisibility(false);
$f->push($customDiv);
$f->push(new Table());
$protoTpl = new SelectItem("proto");
$protoTpl->setElements(array("", "TCP", "UDP"));
$protoTpl->setElementsVal(array("", "tcp", "udp"));
$f->add(new TrFormElement(_T("Protocol"), $protoTpl));
$f->add(new TrFormElement(_T("Port(s)"), new InputTpl("port", "/^[0-9:,]+\$/"), array("tooltip" => _T("You can specify multiple ports using ',' as separator (eg: 22,34,56). Port ranges can be defined with ':' (eg: 3400:3500 - from port 3400 to port 3500)."))), array("value" => ""));
$f->pop();
$f->pop();
$f->push(new Table());
$zones = getZonesInterfaces($src);
if (count($zones) > 1) {
    $sources = array();
    $sourcesVals = array();
    foreach ($zones as $zone) {
Esempio n. 17
0
$f->add(new TrFormElement(_T("Description", "ppolicy"), new InputTpl("description")), array("value" => $FH->getArrayOrPostValue("description")));
$f->add(new TrFormElement(_T("Minimum length", "ppolicy"), new InputTpl("pwdMinLength", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdMinLength"))), array("value" => $FH->getArrayOrPostValue("pwdMinLength")));
$f->add(new TrFormElement(_T("Password quality check", "ppolicy"), new InputTpl("pwdCheckQuality", '/^[012]$/'), array("tooltip" => ppolicyTips("pwdCheckQuality"))), array("value" => $FH->getArrayOrPostValue("pwdCheckQuality")));
$f->add(new TrFormElement(_T("Minimum age (seconds)", "ppolicy"), new InputTpl("pwdMinAge", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdMinAge"))), array("value" => $FH->getArrayOrPostValue("pwdMinAge")));
$f->add(new TrFormElement(_T("Maximum age (seconds)", "ppolicy"), new InputTpl("pwdMaxAge", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdMaxAge"))), array("value" => $FH->getArrayOrPostValue("pwdMaxAge")));
$f->add(new TrFormElement(_T("Number of grace authentications", "ppolicy"), new InputTpl("pwdGraceAuthNLimit", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdGraceAuthNLimit"))), array("value" => $FH->getArrayOrPostValue("pwdGraceAuthNLimit")));
if ($FH->getArrayOrPostValue("pwdMustChange") == 'TRUE' || $FH->getArrayOrPostValue("pwdMustChange") == 'on') {
    $pwdMustChange = "checked";
} else {
    $pwdMustChange = "";
}
$f->add(new TrFormElement(_T("Force users to change their passwords on the first connection ?", "ppolicy"), new CheckboxTpl("pwdMustChange"), array("tooltip" => ppolicyTips("pwdMustChange"))), array("value" => $pwdMustChange));
$f->add(new TrFormElement(_T("Password history", "ppolicy"), new InputTpl("pwdInHistory", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdInHistory"))), array("value" => $FH->getArrayOrPostValue("pwdInHistory")));
if ($FH->getArrayOrPostValue("pwdLockout") == 'TRUE' || $FH->getArrayOrPostValue("pwdLockout") == 'on') {
    $pwdLockout = "checked";
} else {
    $pwdLockout = "";
}
$f->add(new TrFormElement(_T("Preventive user lockout ?", "ppolicy"), new CheckboxTpl("pwdLockout"), array("tooltip" => ppolicyTips("pwdLockout"))), array("value" => $pwdLockout, "extraArg" => 'onclick="toggleVisibility(\'lockoutdiv\');"'));
$f->pop();
$lockoutdiv = new Div(array("id" => "lockoutdiv"));
$lockoutdiv->setVisibility($pwdLockout);
$f->push($lockoutdiv);
$f->push(new Table());
$f->add(new TrFormElement(_T("Password maximum failure", "ppolicy"), new InputTpl("pwdMaxFailure", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdMaxFailure"))), array("value" => $FH->getArrayOrPostValue("pwdMaxFailure")));
$f->add(new TrFormElement(_T("Lockout duration (seconds)", "ppolicy"), new InputTpl("pwdLockoutDuration", '/^[0-9]*$/'), array("tooltip" => ppolicyTips("pwdLockoutDuration"))), array("value" => $FH->getArrayOrPostValue("pwdLockoutDuration")));
$f->pop();
$f->pop();
$f->addValidateButton("bppolicy");
$f->pop();
$f->display();