Fixed cron autoupdates and firewall banlist.

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

View File

@@ -61,6 +61,8 @@ $result = array(
'ok_msg' => $_SESSION['ok_msg']
);
echo json_encode($result);
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);

View File

@@ -11,7 +11,7 @@ $error = '';
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
exit();
$error = 'Unauthenticated';
}
if ($_SESSION['user'] == 'admin') {

View File

@@ -11,7 +11,7 @@ $error = '';
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
exit();
$error = 'Unathenticated';
}
exec (VESTA_CMD."v-delete-cron-reports ".$user, $output, $return_var);

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'];