mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
Translation begins...
This commit is contained in:
parent
8b74eb9179
commit
43d7825b68
39 changed files with 4188 additions and 4079 deletions
|
@ -1,77 +1,77 @@
|
|||
<?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);
|
||||
|
||||
// Are you admin?
|
||||
//if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_min'])) $errors[] = 'minute';
|
||||
if (empty($_POST['v_hour'])) $errors[] = 'hour';
|
||||
if (empty($_POST['v_day'])) $errors[] = 'day';
|
||||
if (empty($_POST['v_month'])) $errors[] = 'month';
|
||||
if (empty($_POST['v_wday'])) $errors[] = 'day of week';
|
||||
if (empty($_POST['v_cmd'])) $errors[] = 'cmd';
|
||||
|
||||
// Protect input
|
||||
$v_min = escapeshellarg($_POST['v_min']);
|
||||
$v_hour = escapeshellarg($_POST['v_hour']);
|
||||
$v_day = escapeshellarg($_POST['v_day']);
|
||||
$v_month = escapeshellarg($_POST['v_month']);
|
||||
$v_wday = escapeshellarg($_POST['v_wday']);
|
||||
$v_cmd = escapeshellarg($_POST['v_cmd']);
|
||||
|
||||
// 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 ".$error_msg." can not be blank.";
|
||||
} else {
|
||||
// Add Cron Job
|
||||
exec (VESTA_CMD."v-add-cron-job ".$user." ".$v_min." ".$v_hour." ".$v_day." ".$v_month." ".$v_wday." ".$v_cmd, $output, $return_var);
|
||||
$v_type = $_POST['v_type'];
|
||||
$v_charset = $_POST['v_charset'];
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||
$_SESSION['error_msg'] = $error;
|
||||
unset($v_password);
|
||||
unset($output);
|
||||
} else {
|
||||
$_SESSION['ok_msg'] = "OK: cron job has been created successfully.";
|
||||
unset($v_min);
|
||||
unset($v_hour);
|
||||
unset($v_day);
|
||||
unset($v_month);
|
||||
unset($v_wday);
|
||||
unset($v_cmd);
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
exec (VESTA_CMD."v-list-database-types 'json'", $output, $return_var);
|
||||
$db_types = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_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);
|
||||
|
||||
// Are you admin?
|
||||
//if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_min'])) $errors[] = _('minute');
|
||||
if (empty($_POST['v_hour'])) $errors[] = _('hour');
|
||||
if (empty($_POST['v_day'])) $errors[] = _('day');
|
||||
if (empty($_POST['v_month'])) $errors[] = _('month');
|
||||
if (empty($_POST['v_wday'])) $errors[] = _('day of week');
|
||||
if (empty($_POST['v_cmd'])) $errors[] = _('cmd');
|
||||
|
||||
// Protect input
|
||||
$v_min = escapeshellarg($_POST['v_min']);
|
||||
$v_hour = escapeshellarg($_POST['v_hour']);
|
||||
$v_day = escapeshellarg($_POST['v_day']);
|
||||
$v_month = escapeshellarg($_POST['v_month']);
|
||||
$v_wday = escapeshellarg($_POST['v_wday']);
|
||||
$v_cmd = escapeshellarg($_POST['v_cmd']);
|
||||
|
||||
// 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 {
|
||||
// Add Cron Job
|
||||
exec (VESTA_CMD."v-add-cron-job ".$user." ".$v_min." ".$v_hour." ".$v_day." ".$v_month." ".$v_wday." ".$v_cmd, $output, $return_var);
|
||||
$v_type = $_POST['v_type'];
|
||||
$v_charset = $_POST['v_charset'];
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
unset($v_password);
|
||||
unset($output);
|
||||
} else {
|
||||
$_SESSION['ok_msg'] = _("OK: cron job has been created successfully.");
|
||||
unset($v_min);
|
||||
unset($v_hour);
|
||||
unset($v_day);
|
||||
unset($v_month);
|
||||
unset($v_wday);
|
||||
unset($v_cmd);
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
exec (VESTA_CMD."v-list-database-types 'json'", $output, $return_var);
|
||||
$db_types = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_cron.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,76 +1,76 @@
|
|||
<?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);
|
||||
|
||||
// Are you admin?
|
||||
//if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_database'])) $errors[] = 'database';
|
||||
if (empty($_POST['v_dbuser'])) $errors[] = 'username';
|
||||
if (empty($_POST['v_password'])) $errors[] = 'password';
|
||||
if (empty($_POST['v_type'])) $errors[] = 'type';
|
||||
if (empty($_POST['v_charset'])) $errors[] = 'charset';
|
||||
|
||||
// Protect input
|
||||
$v_database = escapeshellarg($_POST['v_database']);
|
||||
$v_dbuser = escapeshellarg($_POST['v_dbuser']);
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
$v_type = $_POST['v_type'];
|
||||
$v_charset = $_POST['v_charset'];
|
||||
|
||||
// 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 ".$error_msg." can not be blank.";
|
||||
} else {
|
||||
// Add Database
|
||||
$v_type = escapeshellarg($_POST['v_type']);
|
||||
$v_charset = escapeshellarg($_POST['v_charset']);
|
||||
exec (VESTA_CMD."v-add-database ".$user." ".$v_database." ".$v_dbuser." ".$v_password." ".$v_type." 'default' ".$v_charset, $output, $return_var);
|
||||
$v_type = $_POST['v_type'];
|
||||
$v_charset = $_POST['v_charset'];
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||
$_SESSION['error_msg'] = $error;
|
||||
unset($v_password);
|
||||
unset($output);
|
||||
} else {
|
||||
$_SESSION['ok_msg'] = "OK: database <a href='/edit/db/?database=".$user."_".$_POST['v_database']."'><b>".$user."_".$_POST['v_database']."</b></a> has been created successfully.";
|
||||
unset($v_database);
|
||||
unset($v_dbuser);
|
||||
unset($v_password);
|
||||
unset($v_type);
|
||||
unset($v_charset);
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
exec (VESTA_CMD."v-list-database-types 'json'", $output, $return_var);
|
||||
$db_types = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_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);
|
||||
|
||||
// Are you admin?
|
||||
//if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_database'])) $errors[] = _('database');
|
||||
if (empty($_POST['v_dbuser'])) $errors[] = _('username');
|
||||
if (empty($_POST['v_password'])) $errors[] = _('password');
|
||||
if (empty($_POST['v_type'])) $errors[] = _('type');
|
||||
if (empty($_POST['v_charset'])) $errors[] = _('charset');
|
||||
|
||||
// Protect input
|
||||
$v_database = escapeshellarg($_POST['v_database']);
|
||||
$v_dbuser = escapeshellarg($_POST['v_dbuser']);
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
$v_type = $_POST['v_type'];
|
||||
$v_charset = $_POST['v_charset'];
|
||||
|
||||
// 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 {
|
||||
// Add Database
|
||||
$v_type = escapeshellarg($_POST['v_type']);
|
||||
$v_charset = escapeshellarg($_POST['v_charset']);
|
||||
exec (VESTA_CMD."v-add-database ".$user." ".$v_database." ".$v_dbuser." ".$v_password." ".$v_type." 'default' ".$v_charset, $output, $return_var);
|
||||
$v_type = $_POST['v_type'];
|
||||
$v_charset = $_POST['v_charset'];
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
unset($v_password);
|
||||
unset($output);
|
||||
} else {
|
||||
$_SESSION['ok_msg'] = _('DATABASE_CREATED_OK',$user."_".$_POST['v_database'],$user."_".$_POST['v_database']);
|
||||
unset($v_database);
|
||||
unset($v_dbuser);
|
||||
unset($v_password);
|
||||
unset($v_type);
|
||||
unset($v_charset);
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
exec (VESTA_CMD."v-list-database-types 'json'", $output, $return_var);
|
||||
$db_types = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_db.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,171 +1,171 @@
|
|||
<?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);
|
||||
|
||||
// Are you admin?
|
||||
//if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_domain'])) $errors[] = 'domain';
|
||||
if (empty($_POST['v_ip'])) $errors[] = 'ip';
|
||||
|
||||
// Protect input
|
||||
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
|
||||
$v_domain = escapeshellarg($v_domain);
|
||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
$v_template = escapeshellarg($_POST['v_template']);
|
||||
} else {
|
||||
$v_template = "''";
|
||||
}
|
||||
if (!empty($_POST['v_ns1'])) $v_ns1 = escapeshellarg($_POST['v_ns1']);
|
||||
if (!empty($_POST['v_ns2'])) $v_ns2 = escapeshellarg($_POST['v_ns2']);
|
||||
if (!empty($_POST['v_ns3'])) $v_ns3 = escapeshellarg($_POST['v_ns3']);
|
||||
if (!empty($_POST['v_ns4'])) $v_ns4 = escapeshellarg($_POST['v_ns4']);
|
||||
|
||||
// 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 ".$error_msg." can not be blank.";
|
||||
} else {
|
||||
|
||||
// Add DNS
|
||||
exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$ns4, $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 Expiriation date
|
||||
if ((!empty($_POST['v_exp'])) && ($_POST['v_exp'] != date('Y-m-d', strtotime('+1 year')))) {
|
||||
$v_exp = escapeshellarg($_POST['v_exp']);
|
||||
exec (VESTA_CMD."v-change-dns-domain-exp ".$user." ".$v_domain." ".$v_exp, $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 TTL
|
||||
if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400')) {
|
||||
$v_ttl = escapeshellarg($_POST['v_ttl']);
|
||||
exec (VESTA_CMD."v-change-dns-domain-ttl ".$user." ".$v_domain." ".$v_ttl, $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: domain <a href='/list/dns/?domain=".$_POST[v_domain]."'><b>".$_POST[v_domain]."</b></a> has been created successfully.";
|
||||
unset($v_domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// DNS Record
|
||||
if (!empty($_POST['ok_rec'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_domain'])) $errors[] = 'domain';
|
||||
if (empty($_POST['v_rec'])) $errors[] = 'record';
|
||||
if (empty($_POST['v_type'])) $errors[] = 'type';
|
||||
if (empty($_POST['v_val'])) $errors[] = 'value';
|
||||
|
||||
// Protect input
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
$v_rec = escapeshellarg($_POST['v_rec']);
|
||||
$v_type = escapeshellarg($_POST['v_type']);
|
||||
$v_val = escapeshellarg($_POST['v_val']);
|
||||
$v_priority = escapeshellarg($_POST['v_priority']);
|
||||
|
||||
// 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 ".$error_msg." can not be blank.";
|
||||
} else {
|
||||
// Add DNS Record
|
||||
exec (VESTA_CMD."v-add-dns-domain-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var);
|
||||
$v_type = $_POST['v_type'];
|
||||
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: record <b>".$_POST[v_rec].".".$_POST[v_domain]."</b> has been created successfully.";
|
||||
unset($v_domain);
|
||||
unset($v_rec);
|
||||
unset($v_val);
|
||||
unset($v_priority);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((empty($_GET['domain'])) && (empty($_POST['domain']))) {
|
||||
exec (VESTA_CMD."v-get-user-value ".$user." 'TEMPLATE'", $output, $return_var);
|
||||
$template = $output[0] ;
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
|
||||
$templates = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
if ((empty($v_ns1)) && (empty($v_ns2))) {
|
||||
exec (VESTA_CMD."v-list-user-ns ".$user." json", $output, $return_var);
|
||||
$nameservers = json_decode(implode('', $output), true);
|
||||
$v_ns1 = $nameservers[0];
|
||||
$v_ns2 = $nameservers[1];
|
||||
$v_ns3 = $nameservers[2];
|
||||
$v_ns4 = $nameservers[3];
|
||||
unset($output);
|
||||
}
|
||||
if (empty($v_ttl)) $v_ttl = 14400;
|
||||
if (empty($v_exp)) $v_exp = date('Y-m-d', strtotime('+1 year'));
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html');
|
||||
} else {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_dns.html');
|
||||
}
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
} else {
|
||||
$v_domain = $_GET['domain'];
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_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);
|
||||
|
||||
// Are you admin?
|
||||
//if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_domain'])) $errors[] = _('domain');
|
||||
if (empty($_POST['v_ip'])) $errors[] = _('ip');
|
||||
|
||||
// Protect input
|
||||
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
|
||||
$v_domain = escapeshellarg($v_domain);
|
||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
$v_template = escapeshellarg($_POST['v_template']);
|
||||
} else {
|
||||
$v_template = "''";
|
||||
}
|
||||
if (!empty($_POST['v_ns1'])) $v_ns1 = escapeshellarg($_POST['v_ns1']);
|
||||
if (!empty($_POST['v_ns2'])) $v_ns2 = escapeshellarg($_POST['v_ns2']);
|
||||
if (!empty($_POST['v_ns3'])) $v_ns3 = escapeshellarg($_POST['v_ns3']);
|
||||
if (!empty($_POST['v_ns4'])) $v_ns4 = escapeshellarg($_POST['v_ns4']);
|
||||
|
||||
// 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 {
|
||||
|
||||
// Add DNS
|
||||
exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$ns4, $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 Expiriation date
|
||||
if ((!empty($_POST['v_exp'])) && ($_POST['v_exp'] != date('Y-m-d', strtotime('+1 year')))) {
|
||||
$v_exp = escapeshellarg($_POST['v_exp']);
|
||||
exec (VESTA_CMD."v-change-dns-domain-exp ".$user." ".$v_domain." ".$v_exp, $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 TTL
|
||||
if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400')) {
|
||||
$v_ttl = escapeshellarg($_POST['v_ttl']);
|
||||
exec (VESTA_CMD."v-change-dns-domain-ttl ".$user." ".$v_domain." ".$v_ttl, $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'] = _('DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]);
|
||||
unset($v_domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// DNS Record
|
||||
if (!empty($_POST['ok_rec'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_domain'])) $errors[] = 'domain';
|
||||
if (empty($_POST['v_rec'])) $errors[] = 'record';
|
||||
if (empty($_POST['v_type'])) $errors[] = 'type';
|
||||
if (empty($_POST['v_val'])) $errors[] = 'value';
|
||||
|
||||
// Protect input
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
$v_rec = escapeshellarg($_POST['v_rec']);
|
||||
$v_type = escapeshellarg($_POST['v_type']);
|
||||
$v_val = escapeshellarg($_POST['v_val']);
|
||||
$v_priority = escapeshellarg($_POST['v_priority']);
|
||||
|
||||
// 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 {
|
||||
// Add DNS Record
|
||||
exec (VESTA_CMD."v-add-dns-domain-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var);
|
||||
$v_type = $_POST['v_type'];
|
||||
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'] = _('RECORD_CREATED_OK',$_POST[v_rec],$_POST[v_domain]);
|
||||
unset($v_domain);
|
||||
unset($v_rec);
|
||||
unset($v_val);
|
||||
unset($v_priority);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((empty($_GET['domain'])) && (empty($_POST['domain']))) {
|
||||
exec (VESTA_CMD."v-get-user-value ".$user." 'TEMPLATE'", $output, $return_var);
|
||||
$template = $output[0] ;
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
|
||||
$templates = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
if ((empty($v_ns1)) && (empty($v_ns2))) {
|
||||
exec (VESTA_CMD."v-list-user-ns ".$user." json", $output, $return_var);
|
||||
$nameservers = json_decode(implode('', $output), true);
|
||||
$v_ns1 = $nameservers[0];
|
||||
$v_ns2 = $nameservers[1];
|
||||
$v_ns3 = $nameservers[2];
|
||||
$v_ns4 = $nameservers[3];
|
||||
unset($output);
|
||||
}
|
||||
if (empty($v_ttl)) $v_ttl = 14400;
|
||||
if (empty($v_exp)) $v_exp = date('Y-m-d', strtotime('+1 year'));
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html');
|
||||
} else {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_dns.html');
|
||||
}
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
} else {
|
||||
$v_domain = $_GET['domain'];
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns_rec.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,87 +1,86 @@
|
|||
<?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') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_ip'])) $errors[] = 'ip address';
|
||||
if (empty($_POST['v_netmask'])) $errors[] = 'netmask';
|
||||
if (empty($_POST['v_interface'])) $errors[] = 'interface';
|
||||
if (empty($_POST['v_owner'])) $errors[] = 'assigned used';
|
||||
if (empty($_POST['v_interface'])) $errors[] = 'interface';
|
||||
|
||||
// Protect input
|
||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
||||
$v_netmask = escapeshellarg($_POST['v_netmask']);
|
||||
$v_name = escapeshellarg($_POST['v_name']);
|
||||
|
||||
$v_interface = $_POST['v_interface'];
|
||||
$v_shared = $_POST['v_shared'];
|
||||
if ($v_shared == 'on') {
|
||||
$ip_status = 'shared';
|
||||
} else {
|
||||
$ip_status = 'dedicated';
|
||||
$v_dedicated = 'yes';
|
||||
}
|
||||
|
||||
$v_owner = $_POST['v_owner'];
|
||||
|
||||
// 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 ".$error_msg." can not be blank.";
|
||||
} else {
|
||||
// Add IP
|
||||
$v_interface = escapeshellarg($_POST['v_interface']);
|
||||
$v_owner = $_POST['v_owner'];
|
||||
exec (VESTA_CMD."v-add-sys-ip ".$v_ip." ".$v_netmask." ".$v_interface." ".$v_owner." '".$ip_status."' ".$v_name, $output, $return_var);
|
||||
$v_owner = $_POST['v_owner'];
|
||||
$v_interface = $_POST['v_interface'];
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||
$_SESSION['error_msg'] = $error;
|
||||
unset($v_password);
|
||||
unset($output);
|
||||
} else {
|
||||
$_SESSION['ok_msg'] = "OK: ip <a href='/edit/ip/?ip=".$_POST['v_ip']."'><b>".$_POST['v_ip']."</b></a> has been created successfully.";
|
||||
unset($v_ip);
|
||||
unset($v_netmask);
|
||||
unset($v_name);
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
exec (VESTA_CMD."v-list-sys-interfaces 'json'", $output, $return_var);
|
||||
$interfaces = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var);
|
||||
$users = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_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') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_ip'])) $errors[] = _('ip address');
|
||||
if (empty($_POST['v_netmask'])) $errors[] = _('netmask');
|
||||
if (empty($_POST['v_interface'])) $errors[] = _('interface');
|
||||
if (empty($_POST['v_owner'])) $errors[] = _('assigned user');
|
||||
|
||||
// Protect input
|
||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
||||
$v_netmask = escapeshellarg($_POST['v_netmask']);
|
||||
$v_name = escapeshellarg($_POST['v_name']);
|
||||
|
||||
$v_interface = $_POST['v_interface'];
|
||||
$v_shared = $_POST['v_shared'];
|
||||
if ($v_shared == 'on') {
|
||||
$ip_status = 'shared';
|
||||
} else {
|
||||
$ip_status = 'dedicated';
|
||||
$v_dedicated = 'yes';
|
||||
}
|
||||
|
||||
$v_owner = $_POST['v_owner'];
|
||||
|
||||
// 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 {
|
||||
// Add IP
|
||||
$v_interface = escapeshellarg($_POST['v_interface']);
|
||||
$v_owner = $_POST['v_owner'];
|
||||
exec (VESTA_CMD."v-add-sys-ip ".$v_ip." ".$v_netmask." ".$v_interface." ".$v_owner." '".$ip_status."' ".$v_name, $output, $return_var);
|
||||
$v_owner = $_POST['v_owner'];
|
||||
$v_interface = $_POST['v_interface'];
|
||||
if ($return_var != 0) {
|
||||
$error = implode('<br>', $output);
|
||||
if (empty($error)) $error = _('Error: vesta did not return any output.');
|
||||
$_SESSION['error_msg'] = $error;
|
||||
unset($v_password);
|
||||
unset($output);
|
||||
} else {
|
||||
$_SESSION['ok_msg'] = _('IP_CREATED_OK',$_POST['v_ip'],$_POST['v_ip']);
|
||||
unset($v_ip);
|
||||
unset($v_netmask);
|
||||
unset($v_name);
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
}
|
||||
exec (VESTA_CMD."v-list-sys-interfaces 'json'", $output, $return_var);
|
||||
$interfaces = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var);
|
||||
$users = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_ip.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,178 +1,178 @@
|
|||
<?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);
|
||||
|
||||
// Are you admin?
|
||||
//if ($_SESSION['user'] == 'admin') {
|
||||
// Mail Domain
|
||||
if (!empty($_POST['ok'])) {
|
||||
if (empty($_POST['v_domain'])) $errors[] = 'domain';
|
||||
if (!empty($_POST['v_antispam'])) {
|
||||
$v_antispam = 'yes';
|
||||
} else {
|
||||
$v_antispam = 'no';
|
||||
}
|
||||
|
||||
if (!empty($_POST['v_antivirus'])) {
|
||||
$v_antivirus = 'yes';
|
||||
} else {
|
||||
$v_antivirus = 'no';
|
||||
}
|
||||
|
||||
if (!empty($_POST['v_dkim'])) {
|
||||
$v_dkim = 'yes';
|
||||
} else {
|
||||
$v_dkim = 'no';
|
||||
}
|
||||
|
||||
// Protect input
|
||||
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
|
||||
$v_domain = escapeshellarg($v_domain);
|
||||
|
||||
// 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 ".$error_msg." can not be blank.";
|
||||
} else {
|
||||
|
||||
// Add mail domain
|
||||
exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain." ".$v_antispam." ".$v_antivirus." ".$v_dkim, $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: domain <a href='/list/mail/?domain=".$_POST[v_domain]."'><b>".$_POST[v_domain]."</b></a> has been created successfully.";
|
||||
unset($v_domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Mail Account
|
||||
if (!empty($_POST['ok_acc'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_domain'])) $errors[] = 'domain';
|
||||
if (empty($_POST['v_account'])) $errors[] = 'account';
|
||||
if (empty($_POST['v_password'])) $errors[] = 'password';
|
||||
|
||||
// Protect input
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
$v_account = escapeshellarg($_POST['v_account']);
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
$v_quota = escapeshellarg($_POST['v_quota']);
|
||||
$v_aliases = $_POST['v_aliases'];
|
||||
$v_fwd = $_POST['v_fwd'];
|
||||
|
||||
if (empty($_POST['v_quota'])) $v_quota = 0;
|
||||
if ((!empty($_POST['v_quota'])) || (!empty($_POST['v_aliases'])) || (!empty($_POST['v_fwd'])) ) $v_adv = 'yes';
|
||||
|
||||
// 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 ".$error_msg." can not be blank.";
|
||||
} else {
|
||||
// Add Mail Account
|
||||
exec (VESTA_CMD."v-add-mail-account ".$user." ".$v_domain." ".$v_account." ".$v_password." ".$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;
|
||||
}
|
||||
|
||||
// Add Aliases
|
||||
if ((!empty($_POST['v_aliases'])) && (empty($_SESSION['error_msg']))) {
|
||||
$valiases = preg_replace("/\n/", " ", $_POST['v_aliases']);
|
||||
$valiases = preg_replace("/,/", " ", $valiases);
|
||||
$valiases = preg_replace('/\s+/', ' ',$valiases);
|
||||
$valiases = trim($valiases);
|
||||
$aliases = explode(" ", $valiases);
|
||||
foreach ($aliases as $alias) {
|
||||
$alias = escapeshellarg($alias);
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-mail-account-alias ".$user." ".$v_domain." ".$v_account." ".$alias, $output, $return_var);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Add Forwads
|
||||
if ((!empty($_POST['v_fwd'])) && (empty($_SESSION['error_msg']))) {
|
||||
$vfwd = preg_replace("/\n/", " ", $_POST['v_fwd']);
|
||||
$vfwd = preg_replace("/,/", " ", $vfwd);
|
||||
$vfwd = preg_replace('/\s+/', ' ',$vfwd);
|
||||
$vfwd = trim($vfwd);
|
||||
$fwd = explode(" ", $vfwd);
|
||||
foreach ($fwd as $forward) {
|
||||
$forward = escapeshellarg($forward);
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-mail-account-forward ".$user." ".$v_domain." ".$v_account." ".$forward, $output, $return_var);
|
||||
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($output);
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = "OK: account <a href='/edit/mail/?account=".$_POST['v_account']."&domain=".$_POST[v_domain]."'><b>".$_POST['v_account']."@".$_POST[v_domain]."</b></a> has been created successfully.";
|
||||
unset($v_account);
|
||||
unset($v_password);
|
||||
unset($v_password);
|
||||
unset($v_aliases);
|
||||
unset($v_fwd);
|
||||
unset($v_quota);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((empty($_GET['domain'])) && (empty($_POST['domain']))) {
|
||||
$v_domain = $_GET['domain'];
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
} else {
|
||||
$v_domain = $_GET['domain'];
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_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);
|
||||
|
||||
// Are you admin?
|
||||
//if ($_SESSION['user'] == 'admin') {
|
||||
// Mail Domain
|
||||
if (!empty($_POST['ok'])) {
|
||||
if (empty($_POST['v_domain'])) $errors[] = _('domain');
|
||||
if (!empty($_POST['v_antispam'])) {
|
||||
$v_antispam = 'yes';
|
||||
} else {
|
||||
$v_antispam = 'no';
|
||||
}
|
||||
|
||||
if (!empty($_POST['v_antivirus'])) {
|
||||
$v_antivirus = 'yes';
|
||||
} else {
|
||||
$v_antivirus = 'no';
|
||||
}
|
||||
|
||||
if (!empty($_POST['v_dkim'])) {
|
||||
$v_dkim = 'yes';
|
||||
} else {
|
||||
$v_dkim = 'no';
|
||||
}
|
||||
|
||||
// Protect input
|
||||
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
|
||||
$v_domain = escapeshellarg($v_domain);
|
||||
|
||||
// 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 {
|
||||
|
||||
// Add mail domain
|
||||
exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain." ".$v_antispam." ".$v_antivirus." ".$v_dkim, $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'] = _("DOMAIN_MAIL_CREATED_OK",$_POST[v_domain],$_POST[v_domain]);
|
||||
unset($v_domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Mail Account
|
||||
if (!empty($_POST['ok_acc'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_domain'])) $errors[] = _('domain');
|
||||
if (empty($_POST['v_account'])) $errors[] = _('account');
|
||||
if (empty($_POST['v_password'])) $errors[] = _('password');
|
||||
|
||||
// Protect input
|
||||
$v_domain = escapeshellarg($_POST['v_domain']);
|
||||
$v_account = escapeshellarg($_POST['v_account']);
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
$v_quota = escapeshellarg($_POST['v_quota']);
|
||||
$v_aliases = $_POST['v_aliases'];
|
||||
$v_fwd = $_POST['v_fwd'];
|
||||
|
||||
if (empty($_POST['v_quota'])) $v_quota = 0;
|
||||
if ((!empty($_POST['v_quota'])) || (!empty($_POST['v_aliases'])) || (!empty($_POST['v_fwd'])) ) $v_adv = 'yes';
|
||||
|
||||
// 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 {
|
||||
// Add Mail Account
|
||||
exec (VESTA_CMD."v-add-mail-account ".$user." ".$v_domain." ".$v_account." ".$v_password." ".$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;
|
||||
}
|
||||
|
||||
// Add Aliases
|
||||
if ((!empty($_POST['v_aliases'])) && (empty($_SESSION['error_msg']))) {
|
||||
$valiases = preg_replace("/\n/", " ", $_POST['v_aliases']);
|
||||
$valiases = preg_replace("/,/", " ", $valiases);
|
||||
$valiases = preg_replace('/\s+/', ' ',$valiases);
|
||||
$valiases = trim($valiases);
|
||||
$aliases = explode(" ", $valiases);
|
||||
foreach ($aliases as $alias) {
|
||||
$alias = escapeshellarg($alias);
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-mail-account-alias ".$user." ".$v_domain." ".$v_account." ".$alias, $output, $return_var);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Add Forwads
|
||||
if ((!empty($_POST['v_fwd'])) && (empty($_SESSION['error_msg']))) {
|
||||
$vfwd = preg_replace("/\n/", " ", $_POST['v_fwd']);
|
||||
$vfwd = preg_replace("/,/", " ", $vfwd);
|
||||
$vfwd = preg_replace('/\s+/', ' ',$vfwd);
|
||||
$vfwd = trim($vfwd);
|
||||
$fwd = explode(" ", $vfwd);
|
||||
foreach ($fwd as $forward) {
|
||||
$forward = escapeshellarg($forward);
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-mail-account-forward ".$user." ".$v_domain." ".$v_account." ".$forward, $output, $return_var);
|
||||
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($output);
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('MAIL_ACCOUNT_CREATED_OK',$_POST['v_account'],$_POST[v_domain],$_POST['v_account'],$_POST[v_domain]);
|
||||
unset($v_account);
|
||||
unset($v_password);
|
||||
unset($v_password);
|
||||
unset($v_aliases);
|
||||
unset($v_fwd);
|
||||
unset($v_quota);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((empty($_GET['domain'])) && (empty($_POST['domain']))) {
|
||||
$v_domain = $_GET['domain'];
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
} else {
|
||||
$v_domain = $_GET['domain'];
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail_acc.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,164 +1,164 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
$TAB = 'PACKAGE';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
if (empty($_SESSION['user'])) {
|
||||
header("Location: /login/");
|
||||
}
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// 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 ".$error_msg." can not be blank.";
|
||||
} 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);
|
||||
|
||||
// Add new package
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$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);
|
||||
}
|
||||
|
||||
// Remove tmpdir
|
||||
exec ('rm -rf '.$tmpdir, $output, $return_var);
|
||||
unset($output);
|
||||
|
||||
// Check output
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = "OK: package <a href='/edit/package/?package=".$_POST['v_package']."'><b>".$_POST['v_package']."</b></a> has been created successfully.";
|
||||
unset($v_package);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
// Set default values
|
||||
if (empty($v_template)) $v_template = 'default';
|
||||
if (empty($v_shell)) $v_shell = 'nologin';
|
||||
if (empty($v_web_domains)) $v_web_domains = "'0'";
|
||||
if (empty($v_web_aliases)) $v_web_aliases = "'0'";
|
||||
if (empty($v_dns_domains)) $v_dns_domains = "'0'";
|
||||
if (empty($v_dns_records)) $v_dns_records = "'0'";
|
||||
if (empty($v_mail_domains)) $v_mail_domains = "'0'";
|
||||
if (empty($v_mail_accounts)) $v_mail_accounts = "'0'";
|
||||
if (empty($v_databases)) $v_databases = "'0'";
|
||||
if (empty($v_cron_jobs)) $v_cron_jobs = "'0'";
|
||||
if (empty($v_backups)) $v_backups = "'0'";
|
||||
if (empty($v_disk_quota)) $v_disk_quota = "'0'";
|
||||
if (empty($v_bandwidth)) $v_bandwidth = "'0'";
|
||||
if (empty($v_ns1)) $v_ns1 = 'ns1.example.ltd';
|
||||
if (empty($v_ns2)) $v_ns2 = 'ns2.example.ltd';
|
||||
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_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");
|
||||
|
||||
if (empty($_SESSION['user'])) {
|
||||
header("Location: /login/");
|
||||
}
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// 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);
|
||||
|
||||
// Add new package
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$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);
|
||||
}
|
||||
|
||||
// Remove tmpdir
|
||||
exec ('rm -rf '.$tmpdir, $output, $return_var);
|
||||
unset($output);
|
||||
|
||||
// Check output
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
$_SESSION['ok_msg'] = _('PACKAGE_CREATED_OK',$_POST['v_package'],$_POST['v_package']);
|
||||
unset($v_package);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
// Set default values
|
||||
if (empty($v_template)) $v_template = 'default';
|
||||
if (empty($v_shell)) $v_shell = 'nologin';
|
||||
if (empty($v_web_domains)) $v_web_domains = "'0'";
|
||||
if (empty($v_web_aliases)) $v_web_aliases = "'0'";
|
||||
if (empty($v_dns_domains)) $v_dns_domains = "'0'";
|
||||
if (empty($v_dns_records)) $v_dns_records = "'0'";
|
||||
if (empty($v_mail_domains)) $v_mail_domains = "'0'";
|
||||
if (empty($v_mail_accounts)) $v_mail_accounts = "'0'";
|
||||
if (empty($v_databases)) $v_databases = "'0'";
|
||||
if (empty($v_cron_jobs)) $v_cron_jobs = "'0'";
|
||||
if (empty($v_backups)) $v_backups = "'0'";
|
||||
if (empty($v_disk_quota)) $v_disk_quota = "'0'";
|
||||
if (empty($v_bandwidth)) $v_bandwidth = "'0'";
|
||||
if (empty($v_ns1)) $v_ns1 = 'ns1.example.ltd';
|
||||
if (empty($v_ns2)) $v_ns2 = 'ns2.example.ltd';
|
||||
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_package.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,103 +1,99 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
$TAB = 'USER';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
if (empty($_SESSION['user'])) {
|
||||
header("Location: /login/");
|
||||
}
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_username'])) $errors[] = 'user';
|
||||
if (empty($_POST['v_password'])) $errors[] = 'password';
|
||||
if (empty($_POST['v_package'])) $errrors[] = 'package';
|
||||
if (empty($_POST['v_email'])) $errors[] = 'email';
|
||||
if (empty($_POST['v_fname'])) $errors[] = 'first name';
|
||||
if (empty($_POST['v_lname'])) $errors[] = 'last name';
|
||||
|
||||
// Protect input
|
||||
$v_username = escapeshellarg($_POST['v_username']);
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
$v_package = escapeshellarg($_POST['v_package']);
|
||||
$v_email = escapeshellarg($_POST['v_email']);
|
||||
$v_fname = escapeshellarg($_POST['v_fname']);
|
||||
$v_lname = escapeshellarg($_POST['v_lname']);
|
||||
if (empty($_POST['v_notify'])) $v_notify = 'off';
|
||||
|
||||
// Validate email
|
||||
if (!filter_var($_POST['v_email'], FILTER_VALIDATE_EMAIL)) {
|
||||
$_SESSION['error_msg'] = 'Please enter valid email address.';
|
||||
}
|
||||
|
||||
// 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 ".$error_msg." can not be blank.";
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-user ".$v_username." ".$v_password." ".$v_email." ".$v_package." ".$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;
|
||||
} else {
|
||||
if (empty($v_notify)) {
|
||||
$to = $_POST['v_email'];
|
||||
$subject = "Welcome to Vesta Control Panel";
|
||||
$hostname = exec('hostname');
|
||||
$from = "Vesta Control Panel <noreply@".$hostname.">";
|
||||
if (!empty($_POST['v_fname'])) {
|
||||
$mailtext = "Hello ".$_POST['v_fname']." ".$_POST['v_lname'].",\n";
|
||||
} else {
|
||||
$mailtext = "Hello,\n";
|
||||
}
|
||||
$mailtext .= "Your account has been created successfully and is ready to use.\n\n";
|
||||
$mailtext .= "https://".$_SERVER['HTTP_HOST']."/login/\n";
|
||||
$mailtext .= "username: ".$_POST['v_username']."\n";
|
||||
$mailtext .= "password: ".$_POST['v_password']."\n\n";
|
||||
$mailtext .= "--\nVesta Control Panel\n";
|
||||
send_email($to, $subject, $mailtext, $from);
|
||||
}
|
||||
|
||||
$_SESSION['ok_msg'] = "OK: user <a href='/edit/user/?user=".$_POST[v_username]."'><b>".$_POST[v_username]."</b></a> has been created successfully.";
|
||||
unset($v_username);
|
||||
unset($v_password);
|
||||
unset($v_email);
|
||||
unset($v_fname);
|
||||
unset($v_lname);
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
|
||||
exec (VESTA_CMD."v-list-user-packages json", $output, $return_var);
|
||||
check_error($return_var);
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_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");
|
||||
|
||||
if (empty($_SESSION['user'])) {
|
||||
header("Location: /login/");
|
||||
}
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_username'])) $errors[] = _('user');
|
||||
if (empty($_POST['v_password'])) $errors[] = _('password');
|
||||
if (empty($_POST['v_package'])) $errrors[] = _('package');
|
||||
if (empty($_POST['v_email'])) $errors[] = _('email');
|
||||
if (empty($_POST['v_fname'])) $errors[] = _('first name');
|
||||
if (empty($_POST['v_lname'])) $errors[] = _('last name');
|
||||
|
||||
// Protect input
|
||||
$v_username = escapeshellarg($_POST['v_username']);
|
||||
$v_password = escapeshellarg($_POST['v_password']);
|
||||
$v_package = escapeshellarg($_POST['v_package']);
|
||||
$v_email = escapeshellarg($_POST['v_email']);
|
||||
$v_fname = escapeshellarg($_POST['v_fname']);
|
||||
$v_lname = escapeshellarg($_POST['v_lname']);
|
||||
if (empty($_POST['v_notify'])) $v_notify = 'off';
|
||||
|
||||
// Validate email
|
||||
if (!filter_var($_POST['v_email'], FILTER_VALIDATE_EMAIL)) {
|
||||
$_SESSION['error_msg'] = _('Please enter valid email address.');
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-user ".$v_username." ".$v_password." ".$v_email." ".$v_package." ".$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;
|
||||
} else {
|
||||
if (empty($v_notify)) {
|
||||
$to = $_POST['v_email'];
|
||||
$subject = _("Welcome to Vesta Control Panel");
|
||||
$hostname = exec('hostname');
|
||||
$from = _('MAIL_FROM',$hostname);
|
||||
if (!empty($_POST['v_fname'])) {
|
||||
$mailtext = _('GREETINGS_GORDON_FREEMAN',$_POST['v_fname'],$_POST['v_lname']);
|
||||
} else {
|
||||
$mailtext = _('GREETINGS');
|
||||
}
|
||||
$mailtext .= _('ACCOUNT_READY',$_SERVER['HTTP_HOST'],$_POST['v_username'],$_POST['v_password']);
|
||||
send_email($to, $subject, $mailtext, $from);
|
||||
}
|
||||
|
||||
$_SESSION['ok_msg'] = _('ACCOUNT_CREATED_OK',$_POST[v_username],$_POST[v_username]);
|
||||
unset($v_username);
|
||||
unset($v_password);
|
||||
unset($v_email);
|
||||
unset($v_fname);
|
||||
unset($v_lname);
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
|
||||
exec (VESTA_CMD."v-list-user-packages json", $output, $return_var);
|
||||
check_error($return_var);
|
||||
$data = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_user.html');
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
|
@ -1,328 +1,324 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
$TAB = 'WEB';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_domain'])) $errors[] = 'domain';
|
||||
if (empty($_POST['v_ip'])) $errors[] = 'ip';
|
||||
if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_crt']))) $errors[] = 'ssl certificate';
|
||||
if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_key']))) $errors[] = 'ssl key';
|
||||
if ((!empty($_POST['v_stats_user'])) && (empty($_POST['v_stats_password']))) $errors[] = 'stats user password';
|
||||
if ((!empty($_POST['v_ftp_user'])) && (empty($_POST['v_ftp_password']))) $errors[] = 'ftp user password';
|
||||
|
||||
if ((!empty($_POST['v_aliases'])) && ($_POST['v_aliases'] != 'www.'.$_POST['v_domain'])) $v_adv = 'yes';
|
||||
if ((!empty($_POST['v_ssl'])) || (!empty($_POST['v_elog']))) $v_adv = 'yes';
|
||||
if ((!empty($_POST['v_ssl_crt'])) || (!empty($_POST['v_ssl_key']))) $v_adv = 'yes';
|
||||
if ((!empty($_POST['v_ssl_ca'])) || ($_POST['v_stats'] != 'none')) $v_adv = 'yes';
|
||||
if (empty($_POST['v_nginx'])) $v_adv = 'yes';
|
||||
if (!empty($_POST['v_ftp'])) $v_adv = 'yes';
|
||||
|
||||
$v_nginx_ext = 'jpg, jpeg, gif, png, ico, svg, css, zip, tgz, gz, rar, bz2, exe, pdf, ';
|
||||
$v_nginx_ext .= 'doc, xls, ppt, txt, odt, ods, odp, odf, tar, bmp, rtf, js, mp3, avi, ';
|
||||
$v_nginx_ext .= 'mpeg, flv, html, htm';
|
||||
if ($_POST['v_nginx_ext'] != $v_nginx_ext) $v_adv = 'yes';
|
||||
|
||||
// Protect input
|
||||
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
|
||||
$v_domain = escapeshellarg($v_domain);
|
||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
$v_template = escapeshellarg($_POST['v_template']);
|
||||
} else {
|
||||
$v_template = "''";
|
||||
}
|
||||
if (empty($_POST['v_dns'])) $v_dns = 'off';
|
||||
if (empty($_POST['v_mail'])) $v_mail = 'off';
|
||||
if (empty($_POST['v_nginx'])) $v_nginx = 'off';
|
||||
$v_aliases = $_POST['v_aliases'];
|
||||
$v_elog = $_POST['v_elog'];
|
||||
$v_ssl = $_POST['v_ssl'];
|
||||
$v_ssl_crt = $_POST['v_ssl_crt'];
|
||||
$v_ssl_key = $_POST['v_ssl_key'];
|
||||
$v_ssl_ca = $_POST['v_ssl_ca'];
|
||||
$v_ssl_home = $data[$v_domain]['SSL_HOME'];
|
||||
$v_stats = escapeshellarg($_POST['v_stats']);
|
||||
$v_stats_user = $data[$v_domain]['STATS_USER'];
|
||||
$v_stats_password = $data[$v_domain]['STATS_PASSWORD'];
|
||||
$v_nginx_ext = preg_replace("/\n/", " ", $_POST['v_nginx_ext']);
|
||||
$v_nginx_ext = preg_replace("/,/", " ", $v_nginx_ext);
|
||||
$v_nginx_ext = preg_replace('/\s+/', ' ',$v_nginx_ext);
|
||||
$v_nginx_ext = trim($v_nginx_ext);
|
||||
$v_nginx_ext = str_replace(' ', ", ", $v_nginx_ext);
|
||||
$v_ftp = $_POST['v_ftp'];
|
||||
$v_ftp_user = $_POST['v_ftp_user'];
|
||||
$v_ftp_password = $_POST['v_ftp_password'];
|
||||
$v_ftp_email = $_POST['v_ftp_email'];
|
||||
|
||||
// Validate email
|
||||
if ((!empty($_POST['v_ftp_email'])) && (!filter_var($_POST['v_ftp_email'], FILTER_VALIDATE_EMAIL))) {
|
||||
$_SESSION['error_msg'] = 'Please enter valid email address.';
|
||||
}
|
||||
|
||||
// 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 ".$error_msg." can not be blank.";
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
// Add WEB
|
||||
exec (VESTA_CMD."v-add-web-domain ".$user." ".$v_domain." ".$v_ip." ".$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);
|
||||
|
||||
// Add DNS
|
||||
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
|
||||
exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip, $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);
|
||||
}
|
||||
|
||||
// Add Mail
|
||||
if (($_POST['v_mail'] == 'on') && (empty($_SESSION['error_msg']))) {
|
||||
exec (VESTA_CMD."v-add-mail-domain ".$user." ".$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;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Add Aliases
|
||||
if ((!empty($_POST['v_aliases'])) && (empty($_SESSION['error_msg']))) {
|
||||
$valiases = preg_replace("/\n/", " ", $_POST['v_aliases']);
|
||||
$valiases = preg_replace("/,/", " ", $valiases);
|
||||
$valiases = preg_replace('/\s+/', ' ',$valiases);
|
||||
$valiases = trim($valiases);
|
||||
$aliases = explode(" ", $valiases);
|
||||
foreach ($aliases as $alias) {
|
||||
if ($alias == 'www.'.$_POST['v_domain']) {
|
||||
$www_alias = 'yes';
|
||||
} else {
|
||||
$alias = escapeshellarg($alias);
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-web-domain-alias ".$user." ".$v_domain." ".$alias." '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);
|
||||
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
|
||||
exec (VESTA_CMD."v-add-dns-on-web-alias ".$user." ".$v_domain." ".$alias." '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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((empty($www_alias)) && (empty($_SESSION['error_msg']))) {
|
||||
$alias = preg_replace("/^www./i", "", $_POST['v_domain']);
|
||||
$alias = 'www.'.$alias;
|
||||
$alias = escapeshellarg($alias);
|
||||
exec (VESTA_CMD."v-delete-web-domain-alias ".$user." ".$v_domain." ".$alias." '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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add Nginx
|
||||
if (($_POST['v_nginx'] == 'on') && (empty($_SESSION['error_msg']))) {
|
||||
$ext = str_replace(' ', '', $v_nginx_ext);
|
||||
$ext = escapeshellarg($ext);
|
||||
exec (VESTA_CMD."v-add-web-domain-nginx ".$user." ".$v_domain." 'default' ".$ext." '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);
|
||||
}
|
||||
|
||||
// Add SSL
|
||||
if (!empty($_POST['v_ssl'])) {
|
||||
exec ('mktemp -d', $output, $return_var);
|
||||
$tmpdir = $output[0];
|
||||
|
||||
// Certificate
|
||||
if (!empty($_POST['v_ssl_crt'])) {
|
||||
$fp = fopen($tmpdir."/".$_POST['v_domain'].".crt", 'w');
|
||||
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_crt']));
|
||||
fwrite($fp, "\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
// Key
|
||||
if (!empty($_POST['v_ssl_key'])) {
|
||||
$fp = fopen($tmpdir."/".$_POST['v_domain'].".key", 'w');
|
||||
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_key']));
|
||||
fwrite($fp, "\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
// CA
|
||||
if (!empty($_POST['v_ssl_ca'])) {
|
||||
$fp = fopen($tmpdir."/".$_POST['v_domain'].".ca", 'w');
|
||||
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_ca']));
|
||||
fwrite($fp, "\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
$v_ssl_home = escapeshellarg($_POST['v_ssl_home']);
|
||||
exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." 'no'", $output, $return_var);
|
||||
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);
|
||||
}
|
||||
|
||||
// Add WebStats
|
||||
if ((!empty($_POST['v_stats'])) && ($_POST['v_stats'] != 'none' ) && (empty($_SESSION['error_msg']))) {
|
||||
$v_stats = escapeshellarg($_POST['v_stats']);
|
||||
exec (VESTA_CMD."v-add-web-domain-stats ".$user." ".$v_domain." ".$v_stats, $output, $return_var);
|
||||
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($_POST['v_stats_user'])) && (empty($_SESSION['error_msg']))) {
|
||||
$v_stats_user = escapeshellarg($_POST['v_stats_user']);
|
||||
$v_stats_password = escapeshellarg($_POST['v_stats_password']);
|
||||
exec (VESTA_CMD."v-add-web-domain-stats-user ".$user." ".$v_domain." ".$v_stats_user." ".$v_stats_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;
|
||||
}
|
||||
unset($v_stats_user);
|
||||
unset($v_stats_password);
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add FTP
|
||||
if ((!empty($_POST['v_ftp'])) && (empty($_SESSION['error_msg']))) {
|
||||
$v_ftp_user = escapeshellarg($_POST['v_ftp_user']);
|
||||
$v_ftp_password = escapeshellarg($_POST['v_ftp_password']);
|
||||
exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_user." ".$v_ftp_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;
|
||||
} else {
|
||||
if (!empty($v_ftp_email)) {
|
||||
$to = $_POST['v_ftp_email'];
|
||||
$subject = "FTP login credentials";
|
||||
$hostname = exec('hostname');
|
||||
$from = "Vesta Control Panel <noreply@".$hostname.">";
|
||||
$mailtext .= "Your ftp account has been created successfully and is ready to use.\n\n";
|
||||
$mailtext .= "hostname: ".$_POST['v_domain']."\n";
|
||||
$mailtext .= "username: ".$user."_".$_POST['v_ftp_user']."\n";
|
||||
$mailtext .= "password: ".$_POST['v_ftp_password']."\n\n";
|
||||
$mailtext .= "--\nVesta Control Panel\n";
|
||||
send_email($to, $subject, $mailtext, $from);
|
||||
unset($v_ftp_email);
|
||||
}
|
||||
}
|
||||
unset($v_ftp);
|
||||
unset($v_ftp_user);
|
||||
unset($v_ftp_password);
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (($_POST['v_dns'] == 'on') && (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;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-restart-web", $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);
|
||||
$_SESSION['ok_msg'] = "OK: domain <a href='/edit/web/?domain=".$_POST[v_domain]."'><b>".$_POST[v_domain]."</b></a> has been created successfully.";
|
||||
unset($v_domain);
|
||||
unset($v_aliases);
|
||||
unset($v_ssl);
|
||||
unset($v_ssl_crt);
|
||||
unset($v_ssl_key);
|
||||
unset($v_ssl_ca);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exec (VESTA_CMD."v-list-user-ips ".$user." json", $output, $return_var);
|
||||
$ips = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-get-user-value ".$user." 'TEMPLATE'", $output, $return_var);
|
||||
$template = $output[0] ;
|
||||
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-web-stats json", $output, $return_var);
|
||||
$stats = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_web.html');
|
||||
} else {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_web.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 = 'WEB';
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Header
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
|
||||
|
||||
// Panel
|
||||
top_panel($user,$TAB);
|
||||
|
||||
if (!empty($_POST['ok'])) {
|
||||
// Check input
|
||||
if (empty($_POST['v_domain'])) $errors[] = _('domain');
|
||||
if (empty($_POST['v_ip'])) $errors[] = _('ip');
|
||||
if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_crt']))) $errors[] = _('ssl certificate');
|
||||
if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_key']))) $errors[] = _('ssl key');
|
||||
if ((!empty($_POST['v_stats_user'])) && (empty($_POST['v_stats_password']))) $errors[] = _('stats user password');
|
||||
if ((!empty($_POST['v_ftp_user'])) && (empty($_POST['v_ftp_password']))) $errors[] = _('ftp user password');
|
||||
|
||||
if ((!empty($_POST['v_aliases'])) && ($_POST['v_aliases'] != 'www.'.$_POST['v_domain'])) $v_adv = 'yes';
|
||||
if ((!empty($_POST['v_ssl'])) || (!empty($_POST['v_elog']))) $v_adv = 'yes';
|
||||
if ((!empty($_POST['v_ssl_crt'])) || (!empty($_POST['v_ssl_key']))) $v_adv = 'yes';
|
||||
if ((!empty($_POST['v_ssl_ca'])) || ($_POST['v_stats'] != 'none')) $v_adv = 'yes';
|
||||
if (empty($_POST['v_nginx'])) $v_adv = 'yes';
|
||||
if (!empty($_POST['v_ftp'])) $v_adv = 'yes';
|
||||
|
||||
$v_nginx_ext = 'jpg, jpeg, gif, png, ico, svg, css, zip, tgz, gz, rar, bz2, exe, pdf, ';
|
||||
$v_nginx_ext .= 'doc, xls, ppt, txt, odt, ods, odp, odf, tar, bmp, rtf, js, mp3, avi, ';
|
||||
$v_nginx_ext .= 'mpeg, flv, html, htm';
|
||||
if ($_POST['v_nginx_ext'] != $v_nginx_ext) $v_adv = 'yes';
|
||||
|
||||
// Protect input
|
||||
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
|
||||
$v_domain = escapeshellarg($v_domain);
|
||||
$v_ip = escapeshellarg($_POST['v_ip']);
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
$v_template = escapeshellarg($_POST['v_template']);
|
||||
} else {
|
||||
$v_template = "''";
|
||||
}
|
||||
if (empty($_POST['v_dns'])) $v_dns = 'off';
|
||||
if (empty($_POST['v_mail'])) $v_mail = 'off';
|
||||
if (empty($_POST['v_nginx'])) $v_nginx = 'off';
|
||||
$v_aliases = $_POST['v_aliases'];
|
||||
$v_elog = $_POST['v_elog'];
|
||||
$v_ssl = $_POST['v_ssl'];
|
||||
$v_ssl_crt = $_POST['v_ssl_crt'];
|
||||
$v_ssl_key = $_POST['v_ssl_key'];
|
||||
$v_ssl_ca = $_POST['v_ssl_ca'];
|
||||
$v_ssl_home = $data[$v_domain]['SSL_HOME'];
|
||||
$v_stats = escapeshellarg($_POST['v_stats']);
|
||||
$v_stats_user = $data[$v_domain]['STATS_USER'];
|
||||
$v_stats_password = $data[$v_domain]['STATS_PASSWORD'];
|
||||
$v_nginx_ext = preg_replace("/\n/", " ", $_POST['v_nginx_ext']);
|
||||
$v_nginx_ext = preg_replace("/,/", " ", $v_nginx_ext);
|
||||
$v_nginx_ext = preg_replace('/\s+/', ' ',$v_nginx_ext);
|
||||
$v_nginx_ext = trim($v_nginx_ext);
|
||||
$v_nginx_ext = str_replace(' ', ", ", $v_nginx_ext);
|
||||
$v_ftp = $_POST['v_ftp'];
|
||||
$v_ftp_user = $_POST['v_ftp_user'];
|
||||
$v_ftp_password = $_POST['v_ftp_password'];
|
||||
$v_ftp_email = $_POST['v_ftp_email'];
|
||||
|
||||
// Validate email
|
||||
if ((!empty($_POST['v_ftp_email'])) && (!filter_var($_POST['v_ftp_email'], FILTER_VALIDATE_EMAIL))) {
|
||||
$_SESSION['error_msg'] = _('Please enter valid email address.');
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
// Add WEB
|
||||
exec (VESTA_CMD."v-add-web-domain ".$user." ".$v_domain." ".$v_ip." ".$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);
|
||||
|
||||
// Add DNS
|
||||
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
|
||||
exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip, $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);
|
||||
}
|
||||
|
||||
// Add Mail
|
||||
if (($_POST['v_mail'] == 'on') && (empty($_SESSION['error_msg']))) {
|
||||
exec (VESTA_CMD."v-add-mail-domain ".$user." ".$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;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
// Add Aliases
|
||||
if ((!empty($_POST['v_aliases'])) && (empty($_SESSION['error_msg']))) {
|
||||
$valiases = preg_replace("/\n/", " ", $_POST['v_aliases']);
|
||||
$valiases = preg_replace("/,/", " ", $valiases);
|
||||
$valiases = preg_replace('/\s+/', ' ',$valiases);
|
||||
$valiases = trim($valiases);
|
||||
$aliases = explode(" ", $valiases);
|
||||
foreach ($aliases as $alias) {
|
||||
if ($alias == 'www.'.$_POST['v_domain']) {
|
||||
$www_alias = 'yes';
|
||||
} else {
|
||||
$alias = escapeshellarg($alias);
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-add-web-domain-alias ".$user." ".$v_domain." ".$alias." '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);
|
||||
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
|
||||
exec (VESTA_CMD."v-add-dns-on-web-alias ".$user." ".$v_domain." ".$alias." '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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((empty($www_alias)) && (empty($_SESSION['error_msg']))) {
|
||||
$alias = preg_replace("/^www./i", "", $_POST['v_domain']);
|
||||
$alias = 'www.'.$alias;
|
||||
$alias = escapeshellarg($alias);
|
||||
exec (VESTA_CMD."v-delete-web-domain-alias ".$user." ".$v_domain." ".$alias." '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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add Nginx
|
||||
if (($_POST['v_nginx'] == 'on') && (empty($_SESSION['error_msg']))) {
|
||||
$ext = str_replace(' ', '', $v_nginx_ext);
|
||||
$ext = escapeshellarg($ext);
|
||||
exec (VESTA_CMD."v-add-web-domain-nginx ".$user." ".$v_domain." 'default' ".$ext." '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);
|
||||
}
|
||||
|
||||
// Add SSL
|
||||
if (!empty($_POST['v_ssl'])) {
|
||||
exec ('mktemp -d', $output, $return_var);
|
||||
$tmpdir = $output[0];
|
||||
|
||||
// Certificate
|
||||
if (!empty($_POST['v_ssl_crt'])) {
|
||||
$fp = fopen($tmpdir."/".$_POST['v_domain'].".crt", 'w');
|
||||
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_crt']));
|
||||
fwrite($fp, "\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
// Key
|
||||
if (!empty($_POST['v_ssl_key'])) {
|
||||
$fp = fopen($tmpdir."/".$_POST['v_domain'].".key", 'w');
|
||||
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_key']));
|
||||
fwrite($fp, "\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
// CA
|
||||
if (!empty($_POST['v_ssl_ca'])) {
|
||||
$fp = fopen($tmpdir."/".$_POST['v_domain'].".ca", 'w');
|
||||
fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_ca']));
|
||||
fwrite($fp, "\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
$v_ssl_home = escapeshellarg($_POST['v_ssl_home']);
|
||||
exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." 'no'", $output, $return_var);
|
||||
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);
|
||||
}
|
||||
|
||||
// Add WebStats
|
||||
if ((!empty($_POST['v_stats'])) && ($_POST['v_stats'] != 'none' ) && (empty($_SESSION['error_msg']))) {
|
||||
$v_stats = escapeshellarg($_POST['v_stats']);
|
||||
exec (VESTA_CMD."v-add-web-domain-stats ".$user." ".$v_domain." ".$v_stats, $output, $return_var);
|
||||
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($_POST['v_stats_user'])) && (empty($_SESSION['error_msg']))) {
|
||||
$v_stats_user = escapeshellarg($_POST['v_stats_user']);
|
||||
$v_stats_password = escapeshellarg($_POST['v_stats_password']);
|
||||
exec (VESTA_CMD."v-add-web-domain-stats-user ".$user." ".$v_domain." ".$v_stats_user." ".$v_stats_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;
|
||||
}
|
||||
unset($v_stats_user);
|
||||
unset($v_stats_password);
|
||||
unset($output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add FTP
|
||||
if ((!empty($_POST['v_ftp'])) && (empty($_SESSION['error_msg']))) {
|
||||
$v_ftp_user = escapeshellarg($_POST['v_ftp_user']);
|
||||
$v_ftp_password = escapeshellarg($_POST['v_ftp_password']);
|
||||
exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_user." ".$v_ftp_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;
|
||||
} else {
|
||||
if (!empty($v_ftp_email)) {
|
||||
$to = $_POST['v_ftp_email'];
|
||||
$subject = _("FTP login credentials");
|
||||
$hostname = exec('hostname');
|
||||
$from = _('MAIL_FROM',$hostname);
|
||||
$mailtext .= _('FTP_ACCOUNT_READY',$_POST['v_domain'],$user,$_POST['v_ftp_user'],$_POST['v_ftp_password']);
|
||||
send_email($to, $subject, $mailtext, $from);
|
||||
unset($v_ftp_email);
|
||||
}
|
||||
}
|
||||
unset($v_ftp);
|
||||
unset($v_ftp_user);
|
||||
unset($v_ftp_password);
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (($_POST['v_dns'] == 'on') && (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;
|
||||
}
|
||||
unset($output);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['error_msg'])) {
|
||||
exec (VESTA_CMD."v-restart-web", $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);
|
||||
$_SESSION['ok_msg'] = _('HOSTING_DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]);
|
||||
unset($v_domain);
|
||||
unset($v_aliases);
|
||||
unset($v_ssl);
|
||||
unset($v_ssl_crt);
|
||||
unset($v_ssl_key);
|
||||
unset($v_ssl_ca);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exec (VESTA_CMD."v-list-user-ips ".$user." json", $output, $return_var);
|
||||
$ips = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
exec (VESTA_CMD."v-get-user-value ".$user." 'TEMPLATE'", $output, $return_var);
|
||||
$template = $output[0] ;
|
||||
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-web-stats json", $output, $return_var);
|
||||
$stats = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
// Are you admin?
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_web.html');
|
||||
} else {
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_web.html');
|
||||
}
|
||||
unset($_SESSION['error_msg']);
|
||||
unset($_SESSION['ok_msg']);
|
||||
//}
|
||||
|
||||
// Footer
|
||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue