mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 21:34:12 -07:00
Replaced CRLF by LF
This commit is contained in:
parent
52bdfc3aab
commit
758ec7d94c
34 changed files with 5023 additions and 5023 deletions
|
@ -1,85 +1,85 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'CRON';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Edit as someone else?
|
||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
||||
$user=escapeshellarg($_GET['user']);
|
||||
}
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['job'])) {
|
||||
header("Location: /list/cron/");
|
||||
exit;
|
||||
}
|
||||
|
||||
$v_job = escapeshellarg($_GET['job']);
|
||||
exec (VESTA_CMD."v-list-cron-job ".$user." ".$v_job." 'json'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$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';
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_username = $user;
|
||||
// Change job
|
||||
if (($v_min != $_POST['v_min']) || ($v_hour != $_POST['v_hour']) || ($v_day != $_POST['v_day']) || ($v_month != $_POST['v_month']) || ($v_wday != $_POST['v_wday']) || ($v_cmd != $_POST['v_cmd']) &&(empty($_SESSION['error_msg']))) {
|
||||
$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']);
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$v_cmd = $_POST['v_cmd'];
|
||||
}
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _("OK: changes has been saved.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_cron.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'CRON';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Edit as someone else?
|
||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
||||
$user=escapeshellarg($_GET['user']);
|
||||
}
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['job'])) {
|
||||
header("Location: /list/cron/");
|
||||
exit;
|
||||
}
|
||||
|
||||
$v_job = escapeshellarg($_GET['job']);
|
||||
exec (VESTA_CMD."v-list-cron-job ".$user." ".$v_job." 'json'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$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';
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_username = $user;
|
||||
// Change job
|
||||
if (($v_min != $_POST['v_min']) || ($v_hour != $_POST['v_hour']) || ($v_day != $_POST['v_day']) || ($v_month != $_POST['v_month']) || ($v_wday != $_POST['v_wday']) || ($v_cmd != $_POST['v_cmd']) &&(empty($_SESSION['error_msg']))) {
|
||||
$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']);
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$v_cmd = $_POST['v_cmd'];
|
||||
}
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _("OK: changes has been saved.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_cron.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'DB';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['database'])) {
|
||||
header("Location: /list/db/");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Edit as someone else?
|
||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
||||
$user=escapeshellarg($_GET['user']);
|
||||
}
|
||||
|
||||
$v_database = escapeshellarg($_GET['database']);
|
||||
exec (VESTA_CMD."v-list-database ".$user." ".$v_database." 'json'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$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';
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_username = $user;
|
||||
// Change password
|
||||
if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
exec (VESTA_CMD."v-change-database-password ".$v_username." ".$v_database." ".$v_password, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_password = "••••••••";
|
||||
unset($output);
|
||||
}
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_db.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'DB';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['database'])) {
|
||||
header("Location: /list/db/");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Edit as someone else?
|
||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
||||
$user=escapeshellarg($_GET['user']);
|
||||
}
|
||||
|
||||
$v_database = escapeshellarg($_GET['database']);
|
||||
exec (VESTA_CMD."v-list-database ".$user." ".$v_database." 'json'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$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';
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_username = $user;
|
||||
// Change password
|
||||
if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
exec (VESTA_CMD."v-change-database-password ".$v_username." ".$v_database." ".$v_password, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_password = "••••••••";
|
||||
unset($output);
|
||||
}
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_db.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,210 +1,210 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'DNS';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['domain'])) {
|
||||
header("Location: /list/dns/");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Edit as someone else?
|
||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
||||
$user=escapeshellarg($_GET['user']);
|
||||
}
|
||||
|
||||
// Check 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
$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';
|
||||
}
|
||||
|
||||
exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
|
||||
$templates = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_domain = escapeshellarg($_POST['v_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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$restart_dns = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Template
|
||||
if (( $_SESSION['user'] == 'admin') && ($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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// SOA
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// EXP
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// Restart dns
|
||||
if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) {
|
||||
exec (VESTA_CMD."v-restart-dns", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
|
||||
}
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns.html');
|
||||
} else {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_dns.html');
|
||||
}
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
} else {
|
||||
$v_domain = escapeshellarg($_GET['domain']);
|
||||
$v_record_id = escapeshellarg($_GET['record_id']);
|
||||
exec (VESTA_CMD."v-list-dns-domain-records ".$user." ".$v_domain." 'json'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$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'];
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
$v_record_id = escapeshellarg($_POST['v_record_id']);
|
||||
|
||||
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-domain-record ".$v_username." ".$v_domain." ".$v_record_id." ".$v_val." ".$v_priority, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_val = $_POST['v_val'];
|
||||
$restart_dns = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns_rec.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'DNS';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['domain'])) {
|
||||
header("Location: /list/dns/");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Edit as someone else?
|
||||
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
|
||||
$user=escapeshellarg($_GET['user']);
|
||||
}
|
||||
|
||||
// Check 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
$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';
|
||||
}
|
||||
|
||||
exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
|
||||
$templates = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_domain = escapeshellarg($_POST['v_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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$restart_dns = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Template
|
||||
if (( $_SESSION['user'] == 'admin') && ($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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// SOA
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// EXP
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$restart_dns = 'yes';
|
||||
}
|
||||
|
||||
// Restart dns
|
||||
if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) {
|
||||
exec (VESTA_CMD."v-restart-dns", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
|
||||
}
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns.html');
|
||||
} else {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_dns.html');
|
||||
}
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
} else {
|
||||
$v_domain = escapeshellarg($_GET['domain']);
|
||||
$v_record_id = escapeshellarg($_GET['record_id']);
|
||||
exec (VESTA_CMD."v-list-dns-domain-records ".$user." ".$v_domain." 'json'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$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'];
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
$v_record_id = escapeshellarg($_POST['v_record_id']);
|
||||
|
||||
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-domain-record ".$v_username." ".$v_domain." ".$v_record_id." ".$v_val." ".$v_priority, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_val = $_POST['v_val'];
|
||||
$restart_dns = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns_rec.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,119 +1,119 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'IP';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['ip'])) {
|
||||
header("Location: /list/ip/");
|
||||
exit;
|
||||
}
|
||||
|
||||
$v_ip = escapeshellarg($_GET['ip']);
|
||||
exec (VESTA_CMD."v-list-sys-ip ".$v_ip." 'json'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$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_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';
|
||||
}
|
||||
|
||||
exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var);
|
||||
$users = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_username = $user;
|
||||
$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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_owner = $_POST['v_owner'];
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change Name
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_ip.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'IP';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['ip'])) {
|
||||
header("Location: /list/ip/");
|
||||
exit;
|
||||
}
|
||||
|
||||
$v_ip = escapeshellarg($_GET['ip']);
|
||||
exec (VESTA_CMD."v-list-sys-ip ".$v_ip." 'json'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$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_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';
|
||||
}
|
||||
|
||||
exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var);
|
||||
$users = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_username = $user;
|
||||
$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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_owner = $_POST['v_owner'];
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change Name
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_ip.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,370 +1,370 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'MAIL';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Check user 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']);
|
||||
}
|
||||
|
||||
// Check 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$v_username = $user;
|
||||
$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';
|
||||
}
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_antispam = 'no';
|
||||
unset($output);
|
||||
}
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_antispam = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_antivirus = 'no';
|
||||
unset($output);
|
||||
}
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_antivirus = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_dkim = 'no';
|
||||
unset($output);
|
||||
}
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_dkim = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_catchall = '';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
} else {
|
||||
|
||||
$v_username = $user;
|
||||
$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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$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_quota = $data[$v_account]['QUOTA'];
|
||||
$v_autoreply = $data[$v_account]['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]['MSG'];
|
||||
}
|
||||
$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'];
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
$v_account = escapeshellarg($_POST['v_account']);
|
||||
|
||||
// Password
|
||||
if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
exec (VESTA_CMD."v-change-mail-account-password ".$v_username." ".$v_domain." ".$v_account." ".$v_password, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_password = "••••••••";
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
|
||||
// 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." '".$alias."'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
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." '".$alias."'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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." '".$forward."'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
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." '".$forward."'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$v_autoreply = 'no';
|
||||
$v_autoreply_message = '';
|
||||
}
|
||||
if (($v_autoreply == 'yes') && (!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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$v_autoreply_message = $_POST['v_autoreply_message'];
|
||||
}
|
||||
}
|
||||
|
||||
if (($v_autoreply == 'no') && (!empty($_POST['v_autoreply'])) && (empty($_SESSION['error_msg']))) {
|
||||
if (empty($_POST['v_autoreply_message'])) $_SESSION['error_msg'] = "Error: field atoreply message can not be blank.";
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$v_autoreply = 'yes';
|
||||
$v_autoreply_message = $_POST['v_autoreply_message'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail_acc.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'MAIL';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Check user 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']);
|
||||
}
|
||||
|
||||
// Check 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$v_username = $user;
|
||||
$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';
|
||||
}
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_antispam = 'no';
|
||||
unset($output);
|
||||
}
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_antispam = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_antivirus = 'no';
|
||||
unset($output);
|
||||
}
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_antivirus = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_dkim = 'no';
|
||||
unset($output);
|
||||
}
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_dkim = 'yes';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_catchall = '';
|
||||
unset($output);
|
||||
}
|
||||
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
} else {
|
||||
|
||||
$v_username = $user;
|
||||
$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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$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_quota = $data[$v_account]['QUOTA'];
|
||||
$v_autoreply = $data[$v_account]['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]['MSG'];
|
||||
}
|
||||
$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'];
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
$v_account = escapeshellarg($_POST['v_account']);
|
||||
|
||||
// Password
|
||||
if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
exec (VESTA_CMD."v-change-mail-account-password ".$v_username." ".$v_domain." ".$v_account." ".$v_password, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_password = "••••••••";
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
|
||||
// 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." '".$alias."'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
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." '".$alias."'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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." '".$forward."'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
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." '".$forward."'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$v_autoreply = 'no';
|
||||
$v_autoreply_message = '';
|
||||
}
|
||||
if (($v_autoreply == 'yes') && (!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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$v_autoreply_message = $_POST['v_autoreply_message'];
|
||||
}
|
||||
}
|
||||
|
||||
if (($v_autoreply == 'no') && (!empty($_POST['v_autoreply'])) && (empty($_SESSION['error_msg']))) {
|
||||
if (empty($_POST['v_autoreply_message'])) $_SESSION['error_msg'] = "Error: field atoreply message can not be blank.";
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
$v_autoreply = 'yes';
|
||||
$v_autoreply_message = $_POST['v_autoreply_message'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail_acc.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,190 +1,190 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'PACKAGE';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['package'])) {
|
||||
header("Location: /list/package/");
|
||||
exit;
|
||||
}
|
||||
|
||||
$v_package = escapeshellarg($_GET['package']);
|
||||
exec (VESTA_CMD."v-list-user-package ".$v_package." 'json'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
$v_package = $_GET['package'];
|
||||
$v_template = $data[$v_package]['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_backups = $data[$v_package]['BACKUPS'];
|
||||
$v_date = $data[$v_package]['DATE'];
|
||||
$v_time = $data[$v_package]['TIME'];
|
||||
$v_status = 'active';
|
||||
|
||||
|
||||
exec (VESTA_CMD."v-list-web-templates json", $output, $return_var);
|
||||
check_error($return_var);
|
||||
$templates = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var);
|
||||
check_error($return_var);
|
||||
$shells = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_package'])) $errors[] = _('package');
|
||||
if (empty($_POST['v_template'])) $errors[] = _('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');
|
||||
|
||||
// Protect input
|
||||
$v_package = escapeshellarg($_POST['v_package']);
|
||||
$v_template = escapeshellarg($_POST['v_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_ns = $v_ns1.",".$v_ns2;
|
||||
if (!empty($v_ns3)) $v_ns .= ",".$v_ns3;
|
||||
if (!empty($v_ns4)) $v_ns .= ",".$v_ns4;
|
||||
$v_ns = escapeshellarg($v_ns);
|
||||
$v_time = escapeshellarg(date('H:i:s'));
|
||||
$v_date = escapeshellarg(date('Y-m-d'));
|
||||
|
||||
// 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'] = _('Error: field "%s" can not be blank.',$error_msg);
|
||||
} else {
|
||||
exec ('mktemp -d', $output, $return_var);
|
||||
$tmpdir = $output[0];
|
||||
unset($output);
|
||||
|
||||
// Create package
|
||||
$pkg = "TEMPLATE=".$v_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";
|
||||
|
||||
// Write package
|
||||
$fp = fopen($tmpdir."/".$_POST['v_package'].".pkg", 'w');
|
||||
fwrite($fp, $pkg);
|
||||
fclose($fp);
|
||||
|
||||
// Rewrite package
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package." 'yes'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Remove tmpdir
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_package.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'PACKAGE';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['package'])) {
|
||||
header("Location: /list/package/");
|
||||
exit;
|
||||
}
|
||||
|
||||
$v_package = escapeshellarg($_GET['package']);
|
||||
exec (VESTA_CMD."v-list-user-package ".$v_package." 'json'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
$v_package = $_GET['package'];
|
||||
$v_template = $data[$v_package]['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_backups = $data[$v_package]['BACKUPS'];
|
||||
$v_date = $data[$v_package]['DATE'];
|
||||
$v_time = $data[$v_package]['TIME'];
|
||||
$v_status = 'active';
|
||||
|
||||
|
||||
exec (VESTA_CMD."v-list-web-templates json", $output, $return_var);
|
||||
check_error($return_var);
|
||||
$templates = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var);
|
||||
check_error($return_var);
|
||||
$shells = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_package'])) $errors[] = _('package');
|
||||
if (empty($_POST['v_template'])) $errors[] = _('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');
|
||||
|
||||
// Protect input
|
||||
$v_package = escapeshellarg($_POST['v_package']);
|
||||
$v_template = escapeshellarg($_POST['v_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_ns = $v_ns1.",".$v_ns2;
|
||||
if (!empty($v_ns3)) $v_ns .= ",".$v_ns3;
|
||||
if (!empty($v_ns4)) $v_ns .= ",".$v_ns4;
|
||||
$v_ns = escapeshellarg($v_ns);
|
||||
$v_time = escapeshellarg(date('H:i:s'));
|
||||
$v_date = escapeshellarg(date('Y-m-d'));
|
||||
|
||||
// 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'] = _('Error: field "%s" can not be blank.',$error_msg);
|
||||
} else {
|
||||
exec ('mktemp -d', $output, $return_var);
|
||||
$tmpdir = $output[0];
|
||||
unset($output);
|
||||
|
||||
// Create package
|
||||
$pkg = "TEMPLATE=".$v_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";
|
||||
|
||||
// Write package
|
||||
$fp = fopen($tmpdir."/".$_POST['v_package'].".pkg", 'w');
|
||||
fwrite($fp, $pkg);
|
||||
fclose($fp);
|
||||
|
||||
// Rewrite package
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package." 'yes'", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Remove tmpdir
|
||||
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);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_package.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,275 +1,275 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'USER';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['user'])) {
|
||||
header("Location: /list/user/");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check user
|
||||
$v_username = escapeshellarg($_GET['user']);
|
||||
exec (VESTA_CMD."v-list-user ".$v_username." json", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$v_username = $_GET['user'];
|
||||
$v_password = "••••••••";
|
||||
$v_email = $data[$v_username]['CONTACT'];
|
||||
$v_template = $data[$v_username]['TEMPLATE'];
|
||||
$v_package = $data[$v_username]['PACKAGE'];
|
||||
$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_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'];
|
||||
|
||||
exec (VESTA_CMD."v-list-user-packages json", $output, $return_var);
|
||||
$packages = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-list-web-templates json", $output, $return_var);
|
||||
$templates = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var);
|
||||
$shells = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_username = escapeshellarg($_POST['v_username']);
|
||||
|
||||
// Change password
|
||||
if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
exec (VESTA_CMD."v-change-user-password ".$v_username." ".$v_password, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_password = "••••••••";
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change package
|
||||
if (($v_package != $_POST['v_package']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_package = escapeshellarg($_POST['v_package']);
|
||||
exec (VESTA_CMD."v-change-user-package ".$v_username." ".$v_package, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change template
|
||||
if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_template = escapeshellarg($_POST['v_template']);
|
||||
exec (VESTA_CMD."v-change-user-template ".$v_username." ".$v_template, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change shell
|
||||
if (($v_shell != $_POST['v_shell']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_shell = escapeshellarg($_POST['v_shell']);
|
||||
exec (VESTA_CMD."v-change-user-shell ".$v_username." ".$v_shell, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change contact email
|
||||
if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) {
|
||||
// Validate email
|
||||
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 ".$v_username." ".$v_email, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change 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 ".$v_username." ".$v_fname." ".$v_lname, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change NameServers
|
||||
if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (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']);
|
||||
$ns_cmd = VESTA_CMD."v-change-user-ns ".$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;
|
||||
exec ($ns_cmd, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_user.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
} else {
|
||||
// Check user argument?
|
||||
if (empty($_GET['user'])) {
|
||||
header("Location: /list/user/");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check user
|
||||
$v_username = escapeshellarg($_GET['user']);
|
||||
exec (VESTA_CMD."v-list-user ".$v_username." json", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$v_username = $_GET['user'];
|
||||
$v_password = "••••••••";
|
||||
$v_email = $data[$v_username]['CONTACT'];
|
||||
$v_fname = $data[$v_username]['FNAME'];
|
||||
$v_lname = $data[$v_username]['LNAME'];
|
||||
$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_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'];
|
||||
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_username = escapeshellarg($_POST['v_username']);
|
||||
|
||||
// Change password
|
||||
if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
exec (VESTA_CMD."v-change-user-password ".$v_username." ".$v_password, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_password = "••••••••";
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change contact email
|
||||
if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_email = escapeshellarg($_POST['v_email']);
|
||||
exec (VESTA_CMD."v-change-user-contact ".$v_username." ".$v_email, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change NameServers
|
||||
if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (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']);
|
||||
$ns_cmd = VESTA_CMD."v-change-user-ns ".$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;
|
||||
exec ($ns_cmd, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
|
||||
$TAB = 'USER';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
|
||||
// Check user argument?
|
||||
if (empty($_GET['user'])) {
|
||||
header("Location: /list/user/");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check user
|
||||
$v_username = escapeshellarg($_GET['user']);
|
||||
exec (VESTA_CMD."v-list-user ".$v_username." json", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$v_username = $_GET['user'];
|
||||
$v_password = "••••••••";
|
||||
$v_email = $data[$v_username]['CONTACT'];
|
||||
$v_template = $data[$v_username]['TEMPLATE'];
|
||||
$v_package = $data[$v_username]['PACKAGE'];
|
||||
$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_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'];
|
||||
|
||||
exec (VESTA_CMD."v-list-user-packages json", $output, $return_var);
|
||||
$packages = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-list-web-templates json", $output, $return_var);
|
||||
$templates = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var);
|
||||
$shells = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_username = escapeshellarg($_POST['v_username']);
|
||||
|
||||
// Change password
|
||||
if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
exec (VESTA_CMD."v-change-user-password ".$v_username." ".$v_password, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_password = "••••••••";
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change package
|
||||
if (($v_package != $_POST['v_package']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_package = escapeshellarg($_POST['v_package']);
|
||||
exec (VESTA_CMD."v-change-user-package ".$v_username." ".$v_package, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change template
|
||||
if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_template = escapeshellarg($_POST['v_template']);
|
||||
exec (VESTA_CMD."v-change-user-template ".$v_username." ".$v_template, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change shell
|
||||
if (($v_shell != $_POST['v_shell']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_shell = escapeshellarg($_POST['v_shell']);
|
||||
exec (VESTA_CMD."v-change-user-shell ".$v_username." ".$v_shell, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change contact email
|
||||
if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) {
|
||||
// Validate email
|
||||
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 ".$v_username." ".$v_email, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change 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 ".$v_username." ".$v_fname." ".$v_lname, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change NameServers
|
||||
if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (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']);
|
||||
$ns_cmd = VESTA_CMD."v-change-user-ns ".$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;
|
||||
exec ($ns_cmd, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_user.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
} else {
|
||||
// Check user argument?
|
||||
if (empty($_GET['user'])) {
|
||||
header("Location: /list/user/");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check user
|
||||
$v_username = escapeshellarg($_GET['user']);
|
||||
exec (VESTA_CMD."v-list-user ".$v_username." json", $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
} else {
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
$v_username = $_GET['user'];
|
||||
$v_password = "••••••••";
|
||||
$v_email = $data[$v_username]['CONTACT'];
|
||||
$v_fname = $data[$v_username]['FNAME'];
|
||||
$v_lname = $data[$v_username]['LNAME'];
|
||||
$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_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'];
|
||||
|
||||
}
|
||||
|
||||
// Action
|
||||
if (!empty($_POST['save'])) {
|
||||
$v_username = escapeshellarg($_POST['v_username']);
|
||||
|
||||
// Change password
|
||||
if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
exec (VESTA_CMD."v-change-user-password ".$v_username." ".$v_password, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
$v_password = "••••••••";
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change contact email
|
||||
if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) {
|
||||
$v_email = escapeshellarg($_POST['v_email']);
|
||||
exec (VESTA_CMD."v-change-user-contact ".$v_username." ".$v_email, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Change NameServers
|
||||
if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (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']);
|
||||
$ns_cmd = VESTA_CMD."v-change-user-ns ".$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;
|
||||
exec ($ns_cmd, $output, $return_var);
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
|
||||
}
|
||||
}
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue