check_return_code function

This commit is contained in:
Serghey Rodin 2013-10-29 00:34:26 +02:00
commit 80d5dd9ab0
16 changed files with 298 additions and 725 deletions

View file

@ -44,13 +44,10 @@ if (!empty($_POST['ok'])) {
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
unset($v_password);
unset($output);
} else {
check_return_code($return_var,$output);
unset($v_password);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('CRON_CREATED_OK');
unset($v_min);
unset($v_hour);

View file

@ -62,14 +62,9 @@ if (!empty($_POST['ok'])) {
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
unset($v_password);
unset($output);
}
if ((!empty($v_db_email)) && ($return_var == 0)) {
check_return_code($return_var,$output);
unset($output);
if ((!empty($v_db_email)) && (empty($_SESSION['error_msg']))) {
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]);
if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/";
if ($_POST['v_type'] == 'pgsql') $db_admin_link = "http://".$http_host."/phppgadmin/";
@ -80,13 +75,14 @@ if (!empty($_POST['ok'])) {
$mailtext = __('DATABASE_READY',$user."_".$_POST['v_database'],$user."_".$_POST['v_dbuser'],$_POST['v_password'],$db_admin_link);
send_email($to, $subject, $mailtext, $from);
}
$_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);
if (empty($_SESSION['error_msg'])) {
$_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);
}
}
}

View file

@ -41,34 +41,22 @@ if (!empty($_POST['ok'])) {
} else {
// Add DNS
exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$v_ns4, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
// Change TTL
if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400')) {
if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400') && (empty($_SESSION['error_msg']))) {
$v_ttl = escapeshellarg($_POST['v_ttl']);
exec (VESTA_CMD."v-change-dns-domain-ttl ".$user." ".$v_domain." ".$v_ttl, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
@ -108,11 +96,7 @@ if (!empty($_POST['ok_rec'])) {
// Add DNS Record
exec (VESTA_CMD."v-add-dns-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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('DNS_RECORD_CREATED_OK',$_POST[v_rec],$_POST[v_domain]);

View file

@ -55,19 +55,14 @@ if ($_SESSION['user'] == 'admin') {
exec (VESTA_CMD."v-add-sys-ip ".$v_ip." ".$v_netmask." ".$v_interface." ".$v_owner." '".$ip_status."' ".$v_name." ".$v_nat, $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 code:',$return_var);
$_SESSION['error_msg'] = $error;
unset($v_password);
unset($output);
} else {
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('IP_CREATED_OK',$_POST['v_ip'],$_POST['v_ip']);
unset($v_ip);
unset($v_netmask);
unset($v_name);
unset($v_nat);
unset($output);
}
}
}

View file

@ -12,171 +12,153 @@ 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);
$v_domain = strtolower($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'] = __('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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('MAIL_DOMAIN_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_domain = strtolower($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'] = __('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 code:',$return_var);
$_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'])) {
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
$_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',$_POST['v_account'],$_POST[v_domain],$_POST['v_account'],$_POST[v_domain]);
$_SESSION['ok_msg'] .= " / <a href=http://".$http_host."/webmail target='_blank'>" . __('open webmail') . "</a>";
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 = (isset($_GET['domain'])?$_GET['domain']:'');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail.html');
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
// Mail Domain
if (!empty($_POST['ok'])) {
if (empty($_POST['v_domain'])) $errors[] = __('domain');
if (!empty($_POST['v_antispam'])) {
$v_antispam = 'yes';
} else {
$v_domain = $_GET['domain'];
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail_acc.html');
unset($_SESSION['error_msg']);
unset($_SESSION['ok_msg']);
$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);
$v_domain = strtolower($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'] = __('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);
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = __('MAIL_DOMAIN_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_domain = strtolower($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'] = __('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);
check_return_code($return_var,$output);
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) {
$alias = escapeshellarg($alias);
if (empty($_SESSION['error_msg'])) {
exec (VESTA_CMD."v-add-mail-account-alias ".$user." ".$v_domain." ".$v_account." ".$alias, $output, $return_var);
check_return_code($return_var,$output);
}
unset($output);
}
}
// Add 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);
check_return_code($return_var,$output);
}
unset($output);
}
}
unset($output);
if (empty($_SESSION['error_msg'])) {
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
$_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',$_POST['v_account'],$_POST[v_domain],$_POST['v_account'],$_POST[v_domain]);
$_SESSION['ok_msg'] .= " / <a href=http://".$http_host."/webmail target='_blank'>" . __('open webmail') . "</a>";
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 = (isset($_GET['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');

View file

@ -111,11 +111,7 @@ if ($_SESSION['user'] == 'admin') {
// 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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}

View file

@ -61,11 +61,9 @@ if ($_SESSION['user'] == 'admin') {
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
} else {
check_return_code($return_var,$output);
unset($output);
if (empty($_SESSION['error_msg'])) {
exec (VESTA_CMD."v-change-user-language ".$v_username." ".$v_language, $output, $return_var);
if (!empty($v_notify)) {
$to = $_POST['v_notify'];

View file

@ -97,32 +97,20 @@ $v_ftp_email = $panel[$user]['CONTACT'];
if (empty($_SESSION['error_msg'])) {
// Add WEB
exec (VESTA_CMD."v-add-web-domain ".$user." ".$v_domain." ".$v_ip." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
@ -140,20 +128,12 @@ $v_ftp_email = $panel[$user]['CONTACT'];
$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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
}
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
}
@ -164,11 +144,7 @@ $v_ftp_email = $panel[$user]['CONTACT'];
$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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
}
@ -177,11 +153,7 @@ $v_ftp_email = $panel[$user]['CONTACT'];
$ext = str_replace(' ', '', $v_proxy_ext);
$ext = escapeshellarg($ext);
exec (VESTA_CMD."v-add-web-domain-proxy ".$user." ".$v_domain." '' ".$ext." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
@ -216,11 +188,7 @@ $v_ftp_email = $panel[$user]['CONTACT'];
$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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
@ -228,22 +196,14 @@ $v_ftp_email = $panel[$user]['CONTACT'];
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($v_stats_user);
unset($v_stats_password);
unset($output);
@ -256,11 +216,8 @@ $v_ftp_email = $panel[$user]['CONTACT'];
$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 code:',$return_var);
$_SESSION['error_msg'] = $error;
} else {
check_return_code($return_var,$output);
if (empty($_SESSION['error_msg'])) {
if (!empty($v_ftp_email)) {
$to = $_POST['v_ftp_email'];
$subject = __("FTP login credentials");
@ -278,30 +235,20 @@ $v_ftp_email = $panel[$user]['CONTACT'];
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
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 code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
if (empty($_SESSION['error_msg'])) {
exec (VESTA_CMD."v-restart-proxy", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
if (empty($_SESSION['error_msg'])) {