diff options
Diffstat (limited to 'config/countryblock/countryblock_if.tmp')
-rw-r--r-- | config/countryblock/countryblock_if.tmp | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/config/countryblock/countryblock_if.tmp b/config/countryblock/countryblock_if.tmp new file mode 100644 index 00000000..af56756a --- /dev/null +++ b/config/countryblock/countryblock_if.tmp @@ -0,0 +1,194 @@ +<?php +/* + interfaces_assign.php + part of m0n0wall (http://m0n0.ch/wall) + Written by Jim McBeath based on existing m0n0wall files + + Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = "Country Block - Interfaces"; +require("guiconfig.inc"); + +/* + In this file, "port" refers to the physical port name, + while "interface" refers to LAN, WAN, or OPTn. +*/ + +/* get list without VLAN interfaces */ +$portlist = get_interface_list(); + +/* add VLAN interfaces */ +if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) { + $i = 0; + foreach ($config['vlans']['vlan'] as $vlan) { + $portlist['vlan' . $i] = $vlan; + $portlist['vlan' . $i]['isvlan'] = true; + $i++; + } +} + +if ($_POST) { + + unset($input_errors); + + /* input validation */ + + /* Build a list of the port names so we can see how the interfaces map */ + $portifmap = array(); + foreach ($portlist as $portname => $portinfo) + $portifmap[$portname] = array(); + + /* Go through the list of ports selected by the user, + build a list of port-to-interface mappings in portifmap */ + conf_mount_rw(); + $myFile = "interfaces.txt"; + $fh = fopen($myFile, 'w+'); + + foreach ($_POST as $ifname => $ifport) { + //echo $ifname; + //echo "<br>"; + fwrite($fh, $ifname . "\n"); + //if (($ifname == 'lan') || ($ifname == 'wan') || (substr($ifname, 0, 3) == 'opt')) + //$portifmap[$ifport][] = strtoupper($ifname); + } + + conf_mount_ro(); + + + if (!$input_errors) { + /* No errors detected, so update the config */ + foreach ($_POST as $ifname => $ifport) { + + if (($ifname == 'lan') || ($ifname == 'wan') || + (substr($ifname, 0, 3) == 'opt')) { + + + } + } + + $savemsg = get_std_save_message($retval); + + + + } +} + + + + + +$pgtitle = "CountryBlock Interfaces"; +include("head.inc"); + + + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<p class="pgtitle"><?=$pgtitle?></p> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box("Interfaces selected - Click <a href='countryblock.php'>Here</a> to go back"); ?> +<form action="" method="post" name="iform" id="iform"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr><td class="tabnavtbl"> +<?php + $tab_array = array(); + $tab_array[0] = array("Interface assignments", true, ""); + display_top_tabs($tab_array); +?> + </td></tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="listhdrr">Interface</td> + <td class="listhdr">Selected</td> + <td class="list"> </td> + </tr> + <?php foreach ($config['interfaces'] as $ifname => $iface): + if ($iface['descr']) + $ifdescr = $iface['descr']; + else + $ifdescr = strtoupper($ifname); + ?> + <tr> + <td class="listlr" valign="middle"><strong><?=$ifdescr;?></strong></td> + <td valign="middle" class="listr"> + + + <!---<input name='<?=$ifname;?>' type='checkbox' value='<?=$ifname;?>' checked/>- <?=$ifname;?>---> + + <?php foreach ($portlist as $portname => $portinfo): ?> + + <?php if ($portname == $iface['if']) { + + ob_start(); + $results = exec("cat interfaces.txt | grep $portname"); + ob_end_clean(); + if ($results == $portname) + echo "<input name='$portname' type='checkbox' value='$portname' checked/>$portname"; + else + echo "<input name='$portname' type='checkbox' value='$portname' />$portname"; + } + ?> + <?php endforeach; ?> + + </td> + <td valign="middle" class="list"> + + </td> + </tr> + <?php endforeach; ?> + + <tr> + <td class="list" colspan="3" height="10"></td> + </tr> + +</table> +</div> +<br> +<input type="submit" class="formbtn" value="Save"><br><br> +<p></p></td> + </tr> +</table> +</form> +<?php include("fend.inc"); ?> + + +</body> +</html> + +<?php +conf_mount_rw(); + if ($_POST) { + if (!$input_errors) + touch("interfaces.txt"); + + } + conf_mount_ro(); +?> |