function ip_group_wizard() { if (isset($_GET["delete_index"])) { writelogs("Must delete rule number {$_GET["delete_index"]}", __FUNCTION__, __FILE__); $dansrules = new dansguardian_rules(null, $_GET["rule_id"]); $dansrules->DelIpToFilter($_GET["delete_index"]); exit; } if (isset($_GET["rule_id"])) { $dansrules = new dansguardian_rules(null, $_GET["rule_id"]); if ($dansrules->AddIpToFilter($_GET["pattern"], $_GET["rule_id"])) { $tpl = new templates(); echo $tpl->javascript_parse_text('{success}: ' . $_GET["pattern"]); } exit; } $arr = array("single" => "{single_ip}", "subnet" => "{subnet}", "group" => "{group_ip}"); $users = new usersMenus(); $sock = new sockets(); if ($users->C_ICAP_INSTALLED) { if ($sock->GET_INFO('CicapEnabled') == 1) { $arr = array("single" => "{single_ip}", "pattern" => "{pattern}"); } } $select = Field_array_Hash($arr, 'ip_family', null, null, 0, "font-size:13px;padding:3px"); $tpl = new templates(); $form = "\n\t<table>\n\t<tr>\n\t\t<td class=legend style='font-size:13px' nowrap>{select_ip_family}:</td>\n\t\t<td>{$select}</td>\n\t</tr>\n\t<tr><td colspan=2><hr></td></tr>\n\t<tr>\t\n\t\t<td colspan=2 align='right'><hr>" . button("{add}", "ip_group_wizard()") . "</td>\n\t</table>"; if ($_GET["selected-ip-family"] == "single") { $form = "\n\t<table>\n\t<tr>\n\t\t<td class=legend>{ip_address}:</td>\n\t\t<td style='font-size:13px'>" . Field_text('ip_address', null, 'width:120px;font-size:13px;padding:3px') . "</td>\n\t</tr>\n\t<tr><td colspan=2><hr></td></tr>\n\t<tr>\n\t\t<td>" . button("{back}", "ip_group_start()") . "</td>\n\t\t<td align='right'>" . button("{next}", "ip_group_single()") . "</td>\n\t</tr>\n\t</table>"; } if ($_GET["selected-ip-family"] == "pattern") { $form = "\n<p class=caption style='font-size:14px'>Eg: <li style='font-size:13px'>192.168.1</li>\n<li style='font-size:13px'>192.168.</li></p>\n\t<table>\n\t<tr>\n\t\t<td class=legend>{pattern}:</td>\n\t\t<td style='font-size:13px'>" . Field_text('ip_address', null, 'width:120px;font-size:13px;padding:3px') . "</td>\n\t</tr>\n\t<tr><td colspan=2><hr></td></tr>\n\t<tr>\n\t\t<td>" . button("{back}", "ip_group_start()") . "</td>\n\t\t<td align='right'>" . button("{next}", "ip_group_pattern()") . "</td>\n\t</tr>\n\t</table>"; } if ($_GET["selected-ip-family"] == "subnet") { $form = "\n\t<p class=caption style='font-size:14px'>Eg: <li style='font-size:13px'>192.168.1.0</li> <li style='font-size:13px'>255.255.255.0</li></p>\n\t<table>\n\t<tr>\n\t\t<td class=legend>{ip_start}:</td>\n\t\t<td>" . Field_text('ip_start', null, 'width:190px;font-size:13px;padding:3px') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{netmask}:</td>\n\t\t<td>" . Field_text('netmask', null, 'width:190px;font-size:13px;padding:3px') . "</td>\n\t</tr>\t\n\t<tr>\t\n\t<tr><td colspan=2><hr></td></tr>\n\t\t<td><input type='button' OnClick=\"javascript:ip_group_start()\" value='« {back}'></td>\n\t\t<td align='right'><input type='button' OnClick=\"javascript:ip_group_subnet()\" value='{next} »'></td>\n\t</table>"; } if ($_GET["selected-ip-family"] == "group") { $form = "\n\t<p class=caption>Ex: <li>192.168.1.20</li> <li>192.168.1.140</li></p>\n\t<table>\n\t<tr>\n\t\t<td class=legend>{ip_start}:</td>\n\t\t<td>" . Field_text('ip_start', null, 'width:120px') . "</td>\n\t</tr>\n\t<td class=legend>{ip_to}:</td>\n\t\t<td>" . Field_text('ip_to', null, 'width:120px') . "</td>\n\t</tr>\n\t<tr>\t\n\t<tr><td colspan=2><hr></td></tr>\n\t\t<td><input type='button' OnClick=\"javascript:ip_group_start()\" value='« {back}'></td>\n\t\t<td align='right'><input type='button' OnClick=\"javascript:ip_group_range()\" value='{next} »'></td>\n\t</table>"; } if ($_GET["selected-ip-family"] == "rule") { $dans = new dansguardian(); $rules = $dans->Master_rules_index; if (is_array($rules)) { while (list($num, $val) = each($rules)) { if ($num == 1) { continue; } $rulename = $val; $arr1[$num] = $rulename; } $form = "\n\t\t<div id='ip_group_end'>\n\t\t\t<strong style='font-size:13px'>{$_GET["pattern"]}</strong>\n\t\t\t<table class='table_form'>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{select_rule}:</td>\n\t\t\t\t<td>" . Field_array_Hash($arr1, 'rule_id', null) . "</td>\n\t\t\t</tr>\n\t\t\t<tr><td colspan=2><hr></td></tr>\n\t\t\t\t<td><input type='button' OnClick=\"javascript:ip_group_start()\" value='« {back}'></td>\n\t\t\t\t<td align='right'><input type='button' OnClick=\"javascript:ip_group_end()\" value='{add} »'></td>\n\t\t\t</table>\n\t\t</div>"; } } $html = "\n\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><img src='img/64-add-computer.png' style='margin:5px'></td>\n\t<td valign='top' width=99%>{$form}</td>\n\t</tr>\n\t</table>"; echo $tpl->_ENGINE_parse_body($html); }
function table_del_ips(){ $pattern=trim($_GET["del-ip-addr"]); $dansrules=new dansguardian_rules(null,$_GET["RuleID"]); $dansrules->DelIpToFilter($pattern); }