Fixed cron autoupdates and firewall banlist.

This commit is contained in:
Alexander 2021-10-28 22:51:42 +03:00
commit 2ecb3a10ac
4 changed files with 7 additions and 8 deletions

View file

@ -9,7 +9,6 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check user
if ($_SESSION['user'] != 'admin') {
header("Location: /list/user");
exit;
}
@ -18,9 +17,10 @@ exec (VESTA_CMD."v-list-firewall-ban json", $output, $return_var);
$data = json_decode(implode('', $output), true);
$data = array_reverse($data, true);
unset($output);
$i = 0;
foreach ($data as $key => $value) {
++$i;
if ($data[$key]['SUSPENDED'] == 'yes') {
$data[$key]['status'] = 'suspended';
$data[$key]['suspend_action'] = 'unsuspend' ;
@ -32,22 +32,19 @@ foreach ($data as $key => $value) {
}
$data[$key]['delete_url'] = '/delete/firewall/banlist/?ip='.$data[$key]['ip'].'&chain='.$data[$key]['CHAIN'].'&token='.$_SESSION['token'];
$data[$key]['delete_confirmation'] = __('DELETE_IP_CONFIRMATION',$key);
if ( $i == 1) {
$total_amount = __('1 rule');
} else {
$total_amount = __('%s rules',$i);
}
++$i;
}
if ($i == 0) {
$total_amount = __('There are no currently banned IP');
}
// Render page
// render_page($user, $TAB, 'list_firewall_banlist');
// Back uri
$_SESSION['back'] = $_SERVER['REQUEST_URI'];