コード例 #1
0
/**
 * return option array for valid translation networks
 */
function formTranslateAddresses()
{
    global $config;
    $retval = array();
    // add this hosts ips
    foreach ($config['interfaces'] as $intf => $intfdata) {
        if (isset($intfdata['ipaddr']) && $intfdata['ipaddr'] != 'dhcp') {
            $retval[$intfdata['ipaddr']] = (!empty($intfdata['descr']) ? $intfdata['descr'] : $intf) . " " . gettext("address");
        }
    }
    // add VIPs's
    if (isset($config['virtualip']['vip'])) {
        foreach ($config['virtualip']['vip'] as $sn) {
            if (!isset($sn['noexpand'])) {
                if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
                    $start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
                    $end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits']));
                    $len = $end - $start;
                    $retval[$sn['subnet'] . '/' . $sn['subnet_bits']] = htmlspecialchars("Subnet: {$sn['subnet']}/{$sn['subnet_bits']} ({$sn['descr']})");
                    for ($i = 0; $i <= $len; $i++) {
                        $snip = long2ip32($start + $i);
                        $retval[$snip] = htmlspecialchars("{$snip} ({$sn['descr']})");
                    }
                } else {
                    $retval[$sn['subnet']] = htmlspecialchars("{$sn['subnet']} ({$sn['descr']})");
                }
            }
        }
    }
    // add Aliases
    foreach (legacy_list_aliasses("network") as $alias) {
        if ($alias['type'] == "host") {
            $retval[$alias['name']] = $alias['name'];
        }
    }
    return $retval;
}
コード例 #2
0
                              <option data-other=true value="<?php 
echo $pconfig['dst'];
?>
" <?php 
echo !is_specialnet($pconfig['dst']) ? "selected=\"selected\"" : "";
?>
><?php 
echo gettext("Single host or Network");
?>
</option>
                              <optgroup label="<?php 
echo gettext("aliasses");
?>
">
  <?php 
foreach (legacy_list_aliasses("network") as $alias) {
    ?>
                                <option value="<?php 
    echo $alias['name'];
    ?>
" <?php 
    echo $alias['name'] == $pconfig['dst'] ? "selected=\"selected\"" : "";
    ?>
><?php 
    echo htmlspecialchars($alias['name']);
    ?>
</option>
  <?php 
}
?>
                              </optgroup>
コード例 #3
0
echo !empty($pconfig['associated-rule-id']) ? "disabled" : "";
?>
 id="dstendport" name="dstendport" class="selectpicker" data-live-search="true" data-size="5" data-width="auto">
                                <option data-other=true value="<?php 
echo $pconfig['dstendport'];
?>
">(<?php 
echo gettext("other");
?>
)</option>
                                <optgroup label="<?php 
echo gettext("aliasses");
?>
">
  <?php 
foreach (legacy_list_aliasses("port") as $alias) {
    ?>
                                  <option value="<?php 
    echo $alias['name'];
    ?>
" <?php 
    echo $pconfig['dstendport'] == $alias['name'] ? "selected=\"selected\"" : "";
    ?>
  ><?php 
    echo htmlspecialchars($alias['name']);
    ?>
 </option>
  <?php 
}
?>
                                </optgroup>