mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-07-12 16:13:32 -07:00
disable old php api
This commit is contained in:
parent
08513755b2
commit
93e9fe9f99
137 changed files with 137 additions and 9738 deletions
|
@ -1,21 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
exec (VESTA_CMD."v-add-cron-vesta-autoupdate", $output, $return_var);
|
|
||||||
$_SESSION['error_msg'] = __('Autoupdate has been successfully enabled');
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/updates/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,69 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
$TAB = 'CRON';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check POST request
|
|
||||||
if (!empty($_POST['ok'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check empty fields
|
|
||||||
if ((!isset($_POST['v_min'])) || ($_POST['v_min'] == '')) $errors[] = __('minute');
|
|
||||||
if ((!isset($_POST['v_hour'])) || ($_POST['v_hour'] == '')) $errors[] = __('hour');
|
|
||||||
if ((!isset($_POST['v_day'])) || ($_POST['v_day'] == '')) $errors[] = __('day');
|
|
||||||
if ((!isset($_POST['v_month'])) || ($_POST['v_month'] == '')) $errors[] = __('month');
|
|
||||||
if ((!isset($_POST['v_wday'])) || ($_POST['v_wday'] == '')) $errors[] = __('day of week');
|
|
||||||
if ((!isset($_POST['v_cmd'])) || ($_POST['v_cmd'] == '')) $errors[] = __('cmd');
|
|
||||||
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_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']);
|
|
||||||
|
|
||||||
// Add cron job
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-cron-job ".$user." ".$v_min." ".$v_hour." ".$v_day." ".$v_month." ".$v_wday." ".$v_cmd, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('CRON_CREATED_OK');
|
|
||||||
unset($v_min);
|
|
||||||
unset($v_hour);
|
|
||||||
unset($v_day);
|
|
||||||
unset($v_month);
|
|
||||||
unset($v_wday);
|
|
||||||
unset($v_cmd);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render
|
|
||||||
render_page($user, $TAB, 'add_cron');
|
|
||||||
|
|
||||||
// Flush session messages
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,19 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
exec (VESTA_CMD."v-add-cron-reports ".$user, $output, $return_var);
|
|
||||||
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully enabled');
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
header("Location: /list/cron/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,129 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
$TAB = 'DB';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check POST request
|
|
||||||
if (!empty($_POST['ok'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check empty fields
|
|
||||||
if (empty($_POST['v_database'])) $errors[] = __('database');
|
|
||||||
if (empty($_POST['v_dbuser'])) $errors[] = __('username');
|
|
||||||
if (empty($_POST['v_password'])) $errors[] = __('password');
|
|
||||||
if (empty($_POST['v_type'])) $errors[] = __('type');
|
|
||||||
if (empty($_POST['v_host'])) $errors[] = __('host');
|
|
||||||
if (empty($_POST['v_charset'])) $errors[] = __('charset');
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate email
|
|
||||||
if ((!empty($_POST['v_db_email'])) && (empty($_SESSION['error_msg']))) {
|
|
||||||
if (!filter_var($_POST['v_db_email'], FILTER_VALIDATE_EMAIL)) {
|
|
||||||
$_SESSION['error_msg'] = __('Please enter valid email address.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check password length
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$pw_len = strlen($_POST['v_password']);
|
|
||||||
if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Protect input
|
|
||||||
$v_database = escapeshellarg($_POST['v_database']);
|
|
||||||
$v_dbuser = escapeshellarg($_POST['v_dbuser']);
|
|
||||||
$v_type = $_POST['v_type'];
|
|
||||||
$v_charset = $_POST['v_charset'];
|
|
||||||
$v_host = $_POST['v_host'];
|
|
||||||
$v_db_email = $_POST['v_db_email'];
|
|
||||||
|
|
||||||
// Add database
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$v_type = escapeshellarg($_POST['v_type']);
|
|
||||||
$v_charset = escapeshellarg($_POST['v_charset']);
|
|
||||||
$v_host = escapeshellarg($_POST['v_host']);
|
|
||||||
$v_password = tempnam("/tmp","vst");
|
|
||||||
$fp = fopen($v_password, "w");
|
|
||||||
fwrite($fp, $_POST['v_password']."\n");
|
|
||||||
fclose($fp);
|
|
||||||
exec (VESTA_CMD."v-add-database ".$user." ".$v_database." ".$v_dbuser." ".$v_password." ".$v_type." ".$v_host." ".$v_charset, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
unlink($v_password);
|
|
||||||
$v_password = escapeshellarg($_POST['v_password']);
|
|
||||||
$v_type = $_POST['v_type'];
|
|
||||||
$v_host = $_POST['v_host'];
|
|
||||||
$v_charset = $_POST['v_charset'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get database manager url
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"] . ":");
|
|
||||||
if ($_POST['v_host'] != 'localhost' ) $http_host = $_POST['v_host'];
|
|
||||||
if ($_POST['v_type'] == 'mysql') $db_admin = "phpMyAdmin";
|
|
||||||
if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/";
|
|
||||||
if (($_POST['v_type'] == 'mysql') && (!empty($_SESSION['DB_PMA_URL']))) $db_admin_link = $_SESSION['DB_PMA_URL'];
|
|
||||||
if ($_POST['v_type'] == 'pgsql') $db_admin = "phpPgAdmin";
|
|
||||||
if ($_POST['v_type'] == 'pgsql') $db_admin_link = "http://".$http_host."/phppgadmin/";
|
|
||||||
if (($_POST['v_type'] == 'pgsql') && (!empty($_SESSION['DB_PGA_URL']))) $db_admin_link = $_SESSION['DB_PGA_URL'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Email login credentials
|
|
||||||
if ((!empty($v_db_email)) && (empty($_SESSION['error_msg']))) {
|
|
||||||
$to = $v_db_email;
|
|
||||||
$subject = __("Database Credentials");
|
|
||||||
$hostname = exec('hostname');
|
|
||||||
$from = __('MAIL_FROM',$hostname);
|
|
||||||
$mailtext = __('DATABASE_READY',$user."_".$_POST['v_database'],$user."_".$_POST['v_dbuser'],$_POST['v_password'],$db_admin_link);
|
|
||||||
send_email($to, $subject, $mailtext, $from);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('DATABASE_CREATED_OK',htmlentities($user)."_".htmlentities($_POST['v_database']),htmlentities($user)."_".htmlentities($_POST['v_database']));
|
|
||||||
$_SESSION['ok_msg'] .= " / <a href=".$db_admin_link." target='_blank'>" . __('open %s',$db_admin) . "</a>";
|
|
||||||
unset($v_database);
|
|
||||||
unset($v_dbuser);
|
|
||||||
unset($v_password);
|
|
||||||
unset($v_type);
|
|
||||||
unset($v_charset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get user email
|
|
||||||
$v_db_email = $panel[$user]['CONTACT'];
|
|
||||||
|
|
||||||
// List avaiable database types
|
|
||||||
$db_types = explode(',', $_SESSION['DB_SYSTEM']);
|
|
||||||
|
|
||||||
// List available database servers
|
|
||||||
exec (VESTA_CMD."v-list-database-hosts json", $output, $return_var);
|
|
||||||
$db_hosts_tmp1 = json_decode(implode('', $output), true);
|
|
||||||
$db_hosts_tmp2 = array_map(function($host){return $host['HOST'];}, $db_hosts_tmp1);
|
|
||||||
$db_hosts = array_values(array_unique($db_hosts_tmp2));
|
|
||||||
unset($output);
|
|
||||||
unset($db_hosts_tmp1);
|
|
||||||
unset($db_hosts_tmp2);
|
|
||||||
|
|
||||||
render_page($user, $TAB, 'add_db');
|
|
||||||
|
|
||||||
// Flush session messages
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,180 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
$TAB = 'DNS';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check POST request for dns domain
|
|
||||||
if (!empty($_POST['ok'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check empty fields
|
|
||||||
if (empty($_POST['v_domain'])) $errors[] = __('domain');
|
|
||||||
if (empty($_POST['v_ip'])) $errors[] = __('ip');
|
|
||||||
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_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
|
|
||||||
$v_domain = escapeshellarg($v_domain);
|
|
||||||
$v_domain = strtolower($v_domain);
|
|
||||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
|
||||||
$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']);
|
|
||||||
|
|
||||||
// Add dns domain
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$v_ns4." ".$v_ns5." ".$v_ns6." ".$v_ns7." ".$v_ns8." no", $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Set expiriation date
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
if ((!empty($_POST['v_exp'])) && ($_POST['v_exp'] != date('Y-m-d', strtotime('+1 year')))) {
|
|
||||||
$v_exp = escapeshellarg($_POST['v_exp']);
|
|
||||||
exec (VESTA_CMD."v-change-dns-domain-exp ".$user." ".$v_domain." ".$v_exp." no", $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set ttl
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400') && (empty($_SESSION['error_msg']))) {
|
|
||||||
$v_ttl = escapeshellarg($_POST['v_ttl']);
|
|
||||||
exec (VESTA_CMD."v-change-dns-domain-ttl ".$user." ".$v_domain." ".$v_ttl." no", $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restart dns server
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-restart-dns", $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('DNS_DOMAIN_CREATED_OK',htmlentities($_POST[v_domain]),htmlentities($_POST[v_domain]));
|
|
||||||
unset($v_domain);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Check POST request for dns record
|
|
||||||
if (!empty($_POST['ok_rec'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check empty fields
|
|
||||||
if (empty($_POST['v_domain'])) $errors[] = 'domain';
|
|
||||||
if (empty($_POST['v_rec'])) $errors[] = 'record';
|
|
||||||
if (empty($_POST['v_type'])) $errors[] = 'type';
|
|
||||||
if (empty($_POST['v_val'])) $errors[] = 'value';
|
|
||||||
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_domain = escapeshellarg($_POST['v_domain']);
|
|
||||||
$v_rec = escapeshellarg($_POST['v_rec']);
|
|
||||||
$v_type = escapeshellarg($_POST['v_type']);
|
|
||||||
$v_val = escapeshellarg($_POST['v_val']);
|
|
||||||
$v_priority = escapeshellarg($_POST['v_priority']);
|
|
||||||
|
|
||||||
// Add dns record
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-dns-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
$v_type = $_POST['v_type'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('DNS_RECORD_CREATED_OK',htmlentities($_POST[v_rec]),htmlentities($_POST[v_domain]));
|
|
||||||
unset($v_domain);
|
|
||||||
unset($v_rec);
|
|
||||||
unset($v_val);
|
|
||||||
unset($v_priority);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$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);
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($_GET['domain'])) {
|
|
||||||
// Display body for dns domain
|
|
||||||
|
|
||||||
if (empty($v_ttl)) $v_ttl = 14400;
|
|
||||||
if (empty($v_exp)) $v_exp = date('Y-m-d', strtotime('+1 year'));
|
|
||||||
if (empty($v_ns1)) {
|
|
||||||
exec (VESTA_CMD."v-list-user-ns ".$user." json", $output, $return_var);
|
|
||||||
$nameservers = json_decode(implode('', $output), true);
|
|
||||||
$v_ns1 = str_replace("'", "", $nameservers[0]);
|
|
||||||
$v_ns2 = str_replace("'", "", $nameservers[1]);
|
|
||||||
$v_ns3 = str_replace("'", "", $nameservers[2]);
|
|
||||||
$v_ns4 = str_replace("'", "", $nameservers[3]);
|
|
||||||
$v_ns5 = str_replace("'", "", $nameservers[4]);
|
|
||||||
$v_ns6 = str_replace("'", "", $nameservers[5]);
|
|
||||||
$v_ns7 = str_replace("'", "", $nameservers[6]);
|
|
||||||
$v_ns8 = str_replace("'", "", $nameservers[7]);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
render_page($user, $TAB, 'add_dns');
|
|
||||||
} else {
|
|
||||||
// Display body for dns record
|
|
||||||
|
|
||||||
$v_domain = $_GET['domain'];
|
|
||||||
render_page($user, $TAB, 'add_dns_rec');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Flush session messages
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,23 +1 @@
|
||||||
<?
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
|
|
||||||
error_reporting(NULL);
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
// if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
// header('location: /login/');
|
|
||||||
// exit();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Protect input
|
|
||||||
$v_section = escapeshellarg($_REQUEST['v_section']);
|
|
||||||
$v_unit_id = escapeshellarg($_REQUEST['v_unit_id']);
|
|
||||||
|
|
||||||
$_SESSION['favourites'][strtoupper($_REQUEST['v_section'])][$_REQUEST['v_unit_id']] = 1;
|
|
||||||
|
|
||||||
exec (VESTA_CMD."v-add-user-favourites ".$_SESSION['user']." ".$v_section." ".$v_unit_id, $output, $return_var);
|
|
||||||
// check_return_code($return_var,$output);
|
|
||||||
?>
|
|
||||||
|
|
|
@ -1,61 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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 POST request
|
|
||||||
if (!empty($_POST['ok'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check empty fields
|
|
||||||
if (empty($_POST['v_chain'])) $errors[] = __('banlist');
|
|
||||||
if (empty($_POST['v_ip'])) $errors[] = __('ip address');
|
|
||||||
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_chain = escapeshellarg($_POST['v_chain']);
|
|
||||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
|
||||||
|
|
||||||
// Add firewall ban
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-firewall-ban ".$v_ip." ".$v_chain, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('BANLIST_CREATED_OK');
|
|
||||||
unset($v_ip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render
|
|
||||||
render_page($user, $TAB, 'add_firewall_banlist');
|
|
||||||
|
|
||||||
// Flush session messages
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,71 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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 POST request
|
|
||||||
if (!empty($_POST['ok'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check empty fields
|
|
||||||
if (empty($_POST['v_action'])) $errors[] = __('action');
|
|
||||||
if (empty($_POST['v_protocol'])) $errors[] = __('protocol');
|
|
||||||
if (!isset($_POST['v_port'])) $errors[] = __('port');
|
|
||||||
if (empty($_POST['v_ip'])) $errors[] = __('ip address');
|
|
||||||
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_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']);
|
|
||||||
|
|
||||||
// Add firewall rule
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-firewall-rule ".$v_action." ".$v_ip." ".$v_port." ".$v_protocol." ".$v_comment, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('RULE_CREATED_OK');
|
|
||||||
unset($v_port);
|
|
||||||
unset($v_ip);
|
|
||||||
unset($v_comment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render
|
|
||||||
render_page($user, $TAB, 'add_firewall');
|
|
||||||
|
|
||||||
// Flush session messages
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,92 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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 POST request
|
|
||||||
if (!empty($_POST['ok'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check empty fields
|
|
||||||
if (empty($_POST['v_ip'])) $errors[] = __('ip address');
|
|
||||||
if (empty($_POST['v_netmask'])) $errors[] = __('netmask');
|
|
||||||
if (empty($_POST['v_interface'])) $errors[] = __('interface');
|
|
||||||
if (empty($_POST['v_owner'])) $errors[] = __('assigned 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Protect input
|
|
||||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
|
||||||
$v_netmask = escapeshellarg($_POST['v_netmask']);
|
|
||||||
$v_name = escapeshellarg($_POST['v_name']);
|
|
||||||
$v_nat = escapeshellarg($_POST['v_nat']);
|
|
||||||
$v_interface = escapeshellarg($_POST['v_interface']);
|
|
||||||
$v_owner = escapeshellarg($_POST['v_owner']);
|
|
||||||
$v_shared = $_POST['v_shared'];
|
|
||||||
|
|
||||||
// Check shared checkmark
|
|
||||||
if ($v_shared == 'on') {
|
|
||||||
$ip_status = 'shared';
|
|
||||||
} else {
|
|
||||||
$ip_status = 'dedicated';
|
|
||||||
$v_dedicated = 'yes';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add IP
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-sys-ip ".$v_ip." ".$v_netmask." ".$v_interface." ".$v_owner." ".$ip_status." ".$v_name." ".$v_nat, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
$v_owner = $_POST['v_owner'];
|
|
||||||
$v_interface = $_POST['v_interface'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('IP_CREATED_OK',htmlentities($_POST['v_ip']),htmlentities($_POST['v_ip']));
|
|
||||||
unset($v_ip);
|
|
||||||
unset($v_netmask);
|
|
||||||
unset($v_name);
|
|
||||||
unset($v_nat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// List network interfaces
|
|
||||||
exec (VESTA_CMD."v-list-sys-interfaces json", $output, $return_var);
|
|
||||||
$interfaces = json_decode(implode('', $output), true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// List users
|
|
||||||
exec (VESTA_CMD."v-list-sys-users json", $output, $return_var);
|
|
||||||
$users = json_decode(implode('', $output), true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Render
|
|
||||||
render_page($user, $TAB, 'add_ip');
|
|
||||||
|
|
||||||
// Flush session messages
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,214 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
$TAB = 'MAIL';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
|
|
||||||
// Check POST request for mail domain
|
|
||||||
if (!empty($_POST['ok'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check empty fields
|
|
||||||
if (empty($_POST['v_domain'])) $errors[] = __('domain');
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check antispam option
|
|
||||||
if (!empty($_POST['v_antispam'])) {
|
|
||||||
$v_antispam = 'yes';
|
|
||||||
} else {
|
|
||||||
$v_antispam = 'no';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check antivirus option
|
|
||||||
if (!empty($_POST['v_antivirus'])) {
|
|
||||||
$v_antivirus = 'yes';
|
|
||||||
} else {
|
|
||||||
$v_antivirus = 'no';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check dkim option
|
|
||||||
if (!empty($_POST['v_dkim'])) {
|
|
||||||
$v_dkim = 'yes';
|
|
||||||
} else {
|
|
||||||
$v_dkim = 'no';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set domain name to lowercase and remove www prefix
|
|
||||||
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
|
|
||||||
$v_domain = escapeshellarg($v_domain);
|
|
||||||
$v_domain = strtolower($v_domain);
|
|
||||||
|
|
||||||
// Add mail domain
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain." ".$v_antispam." ".$v_antivirus." ".$v_dkim, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('MAIL_DOMAIN_CREATED_OK',htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
|
|
||||||
unset($v_domain);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Check POST request for mail account
|
|
||||||
if (!empty($_POST['ok_acc'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check empty fields
|
|
||||||
if (empty($_POST['v_domain'])) $errors[] = __('domain');
|
|
||||||
if (empty($_POST['v_account'])) $errors[] = __('account');
|
|
||||||
if (empty($_POST['v_password'])) $errors[] = __('password');
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Protect input
|
|
||||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
|
||||||
$v_domain = strtolower($v_domain);
|
|
||||||
$v_account = escapeshellarg($_POST['v_account']);
|
|
||||||
$v_quota = escapeshellarg($_POST['v_quota']);
|
|
||||||
$v_send_email = $_POST['v_send_email'];
|
|
||||||
$v_credentials = $_POST['v_credentials'];
|
|
||||||
$v_aliases = $_POST['v_aliases'];
|
|
||||||
$v_fwd = $_POST['v_fwd'];
|
|
||||||
if (empty($_POST['v_quota'])) $v_quota = 0;
|
|
||||||
if ((!empty($_POST['v_quota'])) || (!empty($_POST['v_aliases'])) || (!empty($_POST['v_fwd'])) ) $v_adv = 'yes';
|
|
||||||
|
|
||||||
// Add Mail Account
|
|
||||||
if (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-add-mail-account ".$user." ".$v_domain." ".$v_account." ".$v_password." ".$v_quota, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
unlink($v_password);
|
|
||||||
$v_password = escapeshellarg($_POST['v_password']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add Aliases
|
|
||||||
if ((!empty($_POST['v_aliases'])) && (empty($_SESSION['error_msg']))) {
|
|
||||||
$valiases = preg_replace("/\n/", " ", $_POST['v_aliases']);
|
|
||||||
$valiases = preg_replace("/,/", " ", $valiases);
|
|
||||||
$valiases = preg_replace('/\s+/', ' ',$valiases);
|
|
||||||
$valiases = trim($valiases);
|
|
||||||
$aliases = explode(" ", $valiases);
|
|
||||||
foreach ($aliases as $alias) {
|
|
||||||
$alias = escapeshellarg($alias);
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-mail-account-alias ".$user." ".$v_domain." ".$v_account." ".$alias, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add Forwarders
|
|
||||||
if ((!empty($_POST['v_fwd'])) && (empty($_SESSION['error_msg']))) {
|
|
||||||
$vfwd = preg_replace("/\n/", " ", $_POST['v_fwd']);
|
|
||||||
$vfwd = preg_replace("/,/", " ", $vfwd);
|
|
||||||
$vfwd = preg_replace('/\s+/', ' ',$vfwd);
|
|
||||||
$vfwd = trim($vfwd);
|
|
||||||
$fwd = explode(" ", $vfwd);
|
|
||||||
foreach ($fwd as $forward) {
|
|
||||||
$forward = escapeshellarg($forward);
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-mail-account-forward ".$user." ".$v_domain." ".$v_account." ".$forward, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add fwd_only flag
|
|
||||||
if ((!empty($_POST['v_fwd_only'])) && (empty($_SESSION['error_msg']))) {
|
|
||||||
exec (VESTA_CMD."v-add-mail-account-fwd-only ".$user." ".$v_domain." ".$v_account, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get webmail url
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
|
|
||||||
$webmail = "http://".$http_host."/webmail/";
|
|
||||||
if (!empty($_SESSION['MAIL_URL'])) $webmail = $_SESSION['MAIL_URL'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]),htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]));
|
|
||||||
$_SESSION['ok_msg'] .= " / <a href=".$webmail." target='_blank'>" . __('open webmail') . "</a>";
|
|
||||||
unset($v_account);
|
|
||||||
unset($v_password);
|
|
||||||
unset($v_password);
|
|
||||||
unset($v_aliases);
|
|
||||||
unset($v_fwd);
|
|
||||||
unset($v_quota);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
if (empty($_GET['domain'])) {
|
|
||||||
// Display body for mail domain
|
|
||||||
|
|
||||||
render_page($user, $TAB, 'add_mail');
|
|
||||||
} else {
|
|
||||||
// Display body for mail account
|
|
||||||
|
|
||||||
$v_domain = $_GET['domain'];
|
|
||||||
render_page($user, $TAB, 'add_mail_acc');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush session messages
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,209 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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 POST request
|
|
||||||
if (!empty($_POST['ok'])) {
|
|
||||||
|
|
||||||
// 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']);
|
|
||||||
$v_backend_template = escapeshellarg($_POST['v_backend_template']);
|
|
||||||
$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 temporary dir
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec ('mktemp -d', $output, $return_var);
|
|
||||||
$tmpdir = $output[0];
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create package file
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$pkg = "WEB_TEMPLATE=".$v_web_template."\n";
|
|
||||||
if (!empty($_SESSION['WEB_BACKEND'])) {
|
|
||||||
$pkg .= "BACKEND_TEMPLATE=".$v_backend_template."\n";
|
|
||||||
}
|
|
||||||
if (!empty($_SESSION['PROXY_SYSTEM'])) {
|
|
||||||
$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add new package
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove tmpdir
|
|
||||||
exec ('rm -rf '.$tmpdir, $output, $return_var);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('PACKAGE_CREATED_OK',htmlentities($_POST['v_package']),htmlentities($_POST['v_package']));
|
|
||||||
unset($v_package);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// List web temmplates
|
|
||||||
exec (VESTA_CMD."v-list-web-templates json", $output, $return_var);
|
|
||||||
$web_templates = json_decode(implode('', $output), true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// List web templates for backend
|
|
||||||
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 web templates for proxy
|
|
||||||
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 system shells
|
|
||||||
exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var);
|
|
||||||
$shells = json_decode(implode('', $output), true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Set default values
|
|
||||||
if (empty($v_web_template)) $v_web_template = 'default';
|
|
||||||
if (empty($v_backend_template)) $v_backend_template = 'default';
|
|
||||||
if (empty($v_proxy_template)) $v_proxy_template = 'default';
|
|
||||||
if (empty($v_dns_template)) $v_dns_template = 'default';
|
|
||||||
if (empty($v_shell)) $v_shell = 'nologin';
|
|
||||||
if (empty($v_web_domains)) $v_web_domains = "'1'";
|
|
||||||
if (empty($v_web_aliases)) $v_web_aliases = "'1'";
|
|
||||||
if (empty($v_dns_domains)) $v_dns_domains = "'1'";
|
|
||||||
if (empty($v_dns_records)) $v_dns_records = "'1'";
|
|
||||||
if (empty($v_mail_domains)) $v_mail_domains = "'1'";
|
|
||||||
if (empty($v_mail_accounts)) $v_mail_accounts = "'1'";
|
|
||||||
if (empty($v_databases)) $v_databases = "'1'";
|
|
||||||
if (empty($v_cron_jobs)) $v_cron_jobs = "'1'";
|
|
||||||
if (empty($v_backups)) $v_backups = "'1'";
|
|
||||||
if (empty($v_disk_quota)) $v_disk_quota = "'1000'";
|
|
||||||
if (empty($v_bandwidth)) $v_bandwidth = "'1000'";
|
|
||||||
if (empty($v_ns1)) $v_ns1 = 'ns1.example.ltd';
|
|
||||||
if (empty($v_ns2)) $v_ns2 = 'ns2.example.ltd';
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'add_package');
|
|
||||||
|
|
||||||
// Flush session messages
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,129 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
$TAB = 'USER';
|
|
||||||
|
|
||||||
// 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['ok'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check empty fields
|
|
||||||
if (empty($_POST['v_username'])) $errors[] = __('user');
|
|
||||||
if (empty($_POST['v_password'])) $errors[] = __('password');
|
|
||||||
if (empty($_POST['v_package'])) $errrors[] = __('package');
|
|
||||||
if (empty($_POST['v_email'])) $errors[] = __('email');
|
|
||||||
if (empty($_POST['v_fname'])) $errors[] = __('first name');
|
|
||||||
if (empty($_POST['v_lname'])) $errors[] = __('last name');
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate email
|
|
||||||
if ((empty($_SESSION['error_msg'])) && (!filter_var($_POST['v_email'], FILTER_VALIDATE_EMAIL))) {
|
|
||||||
$_SESSION['error_msg'] = __('Please enter valid email address.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check password length
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$pw_len = strlen($_POST['v_password']);
|
|
||||||
if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Protect input
|
|
||||||
$v_username = escapeshellarg($_POST['v_username']);
|
|
||||||
$v_email = escapeshellarg($_POST['v_email']);
|
|
||||||
$v_package = escapeshellarg($_POST['v_package']);
|
|
||||||
$v_language = escapeshellarg($_POST['v_language']);
|
|
||||||
$v_fname = escapeshellarg($_POST['v_fname']);
|
|
||||||
$v_lname = escapeshellarg($_POST['v_lname']);
|
|
||||||
$v_notify = $_POST['v_notify'];
|
|
||||||
|
|
||||||
|
|
||||||
// Add user
|
|
||||||
if (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-add-user ".$v_username." ".$v_password." ".$v_email." ".$v_package." ".$v_fname." ".$v_lname, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
unlink($v_password);
|
|
||||||
$v_password = escapeshellarg($_POST['v_password']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set language
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-change-user-language ".$v_username." ".$v_language, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send email to the new user
|
|
||||||
if ((empty($_SESSION['error_msg'])) && (!empty($v_notify))) {
|
|
||||||
$to = $_POST['v_notify'];
|
|
||||||
$subject = _translate($_POST['v_language'],"Welcome to Vesta Control Panel");
|
|
||||||
$hostname = exec('hostname');
|
|
||||||
unset($output);
|
|
||||||
$from = _translate($_POST['v_language'],'MAIL_FROM',$hostname);
|
|
||||||
if (!empty($_POST['v_fname'])) {
|
|
||||||
$mailtext = _translate($_POST['v_language'],'GREETINGS_GORDON_FREEMAN',$_POST['v_fname'],$_POST['v_lname']);
|
|
||||||
} else {
|
|
||||||
$mailtext = _translate($_POST['v_language'],'GREETINGS');
|
|
||||||
}
|
|
||||||
$mailtext .= _translate($_POST['v_language'],'ACCOUNT_READY',$_SERVER['HTTP_HOST'],$_POST['v_username'],$_POST['v_password']);
|
|
||||||
send_email($to, $subject, $mailtext, $from);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('USER_CREATED_OK',htmlentities($_POST['v_username']),htmlentities($_POST['v_username']));
|
|
||||||
$_SESSION['ok_msg'] .= " / <a href=/login/?loginas=".htmlentities($_POST['v_username'])."&token=".htmlentities($_SESSION['token']).">" . __('login as') ." ".htmlentities($_POST['v_username']). "</a>";
|
|
||||||
unset($v_username);
|
|
||||||
unset($v_password);
|
|
||||||
unset($v_email);
|
|
||||||
unset($v_fname);
|
|
||||||
unset($v_lname);
|
|
||||||
unset($v_notify);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// List hosting packages
|
|
||||||
exec (VESTA_CMD."v-list-user-packages json", $output, $return_var);
|
|
||||||
check_error($return_var);
|
|
||||||
$data = 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);
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'add_user');
|
|
||||||
|
|
||||||
// Flush session messages
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,368 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
$TAB = 'WEB';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check POST request
|
|
||||||
if (!empty($_POST['ok'])) {
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for empty fields
|
|
||||||
if (empty($_POST['v_domain'])) $errors[] = __('domain');
|
|
||||||
if (empty($_POST['v_ip'])) $errors[] = __('ip');
|
|
||||||
if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_crt']))&& (empty($_POST['v_letsencrypt']))) $errors[] = __('ssl certificate');
|
|
||||||
if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_key']))&& (empty($_POST['v_letsencrypt']))) $errors[] = __('ssl key');
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check stats password length
|
|
||||||
if ((!empty($v_stats)) && (empty($_SESSION['error_msg']))) {
|
|
||||||
if (!empty($_POST['v_stats_user'])) {
|
|
||||||
$pw_len = strlen($_POST['v_stats_password']);
|
|
||||||
if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set domain to lowercase and remove www prefix
|
|
||||||
$v_domain = preg_replace("/^www\./i", "", $_POST['v_domain']);
|
|
||||||
$v_domain = escapeshellarg($v_domain);
|
|
||||||
$v_domain = strtolower($v_domain);
|
|
||||||
|
|
||||||
// Define domain ip address
|
|
||||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
|
||||||
|
|
||||||
// Using public IP instead of internal IP when creating DNS
|
|
||||||
// Gets public IP from 'v-list-user-ips' command (that reads /vesta/data/ips/ip), precisely from 'NAT' field
|
|
||||||
$v_public_ip = $v_ip;
|
|
||||||
$v_clean_ip = $_POST['v_ip']; // clean_ip = IP without quotas
|
|
||||||
exec (VESTA_CMD."v-list-user-ips ".$user." json", $output, $return_var);
|
|
||||||
$ips = json_decode(implode('', $output), true);
|
|
||||||
unset($output);
|
|
||||||
if (isset($ips[$v_clean_ip]) && isset($ips[$v_clean_ip]['NAT']) && trim($ips[$v_clean_ip]['NAT'])!='') {
|
|
||||||
$v_public_ip = trim($ips[$v_clean_ip]['NAT']);
|
|
||||||
$v_public_ip = escapeshellarg($v_public_ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define domain aliases
|
|
||||||
$v_aliases = $_POST['v_aliases'];
|
|
||||||
$aliases = preg_replace("/\n/", ",", $v_aliases);
|
|
||||||
$aliases = preg_replace("/\r/", ",", $aliases);
|
|
||||||
$aliases = preg_replace("/\t/", ",", $aliases);
|
|
||||||
$aliases = preg_replace("/ /", ",", $aliases);
|
|
||||||
$aliases_arr = explode(",", $aliases);
|
|
||||||
$aliases_arr = array_unique($aliases_arr);
|
|
||||||
$aliases_arr = array_filter($aliases_arr);
|
|
||||||
$aliases = implode(",",$aliases_arr);
|
|
||||||
$aliases = escapeshellarg($aliases);
|
|
||||||
if (empty($_POST['v_aliases'])) $aliases = 'none';
|
|
||||||
|
|
||||||
// Define proxy extensions
|
|
||||||
$v_proxy_ext = $_POST['v_proxy_ext'];
|
|
||||||
$proxy_ext = preg_replace("/\n/", ",", $v_proxy_ext);
|
|
||||||
$proxy_ext = preg_replace("/\r/", ",", $proxy_ext);
|
|
||||||
$proxy_ext = preg_replace("/\t/", ",", $proxy_ext);
|
|
||||||
$proxy_ext = preg_replace("/ /", ",", $proxy_ext);
|
|
||||||
$proxy_ext_arr = explode(",", $proxy_ext);
|
|
||||||
$proxy_ext_arr = array_unique($proxy_ext_arr);
|
|
||||||
$proxy_ext_arr = array_filter($proxy_ext_arr);
|
|
||||||
$proxy_ext = implode(",",$proxy_ext_arr);
|
|
||||||
$proxy_ext = escapeshellarg($proxy_ext);
|
|
||||||
|
|
||||||
// Define other options
|
|
||||||
$v_elog = $_POST['v_elog'];
|
|
||||||
$v_ssl = $_POST['v_ssl'];
|
|
||||||
$v_ssl_crt = $_POST['v_ssl_crt'];
|
|
||||||
$v_ssl_key = $_POST['v_ssl_key'];
|
|
||||||
$v_ssl_ca = $_POST['v_ssl_ca'];
|
|
||||||
$v_ssl_home = $data[$v_domain]['SSL_HOME'];
|
|
||||||
$v_letsencrypt = $_POST['v_letsencrypt'];
|
|
||||||
$v_stats = escapeshellarg($_POST['v_stats']);
|
|
||||||
$v_stats_user = $data[$v_domain]['STATS_USER'];
|
|
||||||
$v_stats_password = $data[$v_domain]['STATS_PASSWORD'];
|
|
||||||
$v_ftp = $_POST['v_ftp'];
|
|
||||||
$v_ftp_user = $_POST['v_ftp_user'];
|
|
||||||
$v_ftp_password = $_POST['v_ftp_password'];
|
|
||||||
$v_ftp_email = $_POST['v_ftp_email'];
|
|
||||||
if (!empty($v_domain)) $v_ftp_user_prepath .= $v_domain;
|
|
||||||
|
|
||||||
// Set advanced option checkmark
|
|
||||||
if (!empty($_POST['v_proxy'])) $v_adv = 'yes';
|
|
||||||
if (!empty($_POST['v_ftp'])) $v_adv = 'yes';
|
|
||||||
if ($_POST['v_proxy_ext'] != $v_proxy_ext) $v_adv = 'yes';
|
|
||||||
if ((!empty($_POST['v_aliases'])) && ($_POST['v_aliases'] != 'www.'.$_POST['v_domain'])) $v_adv = 'yes';
|
|
||||||
if ((!empty($_POST['v_ssl'])) || (!empty($_POST['v_elog']))) $v_adv = 'yes';
|
|
||||||
if ((!empty($_POST['v_ssl_crt'])) || (!empty($_POST['v_ssl_key']))) $v_adv = 'yes';
|
|
||||||
if ((!empty($_POST['v_ssl_ca'])) || ($_POST['v_stats'] != 'none')) $v_adv = 'yes';
|
|
||||||
if ((!empty($_POST['v_letsencrypt']))) $v_adv = 'yes';
|
|
||||||
|
|
||||||
// Check advanced features
|
|
||||||
if (empty($_POST['v_dns'])) $v_dns = 'off';
|
|
||||||
if (empty($_POST['v_mail'])) $v_mail = 'off';
|
|
||||||
if (empty($_POST['v_proxy'])) $v_proxy = 'off';
|
|
||||||
|
|
||||||
// Add web domain
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
exec (VESTA_CMD."v-add-web-domain ".$user." ".$v_domain." ".$v_ip." no ".$aliases." ".$proxy_ext, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
$domain_added = empty($_SESSION['error_msg']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add DNS domain
|
|
||||||
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
|
|
||||||
exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_public_ip." '' '' '' '' '' '' '' '' no", $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add DNS for domain aliases
|
|
||||||
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
|
|
||||||
foreach ($aliases_arr as $alias) {
|
|
||||||
if ($alias != "www.".$_POST['v_domain']) {
|
|
||||||
$alias = escapeshellarg($alias);
|
|
||||||
exec (VESTA_CMD."v-add-dns-on-web-alias ".$user." ".$alias." ".$v_ip." no", $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add mail domain
|
|
||||||
if (($_POST['v_mail'] == 'on') && (empty($_SESSION['error_msg']))) {
|
|
||||||
exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete proxy support
|
|
||||||
if ((!empty($_SESSION['PROXY_SYSTEM'])) && ($_POST['v_proxy'] == 'off') && (empty($_SESSION['error_msg']))) {
|
|
||||||
$ext = escapeshellarg($ext);
|
|
||||||
exec (VESTA_CMD."v-delete-web-domain-proxy ".$user." ".$v_domain." no", $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add Lets Encrypt support
|
|
||||||
if ((!empty($_POST['v_letsencrypt'])) && (empty($_SESSION['error_msg']))) {
|
|
||||||
exec (VESTA_CMD."v-schedule-letsencrypt-domain ".$user." ".$v_domain, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
} else {
|
|
||||||
// Add SSL certificates only if Lets Encrypt is off
|
|
||||||
if ((!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) {
|
|
||||||
exec ('mktemp -d', $output, $return_var);
|
|
||||||
$tmpdir = $output[0];
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Save 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save private 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save CA bundle
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
$v_ssl_home = escapeshellarg($_POST['v_ssl_home']);
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add web stats
|
|
||||||
if ((!empty($_POST['v_stats'])) && ($_POST['v_stats'] != 'none' ) && (empty($_SESSION['error_msg']))) {
|
|
||||||
$v_stats = escapeshellarg($_POST['v_stats']);
|
|
||||||
exec (VESTA_CMD."v-add-web-domain-stats ".$user." ".$v_domain." ".$v_stats, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add web stats password
|
|
||||||
if ((!empty($_POST['v_stats_user'])) && (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 ".$user." ".$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']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restart DNS server
|
|
||||||
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
|
|
||||||
exec (VESTA_CMD."v-restart-dns", $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restart web server
|
|
||||||
if (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'])) && ($_POST['v_proxy'] == 'on') && (empty($_SESSION['error_msg']))) {
|
|
||||||
exec (VESTA_CMD."v-restart-proxy", $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add FTP
|
|
||||||
if ((!empty($_POST['v_ftp'])) && (empty($_SESSION['error_msg']))) {
|
|
||||||
$v_ftp_users_updated = array();
|
|
||||||
foreach ($_POST['v_ftp_user'] as $i => $v_ftp_user_data) {
|
|
||||||
if ($v_ftp_user_data['is_new'] == 1) {
|
|
||||||
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($v_ftp_user_data['v_ftp_password'])) $errors[] = 'ftp user password';
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate email
|
|
||||||
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.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check ftp password length
|
|
||||||
if ((!empty($v_ftp_user_data['v_ftp']))) {
|
|
||||||
if (!empty($v_ftp_user_data['v_ftp_user'])) {
|
|
||||||
$pw_len = strlen($v_ftp_user_data['v_ftp_password']);
|
|
||||||
if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$v_ftp_user_data['v_ftp_user'] = preg_replace("/^".$user."_/i", "", $v_ftp_user_data['v_ftp_user']);
|
|
||||||
$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_user_data['v_ftp_user']);
|
|
||||||
if ($domain_added) {
|
|
||||||
$v_ftp_path = escapeshellarg(trim($v_ftp_user_data['v_ftp_path']));
|
|
||||||
$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 ".$user." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
unlink($v_ftp_password);
|
|
||||||
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");
|
|
||||||
$from = __('MAIL_FROM',$_POST['v_domain']);
|
|
||||||
$mailtext = __('FTP_ACCOUNT_READY',$_POST['v_domain'],$user,$v_ftp_user_data['v_ftp_user'],$v_ftp_user_data['v_ftp_password']);
|
|
||||||
send_email($to, $subject, $mailtext, $from);
|
|
||||||
unset($v_ftp_email);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$return_var = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($return_var == 0) {
|
|
||||||
$v_ftp_password = "••••••••";
|
|
||||||
$v_ftp_user_data['is_new'] = 0;
|
|
||||||
} else {
|
|
||||||
$v_ftp_user_data['is_new'] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$v_ftp_username = preg_replace("/^".$user."_/", "", $v_ftp_user_data['v_ftp_user']);
|
|
||||||
$v_ftp_users_updated[] = array(
|
|
||||||
'is_new' => $v_ftp_user_data['is_new'],
|
|
||||||
'v_ftp_user' => $return_var == 0 ? $v_ftp_username_full : $v_ftp_username,
|
|
||||||
'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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($_SESSION['error_msg']) && $domain_added) {
|
|
||||||
$_SESSION['ok_msg'] = __('WEB_DOMAIN_CREATED_OK',htmlentities($_POST[v_domain]),htmlentities($_POST[v_domain]));
|
|
||||||
$_SESSION['flash_error_msg'] = $_SESSION['error_msg'];
|
|
||||||
$url = '/edit/web/?domain='.strtolower(preg_replace("/^www\./i", "", $_POST['v_domain']));
|
|
||||||
header('Location: ' . $url);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush field values on success
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['ok_msg'] = __('WEB_DOMAIN_CREATED_OK',htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
|
|
||||||
unset($v_domain);
|
|
||||||
unset($v_aliases);
|
|
||||||
unset($v_ssl);
|
|
||||||
unset($v_ssl_crt);
|
|
||||||
unset($v_ssl_key);
|
|
||||||
unset($v_ssl_ca);
|
|
||||||
unset($v_stats_user);
|
|
||||||
unset($v_stats_password);
|
|
||||||
unset($v_ftp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define user variables
|
|
||||||
$v_ftp_user_prepath = $panel[$user]['HOME'] . "/web";
|
|
||||||
$v_ftp_email = $panel[$user]['CONTACT'];
|
|
||||||
|
|
||||||
// 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 stat engines
|
|
||||||
exec (VESTA_CMD."v-list-web-stats json", $output, $return_var);
|
|
||||||
$stats = json_decode(implode('', $output), true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'add_web');
|
|
||||||
|
|
||||||
// Flush session messages
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,125 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
define('VESTA_CMD', '/usr/bin/sudo /usr/local/vesta/bin/');
|
|
||||||
|
|
||||||
if (isset($_POST['user']) || isset($_POST['hash'])) {
|
|
||||||
|
|
||||||
// Authentication
|
|
||||||
if (empty($_POST['hash'])) {
|
|
||||||
if ($_POST['user'] != 'admin') {
|
|
||||||
echo 'Error: authentication failed';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$password = $_POST['password'];
|
|
||||||
$v_ip = escapeshellarg($_SERVER['REMOTE_ADDR']);
|
|
||||||
$output = '';
|
|
||||||
exec (VESTA_CMD."v-get-user-salt admin ".$v_ip." json" , $output, $return_var);
|
|
||||||
$pam = json_decode(implode('', $output), true);
|
|
||||||
$salt = $pam['admin']['SALT'];
|
|
||||||
$method = $pam['admin']['METHOD'];
|
|
||||||
|
|
||||||
if ($method == 'md5' ) {
|
|
||||||
$hash = crypt($password, '$1$'.$salt.'$');
|
|
||||||
}
|
|
||||||
if ($method == 'sha-512' ) {
|
|
||||||
$hash = crypt($password, '$6$rounds=5000$'.$salt.'$');
|
|
||||||
$hash = str_replace('$rounds=5000','',$hash);
|
|
||||||
}
|
|
||||||
if ($method == 'des' ) {
|
|
||||||
$hash = crypt($password, $salt);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send hash via tmp file
|
|
||||||
$v_hash = exec('mktemp -p /tmp');
|
|
||||||
$fp = fopen($v_hash, "w");
|
|
||||||
fwrite($fp, $hash."\n");
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
// Check user hash
|
|
||||||
exec(VESTA_CMD ."v-check-user-hash admin ".$v_hash." ".$v_ip, $output, $return_var);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Remove tmp file
|
|
||||||
unlink($v_hash);
|
|
||||||
|
|
||||||
// Check API answer
|
|
||||||
if ( $return_var > 0 ) {
|
|
||||||
echo 'Error: authentication failed';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$key = '/usr/local/vesta/data/keys/' . basename($_POST['hash']);
|
|
||||||
if (file_exists($key) && is_file($key)) {
|
|
||||||
exec(VESTA_CMD ."v-check-api-key ".escapeshellarg($key)." ".$v_ip, $output, $return_var);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Check API answer
|
|
||||||
if ( $return_var > 0 ) {
|
|
||||||
echo 'Error: authentication failed';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$return_var = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $return_var > 0 ) {
|
|
||||||
echo 'Error: authentication failed';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prepare arguments
|
|
||||||
if (isset($_POST['cmd'])) $cmd = escapeshellarg($_POST['cmd']);
|
|
||||||
if (isset($_POST['arg1'])) $arg1 = escapeshellarg($_POST['arg1']);
|
|
||||||
if (isset($_POST['arg2'])) $arg2 = escapeshellarg($_POST['arg2']);
|
|
||||||
if (isset($_POST['arg3'])) $arg3 = escapeshellarg($_POST['arg3']);
|
|
||||||
if (isset($_POST['arg4'])) $arg4 = escapeshellarg($_POST['arg4']);
|
|
||||||
if (isset($_POST['arg5'])) $arg5 = escapeshellarg($_POST['arg5']);
|
|
||||||
if (isset($_POST['arg6'])) $arg6 = escapeshellarg($_POST['arg6']);
|
|
||||||
if (isset($_POST['arg7'])) $arg7 = escapeshellarg($_POST['arg7']);
|
|
||||||
if (isset($_POST['arg8'])) $arg8 = escapeshellarg($_POST['arg8']);
|
|
||||||
if (isset($_POST['arg9'])) $arg9 = escapeshellarg($_POST['arg9']);
|
|
||||||
|
|
||||||
// Build query
|
|
||||||
$cmdquery = VESTA_CMD.$cmd." ";
|
|
||||||
if(!empty($arg1)){
|
|
||||||
$cmdquery = $cmdquery.$arg1." "; }
|
|
||||||
if(!empty($arg2)){
|
|
||||||
$cmdquery = $cmdquery.$arg2." "; }
|
|
||||||
if(!empty($arg3)){
|
|
||||||
$cmdquery = $cmdquery.$arg3." "; }
|
|
||||||
if(!empty($arg4)){
|
|
||||||
$cmdquery = $cmdquery.$arg4." "; }
|
|
||||||
if(!empty($arg5)){
|
|
||||||
$cmdquery = $cmdquery.$arg5." "; }
|
|
||||||
if(!empty($arg6)){
|
|
||||||
$cmdquery = $cmdquery.$arg6." "; }
|
|
||||||
if(!empty($arg7)){
|
|
||||||
$cmdquery = $cmdquery.$arg7." "; }
|
|
||||||
if(!empty($arg8)){
|
|
||||||
$cmdquery = $cmdquery.$arg8." "; }
|
|
||||||
if(!empty($arg9)){
|
|
||||||
$cmdquery = $cmdquery.$arg9; }
|
|
||||||
|
|
||||||
// Check command
|
|
||||||
if ($cmd == "'v-make-tmp-file'") {
|
|
||||||
// Used in DNS Cluster
|
|
||||||
$fp = fopen('/tmp/'.basename($_POST['arg2']), 'w');
|
|
||||||
fwrite($fp, $_POST['arg1']."\n");
|
|
||||||
fclose($fp);
|
|
||||||
$return_var = 0;
|
|
||||||
} else {
|
|
||||||
// Run normal cmd query
|
|
||||||
exec ($cmdquery, $output, $return_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((!empty($_POST['returncode'])) && ($_POST['returncode'] == 'yes')) {
|
|
||||||
echo $return_var;
|
|
||||||
} else {
|
|
||||||
if (($return_var == 0) && (empty($output))) {
|
|
||||||
echo "OK";
|
|
||||||
} else {
|
|
||||||
echo implode("\n",$output)."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,23 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
$backup = $_POST['system'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-user-backup-exclusions';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/backup/exclusions"); exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($backup as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/backup/exclusions");
|
|
||||||
|
|
|
@ -1,29 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
$backup = $_POST['backup'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-user-backup';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/backup/"); exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($backup as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/backup/");
|
|
||||||
|
|
|
@ -1,74 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$job = $_POST['job'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-cron-job';
|
|
||||||
break;
|
|
||||||
case 'suspend': $cmd='v-suspend-cron-job';
|
|
||||||
break;
|
|
||||||
case 'unsuspend': $cmd='v-unsuspend-cron-job';
|
|
||||||
break;
|
|
||||||
case 'delete-cron-reports': $cmd='v-delete-cron-reports';
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user, $output, $return_var);
|
|
||||||
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully diabled');
|
|
||||||
unset($output);
|
|
||||||
header("Location: /list/cron/");
|
|
||||||
exit;
|
|
||||||
break;
|
|
||||||
case 'add-cron-reports': $cmd='v-add-cron-reports';
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user, $output, $return_var);
|
|
||||||
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully enabled');
|
|
||||||
unset($output);
|
|
||||||
header("Location: /list/cron/");
|
|
||||||
exit;
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/cron/"); exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-cron-job';
|
|
||||||
break;
|
|
||||||
case 'delete-cron-reports': $cmd='v-delete-cron-reports';
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user, $output, $return_var);
|
|
||||||
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully diabled');
|
|
||||||
unset($output);
|
|
||||||
header("Location: /list/cron/");
|
|
||||||
exit;
|
|
||||||
break;
|
|
||||||
case 'add-cron-reports': $cmd='v-add-cron-reports';
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user, $output, $return_var);
|
|
||||||
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully enabled');
|
|
||||||
unset($output);
|
|
||||||
header("Location: /list/cron/");
|
|
||||||
exit;
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/cron/"); exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($job as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user." ".$value." no", $output, $return_var);
|
|
||||||
$restart = 'yes';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($restart)) {
|
|
||||||
exec (VESTA_CMD."v-restart-cron", $output, $return_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/cron/");
|
|
||||||
|
|
|
@ -1,41 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$database = $_POST['database'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-database';
|
|
||||||
break;
|
|
||||||
case 'suspend': $cmd='v-suspend-database';
|
|
||||||
break;
|
|
||||||
case 'unsuspend': $cmd='v-unsuspend-database';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/db/"); exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-database';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/db/"); exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($database as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/db/");
|
|
||||||
|
|
|
@ -1,85 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$domain = $_POST['domain'];
|
|
||||||
$record = $_POST['record'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
if (empty($record)) {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-dns-domain';
|
|
||||||
break;
|
|
||||||
case 'suspend': $cmd='v-suspend-dns-domain';
|
|
||||||
break;
|
|
||||||
case 'unsuspend': $cmd='v-unsuspend-dns-domain';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/dns/"); exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-dns-record';
|
|
||||||
break;
|
|
||||||
case 'suspend': $cmd='v-suspend-dns-record';
|
|
||||||
break;
|
|
||||||
case 'unsuspend': $cmd='v-unsuspend-dns-record';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/dns/?domain=".$domain); exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (empty($record)) {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-dns-domain';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/dns/"); exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-dns-record';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/dns/?domain=".$domain); exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($record)) {
|
|
||||||
foreach ($domain as $value) {
|
|
||||||
// DNS
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user." ".$value." no", $output, $return_var);
|
|
||||||
$restart = 'yes';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach ($record as $value) {
|
|
||||||
// DNS Record
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
$dom = escapeshellarg($domain);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user." ".$dom." ".$value." no", $output, $return_var);
|
|
||||||
$restart = 'yes';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($restart)) {
|
|
||||||
exec (VESTA_CMD."v-restart-dns", $output, $return_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($record)) {
|
|
||||||
header("Location: /list/dns/");
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
header("Location: /list/dns/?domain=".$domain);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,38 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check user
|
|
||||||
if ($_SESSION['user'] != 'admin') {
|
|
||||||
header("Location: /list/user");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ipchain = $_POST['ipchain'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-firewall-ban';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/firewall/banlist/"); exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($ipchain as $value) {
|
|
||||||
list($ip,$chain) = explode(":",$value);
|
|
||||||
$v_ip = escapeshellarg($ip);
|
|
||||||
$v_chain = escapeshellarg($chain);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$v_ip." ".$v_chain, $output, $return_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/firewall/banlist");
|
|
||||||
|
|
|
@ -1,42 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check user
|
|
||||||
if ($_SESSION['user'] != 'admin') {
|
|
||||||
header("Location: /list/user");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$rule = $_POST['rule'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-firewall-rule';
|
|
||||||
break;
|
|
||||||
case 'suspend': $cmd='v-suspend-firewall-rule';
|
|
||||||
break;
|
|
||||||
case 'unsuspend': $cmd='v-unsuspend-firewall-rule';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/firewall/"); exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($rule as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
|
|
||||||
$restart = 'yes';
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/firewall/");
|
|
||||||
|
|
|
@ -1,38 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$ip = $_POST['ip'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
switch ($action) {
|
|
||||||
case 'reread IP': exec(VESTA_CMD."v-update-sys-ip", $output, $return_var);
|
|
||||||
header("Location: /list/ip/");
|
|
||||||
exit;
|
|
||||||
break;
|
|
||||||
case 'delete': $cmd='v-delete-sys-ip';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/ip/"); exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
header("Location: /list/ip/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($ip as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/ip/");
|
|
||||||
|
|
|
@ -1,81 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$domain = $_POST['domain'];
|
|
||||||
$account = $_POST['account'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
if (empty($account)) {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-mail-domain';
|
|
||||||
break;
|
|
||||||
case 'suspend': $cmd='v-suspend-mail-domain';
|
|
||||||
break;
|
|
||||||
case 'unsuspend': $cmd='v-unsuspend-mail-domain';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/mail/"); exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-mail-account';
|
|
||||||
break;
|
|
||||||
case 'suspend': $cmd='v-suspend-mail-account';
|
|
||||||
break;
|
|
||||||
case 'unsuspend': $cmd='v-unsuspend-mail-account';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/mail/?domain=".$domain); exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (empty($account)) {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-mail-domain';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/mail/"); exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-mail-account';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/mail/?domain=".$domain); exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($account)) {
|
|
||||||
foreach ($domain as $value) {
|
|
||||||
// Mail
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
|
|
||||||
$restart = 'yes';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach ($account as $value) {
|
|
||||||
// Mail Account
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
$dom = escapeshellarg($domain);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user." ".$dom." ".$value, $output, $return_var);
|
|
||||||
$restart = 'yes';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($account)) {
|
|
||||||
header("Location: /list/mail/");
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
header("Location: /list/mail/?domain=".$domain);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,36 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$package = $_POST['package'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-user-package';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/package/"); exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
header("Location: /list/package/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($package as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
|
|
||||||
$restart = 'yes';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
header("Location: /list/package/");
|
|
||||||
|
|
|
@ -1,47 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$action = $_POST['action'];
|
|
||||||
$backup = escapeshellarg($_POST['backup']);
|
|
||||||
|
|
||||||
$web = 'no';
|
|
||||||
$dns = 'no';
|
|
||||||
$mail = 'no';
|
|
||||||
$db = 'no';
|
|
||||||
$cron = 'no';
|
|
||||||
$udir = 'no';
|
|
||||||
|
|
||||||
if (!empty($_POST['web'])) $web = escapeshellarg(implode(",",$_POST['web']));
|
|
||||||
if (!empty($_POST['dns'])) $dns = escapeshellarg(implode(",",$_POST['dns']));
|
|
||||||
if (!empty($_POST['mail'])) $mail = escapeshellarg(implode(",",$_POST['mail']));
|
|
||||||
if (!empty($_POST['db'])) $db = escapeshellarg(implode(",",$_POST['db']));
|
|
||||||
if (!empty($_POST['cron'])) $cron = 'yes';
|
|
||||||
if (!empty($_POST['udir'])) $udir = escapeshellarg(implode(",",$_POST['udir']));
|
|
||||||
|
|
||||||
if ($action == 'restore') {
|
|
||||||
exec (VESTA_CMD."v-schedule-user-restore ".$user." ".$backup." ".$web." ".$dns." ".$mail." ".$db." ".$cron." ".$udir, $output, $return_var);
|
|
||||||
if ($return_var == 0) {
|
|
||||||
$_SESSION['error_msg'] = __('RESTORE_SCHEDULED');
|
|
||||||
} else {
|
|
||||||
$_SESSION['error_msg'] = implode('<br>', $output);
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
|
||||||
$_SESSION['error_msg'] = __('Error: vesta did not return any output.');
|
|
||||||
}
|
|
||||||
if ($return_var == 4) {
|
|
||||||
$_SESSION['error_msg'] = __('RESTORE_EXISTS');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/backup/?backup=" . $_POST['backup']);
|
|
||||||
|
|
|
@ -1,43 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$service = $_POST['service'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
switch ($action) {
|
|
||||||
case 'stop': $cmd='v-stop-service';
|
|
||||||
break;
|
|
||||||
case 'start': $cmd='v-start-service';
|
|
||||||
break;
|
|
||||||
case 'restart': $cmd='v-restart-service';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/server/"); exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((!empty($_POST['system'])) && ($action == 'restart')) {
|
|
||||||
exec (VESTA_CMD."v-restart-system yes", $output, $return_var);
|
|
||||||
$_SESSION['error_srv'] = 'The system is going down for reboot NOW!';
|
|
||||||
unset($output);
|
|
||||||
header("Location: /list/server/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($service as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/server/");
|
|
||||||
|
|
|
@ -1,62 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $_POST['user'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-user'; $restart = 'no';
|
|
||||||
break;
|
|
||||||
case 'suspend': $cmd='v-suspend-user'; $restart = 'no';
|
|
||||||
break;
|
|
||||||
case 'unsuspend': $cmd='v-unsuspend-user'; $restart = 'no';
|
|
||||||
break;
|
|
||||||
case 'update counters': $cmd='v-update-user-counters';
|
|
||||||
break;
|
|
||||||
case 'rebuild': $cmd='v-rebuild-user'; $restart = 'no';
|
|
||||||
break;
|
|
||||||
case 'rebuild web': $cmd='v-rebuild-web-domains'; $restart = 'no';
|
|
||||||
break;
|
|
||||||
case 'rebuild dns': $cmd='v-rebuild-dns-domains'; $restart = 'no';
|
|
||||||
break;
|
|
||||||
case 'rebuild mail': $cmd='v-rebuild-mail-domains';
|
|
||||||
break;
|
|
||||||
case 'rebuild db': $cmd='v-rebuild-databases';
|
|
||||||
break;
|
|
||||||
case 'rebuild cron': $cmd='v-rebuild-cron-jobs';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/user/"); exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($action) {
|
|
||||||
case 'update counters': $cmd='v-update-user-counters';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/user/"); exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($user as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$value." ".$restart, $output, $return_var);
|
|
||||||
$changes = 'yes';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((!empty($restart)) && (!empty($changes))) {
|
|
||||||
exec (VESTA_CMD."v-restart-web", $output, $return_var);
|
|
||||||
exec (VESTA_CMD."v-restart-dns", $output, $return_var);
|
|
||||||
exec (VESTA_CMD."v-restart-cron", $output, $return_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/user/");
|
|
||||||
|
|
|
@ -1,31 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$pkg = $_POST['pkg'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
switch ($action) {
|
|
||||||
case 'update': $cmd='v-update-sys-vesta';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/updates/"); exit;
|
|
||||||
}
|
|
||||||
foreach ($pkg as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/updates/");
|
|
||||||
|
|
|
@ -1,48 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$domain = $_POST['domain'];
|
|
||||||
$action = $_POST['action'];
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-domain';
|
|
||||||
break;
|
|
||||||
case 'suspend': $cmd='v-suspend-domain';
|
|
||||||
break;
|
|
||||||
case 'unsuspend': $cmd='v-unsuspend-domain';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/web/"); exit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($action) {
|
|
||||||
case 'delete': $cmd='v-delete-domain';
|
|
||||||
break;
|
|
||||||
default: header("Location: /list/web/"); exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($domain as $value) {
|
|
||||||
$value = escapeshellarg($value);
|
|
||||||
exec (VESTA_CMD.$cmd." ".$user." ".$value." no", $output, $return_var);
|
|
||||||
$restart='yes';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($restart)) {
|
|
||||||
exec (VESTA_CMD."v-restart-web", $output, $return_var);
|
|
||||||
exec (VESTA_CMD."v-restart-proxy", $output, $return_var);
|
|
||||||
exec (VESTA_CMD."v-restart-dns", $output, $return_var);
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/web/");
|
|
||||||
|
|
|
@ -1,27 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
|
||||||
$user=$_GET['user'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($_GET['system'])) {
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_system = escapeshellarg($_GET['system']);
|
|
||||||
exec (VESTA_CMD."v-delete-user-backup-exclusions ".$v_username." ".$v_system, $output, $return_var);
|
|
||||||
}
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/backup/exclusions/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,33 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
|
||||||
$user=$_GET['user'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($_GET['backup'])) {
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_backup = escapeshellarg($_GET['backup']);
|
|
||||||
exec (VESTA_CMD."v-delete-user-backup ".$v_username." ".$v_backup, $output, $return_var);
|
|
||||||
}
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/backup/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,21 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
exec (VESTA_CMD."v-delete-cron-vesta-autoupdate", $output, $return_var);
|
|
||||||
$_SESSION['error_msg'] = __('Autoupdate has been successfully disabled');
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/updates/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,33 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
|
||||||
$user=$_GET['user'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($_GET['job'])) {
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_job = escapeshellarg($_GET['job']);
|
|
||||||
exec (VESTA_CMD."v-delete-cron-job ".$v_username." ".$v_job, $output, $return_var);
|
|
||||||
}
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/cron/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,19 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
exec (VESTA_CMD."v-delete-cron-reports ".$user, $output, $return_var);
|
|
||||||
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully disabled');
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
header("Location: /list/cron/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,33 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
|
||||||
$user=$_GET['user'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($_GET['database'])) {
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_database = escapeshellarg($_GET['database']);
|
|
||||||
exec (VESTA_CMD."v-delete-database ".$v_username." ".$v_database, $output, $return_var);
|
|
||||||
}
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/db/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,60 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Delete as someone else?
|
|
||||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
|
||||||
$user=$_GET['user'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// DNS domain
|
|
||||||
if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_domain = escapeshellarg($_GET['domain']);
|
|
||||||
exec (VESTA_CMD."v-delete-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
header("Location: /list/dns/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// DNS record
|
|
||||||
if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_domain = escapeshellarg($_GET['domain']);
|
|
||||||
$v_record_id = escapeshellarg($_GET['record_id']);
|
|
||||||
exec (VESTA_CMD."v-delete-dns-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
header("Location: /list/dns/?domain=".$_GET['domain']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/dns/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,15 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
|
|
||||||
error_reporting(NULL);
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
unset($_SESSION['favourites'][strtoupper($_REQUEST['v_section'])][$_REQUEST['v_unit_id']]);
|
|
||||||
|
|
||||||
$v_section = escapeshellarg($_REQUEST['v_section']);
|
|
||||||
$v_unit_id = escapeshellarg($_REQUEST['v_unit_id']);
|
|
||||||
|
|
||||||
exec (VESTA_CMD."v-delete-user-favourites ".$_SESSION['user']." ".$v_section." ".$v_unit_id, $output, $return_var);
|
|
||||||
// check_return_code($return_var,$output);
|
|
||||||
?>
|
|
||||||
|
|
|
@ -1,37 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check user
|
|
||||||
if ($_SESSION['user'] != 'admin') {
|
|
||||||
header("Location: /list/user");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((!empty($_GET['ip'])) && (!empty($_GET['chain']))) {
|
|
||||||
$v_ip = escapeshellarg($_GET['ip']);
|
|
||||||
$v_chain = escapeshellarg($_GET['chain']);
|
|
||||||
exec (VESTA_CMD."v-delete-firewall-ban ".$v_ip." ".$v_chain, $output, $return_var);
|
|
||||||
}
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/firewall/banlist/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,36 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check user
|
|
||||||
if ($_SESSION['user'] != 'admin') {
|
|
||||||
header("Location: /list/user");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($_GET['rule'])) {
|
|
||||||
$v_rule = escapeshellarg($_GET['rule']);
|
|
||||||
exec (VESTA_CMD."v-delete-firewall-rule ".$v_rule, $output, $return_var);
|
|
||||||
}
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/firewall/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,31 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
if (!empty($_GET['ip'])) {
|
|
||||||
$v_ip = escapeshellarg($_GET['ip']);
|
|
||||||
exec (VESTA_CMD."v-delete-sys-ip ".$v_ip, $output, $return_var);
|
|
||||||
}
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/ip/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,59 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Delete as someone else?
|
|
||||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
|
||||||
$user=$_GET['user'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mail domain
|
|
||||||
if ((!empty($_GET['domain'])) && (empty($_GET['account']))) {
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_domain = escapeshellarg($_GET['domain']);
|
|
||||||
exec (VESTA_CMD."v-delete-mail-domain ".$v_username." ".$v_domain, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
header("Location: /list/mail/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mail account
|
|
||||||
if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) {
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_domain = escapeshellarg($_GET['domain']);
|
|
||||||
$v_account = escapeshellarg($_GET['account']);
|
|
||||||
exec (VESTA_CMD."v-delete-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
header("Location: /list/mail/?domain=".$_GET['domain']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/mail/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,29 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if($_GET['delete'] == 1){
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_id = escapeshellarg((int)$_GET['notification_id']);
|
|
||||||
exec (VESTA_CMD."v-delete-user-notification ".$v_username." ".$v_id, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
} else {
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_id = escapeshellarg((int)$_GET['notification_id']);
|
|
||||||
exec (VESTA_CMD."v-acknowledge-user-notification ".$v_username." ".$v_id, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,30 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
if (!empty($_GET['package'])) {
|
|
||||||
$v_package = escapeshellarg($_GET['package']);
|
|
||||||
exec (VESTA_CMD."v-delete-user-package ".$v_package, $output, $return_var);
|
|
||||||
}
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/package/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,31 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
if (!empty($_GET['user'])) {
|
|
||||||
$v_username = escapeshellarg($_GET['user']);
|
|
||||||
exec (VESTA_CMD."v-delete-user ".$v_username, $output, $return_var);
|
|
||||||
}
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($_SESSION['look']);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/user/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,34 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
ob_start();
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete as someone else?
|
|
||||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
|
||||||
$user=$_GET['user'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($_GET['domain'])) {
|
|
||||||
$v_username = escapeshellarg($user);
|
|
||||||
$v_domain = escapeshellarg($_GET['domain']);
|
|
||||||
exec (VESTA_CMD."v-delete-domain ".$v_username." ".$v_domain, $output, $return_var);
|
|
||||||
check_return_code($return_var,$output);
|
|
||||||
unset($output);
|
|
||||||
}
|
|
||||||
|
|
||||||
$back = $_SESSION['back'];
|
|
||||||
if (!empty($back)) {
|
|
||||||
header("Location: ".$back);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: /list/web/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,33 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check token
|
|
||||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
|
||||||
header('Location: /login/');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$backup = basename($_GET['backup']);
|
|
||||||
|
|
||||||
// Check if the backup exists
|
|
||||||
if (!file_exists('/backup/'.$backup)) {
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
|
||||||
header('Content-type: application/gzip');
|
|
||||||
header("Content-Disposition: attachment; filename=\"".$backup."\";" );
|
|
||||||
header("X-Accel-Redirect: /backup/" . $backup);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((!empty($_SESSION['user'])) && ($_SESSION['user'] != 'admin')) {
|
|
||||||
if (strpos($backup, $user.'.') === 0) {
|
|
||||||
header('Content-type: application/gzip');
|
|
||||||
header("Content-Disposition: attachment; filename=\"".$backup."\";" );
|
|
||||||
header("X-Accel-Redirect: /backup/" . $backup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,33 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
if ((!isset($_SESSION['FILEMANAGER_KEY'])) || (empty($_SESSION['FILEMANAGER_KEY']))) {
|
|
||||||
header("Location: /login/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $_SESSION['user'];
|
|
||||||
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
|
|
||||||
$user = $_SESSION['look'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$path = $_REQUEST['path'];
|
|
||||||
if (!empty($path)) {
|
|
||||||
set_time_limit(0);
|
|
||||||
if (ob_get_level()) {
|
|
||||||
ob_end_clean();
|
|
||||||
}
|
|
||||||
header("Content-type: application/octet-stream");
|
|
||||||
header("Content-Transfer-Encoding: binary");
|
|
||||||
header("Content-disposition: attachment;filename=".basename($path));
|
|
||||||
$output = '';
|
|
||||||
exec(VESTA_CMD . "v-check-fs-permission " . $user . " " . escapeshellarg($path), $output, $return_var);
|
|
||||||
if ($return_var != 0) {
|
|
||||||
print 'Error while opening file'; // todo: handle this more styled
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
readfile($path);
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
die('File not found');
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,28 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// Init
|
|
||||||
error_reporting(NULL);
|
|
||||||
session_start();
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
$v_domain = $_GET['domain'];
|
|
||||||
$v_domain = escapeshellarg($_GET['domain']);
|
|
||||||
if ($_GET['type'] == 'access') $type = 'access';
|
|
||||||
if ($_GET['type'] == 'error') $type = 'error';
|
|
||||||
|
|
||||||
header("Cache-Control: public");
|
|
||||||
header("Content-Description: File Transfer");
|
|
||||||
header("Content-Disposition: attachment; filename=".$_GET['domain'].".".$type."-log.txt");
|
|
||||||
header("Content-Type: application/octet-stream; ");
|
|
||||||
header("Content-Transfer-Encoding: binary");
|
|
||||||
|
|
||||||
$v_domain = escapeshellarg($_GET['domain']);
|
|
||||||
if ($_GET['type'] == 'access') $type = 'access';
|
|
||||||
if ($_GET['type'] == 'error') $type = 'error';
|
|
||||||
|
|
||||||
exec (VESTA_CMD."v-list-web-domain-".$type."log $user ".$v_domain." 5000", $output, $return_var);
|
|
||||||
if ($return_var == 0 ) {
|
|
||||||
foreach($output as $file) {
|
|
||||||
echo $file . "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
|
@ -1,130 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// 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']);
|
|
||||||
|
|
|
@ -1,83 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// 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']);
|
|
||||||
|
|
|
@ -1,91 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
// 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']);
|
|
||||||
|
|
|
@ -1,209 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,148 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
|
|
||||||
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>
|
|
||||||
|
|
|
@ -1,88 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,106 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,342 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,231 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,73 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,183 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,627 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,10 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'SERVER';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check user
|
|
||||||
header("Location: /list/firewall");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,67 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,67 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,67 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,72 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,68 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,68 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,68 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,78 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,58 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,191 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,753 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
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']);
|
|
||||||
|
|
|
@ -1,3 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
header("Location: /login/");
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,103 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'WEB';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Prepare values
|
|
||||||
if (!empty($_GET['domain'])) {
|
|
||||||
$v_domain = $_GET['domain'];
|
|
||||||
} else {
|
|
||||||
$v_domain = 'example.ltd';
|
|
||||||
}
|
|
||||||
$v_email = 'admin@' . $v_domain;
|
|
||||||
$v_country = 'US';
|
|
||||||
$v_state = 'California';
|
|
||||||
$v_locality = 'San Francisco';
|
|
||||||
$v_org = 'MyCompany LLC';
|
|
||||||
$v_org_unit = 'IT';
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = '';
|
|
||||||
|
|
||||||
// Check POST
|
|
||||||
if (!isset($_POST['generate'])) {
|
|
||||||
render_page($user, $TAB, 'generate_ssl');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check input
|
|
||||||
if (empty($_POST['v_domain'])) $errors[] = __('Domain');
|
|
||||||
if (empty($_POST['v_country'])) $errors[] = __('Country');
|
|
||||||
if (empty($_POST['v_state'])) $errors[] = __('State');
|
|
||||||
if (empty($_POST['v_locality'])) $errors[] = __('City');
|
|
||||||
if (empty($_POST['v_org'])) $errors[] = __('Organization');
|
|
||||||
if (empty($_POST['v_email'])) $errors[] = __('Email');
|
|
||||||
$v_domain = $_POST['v_domain'];
|
|
||||||
$v_email = $_POST['v_email'];
|
|
||||||
$v_country = $_POST['v_country'];
|
|
||||||
$v_state = $_POST['v_state'];
|
|
||||||
$v_locality = $_POST['v_locality'];
|
|
||||||
$v_org = $_POST['v_org'];
|
|
||||||
|
|
||||||
// Check for errors
|
|
||||||
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);
|
|
||||||
render_page($user, $TAB, 'generate_ssl');
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Protect input
|
|
||||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
|
||||||
$v_email = escapeshellarg($_POST['v_email']);
|
|
||||||
$v_country = escapeshellarg($_POST['v_country']);
|
|
||||||
$v_state = escapeshellarg($_POST['v_state']);
|
|
||||||
$v_locality = escapeshellarg($_POST['v_locality']);
|
|
||||||
$v_org = escapeshellarg($_POST['v_org']);
|
|
||||||
|
|
||||||
exec (VESTA_CMD."v-generate-ssl-cert ".$v_domain." ".$v_email." ".$v_country." ".$v_state." ".$v_locality." ".$v_org." IT '' json", $output, $return_var);
|
|
||||||
|
|
||||||
// Revert to raw values
|
|
||||||
$v_domain = $_POST['v_domain'];
|
|
||||||
$v_email = $_POST['v_email'];
|
|
||||||
$v_country = $_POST['v_country'];
|
|
||||||
$v_state = $_POST['v_state'];
|
|
||||||
$v_locality = $_POST['v_locality'];
|
|
||||||
$v_org = $_POST['v_org'];
|
|
||||||
|
|
||||||
// Check return code
|
|
||||||
if ($return_var != 0) {
|
|
||||||
$error = implode('<br>', $output);
|
|
||||||
if (empty($error)) $error = __('Error code:',$return_var);
|
|
||||||
$_SESSION['error_msg'] = $error;
|
|
||||||
render_page($user, $TAB, 'generate_ssl');
|
|
||||||
unset($_SESSION['error_msg']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// OK message
|
|
||||||
$_SESSION['ok_msg'] = __('SSL_GENERATED_OK');
|
|
||||||
|
|
||||||
// Parse output
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
unset($output);
|
|
||||||
$v_crt = $data[$v_domain]['CRT'];
|
|
||||||
$v_key = $data[$v_domain]['KEY'];
|
|
||||||
$v_csr = $data[$v_domain]['CSR'];
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'list_ssl');
|
|
||||||
|
|
||||||
unset($_SESSION['ok_msg']);
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
session_start();
|
|
||||||
if (isset($_SESSION['user'])) {
|
|
||||||
header("Location: /list/user/");
|
|
||||||
} else {
|
|
||||||
header("Location: /login/");
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,17 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'BACKUP';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php');
|
|
||||||
|
|
||||||
// Data
|
|
||||||
exec (VESTA_CMD."v-list-user-backup-exclusions $user json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'list_backup_exclusions');
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
|
@ -1,26 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'BACKUP';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php');
|
|
||||||
|
|
||||||
// Data & Render page
|
|
||||||
if (empty($_GET['backup'])){
|
|
||||||
exec (VESTA_CMD."v-list-user-backups $user json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data,true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
render_page($user, $TAB, 'list_backup');
|
|
||||||
} else {
|
|
||||||
exec (VESTA_CMD."v-list-user-backup $user ".escapeshellarg($_GET['backup'])." json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data,true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
render_page($user, $TAB, 'list_backup_detail');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
|
@ -1,18 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'CRON';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php');
|
|
||||||
|
|
||||||
// Data
|
|
||||||
exec (VESTA_CMD."v-list-cron-jobs $user json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data,true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'list_cron');
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
|
@ -1,18 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'DB';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Data
|
|
||||||
exec (VESTA_CMD."v-list-databases $user json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data, true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'list_db');
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
|
@ -1,35 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT'] . "/inc/main.php");
|
|
||||||
|
|
||||||
|
|
||||||
if ((!isset($_SESSION['FILEMANAGER_KEY'])) || (empty($_SESSION['FILEMANAGER_KEY']))) {
|
|
||||||
header("Location: /filemanager-not-purchased/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check login_as feature
|
|
||||||
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
|
|
||||||
$user=$_SESSION['look'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($panel)) {
|
|
||||||
$command = VESTA_CMD."v-list-user ".escapeshellarg($user)." 'json'";
|
|
||||||
exec ($command, $output, $return_var);
|
|
||||||
if ( $return_var > 0 ) {
|
|
||||||
header("Location: /error/");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$panel = json_decode(implode('', $output), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$path_a = !empty($_REQUEST['dir_a']) ? htmlentities($_REQUEST['dir_a']) : '';
|
|
||||||
$path_b = !empty($_REQUEST['dir_b']) ? htmlentities($_REQUEST['dir_b']) : '';
|
|
||||||
$GLOBAL_JS = '<script type="text/javascript">GLOBAL.START_DIR_A = "' . $path_a . '";</script>';
|
|
||||||
$GLOBAL_JS .= '<script type="text/javascript">GLOBAL.START_DIR_B = "' . $path_b . '";</script>';
|
|
||||||
$GLOBAL_JS .= '<script type="text/javascript">GLOBAL.ROOT_DIR = "' . $panel[$user]['HOME'] . '";</script>';
|
|
||||||
|
|
||||||
|
|
||||||
// Footer
|
|
||||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/file_manager/main.php');
|
|
||||||
|
|
|
@ -1,26 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'DNS';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Data & Render page
|
|
||||||
if (empty($_GET['domain'])){
|
|
||||||
exec (VESTA_CMD."v-list-dns-domains ".escapeshellarg($user)." json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data, true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
render_page($user, $TAB, 'list_dns');
|
|
||||||
} else {
|
|
||||||
exec (VESTA_CMD."v-list-dns-records ".escapeshellarg($user)." ".escapeshellarg($_GET['domain'])." json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data, true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
render_page($user, $TAB, 'list_dns_rec');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
|
@ -1,24 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
echo '<br> Favorites: <br>';
|
|
||||||
|
|
||||||
// Data
|
|
||||||
exec (VESTA_CMD."v-list-user-favourites ".$_SESSION['user']." json", $output, $return_var);
|
|
||||||
|
|
||||||
|
|
||||||
// print_r(implode('', $output));
|
|
||||||
// $json = '{ "Favourites": { "USER": "", "WEB": "bulletfarm.com", "DNS": "", "MAIL": "", "DB": "", "CRON": "", "BACKUP": "", "IP": "", "PACKAGE": "", "FIREWALL": ""}}';
|
|
||||||
// $data = json_decode($json, true);
|
|
||||||
|
|
||||||
|
|
||||||
$data = json_decode(implode('', $output).'}', true);
|
|
||||||
$data = array_reverse($data,true);
|
|
||||||
|
|
||||||
print_r($data);
|
|
||||||
// $data = array_reverse($data,true);
|
|
||||||
|
|
||||||
// $data = json_decode(implode('', $output), true);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
|
@ -1,24 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'FIREWALL';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check user
|
|
||||||
if ($_SESSION['user'] != 'admin') {
|
|
||||||
header("Location: /list/user");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data
|
|
||||||
exec (VESTA_CMD."v-list-firewall-ban json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data, true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'list_firewall_banlist');
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
|
@ -1,24 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'FIREWALL';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check user
|
|
||||||
if ($_SESSION['user'] != 'admin') {
|
|
||||||
header("Location: /list/user");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data
|
|
||||||
exec (VESTA_CMD."v-list-firewall json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data, true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'list_firewall');
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
|
@ -1,8 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
session_start();
|
|
||||||
if (isset($_SESSION['user'])) {
|
|
||||||
header("Location: /list/user/");
|
|
||||||
} else {
|
|
||||||
header("Location: /login/");
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
@ -1,25 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
|
|
||||||
$TAB = 'IP';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Check user
|
|
||||||
if ($_SESSION['user'] != 'admin') {
|
|
||||||
header('Location: /list/user');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data
|
|
||||||
exec (VESTA_CMD."v-list-sys-ips json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data, true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'list_ip');
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
|
@ -1,16 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'LOG';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Data
|
|
||||||
exec (VESTA_CMD."v-list-user-log $user json", $output, $return_var);
|
|
||||||
check_error($return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
// Render page
|
|
||||||
render_page($user, $TAB, 'list_log');
|
|
||||||
|
|
|
@ -1,26 +1 @@
|
||||||
<?php
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/static/index.html'); ?>
|
||||||
error_reporting(NULL);
|
|
||||||
$TAB = 'MAIL';
|
|
||||||
|
|
||||||
// Main include
|
|
||||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
||||||
|
|
||||||
// Data & Render page
|
|
||||||
if (empty($_GET['domain'])){
|
|
||||||
exec (VESTA_CMD."v-list-mail-domains ".escapeshellarg($user)." json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data, true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
render_page($user, $TAB, 'list_mail');
|
|
||||||
} else {
|
|
||||||
exec (VESTA_CMD."v-list-mail-accounts ".escapeshellarg($user)." ".escapeshellarg($_GET['domain'])." json", $output, $return_var);
|
|
||||||
$data = json_decode(implode('', $output), true);
|
|
||||||
$data = array_reverse($data, true);
|
|
||||||
unset($output);
|
|
||||||
|
|
||||||
render_page($user, $TAB, 'list_mail_acc');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Back uri
|
|
||||||
$_SESSION['back'] = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue