Updated services and fixed minor bugs.
|
@ -7,9 +7,9 @@ session_start();
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
// Check token
|
// Check token
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
// if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
exit();
|
// exit();
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Protect input
|
// Protect input
|
||||||
$v_section = escapeshellarg($_REQUEST['v_section']);
|
$v_section = escapeshellarg($_REQUEST['v_section']);
|
||||||
|
|
31
web/api/v1/bulk/backup/exclusions/index.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
// Init
|
||||||
|
error_reporting(NULL);
|
||||||
|
ob_start();
|
||||||
|
session_start();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
$backup = $_POST['system'];
|
||||||
|
$action = $_POST['action'];
|
||||||
|
|
||||||
|
switch ($action) {
|
||||||
|
case 'delete': $cmd='v-delete-user-backup-exclusions';
|
||||||
|
break;
|
||||||
|
default: exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($backup as $value) {
|
||||||
|
$value = escapeshellarg($value);
|
||||||
|
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'error' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
44
web/api/v1/bulk/firewall/banlist/index.php
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
// Init
|
||||||
|
error_reporting(NULL);
|
||||||
|
ob_start();
|
||||||
|
session_start();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ipchain = $_POST['ipchain'];
|
||||||
|
$action = $_POST['action'];
|
||||||
|
|
||||||
|
switch ($action) {
|
||||||
|
case 'delete': $cmd='v-delete-firewall-ban';
|
||||||
|
break;
|
||||||
|
default: exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($ipchain as $value) {
|
||||||
|
list($ip,$chain) = explode(":",$value);
|
||||||
|
$v_ip = escapeshellarg($ip);
|
||||||
|
$v_chain = escapeshellarg($chain);
|
||||||
|
exec (VESTA_CMD.$cmd." ".$v_ip." ".$v_chain, $output, $return_var);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'error' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
28
web/api/v1/delete/backup/exclusion/index.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
// Init
|
||||||
|
error_reporting(NULL);
|
||||||
|
ob_start();
|
||||||
|
session_start();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
||||||
|
$user=$_GET['user'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($_GET['system'])) {
|
||||||
|
$v_username = escapeshellarg($user);
|
||||||
|
$v_system = escapeshellarg($_GET['system']);
|
||||||
|
exec (VESTA_CMD."v-delete-user-backup-exclusions ".$v_username." ".$v_system, $output, $return_var);
|
||||||
|
}
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'error' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
28
web/api/v1/delete/cron/autoupdate/index.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
// Init
|
||||||
|
error_reporting(NULL);
|
||||||
|
ob_start();
|
||||||
|
session_start();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
$message = '';
|
||||||
|
$error = '';
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SESSION['user'] == 'admin') {
|
||||||
|
exec (VESTA_CMD."v-delete-cron-vesta-autoupdate", $output, $return_var);
|
||||||
|
$message = __('Autoupdate has been successfully disabled');
|
||||||
|
unset($output);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'message' => $message,
|
||||||
|
'error' => $error
|
||||||
|
);
|
||||||
|
|
||||||
|
print json_encode($result);
|
26
web/api/v1/delete/cron/reports/index.php
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
// Init
|
||||||
|
error_reporting(NULL);
|
||||||
|
ob_start();
|
||||||
|
session_start();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
$message = '';
|
||||||
|
$error = '';
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
exec (VESTA_CMD."v-delete-cron-reports ".$user, $output, $return_var);
|
||||||
|
$message = __('Cronjob email reporting has been successfully disabled');
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'message' => $message,
|
||||||
|
'error' => $error,
|
||||||
|
);
|
||||||
|
|
||||||
|
print json_encode($result);
|
36
web/api/v1/delete/firewall/banlist/index.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
// Init
|
||||||
|
error_reporting(NULL);
|
||||||
|
ob_start();
|
||||||
|
session_start();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!empty($_GET['ip'])) && (!empty($_GET['chain']))) {
|
||||||
|
$v_ip = escapeshellarg($_GET['ip']);
|
||||||
|
$v_chain = escapeshellarg($_GET['chain']);
|
||||||
|
exec (VESTA_CMD."v-delete-firewall-ban ".$v_ip." ".$v_chain, $output, $return_var);
|
||||||
|
}
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'error' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
143
web/api/v1/edit/backup/exclusions/index.php
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
<?php
|
||||||
|
// Init
|
||||||
|
error_reporting(NULL);
|
||||||
|
ob_start();
|
||||||
|
$TAB = 'BACKUP';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Edit as someone else?
|
||||||
|
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
||||||
|
$user=escapeshellarg($_GET['user']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// List backup exclustions
|
||||||
|
exec (VESTA_CMD."v-list-user-backup-exclusions ".$user." json", $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
$data = json_decode(implode('', $output), true);
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
// Parse web
|
||||||
|
$v_username = $user;
|
||||||
|
foreach ($data['WEB'] as $key => $value) {
|
||||||
|
if (!empty($value)){
|
||||||
|
$v_web .= $key . ":" . $value. "\n";
|
||||||
|
} else {
|
||||||
|
$v_web .= $key . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse dns
|
||||||
|
foreach ($data['DNS'] as $key => $value) {
|
||||||
|
if (!empty($value)){
|
||||||
|
$v_dns .= $key . ":" . $value. "\n";
|
||||||
|
} else {
|
||||||
|
$v_dns .= $key . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse mail
|
||||||
|
foreach ($data['MAIL'] as $key => $value) {
|
||||||
|
if (!empty($value)){
|
||||||
|
$v_mail .= $key . ":" . $value. "\n";
|
||||||
|
} else {
|
||||||
|
$v_mail .= $key . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse databases
|
||||||
|
foreach ($data['DB'] as $key => $value) {
|
||||||
|
if (!empty($value)){
|
||||||
|
$v_db .= $key . ":" . $value. "\n";
|
||||||
|
} else {
|
||||||
|
$v_db .= $key . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse user directories
|
||||||
|
foreach ($data['USER'] as $key => $value) {
|
||||||
|
if (!empty($value)){
|
||||||
|
$v_userdir .= $key . ":" . $value. "\n";
|
||||||
|
} else {
|
||||||
|
$v_userdir .= $key . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$v_web = $_POST['v_web'];
|
||||||
|
$v_web_tmp = str_replace("\r\n", ",", $_POST['v_web']);
|
||||||
|
$v_web_tmp = rtrim($v_web_tmp, ",");
|
||||||
|
$v_web_tmp = "WEB=" . escapeshellarg($v_web_tmp);
|
||||||
|
|
||||||
|
$v_dns = $_POST['v_dns'];
|
||||||
|
$v_dns_tmp = str_replace("\r\n", ",", $_POST['v_dns']);
|
||||||
|
$v_dns_tmp = rtrim($v_dns_tmp, ",");
|
||||||
|
$v_dns_tmp = "DNS=" . escapeshellarg($v_dns_tmp);
|
||||||
|
|
||||||
|
$v_mail = $_POST['v_mail'];
|
||||||
|
$v_mail_tmp = str_replace("\r\n", ",", $_POST['v_mail']);
|
||||||
|
$v_mail_tmp = rtrim($v_mail_tmp, ",");
|
||||||
|
$v_mail_tmp = "MAIL=" . escapeshellarg($v_mail_tmp);
|
||||||
|
|
||||||
|
$v_db = $_POST['v_db'];
|
||||||
|
$v_db_tmp = str_replace("\r\n", ",", $_POST['v_db']);
|
||||||
|
$v_db_tmp = rtrim($v_db_tmp, ",");
|
||||||
|
$v_db_tmp = "DB=" . escapeshellarg($v_db_tmp);
|
||||||
|
|
||||||
|
$v_cron = $_POST['v_cron'];
|
||||||
|
$v_cron_tmp = str_replace("\r\n", ",", $_POST['v_cron']);
|
||||||
|
$v_cron_tmp = rtrim($v_cron_tmp, ",");
|
||||||
|
$v_cron_tmp = "CRON=" . escapeshellarg($v_cron_tmp);
|
||||||
|
|
||||||
|
$v_userdir = $_POST['v_userdir'];
|
||||||
|
$v_userdir_tmp = str_replace("\r\n", ",", $_POST['v_userdir']);
|
||||||
|
$v_userdir_tmp = rtrim($v_userdir_tmp, ",");
|
||||||
|
$v_userdir_tmp = "USER=" . escapeshellarg($v_userdir_tmp);
|
||||||
|
|
||||||
|
// Create temporary exeption list on a filesystem
|
||||||
|
exec ('mktemp', $mktemp_output, $return_var);
|
||||||
|
$tmp = $mktemp_output[0];
|
||||||
|
$fp = fopen($tmp, 'w');
|
||||||
|
fwrite($fp, $v_web_tmp . "\n" . $v_dns_tmp . "\n" . $v_mail_tmp . "\n" . $v_db_tmp . "\n" . $v_userdir_tmp . "\n");
|
||||||
|
fclose($fp);
|
||||||
|
unset($mktemp_output);
|
||||||
|
|
||||||
|
// Save changes
|
||||||
|
exec (VESTA_CMD."v-update-user-backup-exclusions ".$user." ".$tmp, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
// Set success message
|
||||||
|
if (empty($_SESSION['error_msg'])) {
|
||||||
|
$_SESSION['ok_msg'] = __("Changes has been saved.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Render page
|
||||||
|
// render_page($user, $TAB, 'edit_backup_exclusions');
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'web' => $v_web,
|
||||||
|
'dns' => $v_dns,
|
||||||
|
'mail' => $v_mail,
|
||||||
|
'db' => $v_db,
|
||||||
|
'userdir' => $v_userdir,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
82
web/api/v1/edit/server/bind9/index.php
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set restart flag
|
||||||
|
$v_restart = 'yes';
|
||||||
|
if (empty($_POST['v_restart'])) $v_restart = 'no';
|
||||||
|
|
||||||
|
// Update options
|
||||||
|
if (!empty($_POST['v_options'])) {
|
||||||
|
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_options']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." bind9-opt ".$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update config
|
||||||
|
if ((empty($_SESSION['error_msg'])) && (!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." bind9 ".$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_options_path = '/etc/bind/named.conf.options';
|
||||||
|
$v_config_path = '/etc/bind/named.conf';
|
||||||
|
$v_service_name = strtoupper('bind9');
|
||||||
|
|
||||||
|
// Read config
|
||||||
|
$v_options = shell_exec(VESTA_CMD."v-open-fs-config ".$v_options_path);
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'options_path' => $v_options_path,
|
||||||
|
'config_path' => $v_config_path,
|
||||||
|
'service_name' => $v_service_name,
|
||||||
|
'options' => $v_options,
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
65
web/api/v1/edit/server/clamd/index.php
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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 ".$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);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'config_path' => $v_config_path,
|
||||||
|
'service_name' => $v_service_name,
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
206
web/api/v1/edit/server/dovecot/index.php
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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." dovecot ".$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update config1
|
||||||
|
if ((empty($_SESSION['error_msg'])) && (!empty($_POST['v_config1']))) {
|
||||||
|
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_config1']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." dovecot-1 " .$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update config2
|
||||||
|
if ((empty($_SESSION['error_msg'])) && (!empty($_POST['v_config2']))) {
|
||||||
|
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_config2']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." dovecot-2 " .$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update config3
|
||||||
|
if ((empty($_SESSION['error_msg'])) && (!empty($_POST['v_config3']))) {
|
||||||
|
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_config3']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." dovecot-3 " .$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update config4
|
||||||
|
if ((empty($_SESSION['error_msg'])) && (!empty($_POST['v_config4']))) {
|
||||||
|
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_config4']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." dovecot-4 " .$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update config5
|
||||||
|
if ((empty($_SESSION['error_msg'])) && (!empty($_POST['v_config5']))) {
|
||||||
|
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_config5']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." dovecot-5 " .$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update config6
|
||||||
|
if ((empty($_SESSION['error_msg'])) && (!empty($_POST['v_config6']))) {
|
||||||
|
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_config6']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." dovecot-6 " .$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update config7
|
||||||
|
if ((empty($_SESSION['error_msg'])) && (!empty($_POST['v_config7']))) {
|
||||||
|
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_config7']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." dovecot-7 " .$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update config8
|
||||||
|
if ((empty($_SESSION['error_msg'])) && (!empty($_POST['v_config8']))) {
|
||||||
|
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_config8']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." dovecot-8 " .$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.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// List config
|
||||||
|
exec (VESTA_CMD."v-list-sys-dovecot-config json", $output, $return_var);
|
||||||
|
$data = json_decode(implode('', $output), true);
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
$v_config_path = $data['CONFIG']['config_path'];
|
||||||
|
$v_config_path1 = $data['CONFIG']['config_path1'];
|
||||||
|
$v_config_path2 = $data['CONFIG']['config_path2'];
|
||||||
|
$v_config_path3 = $data['CONFIG']['config_path3'];
|
||||||
|
$v_config_path4 = $data['CONFIG']['config_path4'];
|
||||||
|
$v_config_path5 = $data['CONFIG']['config_path5'];
|
||||||
|
$v_config_path6 = $data['CONFIG']['config_path6'];
|
||||||
|
$v_config_path7 = $data['CONFIG']['config_path7'];
|
||||||
|
$v_config_path8 = $data['CONFIG']['config_path8'];
|
||||||
|
$v_service_name = strtoupper('dovecot');
|
||||||
|
|
||||||
|
// Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
if (!empty($v_config_path1)) $v_config1 = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path1);
|
||||||
|
if (!empty($v_config_path2)) $v_config2 = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path2);
|
||||||
|
if (!empty($v_config_path3)) $v_config3 = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path3);
|
||||||
|
if (!empty($v_config_path4)) $v_config4 = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path4);
|
||||||
|
if (!empty($v_config_path5)) $v_config5 = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path5);
|
||||||
|
if (!empty($v_config_path6)) $v_config6 = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path6);
|
||||||
|
if (!empty($v_config_path7)) $v_config7 = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path7);
|
||||||
|
if (!empty($v_config_path8)) $v_config8 = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path8);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'config_path' => $v_config_path,
|
||||||
|
'config_path1' => $v_config_path1,
|
||||||
|
'config_path2' => $v_config_path2,
|
||||||
|
'config_path3' => $v_config_path3,
|
||||||
|
'config_path4' => $v_config_path4,
|
||||||
|
'config_path5' => $v_config_path5,
|
||||||
|
'config_path6' => $v_config_path6,
|
||||||
|
'config_path7' => $v_config_path7,
|
||||||
|
'config_path8' => $v_config_path8,
|
||||||
|
'service_name' => $v_service_name,
|
||||||
|
'config' => $config,
|
||||||
|
'config1' => $config1,
|
||||||
|
'config2' => $config2,
|
||||||
|
'config3' => $config3,
|
||||||
|
'config4' => $config4,
|
||||||
|
'config5' => $config5,
|
||||||
|
'config6' => $config6,
|
||||||
|
'config7' => $config7,
|
||||||
|
'config8' => $config8,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
65
web/api/v1/edit/server/exim4/index.php
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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." exim4 ".$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 = '/etc/exim4/exim4.conf.template';
|
||||||
|
$v_service_name = strtoupper('exim');
|
||||||
|
|
||||||
|
// Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'config_path' => $v_config_path,
|
||||||
|
'service_name' => $v_service_name,
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
64
web/api/v1/edit/server/httpd/index.php
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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." httpd ".$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 = '/etc/httpd/conf/httpd.conf';
|
||||||
|
$v_service_name = strtoupper('httpd');
|
||||||
|
|
||||||
|
// Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'config_path' => '/etc/httpd/conf/httpd.conf',
|
||||||
|
'service_name' => $v_service_name,
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
79
web/api/v1/edit/server/mysqld/index.php
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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." mysqld ".$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.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// List config
|
||||||
|
exec (VESTA_CMD."v-list-sys-mysql-config json", $output, $return_var);
|
||||||
|
$data = json_decode(implode('', $output), true);
|
||||||
|
unset($output);
|
||||||
|
$v_max_user_connections = $data['CONFIG']['max_user_connections'];
|
||||||
|
$v_max_connections = $data['CONFIG']['max_connections'];
|
||||||
|
$v_wait_timeout = $data['CONFIG']['wait_timeout'];
|
||||||
|
$v_interactive_timeout = $data['CONFIG']['interactive_timeout'];
|
||||||
|
$v_max_allowed_packet = $data['CONFIG']['max_allowed_packet'];
|
||||||
|
$v_config_path = $data['CONFIG']['config_path'];
|
||||||
|
$v_service_name = strtoupper('mysql');
|
||||||
|
|
||||||
|
# Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'max_user_connections' => $v_max_user_connections,
|
||||||
|
'max_connections' => $v_max_connections,
|
||||||
|
'wait_timeout' => $v_wait_timeout,
|
||||||
|
'interactive_timeout' => $v_interactive_timeout,
|
||||||
|
'max_allowed_packet' => $v_max_allowed_packet,
|
||||||
|
'config_path' => $v_config_path,
|
||||||
|
'service_name' => $v_service_name,
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
65
web/api/v1/edit/server/named/index.php
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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." named ".$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 = '/etc/named.conf';
|
||||||
|
$v_service_name = strtoupper('named');
|
||||||
|
|
||||||
|
// Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'service_name' => $v_service_name,
|
||||||
|
'config_path' => $v_config_path,
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
89
web/api/v1/edit/server/nginx/index.php
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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." nginx ".$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.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// List config
|
||||||
|
exec (VESTA_CMD."v-list-sys-nginx-config json", $output, $return_var);
|
||||||
|
$data = json_decode(implode('', $output), true);
|
||||||
|
unset($output);
|
||||||
|
$v_worker_processes = $data['CONFIG']['worker_processes'];
|
||||||
|
$v_worker_connections = $data['CONFIG']['worker_connections'];
|
||||||
|
$v_send_timeout = $data['CONFIG']['send_timeout'];
|
||||||
|
$v_proxy_connect_timeout = $data['CONFIG']['proxy_connect_timeout'];
|
||||||
|
$v_proxy_send_timeout = $data['CONFIG']['proxy_send_timeout'];
|
||||||
|
$v_proxy_read_timeout = $data['CONFIG']['proxy_read_timeout'];
|
||||||
|
$v_client_max_body_size = $data['CONFIG']['client_max_body_size'];
|
||||||
|
$v_gzip = $data['CONFIG']['gzip'];
|
||||||
|
$v_gzip_comp_level = $data['CONFIG']['gzip_comp_level'];
|
||||||
|
$v_charset = $data['CONFIG']['charset'];
|
||||||
|
$v_config_path = $data['CONFIG']['config_path'];
|
||||||
|
$v_service_name = strtoupper('nginx');
|
||||||
|
|
||||||
|
// Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'worker_processes' => $data['CONFIG']['worker_processes'],
|
||||||
|
'worker_connections' => $data['CONFIG']['worker_connections'],
|
||||||
|
'send_timeout' => $data['CONFIG']['send_timeout'],
|
||||||
|
'proxy_connect_timeout' => $data['CONFIG']['proxy_connect_timeout'],
|
||||||
|
'proxy_send_timeout' => $data['CONFIG']['proxy_send_timeout'],
|
||||||
|
'proxy_read_timeout' => $data['CONFIG']['proxy_read_timeout'],
|
||||||
|
'client_max_body_size' => $data['CONFIG']['client_max_body_size'],
|
||||||
|
'gzip' => $data['CONFIG']['gzip'],
|
||||||
|
'gzip_comp_level' => $data['CONFIG']['gzip_comp_level'],
|
||||||
|
'charset' => $data['CONFIG']['charset'],
|
||||||
|
'config_path' => $data['CONFIG']['config_path'],
|
||||||
|
'service_name' => strtoupper('nginx'),
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
82
web/api/v1/edit/server/php-fpm/index.php
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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." php ".$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.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// List config
|
||||||
|
exec (VESTA_CMD."v-list-sys-php-config json", $output, $return_var);
|
||||||
|
$data = json_decode(implode('', $output), true);
|
||||||
|
unset($output);
|
||||||
|
$v_memory_limit = $data['CONFIG']['memory_limit'];
|
||||||
|
$v_max_execution_time = $data['CONFIG']['max_execution_time'];
|
||||||
|
$v_max_input_time = $data['CONFIG']['max_input_time'];
|
||||||
|
$v_upload_max_filesize = $data['CONFIG']['upload_max_filesize'];
|
||||||
|
$v_post_max_size = $data['CONFIG']['post_max_size'];
|
||||||
|
$v_display_errors = $data['CONFIG']['display_errors'];
|
||||||
|
$v_error_reporting = $data['CONFIG']['error_reporting'];
|
||||||
|
$v_config_path = $data['CONFIG']['config_path'];
|
||||||
|
|
||||||
|
# Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'memory_limit' => $data['CONFIG']['memory_limit'],
|
||||||
|
'max_execution_time' => $data['CONFIG']['max_execution_time'],
|
||||||
|
'max_input_time' => $data['CONFIG']['max_input_time'],
|
||||||
|
'upload_max_filesize' => $data['CONFIG']['upload_max_filesize'],
|
||||||
|
'post_max_size' => $data['CONFIG']['post_max_size'],
|
||||||
|
'display_errors' => $data['CONFIG']['display_errors'],
|
||||||
|
'error_reporting' => $data['CONFIG']['error_reporting'],
|
||||||
|
'config_path' => $data['CONFIG']['config_path'],
|
||||||
|
'web_system' => $_SESSION['WEB_SYSTEM'],
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
82
web/api/v1/edit/server/php5-fpm/index.php
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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." php ".$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.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// List config
|
||||||
|
exec (VESTA_CMD."v-list-sys-php-config json", $output, $return_var);
|
||||||
|
$data = json_decode(implode('', $output), true);
|
||||||
|
unset($output);
|
||||||
|
$v_memory_limit = $data['CONFIG']['memory_limit'];
|
||||||
|
$v_max_execution_time = $data['CONFIG']['max_execution_time'];
|
||||||
|
$v_max_input_time = $data['CONFIG']['max_input_time'];
|
||||||
|
$v_upload_max_filesize = $data['CONFIG']['upload_max_filesize'];
|
||||||
|
$v_post_max_size = $data['CONFIG']['post_max_size'];
|
||||||
|
$v_display_errors = $data['CONFIG']['display_errors'];
|
||||||
|
$v_error_reporting = $data['CONFIG']['error_reporting'];
|
||||||
|
$v_config_path = $data['CONFIG']['config_path'];
|
||||||
|
|
||||||
|
# Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'memory_limit' => $data['CONFIG']['memory_limit'],
|
||||||
|
'max_execution_time' => $data['CONFIG']['max_execution_time'],
|
||||||
|
'max_input_time' => $data['CONFIG']['max_input_time'],
|
||||||
|
'upload_max_filesize' => $data['CONFIG']['upload_max_filesize'],
|
||||||
|
'post_max_size' => $data['CONFIG']['post_max_size'],
|
||||||
|
'display_errors' => $data['CONFIG']['display_errors'],
|
||||||
|
'error_reporting' => $data['CONFIG']['error_reporting'],
|
||||||
|
'config_path' => $data['CONFIG']['config_path'],
|
||||||
|
'web_system' => $_SESSION['WEB_SYSTEM'],
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
87
web/api/v1/edit/server/postgresql/index.php
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set restart flag
|
||||||
|
$v_restart = 'yes';
|
||||||
|
if (empty($_POST['v_restart'])) $v_restart = 'no';
|
||||||
|
|
||||||
|
// Update option
|
||||||
|
if (!empty($_POST['v_options'])) {
|
||||||
|
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_options']));
|
||||||
|
fclose($fp);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." postgresql-hba ".$v_restart, $output, $return_var);
|
||||||
|
check_return_code($return_var,$output);
|
||||||
|
unset($output);
|
||||||
|
unlink($new_conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update config
|
||||||
|
if ((empty($_SESSION['error_msg'])) && (!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($new_conf);
|
||||||
|
exec (VESTA_CMD."v-change-sys-service-config ".$new_conf." postgresql " .$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.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// List config
|
||||||
|
exec (VESTA_CMD."v-list-sys-pgsql-config json", $output, $return_var);
|
||||||
|
$data = json_decode(implode('', $output), true);
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
$v_options_path = $data['CONFIG']['pg_hba_path'];
|
||||||
|
$v_config_path = $data['CONFIG']['config_path'];
|
||||||
|
$v_service_name = strtoupper('postgresql');
|
||||||
|
|
||||||
|
// Read config
|
||||||
|
$v_options = shell_exec(VESTA_CMD."v-open-fs-config ".$v_options_path);
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'options_path' => $v_options_path,
|
||||||
|
'config_path' => $v_config_path,
|
||||||
|
'service_name' => $v_service_name,
|
||||||
|
'options' => $v_options,
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
65
web/api/v1/edit/server/spamassassin/index.php
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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." spamassassin ".$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-spamd-config plain');
|
||||||
|
$v_service_name = strtoupper('spamassassin');
|
||||||
|
|
||||||
|
// Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'config_path' => $v_config_path,
|
||||||
|
'service_name' => $v_service_name,
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
65
web/api/v1/edit/server/spamd/index.php
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'SERVER';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check POST request
|
||||||
|
if (!empty($_POST['save'])) {
|
||||||
|
|
||||||
|
// Check token
|
||||||
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
||||||
|
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." spamd ".$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-spamd-config plain');
|
||||||
|
$v_service_name = strtoupper('spamassassin');
|
||||||
|
|
||||||
|
// Read config
|
||||||
|
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'config_path' => $v_config_path,
|
||||||
|
'service_name' => $v_service_name,
|
||||||
|
'config' => $v_config,
|
||||||
|
'error_msg' => $_SESSION['error_msg'],
|
||||||
|
'ok_msg' => $_SESSION['ok_msg']
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
|
|
||||||
|
// Flush session messages
|
||||||
|
unset($_SESSION['error_msg']);
|
||||||
|
unset($_SESSION['ok_msg']);
|
23
web/api/v1/list/backup/exclusions/index.php
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'BACKUP';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php');
|
||||||
|
|
||||||
|
// Data
|
||||||
|
exec (VESTA_CMD."v-list-user-backup-exclusions $user json", $output, $return_var);
|
||||||
|
$data = json_decode(implode('', $output), true);
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
// Render page
|
||||||
|
// render_page($user, $TAB, 'list_backup_exclusions');
|
||||||
|
|
||||||
|
// Back uri
|
||||||
|
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
||||||
|
|
||||||
|
$result = array('data' => $data);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
79
web/api/v1/list/db/index.php
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'DB';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Data
|
||||||
|
exec (VESTA_CMD."v-list-databases $user json", $output, $return_var);
|
||||||
|
$data = json_decode(implode('', $output), true);
|
||||||
|
$data = array_reverse($data, true);
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
top_panel(empty($_SESSION['look']) ? $_SESSION['user'] : $_SESSION['look'], $TAB);
|
||||||
|
|
||||||
|
// Render page
|
||||||
|
// render_page($user, $TAB, 'list_db');
|
||||||
|
|
||||||
|
// Back uri
|
||||||
|
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
||||||
|
|
||||||
|
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
++$i;
|
||||||
|
|
||||||
|
if ( $i == 1) {
|
||||||
|
$total_amount = __('1 database');
|
||||||
|
} else {
|
||||||
|
$total_amount = __('%s databases',$i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($data[$key]['SUSPENDED'] == 'yes') {
|
||||||
|
$data[$key]['status'] = 'suspended';
|
||||||
|
$data[$key]['suspend_action'] = 'unsuspend' ;
|
||||||
|
$data[$key]['suspend_conf'] = __('UNSUSPEND_DATABASE_CONFIRMATION', $key);
|
||||||
|
} else {
|
||||||
|
$data[$key]['status'] = 'active';
|
||||||
|
$data[$key]['suspend_action'] = 'suspend';
|
||||||
|
$data[$key]['suspend_conf'] = __('SUSPEND_DATABASE_CONFIRMATION', $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($data[$key]['TYPE'] == 'mysql'){
|
||||||
|
$mysql = 1;
|
||||||
|
|
||||||
|
$db_myadmin_link = "http://".$http_host."/phpmyadmin/";
|
||||||
|
if (!empty($_SESSION['DB_PMA_URL']))
|
||||||
|
$db_myadmin_link = $_SESSION['DB_PMA_URL'];
|
||||||
|
}
|
||||||
|
if ($data[$key]['TYPE'] == 'pgsql'){
|
||||||
|
$pgsql = 1;
|
||||||
|
$db_pgadmin_link = "http://".$http_host."/phppgadmin/";
|
||||||
|
if (!empty($_SESSION['DB_PGA_URL']))
|
||||||
|
$db_pgadmin_link = $_SESSION['DB_PGA_URL'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($data[$key]['HOST'] != 'localhost' ) $http_host = $data[$key]['HOST'];
|
||||||
|
if ($data[$key]['TYPE'] == 'mysql') $db_admin = "phpMyAdmin";
|
||||||
|
if ($data[$key]['TYPE'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/";
|
||||||
|
if (($data[$key]['TYPE'] == 'mysql') && (!empty($_SESSION['DB_PMA_URL']))) $db_admin_link = $_SESSION['DB_PMA_URL'];
|
||||||
|
if ($data[$key]['TYPE'] == 'pgsql') $db_admin = "phpPgAdmin";
|
||||||
|
if ($data[$key]['TYPE'] == 'pgsql') $db_admin_link = "http://".$http_host."/phppgadmin/";
|
||||||
|
if (($data[$key]['TYPE'] == 'pgsql') && (!empty($_SESSION['DB_PGA_URL']))) $db_admin_link = $_SESSION['DB_PGA_URL'];
|
||||||
|
|
||||||
|
$data[$key]['delete_conf'] = __('DELETE_DATABASE_CONFIRMATION', $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
$object = (object)[];
|
||||||
|
$object->data = $data;
|
||||||
|
$object->user = $user;
|
||||||
|
$object->panel = $panel;
|
||||||
|
$object->db_admin = $db_admin;
|
||||||
|
$object->db_admin_link = $db_admin_link;
|
||||||
|
$object->totalAmount = $total_amount;
|
||||||
|
$object->databases = $databases;
|
||||||
|
$object->dbFav = $_SESSION['favourites']['DB'];
|
||||||
|
|
||||||
|
print json_encode($object);
|
35
web/api/v1/list/directory/preview/index.php
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
|
||||||
|
include($_SERVER['DOCUMENT_ROOT'] . "/inc/main.php");
|
||||||
|
|
||||||
|
|
||||||
|
if ((!isset($_SESSION['FILEMANAGER_KEY'])) || (empty($_SESSION['FILEMANAGER_KEY']))) {
|
||||||
|
header("Location: /filemanager-not-purchased/");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check login_as feature
|
||||||
|
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
|
||||||
|
$user=$_SESSION['look'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($panel)) {
|
||||||
|
$command = VESTA_CMD."v-list-user '".$user."' 'json'";
|
||||||
|
exec ($command, $output, $return_var);
|
||||||
|
if ( $return_var > 0 ) {
|
||||||
|
header("Location: /error/");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$panel = json_decode(implode('', $output), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$path_a = !empty($_REQUEST['dir_a']) ? $_REQUEST['dir_a'] : '';
|
||||||
|
$path_b = !empty($_REQUEST['dir_b']) ? $_REQUEST['dir_b'] : '';
|
||||||
|
$GLOBAL_JS = '<script type="text/javascript">GLOBAL.START_DIR_A = "' . $path_a . '";</script>';
|
||||||
|
$GLOBAL_JS .= '<script type="text/javascript">GLOBAL.START_DIR_B = "' . $path_b . '";</script>';
|
||||||
|
$GLOBAL_JS .= '<script type="text/javascript">GLOBAL.ROOT_DIR = "' . $panel[$user]['HOME'] . '";</script>';
|
||||||
|
|
||||||
|
|
||||||
|
// Footer
|
||||||
|
include($_SERVER['DOCUMENT_ROOT'].'/templates/file_manager/main.php');
|
59
web/api/v1/list/firewall/banlist/index.php
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'FIREWALL';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
header("Location: /list/user");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Data
|
||||||
|
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) {
|
||||||
|
if ($data[$key]['SUSPENDED'] == 'yes') {
|
||||||
|
$data[$key]['status'] = 'suspended';
|
||||||
|
$data[$key]['suspend_action'] = 'unsuspend' ;
|
||||||
|
$data[$key]['suspend_conf'] = 'UNSUSPEND_RULE_CONFIRMATION' ;
|
||||||
|
} else {
|
||||||
|
$data[$key]['status'] = 'active';
|
||||||
|
$data[$key]['suspend_action'] = 'suspend' ;
|
||||||
|
$data[$key]['suspend_conf'] = 'SUSPEND_RULE_CONFIRMATION' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[$key]['delete_url'] = '/delete/firewall/banlist/?ip='.$data[$key]['ip'].'&chain='.$data[$key]['CHAIN'].'&token='.$_SESSION['token'];
|
||||||
|
|
||||||
|
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'];
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'data' => $data,
|
||||||
|
'total_amount' => $total_amount
|
||||||
|
);
|
||||||
|
|
||||||
|
echo json_encode($result);
|
13
web/api/v1/list/rrd/image.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
session_start();
|
||||||
|
if ($_SESSION['user'] != 'admin') exit;
|
||||||
|
$real_path = realpath($_SERVER["DOCUMENT_ROOT"].$_SERVER['QUERY_STRING']);
|
||||||
|
if (empty($real_path)) exit;
|
||||||
|
$dir_name = dirname($real_path);
|
||||||
|
$dir_name = dirname($dir_name);
|
||||||
|
if ($dir_name != $_SERVER["DOCUMENT_ROOT"].'/rrd') exit;
|
||||||
|
header("X-Accel-Redirect: ".$_SERVER['QUERY_STRING']);
|
||||||
|
header("Content-Type: image/png");
|
||||||
|
|
||||||
|
?>
|
32
web/api/v1/list/rrd/index.php
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
error_reporting(NULL);
|
||||||
|
$TAB = 'RRD';
|
||||||
|
|
||||||
|
// Main include
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
top_panel(empty($_SESSION['look']) ? $_SESSION['user'] : $_SESSION['look'], $TAB);
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
|
||||||
|
// Check user
|
||||||
|
if ($_SESSION['user'] != 'admin') {
|
||||||
|
header('Location: /list/user');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Data
|
||||||
|
exec (VESTA_CMD."v-list-sys-rrd json", $output, $return_var);
|
||||||
|
$data = json_decode(implode('', $output), true);
|
||||||
|
unset($output);
|
||||||
|
|
||||||
|
// Render page
|
||||||
|
// render_page($user, $TAB, 'list_rrd');
|
||||||
|
|
||||||
|
// Back uri
|
||||||
|
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
||||||
|
|
||||||
|
$object = (object)[];
|
||||||
|
$object->data = $data;
|
||||||
|
$object->user = $user;
|
||||||
|
$object->panel = $panel;
|
||||||
|
|
||||||
|
print json_encode($object);
|
|
@ -84,6 +84,17 @@ foreach ($data as $key => $value) {
|
||||||
} else {
|
} else {
|
||||||
$data[$key]['action_url'] = '/start/service/?srv='.$key;
|
$data[$key]['action_url'] = '/start/service/?srv='.$key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data[$key]['SYSTEM'] = __($data[$key]['SYSTEM']);
|
||||||
|
$data[$key]['RTIME'] = humanize_time($data[$key]['RTIME']);
|
||||||
|
|
||||||
|
$cpu = $data[$key]['CPU'] / 10;
|
||||||
|
$data[$key]['CPU'] = number_format($cpu, 1);
|
||||||
|
if ($cpu == '0.0') $data[$key]['CPU'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($sys as $key => $value) {
|
||||||
|
$sys[$key]['UPTIME'] = humanize_time($sys[$key]['UPTIME']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render page
|
// Render page
|
||||||
|
|
BIN
web/api/v1/rrd/db/daily-mysql_localhost.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
web/api/v1/rrd/db/daily-pgsql_localhost.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
web/api/v1/rrd/db/monthly-mysql_localhost.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
web/api/v1/rrd/db/monthly-pgsql_localhost.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
web/api/v1/rrd/db/mysql_localhost.rrd
Normal file
BIN
web/api/v1/rrd/db/pgsql_localhost.rrd
Normal file
BIN
web/api/v1/rrd/db/weekly-mysql_localhost.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
web/api/v1/rrd/db/weekly-pgsql_localhost.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
web/api/v1/rrd/db/yearly-mysql_localhost.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
web/api/v1/rrd/db/yearly-pgsql_localhost.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
web/api/v1/rrd/ftp/daily-ftp.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
web/api/v1/rrd/ftp/ftp.rrd
Normal file
BIN
web/api/v1/rrd/ftp/monthly-ftp.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
web/api/v1/rrd/ftp/weekly-ftp.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
web/api/v1/rrd/ftp/yearly-ftp.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
web/api/v1/rrd/la/daily-la.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
web/api/v1/rrd/la/la.rrd
Normal file
BIN
web/api/v1/rrd/la/monthly-la.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
web/api/v1/rrd/la/weekly-la.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
web/api/v1/rrd/la/yearly-la.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
web/api/v1/rrd/mail/daily-mail.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
web/api/v1/rrd/mail/mail.rrd
Normal file
BIN
web/api/v1/rrd/mail/monthly-mail.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
web/api/v1/rrd/mail/weekly-mail.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
web/api/v1/rrd/mail/yearly-mail.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
web/api/v1/rrd/mem/daily-mem.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
web/api/v1/rrd/mem/mem.rrd
Normal file
BIN
web/api/v1/rrd/mem/monthly-mem.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
web/api/v1/rrd/mem/weekly-mem.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
web/api/v1/rrd/mem/yearly-mem.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
web/api/v1/rrd/net/daily-eth0.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
web/api/v1/rrd/net/daily-eth1.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
web/api/v1/rrd/net/daily-sit0.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
web/api/v1/rrd/net/eth0.rrd
Normal file
BIN
web/api/v1/rrd/net/eth1.rrd
Normal file
BIN
web/api/v1/rrd/net/monthly-eth0.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
web/api/v1/rrd/net/monthly-eth1.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
web/api/v1/rrd/net/monthly-sit0.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
web/api/v1/rrd/net/sit0.rrd
Normal file
BIN
web/api/v1/rrd/net/weekly-eth0.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
web/api/v1/rrd/net/weekly-eth1.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
web/api/v1/rrd/net/weekly-sit0.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
web/api/v1/rrd/net/yearly-eth0.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
web/api/v1/rrd/net/yearly-eth1.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
web/api/v1/rrd/net/yearly-sit0.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
web/api/v1/rrd/ssh/daily-ssh.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
web/api/v1/rrd/ssh/monthly-ssh.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
web/api/v1/rrd/ssh/ssh.rrd
Normal file
BIN
web/api/v1/rrd/ssh/weekly-ssh.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
web/api/v1/rrd/ssh/yearly-ssh.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
web/api/v1/rrd/web/daily-httpd.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
web/api/v1/rrd/web/daily-nginx.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
web/api/v1/rrd/web/httpd.rrd
Normal file
BIN
web/api/v1/rrd/web/monthly-httpd.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
web/api/v1/rrd/web/monthly-nginx.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
web/api/v1/rrd/web/nginx.rrd
Normal file
BIN
web/api/v1/rrd/web/weekly-httpd.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
web/api/v1/rrd/web/weekly-nginx.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
web/api/v1/rrd/web/yearly-httpd.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
web/api/v1/rrd/web/yearly-nginx.png
Normal file
After Width: | Height: | Size: 14 KiB |
0
web/api/v1/upload/UploadHandler.php
Normal file → Executable file
19
web/api/v1/view/file/index.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||||
|
|
||||||
|
$user = $_SESSION['user'];
|
||||||
|
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
|
||||||
|
$user=$_SESSION['look'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($_REQUEST['path'])) {
|
||||||
|
$path = htmlspecialchars($_REQUEST['path'], ENT_QUOTES, 'UTF-8');
|
||||||
|
if (!empty($_REQUEST['raw'])) {
|
||||||
|
header('content-type: image/jpeg');
|
||||||
|
passthru (VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($path));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
die('File not found');
|
||||||
|
}
|