本文整理汇总了PHP中Form::addGlobal方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addGlobal方法的具体用法?PHP Form::addGlobal怎么用?PHP Form::addGlobal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form
的用法示例。
在下文中一共展示了Form::addGlobal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form
shell_exec("/usr/bin/killall -HUP smartd");
}
}
}
// Was the config changed? if so, print the message
if ($savemsg) {
print_info_box($savemsg, $style);
}
// Get users email from the xml file
$pconfig['smartmonemail'] = $config['system']['smartmonemail'];
$form = new Form();
$section = new Form_Section('Configuration');
$section->addInput(new Form_Input('smartmonemail', 'Email Address', 'text', $pconfig['smartmonemail']));
$form->add($section);
if (!empty($pconfig['smartmonemail'])) {
$form->addGlobal(new Form_Button('test', 'Send test email', null, 'fa-send'))->addClass('btn-info');
}
print $form;
break;
// Default page, prints the forms to view info, test, etc...
// Default page, prints the forms to view info, test, etc...
default:
// Information
$devs = get_smart_drive_list();
$form = new Form(false);
$btnview = new Form_Button('submit', 'View', null, 'fa-file-text-o');
$btnview->addClass('btn-primary');
$btnview->setAttribute('id');
$section = new Form_Section('Information');
$section->addInput(new Form_Input('action', null, 'hidden', 'info'))->setAttribute('id');
$group = new Form_Group('Info type');
示例2: gettext
$input_errors[] = gettext("The zone name can only contain letters, digits, and underscores ( _ ).");
}
foreach ($a_cp as $cpkey => $cpent) {
if ($cpent['zone'] == $_POST['zone']) {
$input_errors[] = sprintf(gettext("Zone [%s] already exists."), $_POST['zone']);
break;
}
}
if (!$input_errors) {
$cpzone = strtolower($_POST['zone']);
$a_cp[$cpzone] = array();
$a_cp[$cpzone]['zone'] = str_replace(" ", "", $_POST['zone']);
$a_cp[$cpzone]['descr'] = $_POST['descr'];
$a_cp[$cpzone]['localauth_priv'] = true;
write_config();
header("Location: services_captiveportal.php?zone={$cpzone}");
exit;
}
}
include "head.inc";
if ($input_errors) {
print_input_errors($input_errors);
}
$form = new Form(false);
$section = new Form_Section('Add Captive Portal Zone');
$section->addInput(new Form_Input('zone', 'Zone name'))->setPattern('[0-9A-Za-z_]+')->setHelp('Zone name. Can only contain letters, digits, and underscores (_).');
$section->addInput(new Form_Input('descr', 'Zone description'))->setHelp('A description may be entered here for administrative reference (not parsed).');
$form->add($section);
$form->addGlobal(new Form_Button('Submit', 'Save & Continue', null, 'fa-save'))->addClass('btn-primary');
print $form;
include "foot.inc";
示例3: server
$group->add(new Form_Input('auth_server_port', 'Port', 'number', $pconfig['auth_server_port']))->setHelp('Server port. Leave blank for the default port 1812');
$group->add(new Form_Input('auth_server_shared_secret', 'Shared secret', 'number', $pconfig['auth_server_shared_secret']))->setHelp('Shared secret');
$section->add($group);
$group = new Form_Group('Secondary 802.1X server');
$group->add(new Form_IpAddress('auth_server_addr2', 'IP Address', $pconfig['auth_server_addr2']))->setHelp('IP address. (Commonly a Radius server (FreeRadius, Internet Authentication Services, etc.)');
$group->add(new Form_Input('auth_server_port2', 'Port', 'number', $pconfig['auth_server_port2']))->setHelp('Server port. Leave blank for the default port 1812');
$group->add(new Form_Input('auth_server_shared_secret2', 'Shared secret', 'number', $pconfig['auth_server_shared_secret2']))->setHelp('Shared secret');
$section->add($group);
$section->addInput(new Form_Checkbox('rsn_preauth', 'Authentication Roaming Preauth', null, $pconfig['rsn_preauth'], 'yes'));
$form->add($section);
}
$section = new Form_Section('Private networks');
$section->addInput(new Form_Checkbox('blockpriv', 'Block private networks', '', $pconfig['blockpriv'], 'yes'))->setHelp('Blocks traffic from IP addresses that are reserved for private networks per RFC 1918 (10/8, 172.16/12, 192.168/16) ' . ' as well as loopback addresses (127/8). You should generally leave this option turned on, unless your WAN network ' . 'lies in such a private address space, too.');
$section->addInput(new Form_Checkbox('blockbogons', 'Block bogon networks', '', $pconfig['blockbogons'], 'yes'))->setHelp('Blocks traffic from reserved IP addresses (but not RFC 1918) or not yet assigned by IANA. Bogons are prefixes that should ' . 'never appear in the Internet routing table, and so should not appear as the source address in any packets you receive.' . '<br />' . 'Note: The update frequency can be changed under System->Advanced Firewall/NAT settings');
$form->add($section);
$form->addGlobal(new Form_Input('if', null, 'hidden', $if));
if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
$form->addGlobal(new Form_Input('ppp_port', null, 'hidden', $pconfig['port']));
}
$form->addGlobal(new Form_Input('ptpid', null, 'hidden', $pconfig['ptpid']));
print $form;
?>
<script type="text/javascript">
//<![CDATA[
events.push(function(){
function updateType(t) {
switch (t) {
case "none": {
$('.dhcpadvanced, .staticv4, .dhcp, .pppoe, .pptp, .ppp').hide();
示例4: count
$section->addInput(new Form_Input('description', 'Description', 'text', $pconfig['description']))->setHelp('You may enter a description here for your reference.');
$numrows = count($networkacl) - 1;
$counter = 0;
foreach ($networkacl as $item) {
$network = $item['acl_network'];
$cidr = $item['mask'];
$description = $item['description'];
$group = new Form_Group($counter == 0 ? 'Networks' : '');
$group->add(new Form_IpAddress('acl_network' . $counter, null, $network))->addMask('mask' . $counter, $cidr)->setWidth(4)->setHelp($counter == $numrows ? 'Network/mask' : null);
$group->add(new Form_Input('description' . $counter, null, 'text', $description))->setHelp($counter == $numrows ? 'Description' : null);
$group->add(new Form_Button('deleterow' . $counter, 'Delete'))->removeClass('btn-primary')->addClass('btn-warning');
$group->addClass('repeatable');
$section->add($group);
$counter++;
}
$form->addGlobal(new Form_Button('addrow', 'Add network'))->removeClass('btn-primary')->addClass('btn-success');
$form->add($section);
print $form;
} else {
// NOT 'edit' or 'add'
?>
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?php
echo gettext('Access Lists to control access to the DNS Resolver');
?>
</h2></div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
<thead>
<tr>
示例5: Form
if (!$resolved && $type) {
print_info_box(sprintf(gettext('Host "%s" could not be resolved.'), $host), 'warning', false);
}
}
if ($createdalias) {
if ($alias_exists) {
print_info_box(gettext("Alias was updated successfully."), 'success');
} else {
print_info_box(gettext("Alias was created successfully."), 'success');
}
}
$form = new Form(false);
$section = new Form_Section('DNS Lookup');
$section->addInput(new Form_Input('host', 'Hostname', 'text', $host, ['placeholder' => 'Hostname to look up.']));
$form->add($section);
$form->addGlobal(new Form_Button('Submit', 'Lookup', null, 'fa-search'))->addClass('btn-primary');
if (!empty($resolved)) {
if ($alias_exists) {
$button_text = gettext("Update alias");
} else {
$button_text = gettext("Add alias");
}
$form->addGlobal(new Form_Button('create_alias', $button_text, null, 'fa-plus'))->removeClass('btn-primary')->addClass('btn-success');
}
print $form;
if (!$input_errors && $type) {
if ($resolved) {
?>
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?php
echo gettext('Results');
示例6: gettext
$flagtable .= '<strong>' . gettext(" Any flags.") . '</strong>';
return $flagtable;
}
$pgtitle = array(gettext("Firewall"), gettext("Rules"), gettext("Edit"));
$shortcut_section = "firewall";
$closehead = false;
$page_filename = "firewall_rules_edit.php";
include "head.inc";
if ($input_errors) {
print_input_errors($input_errors);
}
require_once 'classes/Form.class.php';
$form = new Form();
$section = new Form_Section('Edit Firewall rule');
if (isset($id)) {
$form->addGlobal(new Form_Input('id', 'ID', 'hidden', $id));
}
if (isset($a_filter[$id])) {
$form->addGlobal(new Form_Input('tracker', 'Tracker', 'hidden', $pconfig['tracker']));
}
$form->addGlobal(new Form_Input('after', 'After', 'hidden', $after));
$form->addGlobal(new Form_Input('ruleid', 'Ruleid', 'hidden', $pconfig['ruleid']));
// Allow extending of the firewall edit page and include custom input validation
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/htmlphpearly");
$values = array('pass' => 'Pass', 'block' => 'Block', 'reject' => 'Reject');
if ($if == "FloatingRules" || isset($pconfig['floating'])) {
$values['match'] = 'Match';
}
$section->addInput(new Form_Select('type', 'Action', $pconfig['type'], $values))->setHelp('Choose what to do with packets that match the criteria specified ' . 'below.<br/>Hint: the difference between block and reject is that with ' . 'reject, a packet (TCP RST or ICMP port unreachable for UDP) is returned ' . 'to the sender, whereas with block the packet is dropped silently. In ' . 'either case, the original packet is discarded.');
$section->addInput(new Form_Checkbox('disabled', 'Disabled', 'Disable this rule', $pconfig['disabled']))->setHelp('Set this option to disable this rule without removing it from the ' . 'list.');
if ($if == "FloatingRules" || isset($pconfig['floating'])) {
示例7: Form
if (empty($tab)) {
if (preg_match("/url/i", $pconfig['type'])) {
$tab = 'url';
} else {
if ($pconfig['type'] == 'host') {
$tab = 'ip';
} else {
$tab = $pconfig['type'];
}
}
}
if ($input_errors) {
print_input_errors($input_errors);
}
$form = new Form();
$form->addGlobal(new Form_Input('tab', null, 'hidden', $tab));
$form->addGlobal(new Form_Input('tab', null, 'hidden', $tab));
$form->addGlobal(new Form_Input('origname', null, 'hidden', $pconfig['name']));
if (isset($id) && $a_aliases[$id]) {
$form->addGlobal(new Form_Input('id', null, 'hidden', $id));
}
$section = new Form_Section('Properties');
$section->addInput(new Form_Input('name', 'Name', 'text', $pconfig['name']))->setPattern('[a-zA-Z0-9_]+')->setHelp('The name of the alias may only consist ' . 'of the characters "a-z, A-Z, 0-9 and _".');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference (not parsed).');
$section->addInput(new Form_Select('type', 'Type', isset($pconfig['type']) ? $pconfig['type'] : $tab, $types));
$form->add($section);
$section = new Form_Section($section_str[$tab]);
// Make somewhere to park the help text, and give it a class so we can update it later
$section->addInput(new Form_StaticText('Hint', '<span class="helptext">' . $help[$tab] . '</span>'));
// If no addresses have been defined, we'll make up a blank set
if ($pconfig['address'] == "") {
示例8: Form
// Send sig HUP to smartd, rereads the config file
shell_exec("/usr/bin/killall -HUP smartd");
}
}
// Was the config changed? if so, print the message
if ($savemsg) {
print_info_box($savemsg, $style);
}
// Get users email from the xml file
$pconfig['smartmonemail'] = $config['system']['smartmonemail'];
$form = new Form();
$section = new Form_Section('Configuration');
$section->addInput(new Form_Input('smartmonemail', 'Email Address', 'text', $pconfig['smartmonemail']));
$form->add($section);
if (!empty($pconfig['smartmonemail'])) {
$form->addGlobal(new Form_Button('test', 'Send test email'))->removeClass('btn-primary')->addClass('btn-default');
}
print $form;
break;
// Default page, prints the forms to view info, test, etc...
// Default page, prints the forms to view info, test, etc...
default:
// Information
$devs = get_smart_drive_list();
$form = new Form(false);
$btnview = new Form_Button('submit', 'View');
$section = new Form_Section('Information');
$section->addInput(new Form_Input('action', null, 'hidden', 'info'));
$group = new Form_Group('Info type');
$group->add(new Form_Checkbox('type', null, 'Info', false, 'i'))->displayAsRadio();
$group->add(new Form_Checkbox('type', null, 'Health', true, 'H'))->displayAsRadio();
示例9: array
$pconfig = $_POST;
if (empty($_POST['friendlyiface'])) {
$pconfig['friendlyiface'] = $_POST['interface'];
}
}
}
$pgtitle = array(gettext("System"), gettext("Routing"), gettext("Gateways"), gettext("Edit"));
$shortcut_section = "gateways";
include "head.inc";
if ($input_errors) {
print_input_errors($input_errors);
}
$form = new Form();
/* If this is a system gateway we need this var */
if ($pconfig['attribute'] == "system" || is_numeric($pconfig['attribute'])) {
$form->addGlobal(new Form_Input('attribute', null, 'hidden', $pconfig['attribute']));
}
if (isset($id) && $a_gateways[$id]) {
$form->addGlobal(new Form_Input('id', null, 'hidden', $id));
}
$form->addGlobal(new Form_Input('friendlyiface', null, 'hidden', $pconfig['friendlyiface']));
$section = new Form_Section('Edit Gateway');
$section->addInput(new Form_Checkbox('disabled', 'Disabled', 'Disable this gateway', $pconfig['disabled']))->setHelp('Set this option to disable this gateway without removing it from the ' . 'list.');
$section->addInput(new Form_Select('interface', 'Interface', $pconfig['friendlyiface'], get_configured_interface_with_descr(false, true)))->setHelp('Choose which interface this gateway applies to.');
$section->addInput(new Form_Select('ipprotocol', 'Address Family', $pconfig['ipprotocol'], array("inet" => "IPv4", "inet6" => "IPv6")))->setHelp('Choose the Internet Protocol this gateway uses.');
$section->addInput(new Form_Input('name', 'Name', 'text', $pconfig['name']))->setHelp('Gateway name');
$egw = new Form_Input('gateway', 'Gateway', 'text', $pconfig['dynamic'] ? 'dynamic' : $pconfig['gateway']);
$egw->setHelp('Gateway IP address');
if ($pconfig['dynamic']) {
$egw->setReadonly();
}
示例10: array
include "head.inc";
if ($input_errors) {
print_input_errors($input_errors);
}
if ($savemsg) {
print_info_box($savemsg, 'success');
}
$tab_array = array();
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
display_top_tabs($tab_array);
$form = new Form();
if (isset($groupid)) {
$form->addGlobal(new Form_Input('groupid', null, 'hidden', $groupid));
}
$section = new Form_Section('Add privileges for ' . $a_group['name']);
$priv_list = array_map(function ($p) {
return $p['name'];
}, $priv_list);
asort($priv_list, SORT_STRING | SORT_FLAG_CASE);
$section->addInput(new Form_Select('sysprivs', 'Assigned privileges', $a_group['priv'], build_priv_list(), true))->addClass('multiselect')->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items.')->setAttribute('style', 'height:400px;');
$section->addInput(new Form_Input('filtertxt', 'Filter', 'text', null))->setHelp('Show only the choices containing this term');
$btnfilter = new Form_Button('btnfilter', 'Filter', null, 'fa-filter');
$btnfilter->addClass('btn btn-info');
$form->addGlobal($btnfilter);
$btnclear = new Form_Button('btnclear', 'Clear', null, 'fa-times');
$btnclear->addClass('btn btn-warning');
$form->addGlobal($btnclear);
$form->add($section);
示例11: Form
<!-- Draw a progress bar to show step progress -->
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="<?php
echo $completion;
?>
" aria-valuemin="0" aria-valuemax="100" style="width:<?php
echo $completion;
?>
%">
</div>
</div>
<?php
$form = new Form(false);
$form->addGlobal(new Form_Input('stepid', null, 'hidden', $stepid));
$form->addGlobal(new Form_Input('xml', null, 'hidden', $xml));
$section = new Form_Section(fixup_string($title));
if ($description) {
$section->addInput(new Form_StaticText(null, fixup_string($description)));
}
$inputaliases = array();
if ($pkg['step'][$stepid]['fields']['field'] != "") {
foreach ($pkg['step'][$stepid]['fields']['field'] as $field) {
$value = $field['value'];
$name = $field['name'];
$name = preg_replace("/\\s+/", "", $name);
$name = strtolower($name);
if ($field['bindstofield'] != "") {
$arraynum = "";
$field_conv = "";
示例12: array
print_info_box($savemsg, 'success');
}
$tab_array = array();
$tab_array[] = array(gettext("Users"), true, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
display_top_tabs($tab_array);
$form = new Form();
$section = new Form_Section('User privileges');
$section->addInput(new Form_Select('sysprivs', 'Assigned privileges', null, build_priv_list(), true))->addClass('multiselect')->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items');
// ->setAttribute('style', 'height:400px;');
$section->addInput(new Form_Input('filtertxt', 'Filter', 'text', null))->setHelp('Show only the choices containing this term');
$btnfilter = new Form_Button('btnfilter', 'Filter', null, 'fa-filter');
$btnfilter->addClass('btn btn-info');
$form->addGlobal($btnfilter);
$btnclear = new Form_Button('btnclear', 'Clear', null, 'fa-times');
$btnclear->addClass('btn btn-warning');
$form->addGlobal($btnclear);
if (isset($userid)) {
$section->addInput(new Form_Input('userid', null, 'hidden', $userid));
}
$form->add($section);
print $form;
?>
<div class="panel panel-body alert-info col-sm-10 col-sm-offset-2" id="pdesc">Select a privilege from the list above for a description</div>
<script type="text/javascript">
//<![CDATA[
events.push(function() {
示例13: isset
}
$form->add($section);
$has_created_time = isset($a_nat[$id]['created']) && is_array($a_nat[$id]['created']);
$has_updated_time = isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['updated']);
if ($has_created_time || $has_updated_time) {
$section = new Form_Section('Rule Information');
if ($has_created_time) {
$section->addInput(new Form_StaticText('Created', date(gettext("n/j/y H:i:s"), $a_nat[$id]['created']['time']) . gettext(" by ") . $a_nat[$id]['created']['username']));
}
if ($has_updated_time) {
$section->addInput(new Form_StaticText('Updated', date(gettext("n/j/y H:i:s"), $a_nat[$id]['updated']['time']) . gettext(" by ") . $a_nat[$id]['updated']['username']));
}
$form->add($section);
}
if (isset($id) && $a_nat[$id]) {
$form->addGlobal(new Form_Input('id', null, 'hidden', $id));
}
$form->addGlobal(new Form_Input('after', null, 'hidden', $after));
print $form;
?>
<script type="text/javascript">
//<![CDATA[
events.push(function() {
var portsenabled = 1;
var dstenabled = 1;
var showsource = 0;
var iface_old = '';
// ---------- jQuery functions, lovingly converted from the original javascript------------------------------------------
function ext_change() {
示例14: typeof
print_info_box($savemsg);
}
if ($save_and_test) {
echo "<script>\n";
echo "myRef = window.open('system_usermanager_settings_test.php?authserver=" . $pconfig['authmode'] . "','mywin','left=20,top=20,width=700,height=550,toolbar=1,resizable=0');\n";
echo "if (myRef==null || typeof(myRef)=='undefined') alert('" . gettext("Popup blocker detected. Action aborted.") . "');\n";
echo "</script>\n";
}
$tab_array = array();
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), true, "system_usermanager_settings.php");
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
display_top_tabs($tab_array);
/* Default to pfsense backend type if none is defined */
if (!$pconfig['backend']) {
$pconfig['backend'] = "pfsense";
}
require_once 'classes/Form.class.php';
$form = new Form();
$section = new Form_Section('Settings');
$section->addInput(new Form_Input('session_timeout', 'Session timeout', 'number', $pconfig['session_timeout']))->setHelp('Time in minutes to expire idle management sessions. The default is 4 ' . 'hours (240 minutes).Enter 0 to never expire sessions. NOTE: This is a security ' . 'risk!');
$auth_servers = array();
foreach (auth_get_authserver_list() as $auth_server) {
$auth_servers[$auth_server['name']] = $auth_server['name'];
}
$section->addInput(new Form_Select('authmode', 'Authentication Server', $pconfig['authmode'], $auth_servers));
$form->addGlobal(new Form_Button('savetest', 'Save & Test'))->removeClass('btn-primary')->addClass('btn-default');
$form->add($section);
print $form;
include "fend.inc";
示例15: gettext
</nav>
</form>
<div class="infoblock">
<?php
echo print_info_box(gettext("Additional users can be added here. User permissions for accessing " . "the webConfigurator can be assigned directly or inherited from group memberships. " . "An icon that appears grey indicates that it is a system defined object. " . "Some system object properties can be modified but they cannot be deleted.") . '<br /><br />' . gettext("Accounts added here are also used for other parts of the system " . "such as OpenVPN, IPsec, and Captive Portal."), 'info');
?>
</div>
<?php
include "foot.inc";
exit;
}
$form = new Form();
if ($act == "new" || $act == "edit" || $input_errors) {
$form->addGlobal(new Form_Input('act', null, 'hidden', ''));
$form->addGlobal(new Form_Input('userid', null, 'hidden', isset($id) ? $id : ''));
$form->addGlobal(new Form_Input('privid', null, 'hidden', ''));
$form->addGlobal(new Form_Input('certid', null, 'hidden', ''));
$ro = "";
if ($pconfig['utype'] == "system") {
$ro = "readonly";
}
$section = new Form_Section('User Properties');
$section->addInput(new Form_StaticText('Defined by', strtoupper($pconfig['utype'])));
$form->addGlobal(new Form_Input('utype', null, 'hidden', $pconfig['utype']));
$section->addInput(new Form_Checkbox('disabled', 'Disabled', 'This user cannot login', $pconfig['disabled']));
$section->addInput($input = new Form_Input('usernamefld', 'Username', 'text', $pconfig['usernamefld']));
if ($ro) {
$input->setReadonly();
}