function createUiContainers() { $t = new Table(); $t->add($this->_createNameElement(_T("Domain name")), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("Name server"), new InputTpl($this->pn("dnsserver")), $this->_dnRulesTooltip()), array("value" => $this->values["dnsserver"], "required" => True)); return array($this->stackedUi($t)); }
function createUiContainers($editMode = false) { $t = new Table(); $t->add($this->_createNameElement(_T("Host name")), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("IPv6 address"), new IPv6InputTpl($this->pn("ip"))), array("value" => $this->values["ip"], "required" => true)); return array($this->stackedUi($t)); }
function createUiContainers() { $t = new Table(); $t->add($this->_createNameElement(_T("Name")), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("Canonical name"), new InputTpl($this->pn("cname")), $this->_dnRulesTooltip(AllowedDn::RELATIVE)), array("value" => $this->values["cname"], "extra" => "." . $this->zone, "required" => True)); return array($this->stackedUi($t)); }
function createUiContainers() { $t = new Table(); $t->add($this->_createNameElement(_T("Domain name")), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("Mail server"), new InputTpl($this->pn("mailserver")), $this->_dnRulesTooltip()), array("value" => $this->values["mailserver"], "required" => True)); $t->add(new TrFormElement(_T("Priority"), new InputTpl($this->pn("priority"), '/^([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("Priority ranges from 0 to 65535"))), array("value" => $this->values["priority"], "required" => True)); return array($this->stackedUi($t)); }
function createUiContainers() { $t = new Table(); $t->add($this->_createNameElement(_T("Domain name")), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("Next domain name"), new InputTpl($this->pn("nextdomain")), $this->_dnRulesTooltip()), array("value" => $this->values["nextdomain"], "required" => True)); $typesUi = array(new FormElement(_T("Types that exist at the record's owner name"), new MultipleInputTpl($this->pn("types"), _T("Types"))), explode(" ", $this->values["types"])); return array($this->stackedUi($t), $this->stackedUi($typesUi, 0, true)); }
function createUiContainers($editMode = false) { $t = new Table(); if (!$editMode) { $t->add(new TrFormElement(_T("Type name"), new InputTpl($this->pn("type"))), array("value" => $this->values["type"], "required" => True)); } $t->add($this->_createNameElement(_T("Host name")), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("Value"), new InputTpl($this->pn("value"))), array("value" => htmlspecialchars($this->values["value"]))); return array($this->stackedUi($t)); }
function createUiContainers($editMode = false) { if (!$editMode && getReverseZone($this->zone)) { $this->values["ip"] = getZoneFreeIp($this->zone); } $t = new Table(); $t->add($this->_createNameElement(_T("Host name")), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("IP address", "network"), new IPInputTpl($this->pn("ip"))), array("value" => $this->values["ip"])); return array($this->stackedUi($t)); }
function createUiContainers($editMode = false) { $t = new Table(); if (strrpos($this->hostname, ".") == strlen($this->hostname) - 1 && $editMode) { $nameElem = $this->_createNameElement(_T("Domain Name"), false); } else { $nameElem = $this->_createNameElement(_T("Domain Name"), true, "/^.*[^\\.]\$/"); } $t->add($nameElem, array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement(_T("Text"), new TextareaTpl($this->pn("text"))), array("value" => $this->values["text"])); return array($this->stackedUi($t)); }
/** * Parse input into nodes * * @param net.daringfireball.markdown.Input $lines * @return net.daringfireball.markdown.Node */ public function parse($lines) { $table = new Table(); $table->add($this->parseRow($this->headers, 'th')); while ($lines->hasMoreLines()) { $line = $lines->nextLine(); if (null === ($row = $this->parseRow($line, 'td'))) { $lines->resetLine($line); break; } $table->add($row); } return $table; }
function createUiContainers(){ $t = new Table(); $t->add($this->_createNameElement(_T("Zone name"),false), array("value" => $this->hostname, "required" => True)); $t->add(new TrFormElement( _T("Name server"), new InputTpl($this->pn("dnsserver")), $this->_dnRulesTooltip(AllowedDn::RELATIVE|AllowedDn::FQDN) ), array("value" => $this->values["dnsserver"], "required" => True)); $t->add(new TrFormElement( _T("Responsible person e-mail"), new InputTpl($this->pn("mail")), $this->_dnRulesTooltip(AllowedDn::RELATIVE|AllowedDn::FQDN) ), array("value"=>$this->values["mail"], "required" => True)); $t->add(new TrFormElement(_T("Time interval before the zone should be refreshed"), new BindRemainingTimeTpl($this->pn("refresh"))), array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["refresh"]))); $t->add(new TrFormElement(_T("Time interval that should elapse before a failed refresh should be retried"), new BindRemainingTimeTpl($this->pn("retry"))), array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["retry"]))); $t->add(new TrFormElement(_T("Expiry time"), new BindRemainingTimeTpl($this->pn("expiry"))), array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["expiry"]))); $t->add(new TrFormElement(_T("Minimum TTL"), new BindRemainingTimeTpl($this->pn("minttl"))), array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["minttl"]))); $t->add(new TrFormElement(_T("Serial number"), new HiddenTpl($this->pn("serial"))), array("value"=>$this->values["serial"], "required" => True)); return array($this->stackedUi($t)); }
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)); }
public static function attempt($array, $remember = false) { //Table::show(self::$hashedFields); // $hashed = array(); // foreach ($array as $key => $value) { if (Table::contains(self::$hashedFields, $key)) { Table::add($hashed, Hash::make($array[$key]), $key); } } // //Table::show($hashed); // $where = ""; $ok = false; // $i = 0; foreach ($array as $key => $value) { if ($i > 0) { $where .= " and "; } if (Table::contains(self::$hashedFields, $key)) { $where .= "{$key}='" . $hashed[$key] . "' "; } else { $where .= "{$key}='{$value}' "; } $i++; } $sql = "select * from " . self::$table . " where " . $where; //echo $sql; // if (Database::countS($sql) > 0) { //returning true value $ok = true; // // session $user = Database::read($sql); $saved = Config::get('auth.saved_fields'); // $static = array(); // foreach ($user[0] as $key => $value) { if (array_key_exists($key, $saved)) { $static[$key] = $value; } } // Session::put('auths', $static); // // remember cookie if ($remember) { Cookie::create(Config::get('auth.rememeber_cookie'), $user[0]["rememberToken"], time() + 3600 * 24 * 7); } } // return $ok; }
function createUiContainers($editMode = false){ $units = array("cm"=>_T("cm"), "m"=>_T("m")); $altRegExp = "/^((-([0-9]{0,5}(\.[0-9]{0,2})?|100000))|(([0-3]?[0-9]{0,7}|4[01][0-9]{0,6})(\.[0-9]{0,2})?|420{6}))$/"; $precRegExp = "/^([0-8][0-9]{0,7}(\.[0-9]{0,2})?|90{7})$/"; $t = new Table(); $t->add($this->_createNameElement(_T("Host name")), array("value" => $this->hostname,/* "extra" => "." . $this->zone,*/ "required" => True)); $t->add(new TrFormElement(_T("Latitude"), new GlobalLocationTpl($this->pn("latitude"),GlobalLocationTpl::LATITUDE)), array("value"=>$this->values["latitude"], "required"=>true)); $t->add(new TrFormElement(_T("Longitude"), new GlobalLocationTpl($this->pn("longitude"),GlobalLocationTpl::LONGITUDE)), array("value"=>$this->values["longitude"], "required"=>true)); $t->add(new TrFormElement(_T("Altitude"), new MeasureInputTpl($this->pn("altitude"),$units,9,$altRegExp)), array("value"=>$this->values["altitude"])); $t->add(new TrFormElement(_T("Diameter of a sphere enclosing the described entity"), new SizeMeasureInputTpl($this->pn("size"),$units)), array("value"=>$this->values["size"])); $t->add(new TrFormElement(_T("Horizontal precision"), new MeasureInputTpl($this->pn("hprecision"),$units,8, $precRegExp)), array("value"=>$this->values["hprecision"])); $t->add(new TrFormElement(_T("Vertical precision"), new MeasureInputTpl($this->pn("vprecision"),$units,8, $precRegExp)), array("value"=>$this->values["vprecision"])); return array($this->stackedUi($t)); }
function createUiContainers(){ $re = '/^([0-5]?\d?\d?\d?\d|6[0-4]\d\d\d|65[0-4]\d\d|655[0-2]\d|6553[0-5])$/'; $t = new Table(); $t->add($this->_createNameElement(_T("Domain name")), array("value" => $this->hostname,/* "extra" => "." . $this->zone,*/ "required" => True)); $t->add(new TrFormElement( _T("Next domain-name to query"), new InputTpl($this->pn("replacement")), $this->_dnRulesTooltip(AllowedDn::FQDN) ), array("value" => $this->values["replacement"])); $t->add(new TrFormElement( _T("Priority"), new InputTpl($this->pn("priority"),$re), array("tooltip" => _T("Priority ranges from 0 to 65535"))), array("value"=>$this->values["priority"], "required" => True)); $t->add(new TrFormElement(_T("Order"), new InputTpl($this->pn("order"),$re)), array("value"=>$this->values["order"], "required" => True)); $t->add(new TrFormElement(_T("Flags"), new InputTpl($this->pn("flags"),'/[a-zA-Z0-9]/')), array("value"=>$this->values["flags"])); $t->add(new TrFormElement(_T("Regular expression"), new InputTpl($this->pn("regexp"))), array("value"=>$this->values["regexp"])); $servicesUi = array(new FormElement(_T("Services"),new MultipleInputTpl($this->pn("services"),_T("Services"))), explode("+",$this->values["services"])); return array($this->stackedUi($t), $this->stackedUi($servicesUi,0,true)); }
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)); }
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)); }
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)); }
} require __DIR__.'/../library/Table.php'; spl_autoload_register(array('Table', 'autoload')); $db = new PDO('mysql:dbname=world;host=localhost', 'table', 'table'); $rows = $db->query('select * from City', PDO::FETCH_OBJ)->fetchAll(); $table = new Table; $table->add( array( array('header' => 'ID', 'value' => function($o) { return $o->ID;}), array('header' => function() { return 'Name'; }, 'value' => function($o) {return $o->Name; }), array('value' => 'Test Value') ) ) ->setDataSource($rows); ?> <html> <head> <link rel="stylesheet" type="text/css" href="datatables.css" /> <link rel="stylesheet" type="text/css" href="datatables_jui.css" /> </head> <body> <? echo $table->render(); ?> </body>
<?php // 1 : load the table module require_once 'modules/table.php'; // 2 : create an instnce of the Table module $table = new Table(); // 3 : configuring the new create table // $table->name('table1'); // $table->add()->name('id')->type('int')->size('10')->close() // ->add()->name('name')->type('varchar')->size('100')->close(); $table->name('user'); $table->add()->name('id')->type('int')->size('3')->close(); $table->add()->name('name')->type('varchar')->size('50')->close(); // echo $table->toString(); // echo $table->create(); // print_r($table->read(3)); // echo $table->update(); // echo $table->delete(); // $a = new table1(); // print_r($a->read(3)); // 4 : exporting the newly created table class echo $table->export();
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)); }
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)); }
</p> <?php } ?> <form id="Form" method="post" action="" onSubmit="autogroupObj.selectAll(); autouserObj.selectAll(); autoadminObj.selectAll(); return validateForm();"> <?php $t = new Table(); if ($_GET["action"] == "add") { $input = new InputTpl("shareName"); } else { $input = new HiddenTpl("shareName"); } $t->add(new TrFormElement(_T("Name"), $input), array("value" => $share)); $t->add(new TrFormElement(_T("Comment"), new InputTpl("shareDesc")), array("value" => $shareDesc)); if (hasAv()) { $checked = ""; if ($av) { $checked = "checked"; } $param = array("value" => $checked); $t->add(new TrFormElement(_T("AntiVirus on this share"), new CheckboxTpl("hasAv")), $param); } $t->display(); $d = new DivExpertMode(); $d->push(new Table()); /* As long as we have no own modShare() (Ticket #96), the sharePath is readonly in edit mode */ if ($_GET["action"] == "add") { $sharePath = "";
templateUrl: 'modules/samba/shares/perms.html' } }); </script> <?php $t = new Table(); $checked = ""; if ($permAll) { $checked = "checked"; } $param = array("value" => $checked, "extraArg" => 'onclick="toggleVisibility(\'permsTable\');"'); $t->add(new TrFormElement(_T("Access for all"), new CheckboxTpl("permAll")), $param); $t->display(); ?> <table cellspacing="0" id="permsTable" <?php if ($permAll) { echo 'style="display:none"'; } ?> > <tr> <td class="label" style="text-align: right;">Permissions</td> <td> <div id="samba-perms" ng-app="mmc.samba.perms" ng-controller="permsCtrl"> <perms perms="perms" entities="entities" /> </div>
echo json_encode($groups) . '<br>'; //$groups = json_decode('[[14,3,47,6,20,33,17,51,9,11,29],[21,13,7,5,34,8,40,10,30,12,31],[32,16,43,28,45,42,15,36,26,25],[23,38,52,22,39,27,2,44,24,49],[35,41,48,4,37,1,19,46,50,18]]'); // testing foreach ($groups as $key => $val) { echo '[' . $players[$key] . ']  '; sort($val); $cardObj->watch_card($val); } echo '<hr>'; // 遊戲開始 $flow = new Flow(); $tab = new Table(); $flow::$members = count($players); // 第一手 $card = $flow->fire($groups); $tab->add($card); echo $players[$flow->now_player()] . ' : ' . $suit[$card] . '<br>'; for ($i = 0; $i < 55; $i++) { $flow->move_next(); $card = $flow->run($tab->get_on_table()); if (!$card) { echo '[' . $i . '] ' . $players[$flow->now_player()] . ' : PASS ! <br>'; continue; // 沒牌了 } if ($card > 0) { $tab->add($card); $show_card = $suit[$card]; } else { $tab->discard($flow->now_player(), -intval($card)); $show_card = "<font color='blue'>蓋牌 " . $suit[-intval($card)] . "</font>";
$page = new PageGenerator($title); $sidemenu->forceActiveItem($activeItem); $page->setSideMenu($sidemenu); $page->display(); ?> <form id="Form" method="post" action="" onSubmit="autogroupObj.selectAll(); autouserObj.selectAll(); autoadminObj.selectAll(); return validateForm();"> <?php $table = new Table(); if ($_GET["action"] == "add") { $input = new InputTpl("shareName"); } else { $input = new HiddenTpl("shareName"); } $table->add(new TrFormElement(_T("Name"), $input), array("value" => $shareName)); // $table->add(new TrFormElement(_T("Path"), new InputTpl("sharePath")),array("value" => $sharePath)); $table->add(new TrFormElement(_T("Description"), new InputTpl("shareDescription")), array("value" => $shareDescription)); $table->display(); ?> <table cellspacing="0"> <?php $param = array("value" => $shareGuest, "extraArg" => 'onclick="toggleVisibility(\'grouptable\');"'); $test = new TrFormElement(_T("Guest access"), new CheckboxTpl("shareGuest")); $test->setCssError("shareGuest"); $test->display($param); $param = array("value" => $shareEnabled); $test = new TrFormElement(_T("Share enabled"), new CheckboxTpl("shareEnabled")); $test->display($param); ?>