本文整理汇总了PHP中is_alias函数的典型用法代码示例。如果您正苦于以下问题:PHP is_alias函数的具体用法?PHP is_alias怎么用?PHP is_alias使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_alias函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_static_route
function delete_static_route($id)
{
global $config, $a_routes, $changedesc_prefix;
if (!isset($a_routes[$id])) {
return;
}
$targets = array();
if (is_alias($a_routes[$id]['network'])) {
foreach (filter_expand_alias_array($a_routes[$id]['network']) as $tgt) {
if (is_ipaddrv4($tgt)) {
$tgt .= "/32";
} else {
if (is_ipaddrv6($tgt)) {
$tgt .= "/128";
}
}
if (!is_subnet($tgt)) {
continue;
}
$targets[] = $tgt;
}
} else {
$targets[] = $a_routes[$id]['network'];
}
foreach ($targets as $tgt) {
$family = is_subnetv6($tgt) ? "-inet6" : "-inet";
mwexec("/sbin/route delete {$family} " . escapeshellarg($tgt));
}
unset($targets);
}
示例2: gettext
echo gettext("edit alias");
?>
" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php
} else {
?>
<?php
echo htmlspecialchars(pprint_address($natent['source']));
}
?>
</td>
<td>
<?php
if (isset($natent['destination']['address']) && is_alias($natent['destination']['address'])) {
?>
<span title="<?php
echo htmlspecialchars(get_alias_description($natent['destination']['address']));
?>
" data-toggle="tooltip">
<?php
echo htmlspecialchars(pprint_address($natent['destination']));
?>
</span>
<a href="/firewall_aliases_edit.php?name=<?php
echo htmlspecialchars($natent['destination']['address']);
?>
"
title="<?php
示例3: elseif
if (is_alias($_POST['ftp_bind_to'])) {
$engine['bind_to'] = $_POST['ftp_bind_to'];
} elseif (strtolower(trim($_POST['ftp_bind_to'])) == "all") {
$engine['bind_to'] = "all";
} else {
$input_errors[] = gettext("You must provide a valid Alias or the reserved keyword 'all' for the 'Bind-To IP Address' value.");
}
} else {
$input_errors[] = gettext("The 'Bind-To IP Address' value cannot be blank. Provide a valid Alias or the reserved keyword 'all'.");
}
// Validate BOUNCE-TO Alias entries to be sure if one is set, then both are set; since
// if you define a BOUNCE-TO address, you must also define the BOUNCE-TO port.
if ($_POST['ftp_client_bounce_to_net'] && !is_alias($_POST['ftp_client_bounce_to_net'])) {
$input_errors[] = gettext("Only aliases are allowed for the FTP Protocol BOUNCE-TO ADDRESS option.");
}
if ($_POST['ftp_client_bounce_to_port'] && !is_alias($_POST['ftp_client_bounce_to_port'])) {
$input_errors[] = gettext("Only aliases are allowed for the FTP Protocol BOUNCE-TO PORT option.");
}
if ($_POST['ftp_client_bounce_to_net'] && empty($_POST['ftp_client_bounce_to_port'])) {
$input_errors[] = gettext("FTP Protocol BOUNCE-TO PORT cannot be empty when BOUNCE-TO ADDRESS is set.");
}
if ($_POST['ftp_client_bounce_to_port'] && empty($_POST['ftp_client_bounce_to_net'])) {
$input_errors[] = gettext("FTP Protocol BOUNCE-TO ADDRESS cannot be empty when BOUNCE-TO PORT is set.");
}
// Validate the BOUNCE-TO Alias entries for correct format of their defined values. BOUNCE-TO ADDRESS must be
// a valid single IP, and BOUNCE-TO PORT must be either a single port value or a port range value. Provide
// detailed error messages for the user that explain any problems.
if ($_POST['ftp_client_bounce_to_net'] && $_POST['ftp_client_bounce_to_port']) {
if (!snort_is_single_addr_alias($_POST['ftp_client_bounce_to_net'])) {
$net = trim(filter_expand_alias($_POST['ftp_client_bounce_to_net']));
$net = preg_replace('/\\s+/', ',', $net);
示例4: unset
if ($config['system']['gateway'] != "") {
$config['interfaces']['wan']['gateway'] = $config['system']['gateway'];
}
unset($config['shaper']);
/* optional if list */
$ifdescrs = get_configured_interface_list(true, true);
/* remove special characters from interface descriptions */
if (is_array($ifdescrs)) {
foreach ($ifdescrs as $iface) {
$config['interfaces'][$iface]['descr'] = remove_bad_chars($config['interfaces'][$iface]['descr']);
}
}
/* check for interface names with an alias */
if (is_array($ifdescrs)) {
foreach ($ifdescrs as $iface) {
if (is_alias($config['interfaces'][$iface]['descr'])) {
// Firewall rules
$origname = $config['interfaces'][$iface]['descr'];
$newname = $config['interfaces'][$iface]['descr'] . "Alias";
update_alias_names_upon_change(array('filter', 'rule'), array('source', 'address'), $newname, $origname);
update_alias_names_upon_change(array('filter', 'rule'), array('destination', 'address'), $newname, $origname);
// NAT Rules
update_alias_names_upon_change(array('nat', 'rule'), array('source', 'address'), $newname, $origname);
update_alias_names_upon_change(array('nat', 'rule'), array('destination', 'address'), $newname, $origname);
update_alias_names_upon_change(array('nat', 'rule'), array('target'), $newname, $origname);
// Alias in an alias
update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $newname, $origname);
}
}
}
unlink_if_exists("{$g['tmp_path']}/config.cache");
示例5: gettext
/* Ensure that our pool names are unique */
for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) {
if ($_POST['name'] == $config['load_balancer']['lbpool'][$i]['name'] && $i != $id) {
$input_errors[] = gettext("This pool name has already been used. Pool names must be unique.");
}
}
if (preg_match('/[ \\/]/', $_POST['name'])) {
$input_errors[] = gettext("You cannot use spaces or slashes in the 'name' field.");
}
if (strlen($_POST['name']) > 16) {
$input_errors[] = gettext("The 'name' field must be 16 characters or less.");
}
if (in_array($_POST['name'], $reserved_table_names)) {
$input_errors[] = sprintf(gettext("The name '%s' is a reserved word and cannot be used."), $_POST['name']);
}
if (is_alias($_POST['name'])) {
$input_errors[] = sprintf(gettext("Sorry, an alias is already named %s."), $_POST['name']);
}
if (!is_portoralias($_POST['port'])) {
$input_errors[] = gettext("The port must be an integer between 1 and 65535, or a port alias.");
}
// May as well use is_port as we want a positive integer and such.
if (!empty($_POST['retry']) && !is_port($_POST['retry'])) {
$input_errors[] = gettext("The retry value must be an integer between 1 and 65535.");
}
if (is_array($_POST['servers'])) {
foreach ($pconfig['servers'] as $svrent) {
if (!is_ipaddr($svrent) && !is_subnetv4($svrent)) {
$input_errors[] = sprintf(gettext("%s is not a valid IP address or IPv4 subnet (in \"enabled\" list)."), $svrent);
} else {
if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
示例6: gettext
if ($_POST['dsttype'] == "single") {
$_POST['dstmask'] = 32;
} else {
if (is_ipaddr($_POST['dsttype'])) {
$_POST['dst'] = $_POST['dsttype'];
$_POST['dstmask'] = 32;
$_POST['dsttype'] = "single";
}
}
}
/* For external, user can enter only ip's */
if ($_POST['external'] && !is_ipaddr($_POST['external'])) {
$input_errors[] = gettext("A valid external subnet must be specified.");
}
/* For dst, if user enters an alias and selects "network" then disallow. */
if ($_POST['dsttype'] == "network" && is_alias($_POST['dst'])) {
$input_errors[] = gettext("You must specify single host or alias for alias entries.");
}
/* For src, user can enter only ip's or networks */
if (!is_specialnet($_POST['srctype'])) {
if ($_POST['src'] && !is_ipaddr($_POST['src'])) {
$input_errors[] = sprintf(gettext("%s is not a valid internal IP address."), $_POST['src']);
}
if ($_POST['srcmask'] && !is_numericint($_POST['srcmask'])) {
$input_errors[] = gettext("A valid internal bit count must be specified.");
}
}
/* For dst, user can enter ip's, networks or aliases */
if (!is_specialnet($_POST['dsttype'])) {
if ($_POST['dst'] && !is_ipaddroralias($_POST['dst'])) {
$input_errors[] = sprintf(gettext("%s is not a valid destination IP address or alias."), $_POST['dst']);
示例7: sprintf
$input_errors[] = sprintf(gettext("URL '%s' is not valid."), $_POST['address' . $x]);
}
}
}
unset($desc_fmt_err_found);
if ($_POST['type'] == "url_ports") {
$address = group_ports($address);
}
} else {
/* item is a normal alias type */
$wrongaliases = "";
$desc_fmt_err_found = false;
for ($x = 0; $x < 4999; $x++) {
if ($_POST["address{$x}"] != "") {
$_POST["address{$x}"] = trim($_POST["address{$x}"]);
if (is_alias($_POST["address{$x}"])) {
if (!alias_same_type($_POST["address{$x}"], $_POST['type'])) {
// But alias type network can include alias type urltable. Feature#1603.
if (!($_POST['type'] == 'network' && preg_match("/urltable/i", alias_get_type($_POST["address{$x}"])))) {
$wrongaliases .= " " . $_POST["address{$x}"];
}
}
} else {
if ($_POST['type'] == "port") {
if (!is_port($_POST["address{$x}"]) && !is_portrange($_POST["address{$x}"])) {
$input_errors[] = $_POST["address{$x}"] . " " . gettext("is not a valid port or alias.");
}
} else {
if ($_POST['type'] == "host" || $_POST['type'] == "network") {
if (is_subnet($_POST["address{$x}"]) || !is_ipaddr($_POST["address{$x}"]) && !is_hostname($_POST["address{$x}"]) && !is_iprange($_POST["address{$x}"])) {
$input_errors[] = sprintf(gettext('%1$s is not a valid %2$s alias.'), $_POST["address{$x}"], $_POST['type']);
示例8: elseif
</td>
<td class="hidden-xs hidden-sm">
<?php
if (isset($natent['nonat'])) {
$nat_address = '<I>NO NAT</I>';
} elseif (!$natent['target']) {
$nat_address = htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . " address";
} elseif ($natent['target'] == "other-subnet") {
$nat_address = $natent['targetip'] . '/' . $natent['targetip_subnet'];
} else {
$nat_address = $natent['target'];
}
?>
<?php
echo htmlspecialchars($nat_address);
if (isset($natent['target']) && is_alias($natent['target'])) {
?>
<a href="/firewall_aliases_edit.php?name=<?php
echo htmlspecialchars($natent['target']);
?>
"><i class="fa fa-list"></i> </a>
<?php
}
?>
</td>
<td class="hidden-xs hidden-sm">
<?php
echo empty($natent['natport']) ? "*" : htmlspecialchars($natent['natport']);
?>
</td>
<td>
示例9: login
function login($pass)
{
// RETURN VALUE:
// 0 - OK
// 1 - unknown user
// 2 - password doesn't match
// VARIABLES:
// $admin - user has admin privileges (from auth table)
// $userid - whatever is used internally (aside from login)
global $userid, $admin, $login, $conf_system_auth, $conf_ldap_server, $conf_ldap_domain, $posljednji_pristup;
$q1 = myquery("select id, password, admin, UNIX_TIMESTAMP(posljednji_pristup) from auth where login='{$login}' and aktivan=1");
if (mysql_num_rows($q1) <= 0) {
return 1;
}
function is_alias($results)
{
foreach ($results as $k1 => $v1) {
if ($k1 === "objectclass") {
foreach ($v1 as $k2 => $v2) {
if ($v2 === "zimbraAlias") {
return true;
}
}
}
}
return false;
}
if ($conf_system_auth == "ldap") {
$ds = ldap_connect($conf_ldap_server);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($ds) {
if (ldap_bind($ds)) {
$i = 0;
// Probavamo UID
$login = ldap_escape($login);
$sr = ldap_search($ds, "", "uid={$login}", array());
if (!$sr) {
niceerror("ldap_search() failed.");
exit;
}
$results = ldap_get_entries($ds, $sr);
// Ako ldap_get_entries vrati false, pretpostavićemo da nema rezultata
// To se dešava rijetko ali se dešava i nije mi jasno zašto
// Ovaj upit ce vratiti i aliase, koje moramo profiltrirati
while ($results && is_alias($results[$i]) && $i < $results['count']) {
$i++;
}
// Probavamo email adresu
if (!$results || $i == $results['count']) {
$sr = ldap_search($ds, "", "mail={$login}", array());
if (!$sr) {
niceerror("ldap_search() 1 failed.");
exit;
}
$results = ldap_get_entries($ds, $sr);
$i = 0;
while ($results && is_alias($results[$i]) && $i < $results['count']) {
$i++;
}
}
// Probavamo email adresu + domena
if (!$results || $i == $results['count']) {
$sr = ldap_search($ds, "", "mail={$login}{$conf_ldap_domain}", array());
if (!$sr) {
niceerror("ldap_search() 2 failed.");
exit;
}
$results = ldap_get_entries($ds, $sr);
$i = 0;
while ($results && is_alias($results[$i]) && $i < $results['count']) {
$i++;
}
}
if (!$results || $i == $results['count']) {
return 1;
}
$dn = $results[$i]['dn'];
if (!@ldap_bind($ds, $dn, $pass)) {
// ldap_bind generiše warning svaki put kad je pogrešna šifra :(
return 2;
}
// ldap_bind succeeded, user is authenticated
} else {
niceerror("LDAP anonymous bind failed.");
exit;
}
} else {
niceerror("Can't contact LDAP server.");
exit;
}
} else {
if ($conf_system_auth == "table") {
if ($pass != mysql_result($q1, 0, 1)) {
return 2;
}
}
}
$userid = mysql_result($q1, 0, 0);
$admin = mysql_result($q1, 0, 2);
$posljednji_pristup = mysql_result($q1, 0, 3);
//.........这里部分代码省略.........
示例10: htmlspecialchars
// Check for returned "selected alias" if action is import
if ($_GET['act'] == "import") {
if ($_GET['varname'] == "bind_to" && !empty($_GET['varvalue'])) {
$pconfig[$_GET['varname']] = htmlspecialchars($_GET['varvalue']);
}
}
if ($_POST['save']) {
/* Grab all the POST values and save in new temp array */
$engine = array();
if ($_POST['frag3_name']) {
$engine['name'] = trim($_POST['frag3_name']);
} else {
$engine['name'] = "default";
}
if ($_POST['frag3_bind_to']) {
if (is_alias($_POST['frag3_bind_to'])) {
$engine['bind_to'] = $_POST['frag3_bind_to'];
} elseif (strtolower(trim($_POST['frag3_bind_to'])) == "all") {
$engine['bind_to'] = "all";
} else {
$input_errors[] = gettext("You must provide a valid Alias or the reserved keyword 'all' for the 'Bind-To IP Address' value.");
}
} else {
$input_errors[] = gettext("The 'Bind-To IP Address' value cannot be blank. Provide a valid Alias or the reserved keyword 'all'.");
}
/* Validate the text input fields before saving */
if (!empty($_POST['frag3_timeout']) || $_POST['frag3_timeout'] == 0) {
$engine['timeout'] = $_POST['frag3_timeout'];
if (!is_numeric($_POST['frag3_timeout']) || $_POST['frag3_timeout'] < 1) {
$input_errors[] = gettext("The value for Timeout must be numeric and greater than zero.");
}
示例11: trim
if (!empty($suricatacfg["def_{$alias}"]) && is_alias($suricatacfg["def_{$alias}"])) {
$avalue = trim(filter_expand_alias($suricatacfg["def_{$alias}"]));
$avalue = preg_replace('/\\s+/', ',', trim($avalue));
}
$addr_vars .= " " . strtoupper($alias) . ": \"{$avalue}\"\n";
}
$addr_vars = trim($addr_vars);
if (is_array($config['system']['ssh']) && isset($config['system']['ssh']['port'])) {
$ssh_port = $config['system']['ssh']['port'];
} else {
$ssh_port = "22";
}
$suricata_ports = array("ftp_ports" => "21", "http_ports" => "80", "oracle_ports" => "1521", "ssh_ports" => $ssh_port, "shellcode_ports" => "!80", "DNP3_PORTS" => "20000", "file_data_ports" => "\$HTTP_PORTS,110,143");
$port_vars = "";
foreach ($suricata_ports as $alias => $avalue) {
if (!empty($suricatacfg["def_{$alias}"]) && is_alias($suricatacfg["def_{$alias}"])) {
$avalue = trim(filter_expand_alias($suricatacfg["def_{$alias}"]));
$avalue = preg_replace('/\\s+/', ',', trim($avalue));
}
$port_vars .= " " . strtoupper($alias) . ": \"{$avalue}\"\n";
}
$port_vars = trim($port_vars);
// Define a Suppress List (Threshold) if one is configured
$suppress = suricata_find_list($suricatacfg['suppresslistname'], 'suppress');
if (!empty($suppress)) {
$suppress_data = str_replace("\r", "", base64_decode($suppress['suppresspassthru']));
@file_put_contents("{$suricatacfgdir}/threshold.config", $suppress_data);
} else {
@file_put_contents("{$suricatacfgdir}/threshold.config", "");
}
// Add interface-specific detection engine settings
示例12: gettext
</tr>
<tr>
<td><a id="help_for_destination" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?php
echo gettext("Destination");
?>
</td>
<td>
<table class="table table-condensed">
<tr>
<td>
<select name="destination" id="destination" class="selectpicker" data-live-search="true" data-size="5" data-width="auto">
<option data-other=true value="<?php
echo $pconfig['destination'];
?>
" <?php
echo !is_alias($pconfig['destination']) && $pconfig['destination'] != 'any' ? "selected=\"selected\"" : "";
?>
><?php
echo gettext("Single host or Network");
?>
</option>
<option value="any" <?php
echo $pconfig['destination'] == "any" ? "selected=\"selected\"" : "";
?>
><?php
echo gettext("any");
?>
</option>
<optgroup label="<?php
echo gettext("Aliases");
?>
示例13: foreach
}
/* check for name conflicts */
foreach ($a_passlist as $p_list) {
if (isset($id) && $a_passlist[$id] && $a_passlist[$id] === $p_list) {
continue;
}
if ($p_list['name'] == $_POST['name']) {
$input_errors[] = gettext("A Pass List file name with this name already exists.");
break;
}
}
if ($_POST['address']) {
if (!is_alias($_POST['address'])) {
$input_errors[] = gettext("A valid alias must be provided");
}
if (is_alias($_POST['address']) && trim(filter_expand_alias($_POST['address'])) == "") {
$input_errors[] = gettext("FQDN aliases are not supported in Suricata.");
}
}
if (!$input_errors) {
$p_list = array();
/* post user input */
$p_list['name'] = $_POST['name'];
$p_list['uuid'] = $passlist_uuid;
$p_list['localnets'] = $_POST['localnets'] ? 'yes' : 'no';
$p_list['wanips'] = $_POST['wanips'] ? 'yes' : 'no';
$p_list['wangateips'] = $_POST['wangateips'] ? 'yes' : 'no';
$p_list['wandnsips'] = $_POST['wandnsips'] ? 'yes' : 'no';
$p_list['vips'] = $_POST['vips'] ? 'yes' : 'no';
$p_list['vpnips'] = $_POST['vpnips'] ? 'yes' : 'no';
$p_list['address'] = $_POST['address'];
示例14: list
?>
"><i class="fa fa-list"></i> </a>
<?php
}
?>
</td>
<td>
<?php
$localport = $natent['local-port'];
if (strpos($natent['destination']['port'], '-') !== false) {
list($dstbeginport, $dstendport) = explode("-", $natent['destination']['port']);
$localendport = $natent['local-port'] + $dstendport - $dstbeginport;
$localport .= '-' . $localendport;
}
if (isset($natent['destination']['port']) && is_alias($natent['destination']['port'])) {
?>
<span title="<?php
echo htmlspecialchars(get_alias_description($localport));
?>
" data-toggle="tooltip">
<?php
echo htmlspecialchars(pprint_port($localport));
?>
</span>
<a href="/firewall_aliases_edit.php?name=<?php
echo htmlspecialchars($localport);
?>
"
title="<?php
示例15: session_start
}
}
if ($_POST['save']) {
// Clear and close out any session variable we created
session_start();
unset($_SESSION['http_inspect_import']);
session_write_close();
// Grab all the POST values and save in new temp array
$engine = array();
if ($_POST['httpinspect_name']) {
$engine['name'] = trim($_POST['httpinspect_name']);
} else {
$engine['name'] = "default";
}
if ($_POST['httpinspect_bind_to']) {
if (is_alias($_POST['httpinspect_bind_to'])) {
$engine['bind_to'] = $_POST['httpinspect_bind_to'];
} elseif (strtolower(trim($_POST['httpinspect_bind_to'])) == "all") {
$engine['bind_to'] = "all";
} else {
$input_errors[] = gettext("You must provide a valid Alias or the reserved keyword 'all' for the 'Bind-To IP Address' value.");
}
} else {
$input_errors[] = gettext("The 'Bind-To IP Address' value cannot be blank. Provide a valid Alias or the reserved keyword 'all'.");
}
if ($_POST['httpinspect_ports']) {
$engine['ports'] = trim($_POST['httpinspect_ports']);
} else {
$engine['ports'] = "default";
}
// Validate the text input fields before saving