disable old php api

This commit is contained in:
Serghey Rodin 2021-10-29 11:29:30 +03:00
commit 93e9fe9f99
137 changed files with 137 additions and 9738 deletions

View file

@ -1,130 +1 @@
<?php
// Init
error_reporting(NULL);
ob_start();
$TAB = 'BACKUP';
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'])) {
header('location: /login/');
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');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,83 +1 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
$TAB = 'CRON';
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Edit as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
$user=escapeshellarg($_GET['user']);
}
// Check job id
if (empty($_GET['job'])) {
header("Location: /list/cron/");
exit;
}
// List cron job
$v_job = escapeshellarg($_GET['job']);
exec (VESTA_CMD."v-list-cron-job ".$user." ".$v_job." json", $output, $return_var);
check_return_code($return_var,$output);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse cron job
$v_username = $user;
$v_job = $_GET['job'];
$v_min = $data[$v_job]['MIN'];
$v_hour = $data[$v_job]['HOUR'];
$v_day = $data[$v_job]['DAY'];
$v_month = $data[$v_job]['MONTH'];
$v_wday = $data[$v_job]['WDAY'];
$v_cmd = $data[$v_job]['CMD'];
$v_date = $data[$v_job]['DATE'];
$v_time = $data[$v_job]['TIME'];
$v_suspended = $data[$v_job]['SUSPENDED'];
if ( $v_suspended == 'yes' ) {
$v_status = 'suspended';
} else {
$v_status = 'active';
}
// Check POST request
if (!empty($_POST['save'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
$v_username = $user;
$v_job = escapeshellarg($_GET['job']);
$v_min = escapeshellarg($_POST['v_min']);
$v_hour = escapeshellarg($_POST['v_hour']);
$v_day = escapeshellarg($_POST['v_day']);
$v_month = escapeshellarg($_POST['v_month']);
$v_wday = escapeshellarg($_POST['v_wday']);
$v_cmd = escapeshellarg($_POST['v_cmd']);
// Save changes
exec (VESTA_CMD."v-change-cron-job ".$v_username." ".$v_job." ".$v_min." ".$v_hour." ".$v_day." ".$v_month." ".$v_wday." ".$v_cmd, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_cmd = $_POST['v_cmd'];
// Set success message
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __("Changes has been saved.");
}
}
// Render page
render_page($user, $TAB, 'edit_cron');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,91 +1 @@
<?php
// Init
error_reporting(NULL);
ob_start();
$TAB = 'DB';
// Main include
include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php');
// Check database id
if (empty($_GET['database'])) {
header("Location: /list/db/");
exit;
}
// Edit as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
$user=escapeshellarg($_GET['user']);
}
// List datbase
$v_database = escapeshellarg($_GET['database']);
exec (VESTA_CMD."v-list-database ".$user." ".$v_database." json", $output, $return_var);
check_return_code($return_var,$output);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse database
$v_username = $user;
$v_database = $_GET['database'];
$v_dbuser = $data[$v_database]['DBUSER'];
$v_password = "";
$v_host = $data[$v_database]['HOST'];
$v_type = $data[$v_database]['TYPE'];
$v_charset = $data[$v_database]['CHARSET'];
$v_date = $data[$v_database]['DATE'];
$v_time = $data[$v_database]['TIME'];
$v_suspended = $data[$v_database]['SUSPENDED'];
if ( $v_suspended == 'yes' ) {
$v_status = 'suspended';
} else {
$v_status = 'active';
}
$v_database = escapeshellarg($_GET['database']);
// Check POST request
if (!empty($_POST['save'])) {
$v_username = $user;
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
// Change database user
if (($v_dbuser != $_POST['v_dbuser']) && (empty($_SESSION['error_msg']))) {
$v_dbuser = preg_replace("/^".$user."_/", "", $_POST['v_dbuser']);
$v_dbuser = escapeshellarg($v_dbuser);
exec (VESTA_CMD."v-change-database-user ".$v_username." ".$v_database." ".$v_dbuser, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_dbuser = $user."_".preg_replace("/^".$user."_/", "", $_POST['v_dbuser']);
}
// Change database password
if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
$v_password = tempnam("/tmp","vst");
$fp = fopen($v_password, "w");
fwrite($fp, $_POST['v_password']."\n");
fclose($fp);
exec (VESTA_CMD."v-change-database-password ".$v_username." ".$v_database." ".$v_password, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
unlink($v_password);
$v_password = escapeshellarg($_POST['v_password']);
}
// Set success message
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Changes has been saved.');
}
}
// Render page
render_page($user, $TAB, 'edit_db');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,209 +1 @@
<?php
error_reporting(NULL);
ob_start();
$TAB = 'DNS';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check domain name
if (empty($_GET['domain'])) {
header("Location: /list/dns/");
exit;
}
// Edit as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
$user=escapeshellarg($_GET['user']);
}
// List dns domain
if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-list-dns-domain ".$user." ".$v_domain." json", $output, $return_var);
check_return_code($return_var,$output);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse dns domain
$v_username = $user;
$v_domain = $_GET['domain'];
$v_ip = $data[$v_domain]['IP'];
$v_template = $data[$v_domain]['TPL'];
$v_ttl = $data[$v_domain]['TTL'];
$v_exp = $data[$v_domain]['EXP'];
$v_soa = $data[$v_domain]['SOA'];
$v_date = $data[$v_domain]['DATE'];
$v_time = $data[$v_domain]['TIME'];
$v_suspended = $data[$v_domain]['SUSPENDED'];
if ( $v_suspended == 'yes' ) {
$v_status = 'suspended';
} else {
$v_status = 'active';
}
// List dns templates
exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
$templates = json_decode(implode('', $output), true);
unset($output);
}
// List dns record
if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
$v_domain = escapeshellarg($_GET['domain']);
$v_record_id = escapeshellarg($_GET['record_id']);
exec (VESTA_CMD."v-list-dns-records ".$user." ".$v_domain." json", $output, $return_var);
check_return_code($return_var,$output);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse dns record
$v_username = $user;
$v_domain = $_GET['domain'];
$v_record_id = $_GET['record_id'];
$v_rec = $data[$v_record_id]['RECORD'];
$v_type = $data[$v_record_id]['TYPE'];
$v_val = $data[$v_record_id]['VALUE'];
$v_priority = $data[$v_record_id]['PRIORITY'];
$v_suspended = $data[$v_record_id]['SUSPENDED'];
if ( $v_suspended == 'yes' ) {
$v_status = 'suspended';
} else {
$v_status = 'active';
}
$v_date = $data[$v_record_id]['DATE'];
$v_time = $data[$v_record_id]['TIME'];
}
// Check POST request for dns domain
if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
$v_domain = escapeshellarg($_POST['v_domain']);
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
// Change domain IP
if (($v_ip != $_POST['v_ip']) && (empty($_SESSION['error_msg']))) {
$v_ip = escapeshellarg($_POST['v_ip']);
exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." ".$v_domain." ".$v_ip." no", $output, $return_var);
check_return_code($return_var,$output);
$restart_dns = 'yes';
unset($output);
}
// Change domain template
if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
$v_template = escapeshellarg($_POST['v_template']);
exec (VESTA_CMD."v-change-dns-domain-tpl ".$v_username." ".$v_domain." ".$v_template." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_dns = 'yes';
}
// Change SOA record
if (($v_soa != $_POST['v_soa']) && (empty($_SESSION['error_msg']))) {
$v_soa = escapeshellarg($_POST['v_soa']);
exec (VESTA_CMD."v-change-dns-domain-soa ".$v_username." ".$v_domain." ".$v_soa." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_dns = 'yes';
}
// Change expiriation date
if (($v_exp != $_POST['v_exp']) && (empty($_SESSION['error_msg']))) {
$v_exp = escapeshellarg($_POST['v_exp']);
exec (VESTA_CMD."v-change-dns-domain-exp ".$v_username." ".$v_domain." ".$v_exp." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Change domain ttl
if (($v_ttl != $_POST['v_ttl']) && (empty($_SESSION['error_msg']))) {
$v_ttl = escapeshellarg($_POST['v_ttl']);
exec (VESTA_CMD."v-change-dns-domain-ttl ".$v_username." ".$v_domain." ".$v_ttl." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_dns = 'yes';
}
// Restart dns server
if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-restart-dns", $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.');
}
}
// Check POST request for dns record
if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
// Protect input
$v_domain = escapeshellarg($_POST['v_domain']);
$v_record_id = escapeshellarg($_POST['v_record_id']);
// Change dns record
if (($v_val != $_POST['v_val']) || ($v_priority != $_POST['v_priority']) && (empty($_SESSION['error_msg']))) {
$v_val = escapeshellarg($_POST['v_val']);
$v_priority = escapeshellarg($_POST['v_priority']);
exec (VESTA_CMD."v-change-dns-record ".$v_username." ".$v_domain." ".$v_record_id." ".$v_val." ".$v_priority, $output, $return_var);
check_return_code($return_var,$output);
$v_val = $_POST['v_val'];
unset($output);
$restart_dns = 'yes';
}
// Change dns record id
if (($_GET['record_id'] != $_POST['v_record_id']) && (empty($_SESSION['error_msg']))) {
$v_old_record_id = escapeshellarg($_GET['record_id']);
exec (VESTA_CMD."v-change-dns-record-id ".$v_username." ".$v_domain." ".$v_old_record_id." ".$v_record_id, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_dns = 'yes';
}
// Restart dns server
if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-restart-dns", $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.');
}
// Change url if record id was changed
if ((empty($_SESSION['error_msg'])) && ($_GET['record_id'] != $_POST['v_record_id'])) {
header("Location: /edit/dns/?domain=".$_GET['domain']."&record_id=".$_POST['v_record_id']);
exit;
}
}
// Render page
if (empty($_GET['record_id'])) {
// Display body for dns domain
render_page($user, $TAB, 'edit_dns');
} else {
// Display body for dns record
render_page($user, $TAB, 'edit_dns_rec');
}
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,148 +1 @@
<?php
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$user = $_SESSION['user'];
// Check module activation
if (!$_SESSION['FILEMANAGER_KEY']) {
$_SESSION['request_uri'] = $_SERVER['REQUEST_URI'];
header("Location: /login/");
exit;
}
// Check login_as feature
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
$user=$_SESSION['look'];
}
?>
<title>Edit file <?= htmlspecialchars($_REQUEST['path']) ?></title>
<meta charset="utf-8" />
<link href="/css/file_manager_editor.css" type="text/css" rel="stylesheet">
<script src="/js/cheef-editor/jquery/jquery-1.8.3.min.js"></script>
<script src="/js/cheef-editor/ace/ace.js"></script>
<script src="/js/cheef-editor/ace/theme-twilight.js"></script>
<script src="/js/cheef-editor/ace/mode-ruby.js"></script>
<script src="/js/cheef-editor/jquery-ace.min.js"></script>
<div id="message" style="display:none; position: absoulte;background-color: green; color: white; padding: 10px;"></div>
<div id="error-message" style="display:none; position: absoulte;background-color: red; color: white; padding: 10px;"></div>
<?php
if (!empty($_REQUEST['path'])) {
$content = '';
$path = $_REQUEST['path'];
if (!empty($_POST['save'])) {
$fn = tempnam ('/tmp', 'vst-save-file-');
if ($fn) {
$contents = $_POST['contents'];
$contents = preg_replace("/\r/", "", $contents);
$f = fopen ($fn, 'w+');
fwrite($f, $contents);
fclose($f);
chmod($fn, 0644);
if ($f) {
exec (VESTA_CMD . "v-copy-fs-file {$user} {$fn} ".escapeshellarg($path), $output, $return_var);
$error = check_return_code($return_var, $output);
if ($return_var != 0) {
print('<p style="color: white">Error while saving file</p>');
exit;
}
}
unlink($fn);
}
}
exec (VESTA_CMD . "v-open-fs-file {$user} ".escapeshellarg($path), $content, $return_var);
if ($return_var != 0) {
print 'Error while opening file'; // todo: handle this more styled
exit;
}
$content = implode("\n", $content)."\n";
} else {
$content = '';
}
?>
<form id="edit-file-form" method="post">
<!-- input id="do-backup" type="button" onClick="javascript:void(0);" name="save" value="backup (ctrl+F2)" class="backup" / -->
<input type="submit" name="save" value="Save" class="save" />
<textarea name="contents" class="editor" id="editor" rows="4" style="display:none;width: 100%; height: 100%;"><?=htmlentities($content)?></textarea>
</form>
<script type="text/javascript" src="/js/hotkeys.js"></script>
<script type="text/javascript">
$('.editor').ace({ theme: 'twilight', lang: 'ruby' });
var dcrt = $('#editor').data('ace');
dcrt.editor.ace.getSession().setNewLineMode('unix');
var aceInstance = dcrt.editor.ace;
aceInstance.gotoLine(0);
aceInstance.focus();
var makeBackup = function() {
var params = {
action: 'backup',
path: '<?= $path ?>'
};
$.ajax({url: "/file_manager/fm_api.php",
method: "POST",
data: params,
dataType: 'JSON',
success: function(reply) {
var fadeTimeout = 3000;
if (reply.result) {
$('#message').text('File backed up as ' + reply.filename);
clearTimeout(window.msg_tmt);
$('#message').show();
window.msg_tmt = setTimeout(function() {$('#message').fadeOut();}, fadeTimeout);
}
else {
$('#error-message').text(reply.message);
clearTimeout(window.errmsg_tmt);
$('#error-message').show();
window.errmsg_tmt = setTimeout(function() {$('#error-message').fadeOut();}, fadeTimeout);
}
}
});
}
$('#do-backup').on('click', function(evt) {
evt.preventDefault();
makeBackup();
});
//
// Shortcuts
//
shortcut.add("Ctrl+s",function() {
var inp = $('<input>').attr({'type': 'hidden', 'name': 'save'}).val('Save');
$('#edit-file-form').append(inp);
$('#edit-file-form').submit();
},{
'type': 'keydown',
'propagate': false,
'disable_in_input': false,
'target': document
});
shortcut.add("Ctrl+F2",function() {
makeBackup();
},{
'type': 'keydown',
'propagate': false,
'disable_in_input': false,
'target': document
});
</script>
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,88 +1 @@
<?php
error_reporting(NULL);
ob_start();
$TAB = 'FIREWALL';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check user
if ($_SESSION['user'] != 'admin') {
header("Location: /list/user");
exit;
}
// Check ip argument
if (empty($_GET['rule'])) {
header("Location: /list/firewall/");
exit;
}
// List rule
$v_rule = escapeshellarg($_GET['rule']);
exec (VESTA_CMD."v-list-firewall-rule ".$v_rule." json", $output, $return_var);
check_return_code($return_var,$output);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse rule
$v_rule = $_GET['rule'];
$v_action = $data[$v_rule]['ACTION'];
$v_protocol = $data[$v_rule]['PROTOCOL'];
$v_port = $data[$v_rule]['PORT'];
$v_ip = $data[$v_rule]['IP'];
$v_comment = $data[$v_rule]['COMMENT'];
$v_date = $data[$v_rule]['DATE'];
$v_time = $data[$v_rule]['TIME'];
$v_suspended = $data[$v_rule]['SUSPENDED'];
if ( $v_suspended == 'yes' ) {
$v_status = 'suspended';
} else {
$v_status = 'active';
}
// Check POST request
if (!empty($_POST['save'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
$v_rule = escapeshellarg($_GET['rule']);
$v_action = escapeshellarg($_POST['v_action']);
$v_protocol = escapeshellarg($_POST['v_protocol']);
$v_port = str_replace(" ",",", $_POST['v_port']);
$v_port = preg_replace('/\,+/', ',', $v_port);
$v_port = trim($v_port, ",");
$v_port = escapeshellarg($v_port);
$v_ip = escapeshellarg($_POST['v_ip']);
$v_comment = escapeshellarg($_POST['v_comment']);
// Change Status
exec (VESTA_CMD."v-change-firewall-rule ".$v_rule." ".$v_action." ".$v_ip." ".$v_port." ".$v_protocol." ".$v_comment, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_rule = $_GET['v_rule'];
$v_action = $_POST['v_action'];
$v_protocol = $_POST['v_protocol'];
$v_port = str_replace(" ",",", $_POST['v_port']);
$v_port = preg_replace('/\,+/', ',', $v_port);
$v_port = trim($v_port, ",");
$v_ip = $_POST['v_ip'];
$v_comment = $_POST['v_comment'];
// Set success message
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Changes has been saved.');
}
}
// Render page
render_page($user, $TAB, 'edit_firewall');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,106 +1 @@
<?php
error_reporting(NULL);
ob_start();
$TAB = 'IP';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check user
if ($_SESSION['user'] != 'admin') {
header("Location: /list/user");
exit;
}
// Check ip argument
if (empty($_GET['ip'])) {
header("Location: /list/ip/");
exit;
}
// List ip
$v_ip = escapeshellarg($_GET['ip']);
exec (VESTA_CMD."v-list-sys-ip ".$v_ip." json", $output, $return_var);
check_return_code($return_var,$output);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse ip
$v_username = $user;
$v_ip = $_GET['ip'];
$v_netmask = $data[$v_ip]['NETMASK'];
$v_interace = $data[$v_ip]['INTERFACE'];
$v_name = $data[$v_ip]['NAME'];
$v_nat = $data[$v_ip]['NAT'];
$v_ipstatus = $data[$v_ip]['STATUS'];
if ($v_ipstatus == 'dedicated') $v_dedicated = 'yes';
$v_owner = $data[$v_ip]['OWNER'];
$v_date = $data[$v_ip]['DATE'];
$v_time = $data[$v_ip]['TIME'];
$v_suspended = $data[$v_ip]['SUSPENDED'];
if ( $v_suspended == 'yes' ) {
$v_status = 'suspended';
} else {
$v_status = 'active';
}
// List users
exec (VESTA_CMD."v-list-sys-users json", $output, $return_var);
$users = json_decode(implode('', $output), true);
unset($output);
// Check POST request
if (!empty($_POST['save'])) {
$v_ip = escapeshellarg($_POST['v_ip']);
// Change Status
if (($v_ipstatus == 'shared') && (empty($_POST['v_shared'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-change-sys-ip-status ".$v_ip." dedicated", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_dedicated = 'yes';
}
if (($v_ipstatus == 'dedicated') && (!empty($_POST['v_shared'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-change-sys-ip-status ".$v_ip." shared", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
unset($v_dedicated);
}
// Change owner
if (($v_owner != $_POST['v_owner']) && (empty($_SESSION['error_msg']))) {
$v_owner = escapeshellarg($_POST['v_owner']);
exec (VESTA_CMD."v-change-sys-ip-owner ".$v_ip." ".$v_owner, $output, $return_var);
check_return_code($return_var,$output);
$v_owner = $_POST['v_owner'];
unset($output);
}
// Change associated domain
if (($v_name != $_POST['v_name']) && (empty($_SESSION['error_msg']))) {
$v_name = escapeshellarg($_POST['v_name']);
exec (VESTA_CMD."v-change-sys-ip-name ".$v_ip." ".$v_name, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Change NAT address
if (($v_nat != $_POST['v_nat']) && (empty($_SESSION['error_msg']))) {
$v_nat = escapeshellarg($_POST['v_nat']);
exec (VESTA_CMD."v-change-sys-ip-nat ".$v_ip." ".$v_nat, $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_ip');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,342 +1 @@
<?php
error_reporting(NULL);
ob_start();
$TAB = 'MAIL';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check domain argument
if (empty($_GET['domain'])) {
header("Location: /list/mail/");
exit;
}
// Edit as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
$user=escapeshellarg($_GET['user']);
}
$v_username = $user;
// List mail domain
if ((!empty($_GET['domain'])) && (empty($_GET['account']))) {
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-list-mail-domain ".$user." ".$v_domain." json", $output, $return_var);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse domain
$v_domain = $_GET['domain'];
$v_antispam = $data[$v_domain]['ANTISPAM'];
$v_antivirus = $data[$v_domain]['ANTIVIRUS'];
$v_dkim = $data[$v_domain]['DKIM'];
$v_catchall = $data[$v_domain]['CATCHALL'];
$v_date = $data[$v_domain]['DATE'];
$v_time = $data[$v_domain]['TIME'];
$v_suspended = $data[$v_domain]['SUSPENDED'];
if ( $v_suspended == 'yes' ) {
$v_status = 'suspended';
} else {
$v_status = 'active';
}
}
// List mail account
if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) {
$v_domain = escapeshellarg($_GET['domain']);
$v_account = escapeshellarg($_GET['account']);
exec (VESTA_CMD."v-list-mail-account ".$user." ".$v_domain." ".$v_account." json", $output, $return_var);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse mail account
$v_username = $user;
$v_domain = $_GET['domain'];
$v_account = $_GET['account'];
$v_password = "";
$v_aliases = str_replace(',', "\n", $data[$v_account]['ALIAS']);
$valiases = explode(",", $data[$v_account]['ALIAS']);
$v_fwd = str_replace(',', "\n", $data[$v_account]['FWD']);
$vfwd = explode(",", $data[$v_account]['FWD']);
$v_fwd_only = $data[$v_account]['FWD_ONLY'];
$v_quota = $data[$v_account]['QUOTA'];
$v_autoreply = $data[$v_account]['AUTOREPLY'];
$v_suspended = $data[$v_account]['SUSPENDED'];
if ( $v_suspended == 'yes' ) {
$v_status = 'suspended';
} else {
$v_status = 'active';
}
$v_date = $data[$v_account]['DATE'];
$v_time = $data[$v_account]['TIME'];
$v_domain = escapeshellarg($_GET['domain']);
$v_account = escapeshellarg($_GET['account']);
$v_account_without_quotas = $_GET['account'];
// Parse autoreply
if ( $v_autoreply == 'yes' ) {
exec (VESTA_CMD."v-list-mail-account-autoreply ".$user." ".$v_domain." ".$v_account." json", $output, $return_var);
$autoreply_str = json_decode(implode('', $output), true);
unset($output);
$v_autoreply_message = $autoreply_str[$v_account_without_quotas]['MSG'];
$v_autoreply_message=str_replace("\\n", "\n", $v_autoreply_message);
}
}
// Check POST request for mail domain
if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (empty($_GET['account']))) {
$v_domain = escapeshellarg($_POST['v_domain']);
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
// Delete antispam
if (($v_antispam == 'yes') && (empty($_POST['v_antispam'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-mail-domain-antispam ".$v_username." ".$v_domain, $output, $return_var);
check_return_code($return_var,$output);
$v_antispam = 'no';
unset($output);
}
// Add antispam
if (($v_antispam == 'no') && (!empty($_POST['v_antispam'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-add-mail-domain-antispam ".$v_username." ".$v_domain, $output, $return_var);
check_return_code($return_var,$output);
$v_antispam = 'yes';
unset($output);
}
// Delete antivirus
if (($v_antivirus == 'yes') && (empty($_POST['v_antivirus'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-mail-domain-antivirus ".$v_username." ".$v_domain, $output, $return_var);
check_return_code($return_var,$output);
$v_antivirus = 'no';
unset($output);
}
// Add antivirs
if (($v_antivirus == 'no') && (!empty($_POST['v_antivirus'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-add-mail-domain-antivirus ".$v_username." ".$v_domain, $output, $return_var);
check_return_code($return_var,$output);
$v_antivirus = 'yes';
unset($output);
}
// Delete DKIM
if (($v_dkim == 'yes') && (empty($_POST['v_dkim'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-mail-domain-dkim ".$v_username." ".$v_domain, $output, $return_var);
check_return_code($return_var,$output);
$v_dkim = 'no';
unset($output);
}
// Add DKIM
if (($v_dkim == 'no') && (!empty($_POST['v_dkim'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-add-mail-domain-dkim ".$v_username." ".$v_domain, $output, $return_var);
check_return_code($return_var,$output);
$v_dkim = 'yes';
unset($output);
}
// Delete catchall
if ((!empty($v_catchall)) && (empty($_POST['v_catchall'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-mail-domain-catchall ".$v_username." ".$v_domain, $output, $return_var);
check_return_code($return_var,$output);
$v_catchall = '';
unset($output);
}
// Change catchall address
if ((!empty($v_catchall)) && (!empty($_POST['v_catchall'])) && (empty($_SESSION['error_msg']))) {
if ($v_catchall != $_POST['v_catchall']) {
$v_catchall = escapeshellarg($_POST['v_catchall']);
exec (VESTA_CMD."v-change-mail-domain-catchall ".$v_username." ".$v_domain." ".$v_catchall, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
}
// Add catchall
if ((empty($v_catchall)) && (!empty($_POST['v_catchall'])) && (empty($_SESSION['error_msg']))) {
$v_catchall = escapeshellarg($_POST['v_catchall']);
exec (VESTA_CMD."v-add-mail-domain-catchall ".$v_username." ".$v_domain." ".$v_catchall, $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.');
}
}
// Check POST request for mail account
if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['account']))) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
// Validate email
if ((!empty($_POST['v_send_email'])) && (empty($_SESSION['error_msg']))) {
if (!filter_var($_POST['v_send_email'], FILTER_VALIDATE_EMAIL)) {
$_SESSION['error_msg'] = __('Please enter valid email address.');
}
}
$v_domain = escapeshellarg($_POST['v_domain']);
$v_account = escapeshellarg($_POST['v_account']);
$v_send_email = $_POST['v_send_email'];
$v_credentials = $_POST['v_credentials'];
// Change password
if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
$v_password = tempnam("/tmp","vst");
$fp = fopen($v_password, "w");
fwrite($fp, $_POST['v_password']."\n");
fclose($fp);
exec (VESTA_CMD."v-change-mail-account-password ".$v_username." ".$v_domain." ".$v_account." ".$v_password, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
unlink($v_password);
$v_password = escapeshellarg($_POST['v_password']);;
}
// Change quota
if (($v_quota != $_POST['v_quota']) && (empty($_SESSION['error_msg']))) {
if (empty($_POST['v_quota'])) {
$v_quota = 0;
} else {
$v_quota = escapeshellarg($_POST['v_quota']);
}
exec (VESTA_CMD."v-change-mail-account-quota ".$v_username." ".$v_domain." ".$v_account." ".$v_quota, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Change account aliases
if (empty($_SESSION['error_msg'])) {
$waliases = preg_replace("/\n/", " ", $_POST['v_aliases']);
$waliases = preg_replace("/,/", " ", $waliases);
$waliases = preg_replace('/\s+/', ' ',$waliases);
$waliases = trim($waliases);
$aliases = explode(" ", $waliases);
$v_aliases = str_replace(' ', "\n", $waliases);
$result = array_diff($valiases, $aliases);
foreach ($result as $alias) {
if ((empty($_SESSION['error_msg'])) && (!empty($alias))) {
exec (VESTA_CMD."v-delete-mail-account-alias ".$v_username." ".$v_domain." ".$v_account." ".escapeshellarg($alias), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
}
$result = array_diff($aliases, $valiases);
foreach ($result as $alias) {
if ((empty($_SESSION['error_msg'])) && (!empty($alias))) {
exec (VESTA_CMD."v-add-mail-account-alias ".$v_username." ".$v_domain." ".$v_account." ".escapeshellarg($alias), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
}
}
// Change forwarders
if (empty($_SESSION['error_msg'])) {
$wfwd = preg_replace("/\n/", " ", $_POST['v_fwd']);
$wfwd = preg_replace("/,/", " ", $wfwd);
$wfwd = preg_replace('/\s+/', ' ',$wfwd);
$wfwd = trim($wfwd);
$fwd = explode(" ", $wfwd);
$v_fwd = str_replace(' ', "\n", $wfwd);
$result = array_diff($vfwd, $fwd);
foreach ($result as $forward) {
if ((empty($_SESSION['error_msg'])) && (!empty($forward))) {
exec (VESTA_CMD."v-delete-mail-account-forward ".$v_username." ".$v_domain." ".$v_account." ".escapeshellarg($forward), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
}
$result = array_diff($fwd, $vfwd);
foreach ($result as $forward) {
if ((empty($_SESSION['error_msg'])) && (!empty($forward))) {
exec (VESTA_CMD."v-add-mail-account-forward ".$v_username." ".$v_domain." ".$v_account." ".escapeshellarg($forward), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
}
}
// Delete FWD_ONLY flag
if (($v_fwd_only == 'yes') && (empty($_POST['v_fwd_only'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-mail-account-fwd-only ".$v_username." ".$v_domain." ".$v_account, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_fwd_only = '';
}
// Add FWD_ONLY flag
if (($v_fwd_only != 'yes') && (!empty($_POST['v_fwd_only'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-add-mail-account-fwd-only ".$v_username." ".$v_domain." ".$v_account, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_fwd_only = 'yes';
}
// Delete autoreply
if (($v_autoreply == 'yes') && (empty($_POST['v_autoreply'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-mail-account-autoreply ".$v_username." ".$v_domain." ".$v_account, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_autoreply = 'no';
$v_autoreply_message = '';
}
// Add autoreply
if ((!empty($_POST['v_autoreply'])) && (empty($_SESSION['error_msg']))) {
if ( $v_autoreply_message != str_replace("\r\n", "\n", $_POST['v_autoreply_message'])) {
$v_autoreply_message = str_replace("\r\n", "\n", $_POST['v_autoreply_message']);
$v_autoreply_message = escapeshellarg($v_autoreply_message);
exec (VESTA_CMD."v-add-mail-account-autoreply ".$v_username." ".$v_domain." ".$v_account." ".$v_autoreply_message, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_autoreply = 'yes';
$v_autoreply_message = $_POST['v_autoreply_message'];
}
}
// Email login credentials
if ((!empty($v_send_email)) && (empty($_SESSION['error_msg']))) {
$to = $v_send_email;
$subject = __("Email Credentials");
$hostname = exec('hostname');
$from = __('MAIL_FROM', $hostname);
$mailtext = $v_credentials;
send_email($to, $subject, $mailtext, $from);
}
// Set success message
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Changes has been saved.');
}
}
// Render page
if (empty($_GET['account'])) {
// Display body for mail domain
render_page($user, $TAB, 'edit_mail');
} else {
// Display body for mail account
render_page($user, $TAB, 'edit_mail_acc');
}
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,231 +1 @@
<?php
error_reporting(NULL);
ob_start();
$TAB = 'PACKAGE';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check user
if ($_SESSION['user'] != 'admin') {
header("Location: /list/user");
exit;
}
// Check package argument
if (empty($_GET['package'])) {
header("Location: /list/package/");
exit;
}
// List package
$v_package = escapeshellarg($_GET['package']);
exec (VESTA_CMD."v-list-user-package ".$v_package." json", $output, $return_var);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse package
$v_package = $_GET['package'];
$v_web_template = $data[$v_package]['WEB_TEMPLATE'];
$v_backend_template = $data[$v_package]['BACKEND_TEMPLATE'];
$v_proxy_template = $data[$v_package]['PROXY_TEMPLATE'];
$v_dns_template = $data[$v_package]['DNS_TEMPLATE'];
$v_web_domains = $data[$v_package]['WEB_DOMAINS'];
$v_web_aliases = $data[$v_package]['WEB_ALIASES'];
$v_dns_domains = $data[$v_package]['DNS_DOMAINS'];
$v_dns_records = $data[$v_package]['DNS_RECORDS'];
$v_mail_domains = $data[$v_package]['MAIL_DOMAINS'];
$v_mail_accounts = $data[$v_package]['MAIL_ACCOUNTS'];
$v_databases = $data[$v_package]['DATABASES'];
$v_cron_jobs = $data[$v_package]['CRON_JOBS'];
$v_disk_quota = $data[$v_package]['DISK_QUOTA'];
$v_bandwidth = $data[$v_package]['BANDWIDTH'];
$v_shell = $data[$v_package]['SHELL'];
$v_ns = $data[$v_package]['NS'];
$nameservers = explode(",", $v_ns);
$v_ns1 = $nameservers[0];
$v_ns2 = $nameservers[1];
$v_ns3 = $nameservers[2];
$v_ns4 = $nameservers[3];
$v_ns5 = $nameservers[4];
$v_ns6 = $nameservers[5];
$v_ns7 = $nameservers[6];
$v_ns8 = $nameservers[7];
$v_backups = $data[$v_package]['BACKUPS'];
$v_date = $data[$v_package]['DATE'];
$v_time = $data[$v_package]['TIME'];
$v_status = 'active';
// List web templates
exec (VESTA_CMD."v-list-web-templates json", $output, $return_var);
$web_templates = json_decode(implode('', $output), true);
unset($output);
// List backend templates
if (!empty($_SESSION['WEB_BACKEND'])) {
exec (VESTA_CMD."v-list-web-templates-backend json", $output, $return_var);
$backend_templates = json_decode(implode('', $output), true);
unset($output);
}
// List proxy templates
if (!empty($_SESSION['PROXY_SYSTEM'])) {
exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var);
$proxy_templates = json_decode(implode('', $output), true);
unset($output);
}
// List dns templates
exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
$dns_templates = json_decode(implode('', $output), true);
unset($output);
// List shels
exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var);
$shells = json_decode(implode('', $output), true);
unset($output);
// Check POST request
if (!empty($_POST['save'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
// Check empty fields
if (empty($_POST['v_package'])) $errors[] = __('package');
if (empty($_POST['v_web_template'])) $errors[] = __('web template');
if (!empty($_SESSION['WEB_BACKEND'])) {
if (empty($_POST['v_backend_template'])) $errors[] = __('backend template');
}
if (!empty($_SESSION['PROXY_SYSTEM'])) {
if (empty($_POST['v_proxy_template'])) $errors[] = __('proxy template');
}
if (empty($_POST['v_dns_template'])) $errors[] = __('dns template');
if (empty($_POST['v_shell'])) $errrors[] = __('shell');
if (!isset($_POST['v_web_domains'])) $errors[] = __('web domains');
if (!isset($_POST['v_web_aliases'])) $errors[] = __('web aliases');
if (!isset($_POST['v_dns_domains'])) $errors[] = __('dns domains');
if (!isset($_POST['v_dns_records'])) $errors[] = __('dns records');
if (!isset($_POST['v_mail_domains'])) $errors[] = __('mail domains');
if (!isset($_POST['v_mail_accounts'])) $errors[] = __('mail accounts');
if (!isset($_POST['v_databases'])) $errors[] = __('databases');
if (!isset($_POST['v_cron_jobs'])) $errors[] = __('cron jobs');
if (!isset($_POST['v_backups'])) $errors[] = __('backups');
if (!isset($_POST['v_disk_quota'])) $errors[] = __('quota');
if (!isset($_POST['v_bandwidth'])) $errors[] = __('bandwidth');
if (empty($_POST['v_ns1'])) $errors[] = __('ns1');
if (empty($_POST['v_ns2'])) $errors[] = __('ns2');
if (!empty($errors[0])) {
foreach ($errors as $i => $error) {
if ( $i == 0 ) {
$error_msg = $error;
} else {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
}
// Protect input
$v_package = escapeshellarg($_POST['v_package']);
$v_web_template = escapeshellarg($_POST['v_web_template']);
if (!empty($_SESSION['WEB_BACKEND'])) {
$v_backend_template = escapeshellarg($_POST['v_backend_template']);
}
if (!empty($_SESSION['PROXY_SYSTEM'])) {
$v_proxy_template = escapeshellarg($_POST['v_proxy_template']);
}
$v_dns_template = escapeshellarg($_POST['v_dns_template']);
$v_shell = escapeshellarg($_POST['v_shell']);
$v_web_domains = escapeshellarg($_POST['v_web_domains']);
$v_web_aliases = escapeshellarg($_POST['v_web_aliases']);
$v_dns_domains = escapeshellarg($_POST['v_dns_domains']);
$v_dns_records = escapeshellarg($_POST['v_dns_records']);
$v_mail_domains = escapeshellarg($_POST['v_mail_domains']);
$v_mail_accounts = escapeshellarg($_POST['v_mail_accounts']);
$v_databases = escapeshellarg($_POST['v_databases']);
$v_cron_jobs = escapeshellarg($_POST['v_cron_jobs']);
$v_backups = escapeshellarg($_POST['v_backups']);
$v_disk_quota = escapeshellarg($_POST['v_disk_quota']);
$v_bandwidth = escapeshellarg($_POST['v_bandwidth']);
$v_ns1 = trim($_POST['v_ns1'], '.');
$v_ns2 = trim($_POST['v_ns2'], '.');
$v_ns3 = trim($_POST['v_ns3'], '.');
$v_ns4 = trim($_POST['v_ns4'], '.');
$v_ns5 = trim($_POST['v_ns5'], '.');
$v_ns6 = trim($_POST['v_ns6'], '.');
$v_ns7 = trim($_POST['v_ns7'], '.');
$v_ns8 = trim($_POST['v_ns8'], '.');
$v_ns = $v_ns1.",".$v_ns2;
if (!empty($v_ns3)) $v_ns .= ",".$v_ns3;
if (!empty($v_ns4)) $v_ns .= ",".$v_ns4;
if (!empty($v_ns5)) $v_ns .= ",".$v_ns5;
if (!empty($v_ns6)) $v_ns .= ",".$v_ns6;
if (!empty($v_ns7)) $v_ns .= ",".$v_ns7;
if (!empty($v_ns8)) $v_ns .= ",".$v_ns8;
$v_ns = escapeshellarg($v_ns);
$v_time = escapeshellarg(date('H:i:s'));
$v_date = escapeshellarg(date('Y-m-d'));
// Create temprorary directory
exec ('mktemp -d', $output, $return_var);
$tmpdir = $output[0];
unset($output);
// Save package file on a fs
$pkg = "WEB_TEMPLATE=".$v_web_template."\n";
$pkg .= "BACKEND_TEMPLATE=".$v_backend_template."\n";
$pkg .= "PROXY_TEMPLATE=".$v_proxy_template."\n";
$pkg .= "DNS_TEMPLATE=".$v_dns_template."\n";
$pkg .= "WEB_DOMAINS=".$v_web_domains."\n";
$pkg .= "WEB_ALIASES=".$v_web_aliases."\n";
$pkg .= "DNS_DOMAINS=".$v_dns_domains."\n";
$pkg .= "DNS_RECORDS=".$v_dns_records."\n";
$pkg .= "MAIL_DOMAINS=".$v_mail_domains."\n";
$pkg .= "MAIL_ACCOUNTS=".$v_mail_accounts."\n";
$pkg .= "DATABASES=".$v_databases."\n";
$pkg .= "CRON_JOBS=".$v_cron_jobs."\n";
$pkg .= "DISK_QUOTA=".$v_disk_quota."\n";
$pkg .= "BANDWIDTH=".$v_bandwidth."\n";
$pkg .= "NS=".$v_ns."\n";
$pkg .= "SHELL=".$v_shell."\n";
$pkg .= "BACKUPS=".$v_backups."\n";
$pkg .= "TIME=".$v_time."\n";
$pkg .= "DATE=".$v_date."\n";
$fp = fopen($tmpdir."/".$_POST['v_package'].".pkg", 'w');
fwrite($fp, $pkg);
fclose($fp);
// Save changes
exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package." yes", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
// Remove temporary dir
exec ('rm -rf '.$tmpdir, $output, $return_var);
unset($output);
// Propogate new package
exec (VESTA_CMD."v-update-user-package ".$v_package." json", $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_package');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." apache2 ".$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/apache2/apache2.conf';
$v_service_name = strtoupper('apache2');
// Read config
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
// Render page
render_page($user, $TAB, 'edit_server_httpd');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,73 +1 @@
<?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 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);
// Render page
render_page($user, $TAB, 'edit_server_bind9');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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 ".$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']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." cron ".$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/crontab';
$v_service_name = strtoupper('cron');
// 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']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." crond ".$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/crontab';
$v_service_name = strtoupper('cron');
// 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']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,183 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_dovecot');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." exim ".$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/exim/exim.conf';
$v_service_name = strtoupper('exim');
// 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']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_service');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." fail2ban ".$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/fail2ban/jail.local';
$v_service_name = strtoupper('fail2ban');
// 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']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_httpd');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,627 +1 @@
<?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;
}
// Get server hostname
$v_hostname = exec('hostname');
// Get server port
$port = $_SERVER['SERVER_PORT'];
// List available timezones and get current one
$v_timezones = list_timezones();
exec (VESTA_CMD."v-get-sys-timezone", $output, $return_var);
$v_timezone = $output[0];
unset($output);
if ($v_timezone == 'Etc/UTC' ) $v_timezone = 'UTC';
if ($v_timezone == 'Pacific/Honolulu' ) $v_timezone = 'HAST';
if ($v_timezone == 'US/Aleutian' ) $v_timezone = 'HADT';
if ($v_timezone == 'Etc/GMT+9' ) $v_timezone = 'AKST';
if ($v_timezone == 'America/Anchorage' ) $v_timezone = 'AKDT';
if ($v_timezone == 'America/Dawson_Creek' ) $v_timezone = 'PST';
if ($v_timezone == 'PST8PDT' ) $v_timezone = 'PDT';
if ($v_timezone == 'MST7MDT' ) $v_timezone = 'MDT';
if ($v_timezone == 'Canada/Saskatchewan' ) $v_timezone = 'CST';
if ($v_timezone == 'CST6CDT' ) $v_timezone = 'CDT';
if ($v_timezone == 'EST5EDT' ) $v_timezone = 'EDT';
if ($v_timezone == 'America/Puerto_Rico' ) $v_timezone = 'AST';
if ($v_timezone == 'America/Halifax' ) $v_timezone = 'ADT';
// List supported languages
exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var);
$languages = json_decode(implode('', $output), true);
unset($output);
// List dns cluster hosts
exec (VESTA_CMD."v-list-remote-dns-hosts json", $output, $return_var);
$dns_cluster = json_decode(implode('', $output), true);
unset($output);
foreach ($dns_cluster as $key => $value) {
$v_dns_cluster = 'yes';
}
// List Database hosts
exec (VESTA_CMD."v-list-database-hosts json", $output, $return_var);
$db_hosts = json_decode(implode('', $output), true);
unset($output);
$v_mysql_hosts = array_values(array_filter($db_hosts, function($host){return $host['TYPE'] === 'mysql';}));
$v_mysql = count($v_mysql_hosts) ? 'yes' : 'no';
$v_pgsql_hosts = array_values(array_filter($db_hosts, function($host){return $host['TYPE'] === 'pgsql';}));
$v_pgsql = count($v_pgsql_hosts) ? 'yes' : 'no';
unset($db_hosts);
// List backup settings
$v_backup_dir = "/backup";
if (!empty($_SESSION['BACKUP'])) $v_backup_dir = $_SESSION['BACKUP'];
$v_backup_gzip = '5';
if (!empty($_SESSION['BACKUP_GZIP'])) $v_backup_gzip = $_SESSION['BACKUP_GZIP'];
$backup_types = explode(",",$_SESSION['BACKUP_SYSTEM']);
foreach ($backup_types as $backup_type) {
if ($backup_type == 'local') {
$v_backup = 'yes';
} else {
exec (VESTA_CMD."v-list-backup-host ".$backup_type. " json", $output, $return_var);
$v_remote_backup = json_decode(implode('', $output), true);
unset($output);
$v_backup_host = $v_remote_backup[$backup_type]['HOST'];
$v_backup_type = $v_remote_backup[$backup_type]['TYPE'];
$v_backup_username = $v_remote_backup[$backup_type]['USERNAME'];
$v_backup_password = "";
$v_backup_port = $v_remote_backup[$backup_type]['PORT'];
$v_backup_bpath = $v_remote_backup[$backup_type]['BPATH'];
}
}
// List ssl web domains
exec (VESTA_CMD."v-search-ssl-certificates json", $output, $return_var);
$v_ssl_domains = json_decode(implode('', $output), true);
//$v_vesta_certificate
unset($output);
// List ssl certificate info
exec (VESTA_CMD."v-list-sys-vesta-ssl json", $output, $return_var);
$v_sys_ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_sys_ssl_crt = $v_sys_ssl_str['VESTA']['CRT'];
$v_sys_ssl_key = $v_sys_ssl_str['VESTA']['KEY'];
$v_sys_ssl_ca = $v_sys_ssl_str['VESTA']['CA'];
$v_sys_ssl_subject = $v_sys_ssl_str['VESTA']['SUBJECT'];
$v_sys_ssl_aliases = $v_sys_ssl_str['VESTA']['ALIASES'];
$v_sys_ssl_not_before = $v_sys_ssl_str['VESTA']['NOT_BEFORE'];
$v_sys_ssl_not_after = $v_sys_ssl_str['VESTA']['NOT_AFTER'];
$v_sys_ssl_signature = $v_sys_ssl_str['VESTA']['SIGNATURE'];
$v_sys_ssl_pub_key = $v_sys_ssl_str['VESTA']['PUB_KEY'];
$v_sys_ssl_issuer = $v_sys_ssl_str['VESTA']['ISSUER'];
// List mail ssl certificate info
if (!empty($_SESSION['VESTA_CERTIFICATE'])); {
exec (VESTA_CMD."v-list-sys-mail-ssl json", $output, $return_var);
$v_mail_ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_mail_ssl_crt = $v_mail_ssl_str['MAIL']['CRT'];
$v_mail_ssl_key = $v_mail_ssl_str['MAIL']['KEY'];
$v_mail_ssl_ca = $v_mail_ssl_str['MAIL']['CA'];
$v_mail_ssl_subject = $v_mail_ssl_str['MAIL']['SUBJECT'];
$v_mail_ssl_aliases = $v_mail_ssl_str['MAIL']['ALIASES'];
$v_mail_ssl_not_before = $v_mail_ssl_str['MAIL']['NOT_BEFORE'];
$v_mail_ssl_not_after = $v_mail_ssl_str['MAIL']['NOT_AFTER'];
$v_mail_ssl_signature = $v_mail_ssl_str['MAIL']['SIGNATURE'];
$v_mail_ssl_pub_key = $v_mail_ssl_str['MAIL']['PUB_KEY'];
$v_mail_ssl_issuer = $v_mail_ssl_str['MAIL']['ISSUER'];
}
// Check POST request
if (!empty($_POST['save'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
// Change hostname
if ((!empty($_POST['v_hostname'])) && ($v_hostname != $_POST['v_hostname'])) {
exec (VESTA_CMD."v-change-sys-hostname ".escapeshellarg($_POST['v_hostname']), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_hostname = $_POST['v_hostname'];
}
// Change port
if ((!empty($_POST['port'])) && ($port != $_POST['port'])) {
exec (VESTA_CMD."v-change-vesta-port ".escapeshellarg($_POST['port']), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$port = $_POST['port'];
}
// Change timezone
if (empty($_SESSION['error_msg'])) {
if (!empty($_POST['v_timezone'])) {
$v_tz = $_POST['v_timezone'];
if ($v_tz == 'UTC' ) $v_tz = 'Etc/UTC';
if ($v_tz == 'HAST' ) $v_tz = 'Pacific/Honolulu';
if ($v_tz == 'HADT' ) $v_tz = 'US/Aleutian';
if ($v_tz == 'AKST' ) $v_tz = 'Etc/GMT+9';
if ($v_tz == 'AKDT' ) $v_tz = 'America/Anchorage';
if ($v_tz == 'PST' ) $v_tz = 'America/Dawson_Creek';
if ($v_tz == 'PDT' ) $v_tz = 'PST8PDT';
if ($v_tz == 'MDT' ) $v_tz = 'MST7MDT';
if ($v_tz == 'CST' ) $v_tz = 'Canada/Saskatchewan';
if ($v_tz == 'CDT' ) $v_tz = 'CST6CDT';
if ($v_tz == 'EDT' ) $v_tz = 'EST5EDT';
if ($v_tz == 'AST' ) $v_tz = 'America/Puerto_Rico';
if ($v_tz == 'ADT' ) $v_tz = 'America/Halifax';
if ($v_timezone != $v_tz) {
exec (VESTA_CMD."v-change-sys-timezone ".escapeshellarg($v_tz), $output, $return_var);
check_return_code($return_var,$output);
$v_timezone = $v_tz;
unset($output);
}
}
}
// Change default language
if (empty($_SESSION['error_msg'])) {
if ((!empty($_POST['v_language'])) && ($_SESSION['LANGUAGE'] != $_POST['v_language'])) {
exec (VESTA_CMD."v-change-sys-language ".escapeshellarg($_POST['v_language']), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $_SESSION['LANGUAGE'] = $_POST['v_language'];
}
}
// Set disk_quota support
if (empty($_SESSION['error_msg'])) {
if ((!empty($_POST['v_quota'])) && ($_SESSION['DISK_QUOTA'] != $_POST['v_quota'])) {
if($_POST['v_quota'] == 'yes') {
exec (VESTA_CMD."v-add-sys-quota", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $_SESSION['DISK_QUOTA'] = 'yes';
} else {
exec (VESTA_CMD."v-delete-sys-quota", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $_SESSION['DISK_QUOTA'] = 'no';
}
}
}
// Set firewall support
if (empty($_SESSION['error_msg'])) {
if ($_SESSION['FIREWALL_SYSTEM'] == 'iptables') $v_firewall = 'yes';
if ($_SESSION['FIREWALL_SYSTEM'] != 'iptables') $v_firewall = 'no';
if ((!empty($_POST['v_firewall'])) && ($v_firewall != $_POST['v_firewall'])) {
if($_POST['v_firewall'] == 'yes') {
exec (VESTA_CMD."v-add-sys-firewall", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $_SESSION['FIREWALL_SYSTEM'] = 'iptables';
} else {
exec (VESTA_CMD."v-delete-sys-firewall", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $_SESSION['FIREWALL_SYSTEM'] = '';
}
}
}
// Update mysql pasword
if (empty($_SESSION['error_msg'])) {
if (!empty($_POST['v_mysql_password'])) {
exec (VESTA_CMD."v-change-database-host-password mysql localhost root ".escapeshellarg($_POST['v_mysql_password']), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_db_adv = 'yes';
}
}
// Delete Mail Domain SSL certificate
if ((!isset($_POST['v_mail_ssl_domain_checkbox'])) && (!empty($_SESSION['MAIL_CERTIFICATE'])) && (empty($_SESSION['error_msg']))) {
unset($_SESSION['MAIL_CERTIFICATE']);
exec (VESTA_CMD."v-delete-sys-mail-ssl", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Updating Mail Domain SSL certificate
if ((isset($_POST['v_mail_ssl_domain_checkbox'])) && (isset($_POST['v_mail_ssl_domain'])) && (empty($_SESSION['error_msg']))) {
if ((!empty($_POST['v_mail_ssl_domain'])) && ($_POST['v_mail_ssl_domain'] != $_SESSION['MAIL_CERTIFICATE'])) {
$v_mail_ssl_str = explode(":", $_POST['v_mail_ssl_domain']);
$v_mail_ssl_user = escapeshellarg($v_mail_ssl_str[0]);
$v_mail_ssl_domain = escapeshellarg($v_mail_ssl_str[1]);
exec (VESTA_CMD."v-add-sys-mail-ssl ".$v_mail_ssl_user." ".$v_mail_ssl_domain, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
unset($v_mail_ssl_str);
if (empty($_SESSION['error_msg'])) {
$_SESSION['MAIL_CERTIFICATE'] = $_POST['v_mail_ssl_domain'];
// List SSL certificate info
exec (VESTA_CMD."v-list-sys-mail-ssl json", $output, $return_var);
$v_mail_ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_mail_ssl_crt = $v_mail_ssl_str['MAIL']['CRT'];
$v_mail_ssl_key = $v_mail_ssl_str['MAIL']['KEY'];
$v_mail_ssl_ca = $v_mail_ssl_str['MAIL']['CA'];
$v_mail_ssl_subject = $v_mail_ssl_str['MAIL']['SUBJECT'];
$v_mail_ssl_aliases = $v_mail_ssl_str['MAIL']['ALIASES'];
$v_mail_ssl_not_before = $v_mail_ssl_str['MAIL']['NOT_BEFORE'];
$v_mail_ssl_not_after = $v_mail_ssl_str['MAIL']['NOT_AFTER'];
$v_mail_ssl_signature = $v_mail_ssl_str['MAIL']['SIGNATURE'];
$v_mail_ssl_pub_key = $v_mail_ssl_str['MAIL']['PUB_KEY'];
$v_mail_ssl_issuer = $v_mail_ssl_str['MAIL']['ISSUER'];
}
}
}
// Update webmail url
if (empty($_SESSION['error_msg'])) {
if ($_POST['v_mail_url'] != $_SESSION['MAIL_URL']) {
exec (VESTA_CMD."v-change-sys-config-value MAIL_URL ".escapeshellarg($_POST['v_mail_url']), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_mail_adv = 'yes';
}
}
// Update phpMyAdmin url
if (empty($_SESSION['error_msg'])) {
if ($_POST['v_mysql_url'] != $_SESSION['DB_PMA_URL']) {
exec (VESTA_CMD."v-change-sys-config-value DB_PMA_URL ".escapeshellarg($_POST['v_mysql_url']), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_db_adv = 'yes';
}
}
// Update phpPgAdmin url
if (empty($_SESSION['error_msg'])) {
if ($_POST['v_pgsql_url'] != $_SESSION['DB_PGA_URL']) {
exec (VESTA_CMD."v-change-sys-config-value DB_PGA_URL ".escapeshellarg($_POST['v_pgsql_url']), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_db_adv = 'yes';
}
}
// Disable local backup
if (empty($_SESSION['error_msg'])) {
if (($_POST['v_backup'] == 'no') && ($v_backup == 'yes' )) {
exec (VESTA_CMD."v-delete-backup-host local", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $v_backup = 'no';
$v_backup_adv = 'yes';
}
}
// Enable local backups
if (empty($_SESSION['error_msg'])) {
if (($_POST['v_backup'] == 'yes') && ($v_backup != 'yes' )) {
exec (VESTA_CMD."v-add-backup-host local", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $v_backup = 'yes';
$v_backup_adv = 'yes';
}
}
// Change backup gzip level
if (empty($_SESSION['error_msg'])) {
if ($_POST['v_backup_gzip'] != $v_backup_gzip ) {
exec (VESTA_CMD."v-change-sys-config-value BACKUP_GZIP ".escapeshellarg($_POST['v_backup_gzip']), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $v_backup_gzip = $_POST['v_backup_gzip'];
$v_backup_adv = 'yes';
}
}
// Change backup path
if (empty($_SESSION['error_msg'])) {
if ($_POST['v_backup_dir'] != $v_backup_dir ) {
exec (VESTA_CMD."v-change-sys-config-value BACKUP ".escapeshellarg($_POST['v_backup_dir']), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $v_backup_dir = $_POST['v_backup_dir'];
$v_backup_adv = 'yes';
}
}
// Add remote backup host
if (empty($_SESSION['error_msg'])) {
if ((!empty($_POST['v_backup_host'])) && (empty($v_backup_host))) {
$v_backup_host = escapeshellarg($_POST['v_backup_host']);
$v_backup_type = escapeshellarg($_POST['v_backup_type']);
$v_backup_username = escapeshellarg($_POST['v_backup_username']);
$v_backup_password = escapeshellarg($_POST['v_backup_password']);
$v_backup_bpath = escapeshellarg($_POST['v_backup_bpath']);
exec (VESTA_CMD."v-add-backup-host ".$v_backup_type." ".$v_backup_host ." ".$v_backup_username." ".$v_backup_password." ".$v_backup_bpath, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $v_backup_host = $_POST['v_backup_host'];
if (empty($_SESSION['error_msg'])) $v_backup_type = $_POST['v_backup_type'];
if (empty($_SESSION['error_msg'])) $v_backup_username = $_POST['v_backup_username'];
if (empty($_SESSION['error_msg'])) $v_backup_password = $_POST['v_backup_password'];
if (empty($_SESSION['error_msg'])) $v_backup_bpath = $_POST['v_backup_bpath'];
$v_backup_new = 'yes';
$v_backup_adv = 'yes';
$v_backup_remote_adv = 'yes';
}
}
// Change remote backup host type
if (empty($_SESSION['error_msg'])) {
if ((!empty($_POST['v_backup_host'])) && ($_POST['v_backup_type'] != $v_backup_type)) {
exec (VESTA_CMD."v-delete-backup-host " . escapeshellarg($v_backup_type), $output, $return_var);
unset($output);
$v_backup_host = escapeshellarg($_POST['v_backup_host']);
$v_backup_type = escapeshellarg($_POST['v_backup_type']);
$v_backup_username = escapeshellarg($_POST['v_backup_username']);
$v_backup_password = escapeshellarg($_POST['v_backup_password']);
$v_backup_bpath = escapeshellarg($_POST['v_backup_bpath']);
exec (VESTA_CMD."v-add-backup-host ".$v_backup_type." ".$v_backup_host." ".$v_backup_username." ".$v_backup_password." ".$v_backup_bpath, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $v_backup_host = $_POST['v_backup_host'];
if (empty($_SESSION['error_msg'])) $v_backup_type = $_POST['v_backup_type'];
if (empty($_SESSION['error_msg'])) $v_backup_username = $_POST['v_backup_username'];
if (empty($_SESSION['error_msg'])) $v_backup_password = $_POST['v_backup_password'];
if (empty($_SESSION['error_msg'])) $v_backup_bpath = $_POST['v_backup_bpath'];
$v_backup_adv = 'yes';
$v_backup_remote_adv = 'yes';
}
}
// Change remote backup host
if (empty($_SESSION['error_msg'])) {
if ((!empty($_POST['v_backup_host'])) && ($_POST['v_backup_type'] == $v_backup_type) && (!isset($v_backup_new))) {
if (($_POST['v_backup_host'] != $v_backup_host) || ($_POST['v_backup_username'] != $v_backup_username) || ($_POST['v_backup_password'] != $v_backup_password) || ($_POST['v_backup_bpath'] != $v_backup_bpath)){
$v_backup_host = escapeshellarg($_POST['v_backup_host']);
$v_backup_type = escapeshellarg($_POST['v_backup_type']);
$v_backup_username = escapeshellarg($_POST['v_backup_username']);
$v_backup_password = escapeshellarg($_POST['v_backup_password']);
$v_backup_bpath = escapeshellarg($_POST['v_backup_bpath']);
exec (VESTA_CMD."v-add-backup-host ".$v_backup_type." ".$v_backup_host." ".$v_backup_username." ".$v_backup_password." ".$v_backup_bpath, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $v_backup_host = $_POST['v_backup_host'];
if (empty($_SESSION['error_msg'])) $v_backup_type = $_POST['v_backup_type'];
if (empty($_SESSION['error_msg'])) $v_backup_username = $_POST['v_backup_username'];
if (empty($_SESSION['error_msg'])) $v_backup_password = $_POST['v_backup_password'];
if (empty($_SESSION['error_msg'])) $v_backup_bpath = $_POST['v_backup_bpath'];
$v_backup_adv = 'yes';
$v_backup_remote_adv = 'yes';
}
}
}
// Delete remote backup host
if (empty($_SESSION['error_msg'])) {
if ((empty($_POST['v_backup_host'])) && (!empty($v_backup_host))) {
exec (VESTA_CMD."v-delete-backup-host ". $v_backup_type, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) $v_backup_host = '';
if (empty($_SESSION['error_msg'])) $v_backup_type = '';
if (empty($_SESSION['error_msg'])) $v_backup_username = '';
if (empty($_SESSION['error_msg'])) $v_backup_password = '';
if (empty($_SESSION['error_msg'])) $v_backup_bpath = '';
$v_backup_adv = '';
$v_backup_remote_adv = '';
}
}
// Delete WEB Domain SSL certificate
if ((!isset($_POST['v_web_ssl_domain_checkbox'])) && (!empty($_SESSION['VESTA_CERTIFICATE'])) && (empty($_SESSION['error_msg']))) {
unset($_SESSION['VESTA_CERTIFICATE']);
exec (VESTA_CMD."v-delete-sys-vesta-ssl", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Updating WEB Domain SSL certificate
if ((isset($_POST['v_web_ssl_domain_checkbox'])) && (isset($_POST['v_web_ssl_domain'])) && (empty($_SESSION['error_msg']))) {
if ((!empty($_POST['v_web_ssl_domain'])) && ($_POST['v_web_ssl_domain'] != $_SESSION['VESTA_CERTIFICATE'])) {
$v_web_ssl_str = explode(":", $_POST['v_web_ssl_domain']);
$v_web_ssl_user = escapeshellarg($v_web_ssl_str[0]);
$v_web_ssl_domain = escapeshellarg($v_web_ssl_str[1]);
exec (VESTA_CMD."v-add-sys-vesta-ssl ".$v_web_ssl_user." ".$v_web_ssl_domain, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['VESTA_CERTIFICATE'] = $_POST['v_web_ssl_domain'];
// List SSL certificate info
exec (VESTA_CMD."v-list-sys-vesta-ssl json", $output, $return_var);
$v_sys_ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_sys_ssl_crt = $v_sys_ssl_str['VESTA']['CRT'];
$v_sys_ssl_key = $v_sys_ssl_str['VESTA']['KEY'];
$v_sys_ssl_ca = $v_sys_ssl_str['VESTA']['CA'];
$v_sys_ssl_subject = $v_sys_ssl_str['VESTA']['SUBJECT'];
$v_sys_ssl_aliases = $v_sys_ssl_str['VESTA']['ALIASES'];
$v_sys_ssl_not_before = $v_sys_ssl_str['VESTA']['NOT_BEFORE'];
$v_sys_ssl_not_after = $v_sys_ssl_str['VESTA']['NOT_AFTER'];
$v_sys_ssl_signature = $v_sys_ssl_str['VESTA']['SIGNATURE'];
$v_sys_ssl_pub_key = $v_sys_ssl_str['VESTA']['PUB_KEY'];
$v_sys_ssl_issuer = $v_sys_ssl_str['VESTA']['ISSUER'];
}
}
}
// Update SSL certificate
if ((!empty($_POST['v_sys_ssl_crt'])) && (empty($_POST['v_web_ssl_domain'])) && (empty($_SESSION['error_msg']))) {
if (($v_sys_ssl_crt != str_replace("\r\n", "\n", $_POST['v_sys_ssl_crt'])) || ($v_sys_ssl_key != str_replace("\r\n", "\n", $_POST['v_sys_ssl_key']))) {
exec ('mktemp -d', $mktemp_output, $return_var);
$tmpdir = $mktemp_output[0];
// Certificate
if (!empty($_POST['v_sys_ssl_crt'])) {
$fp = fopen($tmpdir."/certificate.crt", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_sys_ssl_crt']));
fwrite($fp, "\n");
fclose($fp);
}
// Key
if (!empty($_POST['v_sys_ssl_key'])) {
$fp = fopen($tmpdir."/certificate.key", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_sys_ssl_key']));
fwrite($fp, "\n");
fclose($fp);
}
exec (VESTA_CMD."v-change-sys-vesta-ssl ".$tmpdir, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
// List ssl certificate info
exec (VESTA_CMD."v-list-sys-vesta-ssl json", $output, $return_var);
$v_sys_ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_sys_ssl_crt = $v_sys_ssl_str['VESTA']['CRT'];
$v_sys_ssl_key = $v_sys_ssl_str['VESTA']['KEY'];
$v_sys_ssl_ca = $v_sys_ssl_str['VESTA']['CA'];
$v_sys_ssl_subject = $v_sys_ssl_str['VESTA']['SUBJECT'];
$v_sys_ssl_aliases = $v_sys_ssl_str['VESTA']['ALIASES'];
$v_sys_ssl_not_before = $v_sys_ssl_str['VESTA']['NOT_BEFORE'];
$v_sys_ssl_not_after = $v_sys_ssl_str['VESTA']['NOT_AFTER'];
$v_sys_ssl_signature = $v_sys_ssl_str['VESTA']['SIGNATURE'];
$v_sys_ssl_pub_key = $v_sys_ssl_str['VESTA']['PUB_KEY'];
$v_sys_ssl_issuer = $v_sys_ssl_str['VESTA']['ISSUER'];
}
}
}
// Flush field values on success
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Changes has been saved.');
}
// activating sftp licence
if (empty($_SESSION['error_msg'])) {
if($_SESSION['SFTPJAIL_KEY'] != $_POST['v_sftp_licence'] && $_POST['v_sftp'] == 'yes'){
$module = 'sftpjail';
$licence_key = escapeshellarg($_POST['v_sftp_licence']);
exec (VESTA_CMD."v-activate-vesta-license ".$module." ".$licence_key, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Licence Activated');
$_SESSION['SFTPJAIL_KEY'] = $_POST['v_sftp_licence'];
}
}
}
// cancel sftp licence
if (empty($_SESSION['error_msg'])) {
if($_POST['v_sftp'] == 'cancel' && $_SESSION['SFTPJAIL_KEY']){
$module = 'sftpjail';
$licence_key = escapeshellarg($_SESSION['SFTPJAIL_KEY']);
exec (VESTA_CMD."v-deactivate-vesta-license ".$module." ".$licence_key, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Licence Deactivated');
unset($_SESSION['SFTPJAIL_KEY']);
}
}
}
// activating filemanager licence
if (empty($_SESSION['error_msg'])) {
if($_SESSION['FILEMANAGER_KEY'] != $_POST['v_filemanager_licence'] && $_POST['v_filemanager'] == 'yes'){
$module = 'filemanager';
$licence_key = escapeshellarg($_POST['v_filemanager_licence']);
exec (VESTA_CMD."v-activate-vesta-license ".$module." ".$licence_key, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Licence Activated');
$_SESSION['FILEMANAGER_KEY'] = $_POST['v_filemanager_licence'];
}
}
}
// cancel filemanager licence
if (empty($_SESSION['error_msg'])) {
if($_POST['v_filemanager'] == 'cancel' && $_SESSION['FILEMANAGER_KEY']){
$module = 'filemanager';
$licence_key = escapeshellarg($_SESSION['FILEMANAGER_KEY']);
exec (VESTA_CMD."v-deactivate-vesta-license ".$module." ".$licence_key, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Licence Deactivated');
unset($_SESSION['FILEMANAGER_KEY']);
}
}
}
// activating softaculous
if (empty($_SESSION['error_msg'])) {
if($_SESSION['SOFTACULOUS'] != $_POST['v_softaculous'] && $_POST['v_softaculous'] == 'yes'){
exec (VESTA_CMD."v-add-vesta-softaculous WEB", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Softaculous Activated');
$_SESSION['SOFTACULOUS'] = 'yes';
}
}
}
// disable softaculous
if (empty($_SESSION['error_msg'])) {
if($_SESSION['SOFTACULOUS'] != $_POST['v_softaculous'] && $_POST['v_softaculous'] == 'no'){
exec (VESTA_CMD."v-delete-vesta-softaculous", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Softaculous Disabled');
$_SESSION['SOFTACULOUS'] = '';
}
}
}
}
// Check system configuration
exec (VESTA_CMD . "v-list-sys-config json", $output, $return_var);
$data = json_decode(implode('', $output), true);
unset($output);
$sys_arr = $data['config'];
foreach ($sys_arr as $key => $value) {
$_SESSION[$key] = $value;
}
// Render page
render_page($user, $TAB, 'edit_server');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,10 +1 @@
<?php
error_reporting(NULL);
$TAB = 'SERVER';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check user
header("Location: /list/firewall");
exit;
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,67 +1 @@
<?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." mariadb ".$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('mariadb');
# Read config
$v_config = shell_exec(VESTA_CMD."v-open-fs-config ".$v_config_path);
// Render page
render_page($user, $TAB, 'edit_server_mysql');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,67 +1 @@
<?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." mysql ".$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);
// Render page
render_page($user, $TAB, 'edit_server_mysql');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,67 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_mysql');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_service');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,72 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_nginx');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,68 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_php');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,68 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_php');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,68 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_php');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,78 +1 @@
<?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 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);
// Render page
render_page($user, $TAB, 'edit_server_pgsql');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." proftpd ".$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-proftpd-config plain');
$v_service_name = strtoupper('proftpd');
// 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']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_service');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." 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);
// Render page
render_page($user, $TAB, 'edit_server_service');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,58 +1 @@
<?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." vsftpd ".$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-vsftpd-config plain');
$v_service_name = strtoupper('vsftpd');
// 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']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,191 +1 @@
<?php
error_reporting(NULL);
ob_start();
$TAB = 'USER';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check user argument
if (empty($_GET['user'])) {
header("Location: /list/user/");
exit;
}
// Edit as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
$user=$_GET['user'];
$v_username=$_GET['user'];
} else {
$user=$_SESSION['user'];
$v_username=$_SESSION['user'];
}
// List user
exec (VESTA_CMD."v-list-user ".escapeshellarg($v_username)." json", $output, $return_var);
check_return_code($return_var,$output);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse user
$v_password = "";
$v_email = $data[$v_username]['CONTACT'];
$v_package = $data[$v_username]['PACKAGE'];
$v_language = $data[$v_username]['LANGUAGE'];
$v_fname = $data[$v_username]['FNAME'];
$v_lname = $data[$v_username]['LNAME'];
$v_shell = $data[$v_username]['SHELL'];
$v_ns = $data[$v_username]['NS'];
$nameservers = explode(",", $v_ns);
$v_ns1 = $nameservers[0];
$v_ns2 = $nameservers[1];
$v_ns3 = $nameservers[2];
$v_ns4 = $nameservers[3];
$v_ns5 = $nameservers[4];
$v_ns6 = $nameservers[5];
$v_ns7 = $nameservers[6];
$v_ns8 = $nameservers[7];
$v_suspended = $data[$v_username]['SUSPENDED'];
if ( $v_suspended == 'yes' ) {
$v_status = 'suspended';
} else {
$v_status = 'active';
}
$v_time = $data[$v_username]['TIME'];
$v_date = $data[$v_username]['DATE'];
// List packages
exec (VESTA_CMD."v-list-user-packages json", $output, $return_var);
$packages = json_decode(implode('', $output), true);
unset($output);
// List languages
exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var);
$languages = json_decode(implode('', $output), true);
unset($output);
// List shells
exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var);
$shells = json_decode(implode('', $output), true);
unset($output);
// Are you admin?
// Check POST request
if (!empty($_POST['save'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
// Change password
if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) {
$v_password = tempnam("/tmp","vst");
$fp = fopen($v_password, "w");
fwrite($fp, $_POST['v_password']."\n");
fclose($fp);
exec (VESTA_CMD."v-change-user-password ".escapeshellarg($v_username)." ".$v_password, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
unlink($v_password);
$v_password = escapeshellarg($_POST['v_password']);
}
// Change package (admin only)
if (($v_package != $_POST['v_package']) && ($_SESSION['user'] == 'admin') && (empty($_SESSION['error_msg']))) {
$v_package = escapeshellarg($_POST['v_package']);
exec (VESTA_CMD."v-change-user-package ".escapeshellarg($v_username)." ".$v_package, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Change language
if (($v_language != $_POST['v_language']) && (empty($_SESSION['error_msg']))) {
$v_language = escapeshellarg($_POST['v_language']);
exec (VESTA_CMD."v-change-user-language ".escapeshellarg($v_username)." ".$v_language, $output, $return_var);
check_return_code($return_var,$output);
if (empty($_SESSION['error_msg'])) {
if ((empty($_GET['user'])) || ($_GET['user'] == $_SESSION['user'])) $_SESSION['language'] = $_POST['v_language'];
}
unset($output);
}
// Change shell (admin only)
if (($v_shell != $_POST['v_shell']) && ($_SESSION['user'] == 'admin') && (empty($_SESSION['error_msg']))) {
$v_shell = escapeshellarg($_POST['v_shell']);
exec (VESTA_CMD."v-change-user-shell ".escapeshellarg($v_username)." ".$v_shell, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Change contact email
if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) {
if (!filter_var($_POST['v_email'], FILTER_VALIDATE_EMAIL)) {
$_SESSION['error_msg'] = __('Please enter valid email address.');
} else {
$v_email = escapeshellarg($_POST['v_email']);
exec (VESTA_CMD."v-change-user-contact ".escapeshellarg($v_username)." ".$v_email, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
}
// Change full name
if (($v_fname != $_POST['v_fname']) || ($v_lname != $_POST['v_lname']) && (empty($_SESSION['error_msg']))) {
$v_fname = escapeshellarg($_POST['v_fname']);
$v_lname = escapeshellarg($_POST['v_lname']);
exec (VESTA_CMD."v-change-user-name ".escapeshellarg($v_username)." ".$v_fname." ".$v_lname, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_fname = $_POST['v_fname'];
$v_lname = $_POST['v_lname'];
}
// Change NameServers
if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) || ($v_ns5 != $_POST['v_ns5'])
|| ($v_ns6 != $_POST['v_ns6']) || ($v_ns7 != $_POST['v_ns7']) || ($v_ns8 != $_POST['v_ns8']) && (empty($_SESSION['error_msg']))) {
$v_ns1 = escapeshellarg($_POST['v_ns1']);
$v_ns2 = escapeshellarg($_POST['v_ns2']);
$v_ns3 = escapeshellarg($_POST['v_ns3']);
$v_ns4 = escapeshellarg($_POST['v_ns4']);
$v_ns5 = escapeshellarg($_POST['v_ns5']);
$v_ns6 = escapeshellarg($_POST['v_ns6']);
$v_ns7 = escapeshellarg($_POST['v_ns7']);
$v_ns8 = escapeshellarg($_POST['v_ns8']);
$ns_cmd = VESTA_CMD."v-change-user-ns ".escapeshellarg($v_username)." ".$v_ns1." ".$v_ns2;
if (!empty($_POST['v_ns3'])) $ns_cmd = $ns_cmd." ".$v_ns3;
if (!empty($_POST['v_ns4'])) $ns_cmd = $ns_cmd." ".$v_ns4;
if (!empty($_POST['v_ns5'])) $ns_cmd = $ns_cmd." ".$v_ns5;
if (!empty($_POST['v_ns6'])) $ns_cmd = $ns_cmd." ".$v_ns6;
if (!empty($_POST['v_ns7'])) $ns_cmd = $ns_cmd." ".$v_ns7;
if (!empty($_POST['v_ns8'])) $ns_cmd = $ns_cmd." ".$v_ns8;
exec ($ns_cmd, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_ns1 = str_replace("'","", $v_ns1);
$v_ns2 = str_replace("'","", $v_ns2);
$v_ns3 = str_replace("'","", $v_ns3);
$v_ns4 = str_replace("'","", $v_ns4);
$v_ns5 = str_replace("'","", $v_ns5);
$v_ns6 = str_replace("'","", $v_ns6);
$v_ns7 = str_replace("'","", $v_ns7);
$v_ns8 = str_replace("'","", $v_ns8);
}
// Set success message
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('Changes has been saved.');
}
}
// Render page
render_page($user, $TAB, 'edit_user');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>

View file

@ -1,753 +1 @@
<?php
error_reporting(NULL);
ob_start();
unset($_SESSION['error_msg']);
$TAB = 'WEB';
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check domain argument
if (empty($_GET['domain'])) {
header("Location: /list/web/");
exit;
}
// Edit as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
$user=escapeshellarg($_GET['user']);
}
// List domain
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-list-web-domain ".$user." ".$v_domain." json", $output, $return_var);
$data = json_decode(implode('', $output), true);
unset($output);
// Parse domain
$v_username = $user;
$v_domain = $_GET['domain'];
$v_ip = $data[$v_domain]['IP'];
$v_template = $data[$v_domain]['TPL'];
$v_aliases = str_replace(',', "\n", $data[$v_domain]['ALIAS']);
$valiases = explode(",", $data[$v_domain]['ALIAS']);
$v_tpl = $data[$v_domain]['IP'];
$v_cgi = $data[$v_domain]['CGI'];
$v_elog = $data[$v_domain]['ELOG'];
$v_ssl = $data[$v_domain]['SSL'];
if (!empty($v_ssl)) {
exec (VESTA_CMD."v-list-web-domain-ssl ".$user." ".escapeshellarg($v_domain)." json", $output, $return_var);
$ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_ssl_crt = $ssl_str[$v_domain]['CRT'];
$v_ssl_key = $ssl_str[$v_domain]['KEY'];
$v_ssl_ca = $ssl_str[$v_domain]['CA'];
$v_ssl_subject = $ssl_str[$v_domain]['SUBJECT'];
$v_ssl_aliases = $ssl_str[$v_domain]['ALIASES'];
$v_ssl_not_before = $ssl_str[$v_domain]['NOT_BEFORE'];
$v_ssl_not_after = $ssl_str[$v_domain]['NOT_AFTER'];
$v_ssl_signature = $ssl_str[$v_domain]['SIGNATURE'];
$v_ssl_pub_key = $ssl_str[$v_domain]['PUB_KEY'];
$v_ssl_issuer = $ssl_str[$v_domain]['ISSUER'];
}
$v_letsencrypt = $data[$v_domain]['LETSENCRYPT'];
if (empty($v_letsencrypt)) $v_letsencrypt = 'no';
$v_ssl_home = $data[$v_domain]['SSL_HOME'];
$v_backend_template = $data[$v_domain]['BACKEND'];
$v_proxy = $data[$v_domain]['PROXY'];
$v_proxy_template = $data[$v_domain]['PROXY'];
$v_proxy_ext = str_replace(',', ', ', $data[$v_domain]['PROXY_EXT']);
$v_stats = $data[$v_domain]['STATS'];
$v_stats_user = $data[$v_domain]['STATS_USER'];
if (!empty($v_stats_user)) $v_stats_password = "";
$v_ftp_user = $data[$v_domain]['FTP_USER'];
$v_ftp_path = $data[$v_domain]['FTP_PATH'];
if (!empty($v_ftp_user)) $v_ftp_password = "";
$v_ftp_user_prepath = $data[$v_domain]['DOCUMENT_ROOT'];
$v_ftp_user_prepath = str_replace('/public_html', '', $v_ftp_user_prepath, $occurance = 1);
$v_ftp_email = $panel[$user]['CONTACT'];
$v_suspended = $data[$v_domain]['SUSPENDED'];
if ( $v_suspended == 'yes' ) {
$v_status = 'suspended';
} else {
$v_status = 'active';
}
$v_time = $data[$v_domain]['TIME'];
$v_date = $data[$v_domain]['DATE'];
// List ip addresses
exec (VESTA_CMD."v-list-user-ips ".$user." json", $output, $return_var);
$ips = json_decode(implode('', $output), true);
unset($output);
// List web templates
exec (VESTA_CMD."v-list-web-templates json", $output, $return_var);
$templates = json_decode(implode('', $output), true);
unset($output);
// List backend templates
if (!empty($_SESSION['WEB_BACKEND'])) {
exec (VESTA_CMD."v-list-web-templates-backend json", $output, $return_var);
$backend_templates = json_decode(implode('', $output), true);
unset($output);
}
// List proxy templates
if (!empty($_SESSION['PROXY_SYSTEM'])) {
exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var);
$proxy_templates = json_decode(implode('', $output), true);
unset($output);
}
// List web stat engines
exec (VESTA_CMD."v-list-web-stats json", $output, $return_var);
$stats = json_decode(implode('', $output), true);
unset($output);
// Check POST request
if (!empty($_POST['save'])) {
$v_domain = escapeshellarg($_POST['v_domain']);
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
}
// Change web domain IP
if (($v_ip != $_POST['v_ip']) && (empty($_SESSION['error_msg']))) {
$v_ip = escapeshellarg($_POST['v_ip']);
exec (VESTA_CMD."v-change-web-domain-ip ".$v_username." ".$v_domain." ".$v_ip." no", $output, $return_var);
check_return_code($return_var,$output);
$restart_web = 'yes';
$restart_proxy = 'yes';
unset($output);
}
// Chane dns domain IP
if (($v_ip != $_POST['v_ip']) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain." json", $output, $return_var);
unset($output);
if ($return_var == 0 ) {
$v_ip = escapeshellarg($_POST['v_ip']);
exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." ".$v_domain." ".$v_ip." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_dns = 'yes';
}
}
// Change dns ip for each alias
if (($v_ip != $_POST['v_ip']) && (empty($_SESSION['error_msg']))) {
foreach($valiases as $v_alias ){
$v_alias = escapeshellarg($v_alias);
exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_alias." json", $output, $return_var);
unset($output);
if ($return_var == 0 ) {
$v_ip = escapeshellarg($_POST['v_ip']);
exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." ".$v_alias." ".$v_ip, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_dns = 'yes';
}
}
}
// Change template (admin only)
if (($v_template != $_POST['v_template']) && ( $_SESSION['user'] == 'admin') && (empty($_SESSION['error_msg']))) {
$v_template = escapeshellarg($_POST['v_template']);
exec (VESTA_CMD."v-change-web-domain-tpl ".$v_username." ".$v_domain." ".$v_template." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_web = 'yes';
}
// Change aliases
if (empty($_SESSION['error_msg'])) {
$waliases = preg_replace("/\n/", " ", $_POST['v_aliases']);
$waliases = preg_replace("/,/", " ", $waliases);
$waliases = preg_replace('/\s+/', ' ',$waliases);
$waliases = trim($waliases);
$aliases = explode(" ", $waliases);
$v_aliases = str_replace(' ', "\n", $waliases);
$result = array_diff($valiases, $aliases);
foreach ($result as $alias) {
if ((empty($_SESSION['error_msg'])) && (!empty($alias))) {
$restart_web = 'yes';
$restart_proxy = 'yes';
$v_template = escapeshellarg($_POST['v_template']);
$alias = escapeshellarg($alias);
exec (VESTA_CMD."v-delete-web-domain-alias ".$v_username." ".$v_domain." ".$alias." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
unset($output);
if ($return_var == 0) {
exec (VESTA_CMD."v-delete-dns-on-web-alias ".$v_username." ".$v_domain." ".$alias." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_dns = 'yes';
}
}
}
}
$result = array_diff($aliases, $valiases);
foreach ($result as $alias) {
if ((empty($_SESSION['error_msg'])) && (!empty($alias))) {
$restart_web = 'yes';
$restart_proxy = 'yes';
$v_template = escapeshellarg($_POST['v_template']);
$alias = escapeshellarg($alias);
exec (VESTA_CMD."v-add-web-domain-alias ".$v_username." ".$v_domain." ".$alias." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
unset($output);
if ($return_var == 0) {
exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".$alias." ".$v_ip." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_dns = 'yes';
}
}
}
}
}
// Change backend template
if ((!empty($_SESSION['WEB_BACKEND'])) && ( $v_backend_template != $_POST['v_backend_template']) && ( $_SESSION['user'] == 'admin') && (empty($_SESSION['error_msg']))) {
$v_backend_template = $_POST['v_backend_template'];
exec (VESTA_CMD."v-change-web-domain-backend-tpl ".$v_username." ".$v_domain." ".escapeshellarg($v_backend_template), $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Delete proxy support
if ((!empty($_SESSION['PROXY_SYSTEM'])) && (!empty($v_proxy)) && (empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-web-domain-proxy ".$v_username." ".$v_domain." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
unset($v_proxy);
$restart_proxy = 'yes';
}
// Change proxy template / Update extension list (admin only)
if ((!empty($_SESSION['PROXY_SYSTEM'])) && (!empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg'])) && ($_SESSION['user'] == 'admin')) {
$ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']);
$ext = preg_replace("/,/", " ", $ext);
$ext = preg_replace('/\s+/', ' ',$ext);
$ext = trim($ext);
$ext = str_replace(' ', ", ", $ext);
if (( $v_proxy_template != $_POST['v_proxy_template']) || ($v_proxy_ext != $ext)) {
$ext = str_replace(', ', ",", $ext);
if (!empty($_POST['v_proxy_template'])) $v_proxy_template = $_POST['v_proxy_template'];
exec (VESTA_CMD."v-change-web-domain-proxy-tpl ".$v_username." ".$v_domain." ".escapeshellarg($v_proxy_template)." ".escapeshellarg($ext)." no", $output, $return_var);
check_return_code($return_var,$output);
$v_proxy_ext = str_replace(',', ', ', $ext);
unset($output);
$restart_proxy = 'yes';
}
}
// Add proxy support
if ((!empty($_SESSION['PROXY_SYSTEM'])) && (empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) {
$v_proxy_template = $_POST['v_proxy_template'];
if (!empty($_POST['v_proxy_ext'])) {
$ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']);
$ext = preg_replace("/,/", " ", $ext);
$ext = preg_replace('/\s+/', ' ',$ext);
$ext = trim($ext);
$ext = str_replace(' ', ",", $ext);
$v_proxy_ext = str_replace(',', ', ', $ext);
}
exec (VESTA_CMD."v-add-web-domain-proxy ".$v_username." ".$v_domain." ".escapeshellarg($v_proxy_template)." ".escapeshellarg($ext)." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_proxy = 'yes';
}
// Change document root for ssl domain
if (( $v_ssl == 'yes') && (!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) {
if ( $v_ssl_home != $_POST['v_ssl_home'] ) {
$v_ssl_home = escapeshellarg($_POST['v_ssl_home']);
exec (VESTA_CMD."v-change-web-domain-sslhome ".$user." ".$v_domain." ".$v_ssl_home." no", $output, $return_var);
check_return_code($return_var,$output);
$v_ssl_home = $_POST['v_ssl_home'];
$restart_web = 'yes';
$restart_proxy = 'yes';
unset($output);
}
}
// Change SSL certificate
if (( $v_letsencrypt == 'no' ) && (empty($_POST['v_letsencrypt'])) && ( $v_ssl == 'yes' ) && (!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) {
if (( $v_ssl_crt != str_replace("\r\n", "\n", $_POST['v_ssl_crt'])) || ( $v_ssl_key != str_replace("\r\n", "\n", $_POST['v_ssl_key'])) || ( $v_ssl_ca != str_replace("\r\n", "\n", $_POST['v_ssl_ca']))) {
exec ('mktemp -d', $mktemp_output, $return_var);
$tmpdir = $mktemp_output[0];
// Certificate
if (!empty($_POST['v_ssl_crt'])) {
$fp = fopen($tmpdir."/".$_POST['v_domain'].".crt", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_crt']));
fwrite($fp, "\n");
fclose($fp);
}
// Key
if (!empty($_POST['v_ssl_key'])) {
$fp = fopen($tmpdir."/".$_POST['v_domain'].".key", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_key']));
fwrite($fp, "\n");
fclose($fp);
}
// CA
if (!empty($_POST['v_ssl_ca'])) {
$fp = fopen($tmpdir."/".$_POST['v_domain'].".ca", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_ca']));
fwrite($fp, "\n");
fclose($fp);
}
exec (VESTA_CMD."v-change-web-domain-sslcert ".$user." ".$v_domain." ".$tmpdir." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$restart_web = 'yes';
$restart_proxy = 'yes';
exec (VESTA_CMD."v-list-web-domain-ssl ".$user." ".$v_domain." json", $output, $return_var);
$ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_ssl_crt = $ssl_str[$v_domain]['CRT'];
$v_ssl_key = $ssl_str[$v_domain]['KEY'];
$v_ssl_ca = $ssl_str[$v_domain]['CA'];
$v_ssl_subject = $ssl_str[$v_domain]['SUBJECT'];
$v_ssl_aliases = $ssl_str[$v_domain]['ALIASES'];
$v_ssl_not_before = $ssl_str[$v_domain]['NOT_BEFORE'];
$v_ssl_not_after = $ssl_str[$v_domain]['NOT_AFTER'];
$v_ssl_signature = $ssl_str[$v_domain]['SIGNATURE'];
$v_ssl_pub_key = $ssl_str[$v_domain]['PUB_KEY'];
$v_ssl_issuer = $ssl_str[$v_domain]['ISSUER'];
// Cleanup certificate tempfiles
if (!empty($_POST['v_ssl_crt'])) unlink($tmpdir."/".$_POST['v_domain'].".crt");
if (!empty($_POST['v_ssl_key'])) unlink($tmpdir."/".$_POST['v_domain'].".key");
if (!empty($_POST['v_ssl_ca'])) unlink($tmpdir."/".$_POST['v_domain'].".ca");
rmdir($tmpdir);
}
}
// Delete Lets Encrypt support
if (( $v_letsencrypt == 'yes' ) && (empty($_POST['v_letsencrypt'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-letsencrypt-domain ".$user." ".$v_domain." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_ssl_crt = '';
$v_ssl_key = '';
$v_ssl_ca = '';
$v_letsencrypt = 'no';
$v_letsencrypt_deleted = 'yes';
$v_ssl = 'no';
$restart_web = 'yes';
$restart_proxy = 'yes';
}
// Delete SSL certificate
if (( $v_ssl == 'yes' ) && (empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-web-domain-ssl ".$v_username." ".$v_domain." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_ssl_crt = '';
$v_ssl_key = '';
$v_ssl_ca = '';
$v_ssl = 'no';
$restart_web = 'yes';
$restart_proxy = 'yes';
}
// Add Lets Encrypt support
if ((!empty($_POST['v_ssl'])) && ( $v_letsencrypt == 'no' ) && (!empty($_POST['v_letsencrypt'])) && empty($_SESSION['error_msg'])) {
$l_aliases = str_replace("\n", ',', $v_aliases);
exec (VESTA_CMD."v-add-letsencrypt-domain ".$user." ".$v_domain." ".escapeshellarg($l_aliases)." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_letsencrypt = 'yes';
$v_ssl = 'yes';
$restart_web = 'yes';
$restart_proxy = 'yes';
}
// Add SSL certificate
if (( $v_ssl == 'no' ) && (!empty($_POST['v_ssl'])) && (empty($v_letsencrypt_deleted)) && (empty($_SESSION['error_msg']))) {
if (empty($_POST['v_ssl_crt'])) $errors[] = 'ssl certificate';
if (empty($_POST['v_ssl_key'])) $errors[] = 'ssl key';
if (empty($_POST['v_ssl_home'])) $errors[] = 'ssl home';
$v_ssl_home = escapeshellarg($_POST['v_ssl_home']);
if (!empty($errors[0])) {
foreach ($errors as $i => $error) {
if ( $i == 0 ) {
$error_msg = $error;
} else {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
} else {
exec ('mktemp -d', $mktemp_output, $return_var);
$tmpdir = $mktemp_output[0];
// Certificate
if (!empty($_POST['v_ssl_crt'])) {
$fp = fopen($tmpdir."/".$_POST['v_domain'].".crt", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_crt']));
fclose($fp);
}
// Key
if (!empty($_POST['v_ssl_key'])) {
$fp = fopen($tmpdir."/".$_POST['v_domain'].".key", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_key']));
fclose($fp);
}
// CA
if (!empty($_POST['v_ssl_ca'])) {
$fp = fopen($tmpdir."/".$_POST['v_domain'].".ca", 'w');
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_ca']));
fclose($fp);
}
exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." no", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_ssl = 'yes';
$restart_web = 'yes';
$restart_proxy = 'yes';
exec (VESTA_CMD."v-list-web-domain-ssl ".$user." ".$v_domain." json", $output, $return_var);
$ssl_str = json_decode(implode('', $output), true);
unset($output);
$v_ssl_crt = $ssl_str[$_POST['v_domain']]['CRT'];
$v_ssl_key = $ssl_str[$_POST['v_domain']]['KEY'];
$v_ssl_ca = $ssl_str[$_POST['v_domain']]['CA'];
$v_ssl_subject = $ssl_str[$_POST['v_domain']]['SUBJECT'];
$v_ssl_aliases = $ssl_str[$_POST['v_domain']]['ALIASES'];
$v_ssl_not_before = $ssl_str[$_POST['v_domain']]['NOT_BEFORE'];
$v_ssl_not_after = $ssl_str[$_POST['v_domain']]['NOT_AFTER'];
$v_ssl_signature = $ssl_str[$_POST['v_domain']]['SIGNATURE'];
$v_ssl_pub_key = $ssl_str[$_POST['v_domain']]['PUB_KEY'];
$v_ssl_issuer = $ssl_str[$_POST['v_domain']]['ISSUER'];
// Cleanup certificate tempfiles
if (!empty($_POST['v_ssl_crt'])) unlink($tmpdir."/".$_POST['v_domain'].".crt");
if (!empty($_POST['v_ssl_key'])) unlink($tmpdir."/".$_POST['v_domain'].".key");
if (!empty($_POST['v_ssl_ca'])) unlink($tmpdir."/".$_POST['v_domain'].".ca");
rmdir($tmpdir);
}
}
// Delete web stats
if ((!empty($v_stats)) && ($_POST['v_stats'] == 'none') && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-web-domain-stats ".$v_username." ".$v_domain, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_stats = '';
}
// Change web stats engine
if ((!empty($v_stats)) && ($_POST['v_stats'] != $v_stats) && (empty($_SESSION['error_msg']))) {
$v_stats = escapeshellarg($_POST['v_stats']);
exec (VESTA_CMD."v-change-web-domain-stats ".$v_username." ".$v_domain." ".$v_stats, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Add web stats
if ((empty($v_stats)) && ($_POST['v_stats'] != 'none') && (empty($_SESSION['error_msg']))) {
$v_stats = escapeshellarg($_POST['v_stats']);
exec (VESTA_CMD."v-add-web-domain-stats ".$v_username." ".$v_domain." ".$v_stats, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Delete web stats authorization
if ((!empty($v_stats_user)) && (empty($_POST['v_stats_auth'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-delete-web-domain-stats-user ".$v_username." ".$v_domain, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
$v_stats_user = '';
$v_stats_password = '';
}
// Change web stats user or password
if ((empty($v_stats_user)) && (!empty($_POST['v_stats_auth'])) && (empty($_SESSION['error_msg']))) {
if (empty($_POST['v_stats_user'])) $errors[] = __('stats username');
if (!empty($errors[0])) {
foreach ($errors as $i => $error) {
if ( $i == 0 ) {
$error_msg = $error;
} else {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
} else {
$v_stats_user = escapeshellarg($_POST['v_stats_user']);
$v_stats_password = tempnam("/tmp","vst");
$fp = fopen($v_stats_password, "w");
fwrite($fp, $_POST['v_stats_password']."\n");
fclose($fp);
exec (VESTA_CMD."v-add-web-domain-stats-user ".$v_username." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
unlink($v_stats_password);
$v_stats_password = escapeshellarg($_POST['v_stats_password']);
}
}
// Add web stats authorization
if ((!empty($v_stats_user)) && (!empty($_POST['v_stats_auth'])) && (empty($_SESSION['error_msg']))) {
if (empty($_POST['v_stats_user'])) $errors[] = __('stats user');
if (!empty($errors[0])) {
foreach ($errors as $i => $error) {
if ( $i == 0 ) {
$error_msg = $error;
} else {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
}
if (($v_stats_user != $_POST['v_stats_user']) || (!empty($_POST['v_stats_password'])) && (empty($_SESSION['error_msg']))) {
$v_stats_user = escapeshellarg($_POST['v_stats_user']);
$v_stats_password = tempnam("/tmp","vst");
$fp = fopen($v_stats_password, "w");
fwrite($fp, $_POST['v_stats_password']."\n");
fclose($fp);
exec (VESTA_CMD."v-add-web-domain-stats-user ".$v_username." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
unlink($v_stats_password);
$v_stats_password = escapeshellarg($_POST['v_stats_password']);
}
}
// Update ftp account
if (!empty($_POST['v_ftp_user'])) {
$v_ftp_users_updated = array();
foreach ($_POST['v_ftp_user'] as $i => $v_ftp_user_data) {
if (empty($v_ftp_user_data['v_ftp_user'])) {
continue;
}
$v_ftp_user_data['v_ftp_user'] = preg_replace("/^".$user."_/i", "", $v_ftp_user_data['v_ftp_user']);
if ($v_ftp_user_data['is_new'] == 1 && !empty($_POST['v_ftp'])) {
if ((!empty($v_ftp_user_data['v_ftp_email'])) && (!filter_var($v_ftp_user_data['v_ftp_email'], FILTER_VALIDATE_EMAIL))) $_SESSION['error_msg'] = __('Please enter valid email address.');
if (empty($v_ftp_user_data['v_ftp_user'])) $errors[] = 'ftp user';
if (!empty($errors[0])) {
foreach ($errors as $i => $error) {
if ( $i == 0 ) {
$error_msg = $error;
} else {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
}
// Add ftp account
$v_ftp_username = $v_ftp_user_data['v_ftp_user'];
$v_ftp_username_full = $user . '_' . $v_ftp_user_data['v_ftp_user'];
$v_ftp_user = escapeshellarg($v_ftp_username);
$v_ftp_path = escapeshellarg(trim($v_ftp_user_data['v_ftp_path']));
if (empty($_SESSION['error_msg'])) {
$v_ftp_password = tempnam("/tmp","vst");
$fp = fopen($v_ftp_password, "w");
fwrite($fp, $v_ftp_user_data['v_ftp_password']."\n");
fclose($fp);
exec (VESTA_CMD."v-add-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
check_return_code($return_var,$output);
if ((!empty($v_ftp_user_data['v_ftp_email'])) && (empty($_SESSION['error_msg']))) {
$to = $v_ftp_user_data['v_ftp_email'];
$subject = __("FTP login credentials");
$hostname = exec('hostname');
$from = __('MAIL_FROM',$hostname);
$mailtext = __('FTP_ACCOUNT_READY',$_GET['domain'],$user,$v_ftp_username,$v_ftp_user_data['v_ftp_password']);
send_email($to, $subject, $mailtext, $from);
unset($v_ftp_email);
}
unset($output);
unlink($v_ftp_password);
$v_ftp_password = escapeshellarg($v_ftp_user_data['v_ftp_password']);
}
if ($return_var == 0) {
$v_ftp_password = "";
$v_ftp_user_data['is_new'] = 0;
}
else {
$v_ftp_user_data['is_new'] = 1;
}
$v_ftp_users_updated[] = array(
'is_new' => empty($_SESSION['error_msg']) ? 0 : 1,
'v_ftp_user' => $v_ftp_username_full,
'v_ftp_password' => $v_ftp_password,
'v_ftp_path' => $v_ftp_user_data['v_ftp_path'],
'v_ftp_email' => $v_ftp_user_data['v_ftp_email'],
'v_ftp_pre_path' => $v_ftp_user_prepath
);
continue;
}
// Delete FTP account
if ($v_ftp_user_data['delete'] == 1) {
$v_ftp_username = $user . '_' . $v_ftp_user_data['v_ftp_user'];
exec (VESTA_CMD."v-delete-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_username, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
continue;
}
if (!empty($_POST['v_ftp'])) {
if (empty($v_ftp_user_data['v_ftp_user'])) $errors[] = __('ftp user');
if (!empty($errors[0])) {
foreach ($errors as $i => $error) {
if ( $i == 0 ) {
$error_msg = $error;
} else {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
}
// Change FTP account path
$v_ftp_username_for_emailing = $v_ftp_user_data['v_ftp_user'];
$v_ftp_username = $user . '_' . $v_ftp_user_data['v_ftp_user']; //preg_replace("/^".$user."_/", "", $v_ftp_user_data['v_ftp_user']);
$v_ftp_username = escapeshellarg($v_ftp_username);
$v_ftp_path = escapeshellarg(trim($v_ftp_user_data['v_ftp_path']));
if(escapeshellarg(trim($v_ftp_user_data['v_ftp_path_prev'])) != $v_ftp_path) {
exec (VESTA_CMD."v-change-web-domain-ftp-path ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_path, $output, $return_var);
}
// Change FTP account password
if (!empty($v_ftp_user_data['v_ftp_password'])) {
$v_ftp_password = tempnam("/tmp","vst");
$fp = fopen($v_ftp_password, "w");
fwrite($fp, $v_ftp_user_data['v_ftp_password']."\n");
fclose($fp);
exec (VESTA_CMD."v-change-web-domain-ftp-password ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_password, $output, $return_var);
unlink($v_ftp_password);
$to = $v_ftp_user_data['v_ftp_email'];
$subject = __("FTP login credentials");
$hostname = exec('hostname');
$from = __('MAIL_FROM',$hostname);
$mailtext = __('FTP_ACCOUNT_READY',$_GET['domain'],$user,$v_ftp_username_for_emailing,$v_ftp_user_data['v_ftp_password']);
send_email($to, $subject, $mailtext, $from);
unset($v_ftp_email);
}
check_return_code($return_var, $output);
unset($output);
$v_ftp_users_updated[] = array(
'is_new' => 0,
'v_ftp_user' => $v_ftp_username,
'v_ftp_password' => $v_ftp_user_data['v_ftp_password'],
'v_ftp_path' => $v_ftp_user_data['v_ftp_path'],
'v_ftp_email' => $v_ftp_user_data['v_ftp_email'],
'v_ftp_pre_path' => $v_ftp_user_prepath
);
}
}
}
// Restart web server
if (!empty($restart_web) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-restart-web", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Restart proxy server
if ((!empty($_SESSION['PROXY_SYSTEM'])) && !empty($restart_proxy) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-restart-proxy", $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
// Restart dns server
if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-restart-dns", $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.');
}
}
$v_ftp_users_raw = explode(':', $v_ftp_user);
$v_ftp_users_paths_raw = explode(':', $data[$v_domain]['FTP_PATH']);
$v_ftp_users = array();
foreach ($v_ftp_users_raw as $v_ftp_user_index => $v_ftp_user_val) {
if (empty($v_ftp_user_val)) {
continue;
}
$v_ftp_users[] = array(
'is_new' => 0,
'v_ftp_user' => $v_ftp_user_val,
'v_ftp_password' => $v_ftp_password,
'v_ftp_path' => (isset($v_ftp_users_paths_raw[$v_ftp_user_index]) ? $v_ftp_users_paths_raw[$v_ftp_user_index] : ''),
'v_ftp_email' => $v_ftp_email,
'v_ftp_pre_path' => $v_ftp_user_prepath
);
}
if (empty($v_ftp_users)) {
$v_ftp_user = null;
$v_ftp_users[] = array(
'is_new' => 1,
'v_ftp_user' => '',
'v_ftp_password' => '',
'v_ftp_path' => (isset($v_ftp_users_paths_raw[$v_ftp_user_index]) ? $v_ftp_users_paths_raw[$v_ftp_user_index] : ''),
'v_ftp_email' => '',
'v_ftp_pre_path' => $v_ftp_user_prepath
);
}
// set default pre path for newly created users
$v_ftp_pre_path_new_user = $v_ftp_user_prepath;
if (isset($v_ftp_users_updated)) {
$v_ftp_users = $v_ftp_users_updated;
if (empty($v_ftp_users_updated)) {
$v_ftp_user = null;
$v_ftp_users[] = array(
'is_new' => 1,
'v_ftp_user' => '',
'v_ftp_password' => '',
'v_ftp_path' => (isset($v_ftp_users_paths_raw[$v_ftp_user_index]) ? $v_ftp_users_paths_raw[$v_ftp_user_index] : ''),
'v_ftp_email' => '',
'v_ftp_pre_path' => $v_ftp_user_prepath
);
}
}
// Render page
render_page($user, $TAB, 'edit_web');
// Flush session messages
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>