<?phprequire_once("guiconfig.inc");require_once("filter.inc");if (!isset($config['filter']['rule'])) { $config['filter']['rule'] = array();}$a_filter = &$config['filter']['rule'];if ($_SERVER['REQUEST_METHOD'] === 'POST') { $pconfig = $_POST; if (isset($pconfig['id']) && isset($a_filter[$pconfig['id']])) { // id found and valid $id = $pconfig['id']; } if (isset($pconfig['act']) && $pconfig['act'] == 'toggle' && isset($id)) { // toggle item if(isset($a_filter[$id]['disabled'])) { unset($a_filter[$id]['disabled']); } else { $a_filter[$id]['disabled'] = true; } write_config(); filter_configure(); header(url_safe('Location: /block.php?rand=%s', rand())); exit; }}include("head.inc");?><body><script type="text/javascript">$( document ).ready(function() { // link toggle buttons $(".act_toggle").click(function(event){ event.preventDefault(); var id = $(this).attr("id").split('_').pop(-1); $("#id").val(id); $("#action").val("toggle"); $("#iform").submit(); });});</script> <form action="block.php?rand=<?=rand();?>" method="post" name="iform" id="iform"> <input type="hidden" id="id" name="id" value="" /> <input type="hidden" id="action" name="act" value="" /> <table class="table table-striped table-hover" id="rules"> <thead> <tr> <th> </th> <th> </th> </tr> </thead> <tbody><?php foreach ($a_filter as $i => $filterent): if ((isset($filterent['floating']))): // select icon if ($filterent['type'] == "block" && empty($filterent['disabled'])) { $iconfn = "glyphicon-remove text-danger"; } elseif ($filterent['type'] == "block" && !empty($filterent['disabled'])) { $iconfn = "glyphicon-remove text-muted"; } elseif ($filterent['type'] == "reject" && empty($filterent['disabled'])) { $iconfn = "glyphicon-remove-sign text-danger"; } elseif ($filterent['type'] == "reject" && !empty($filterent['disabled'])) { $iconfn = "glyphicon-remove-sign text-muted"; } else if ($filterent['type'] == "match" && empty($filterent['disabled'])) { $iconfn = "glyphicon-ok text-info"; } else if ($filterent['type'] == "match" && !empty($filterent['disabled'])) { $iconfn = "glyphicon-ok text-muted"; } elseif (empty($filterent['disabled'])) { $iconfn = "glyphicon-play text-success"; } else { $iconfn = "glyphicon-play text-muted"; }?> <tr class="rule" data-category="<?=!empty($filterent['category']) ? $filterent['category'] : "";?>"> <td> <a href="#" class="act_toggle" id="toggle_<?=$i;?>" data-toggle="tooltip" title="<?=(empty($filterent['disabled'])) ? gettext("disable rule") : gettext("enable rule");?>"><span class="glyphicon <?=$iconfn;?>"></span></a> </td> <td> <?=htmlspecialchars($filterent['descr']);?> </td> </tr><?php endif; endforeach;?> </tbody> </table> </form><?php include("foot.inc"); ?>
<?phprequire_once("guiconfig.inc");require_once("filter.inc");if (!isset($config['filter']['rule'])) { $config['filter']['rule'] = array();}$a_filter = &$config['filter']['rule'];if ($_SERVER['REQUEST_METHOD'] === 'POST') { $pconfig = $_POST; if (isset($pconfig['id']) && isset($a_filter[$pconfig['id']])) { // id found and valid $id = $pconfig['id']; } if (isset($pconfig['act']) && $pconfig['act'] == 'toggle' && isset($id)) { // toggle item if(isset($a_filter[$id]['disabled'])) { unset($a_filter[$id]['disabled']); } else { $a_filter[$id]['disabled'] = true; } write_config(); filter_configure(); header(url_safe('Location: /block.php?rand=%s', rand())); exit; }}include("head.inc");?>
<?php foreach ($a_filter as $i => $filterent): if ((isset($filterent['floating']))): // select icon if ($filterent['type'] == "block" && empty($filterent['disabled'])) { $iconfn = "glyphicon-remove text-danger"; } elseif ($filterent['type'] == "block" && !empty($filterent['disabled'])) { $iconfn = "glyphicon-remove text-muted"; } elseif ($filterent['type'] == "reject" && empty($filterent['disabled'])) { $iconfn = "glyphicon-remove-sign text-danger"; } elseif ($filterent['type'] == "reject" && !empty($filterent['disabled'])) { $iconfn = "glyphicon-remove-sign text-muted"; } else if ($filterent['type'] == "match" && empty($filterent['disabled'])) { $iconfn = "glyphicon-ok text-info"; } else if ($filterent['type'] == "match" && !empty($filterent['disabled'])) { $iconfn = "glyphicon-ok text-muted"; } elseif (empty($filterent['disabled'])) { $iconfn = "glyphicon-play text-success"; } else { $iconfn = "glyphicon-play text-muted"; }?>
<?php endif; endforeach;?>
<?php include("foot.inc"); ?>