mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-19 13:01:51 -07:00
Create clamd.scan index page
This commit is contained in:
parent
0d85c88d18
commit
041fd2914f
1 changed files with 46 additions and 0 deletions
46
web/edit/server/clamd.scan/index.php
Normal file
46
web/edit/server/clamd.scan/index.php
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
header("Location: /list/user");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
header('location: /login/');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
// Set restart flag
|
||||||
|
$v_restart = 'yes';
|
||||||
|
if (empty($_POST['v_restart'])) $v_restart = 'no';
|
||||||
|
// Update config
|
||||||
|
if (!empty($_POST['v_config'])) {
|
||||||
|
exec ('mktemp', $mktemp_output, $return_var);
|
||||||
|
$new_conf = $mktemp_output[0];
|
||||||
|
$fp = fopen($new_conf, 'w');
|
||||||
|
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_config']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." clamd.scan ".$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
// Set success message
|
||||||
|
if (empty($_SESSION['error_msg'])) {
|
||||||
|
$_SESSION['ok_msg'] = __('Changes has been saved.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$v_config_path = shell_exec(VESTA_CMD.'v-list-sys-clamd-config plain');
|
||||||
|
$v_service_name = strtoupper('clamav');
|
||||||
|
// Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
// Render page
|
||||||
|
render_page($user, $TAB, 'edit_server_service');
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
Loading…
Add table
Add a link
Reference in a new issue