check_return_code function

This commit is contained in:
Serghey Rodin 2013-10-29 23:12:47 +02:00
parent 3cb02aec9d
commit d0f6d5d65f
19 changed files with 118 additions and 229 deletions

View file

@ -5,7 +5,6 @@ ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Delete as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
$user=$_GET['user'];
}
@ -15,15 +14,9 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$v_backup = escapeshellarg($_GET['backup']);
exec (VESTA_CMD."v-delete-user-backup ".$v_username." ".$v_backup, $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;
}
check_return_code($return_var,$output);
unset($output);
//}
$back = $_SESSION['back'];
if (!empty($back)) {
header("Location: ".$back);

View file

@ -5,7 +5,6 @@ ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Delete as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
$user=$_GET['user'];
}
@ -15,15 +14,9 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$v_job = escapeshellarg($_GET['job']);
exec (VESTA_CMD."v-delete-cron-job ".$v_username." ".$v_job, $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;
}
check_return_code($return_var,$output);
unset($output);
//}
$back = $_SESSION['back'];
if (!empty($back)) {
header("Location: ".$back);

View file

@ -5,7 +5,6 @@ ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Delete as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
$user=$_GET['user'];
}
@ -15,15 +14,9 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$v_database = escapeshellarg($_GET['database']);
exec (VESTA_CMD."v-delete-database ".$v_username." ".$v_database, $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;
}
check_return_code($return_var,$output);
unset($output);
//}
$back = $_SESSION['back'];
if (!empty($back)) {
header("Location: ".$back);

View file

@ -15,11 +15,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-delete-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
$back = $_SESSION['back'];
@ -37,11 +33,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$v_domain = escapeshellarg($_GET['domain']);
$v_record_id = escapeshellarg($_GET['record_id']);
exec (VESTA_CMD."v-delete-dns-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
@ -51,7 +43,6 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
header("Location: /list/dns/?domain=".$_GET['domain']);
exit;
}
//}
$back = $_SESSION['back'];
if (!empty($back)) {

View file

@ -10,12 +10,7 @@ if ($_SESSION['user'] == 'admin') {
$v_ip = escapeshellarg($_GET['ip']);
exec (VESTA_CMD."v-delete-sys-ip ".$v_ip, $output, $return_var);
}
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
if ($return_var == 4) $error = __('IP address is in use');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}

View file

@ -15,11 +15,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-delete-mail-domain ".$v_username." ".$v_domain, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
@ -36,11 +32,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$v_domain = escapeshellarg($_GET['domain']);
$v_account = escapeshellarg($_GET['account']);
exec (VESTA_CMD."v-delete-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
@ -50,7 +42,6 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
header("Location: /list/mail/?domain=".$_GET['domain']);
exit;
}
//}
$back = $_SESSION['back'];
if (!empty($back)) {

View file

@ -10,11 +10,7 @@ if ($_SESSION['user'] == 'admin') {
$v_package = escapeshellarg($_GET['package']);
exec (VESTA_CMD."v-delete-user-package ".$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;
}
check_return_code($return_var,$output);
unset($output);
}

View file

@ -10,11 +10,7 @@ if ($_SESSION['user'] == 'admin') {
$v_username = escapeshellarg($_GET['user']);
exec (VESTA_CMD."v-delete-user ".$v_username, $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;
}
check_return_code($return_var,$output);
unset($_SESSION['look']);
unset($output);
}

View file

@ -14,37 +14,25 @@ if (!empty($_GET['domain'])) {
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-delete-web-domain ".$v_username." ".$v_domain, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
// DNS
if ($return_var == 0) {
if (empty($_SESSION['error_msg'])) {
exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain." json", $output, $lreturn_var);
if ($lreturn_var == 0 ) {
exec (VESTA_CMD."v-delete-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
}
// Mail
if ($return_var == 0) {
if (empty($_SESSION['error_msg'])) {
exec (VESTA_CMD."v-list-mail-domain ".$v_username." ".$v_domain." json", $output, $lreturn_var);
if ($lreturn_var == 0 ) {
exec (VESTA_CMD."v-delete-mail-domain ".$v_username." ".$v_domain, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
}

View file

@ -14,11 +14,7 @@ if ($_SESSION['user'] == 'admin') {
$v_job = escapeshellarg($_GET['job']);
exec (VESTA_CMD."v-suspend-cron-job ".$v_username." ".$v_job, $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;
}
check_return_code($return_var,$output);
unset($output);
}

View file

@ -15,13 +15,8 @@ if ($_SESSION['user'] == 'admin') {
$v_database = escapeshellarg($_GET['database']);
exec (VESTA_CMD."v-suspend-database ".$v_username." ".$v_database, $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;
}
check_return_code($return_var,$output);
unset($output);
}
$back = $_SESSION['back'];

View file

@ -15,11 +15,7 @@ if ($_SESSION['user'] == 'admin') {
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-suspend-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
@ -36,11 +32,7 @@ if ($_SESSION['user'] == 'admin') {
$v_domain = escapeshellarg($_GET['domain']);
$v_record_id = escapeshellarg($_GET['record_id']);
exec (VESTA_CMD."v-suspend-dns-record ".$v_username." ".$v_domain." ".$v_record_id, $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;
}
check_return_code($return_var,$output);
unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
@ -49,9 +41,7 @@ if ($_SESSION['user'] == 'admin') {
}
header("Location: /list/dns/?domain=".$_GET['domain']);
exit;
}
}
$back = $_SESSION['back'];
if (!empty($back)) {

View file

@ -15,11 +15,7 @@ if ($_SESSION['user'] == 'admin') {
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-suspend-mail-domain ".$v_username." ".$v_domain, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
$back=getenv("HTTP_REFERER");
if (!empty($back)) {
@ -36,11 +32,7 @@ if ($_SESSION['user'] == 'admin') {
$v_domain = escapeshellarg($_GET['domain']);
$v_account = escapeshellarg($_GET['account']);
exec (VESTA_CMD."v-suspend-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {

View file

@ -11,13 +11,8 @@ if ($_SESSION['user'] == 'admin') {
$v_username = escapeshellarg($_GET['user']);
exec (VESTA_CMD."v-suspend-user ".$v_username, $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;
}
check_return_code($return_var,$output);
unset($output);
}
$back = $_SESSION['back'];

View file

@ -15,11 +15,7 @@ if ($_SESSION['user'] == 'admin') {
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-suspend-web-domain ".$v_username." ".$v_domain, $output, $return_var);
}
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}

View file

@ -14,11 +14,7 @@ if ($_SESSION['user'] == 'admin') {
$v_job = escapeshellarg($_GET['job']);
exec (VESTA_CMD."v-unsuspend-cron-job ".$v_username." ".$v_job, $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;
}
check_return_code($return_var,$output);
unset($output);
}

View file

@ -13,6 +13,7 @@ if ($_SESSION['user'] == 'admin') {
$v_username = escapeshellarg($user);
$v_database = escapeshellarg($_GET['database']);
exec (VESTA_CMD."v-unsuspend-database ".$v_username." ".$v_database, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
}
}

View file

@ -11,11 +11,7 @@ if ($_SESSION['user'] == 'admin') {
$v_username = escapeshellarg($_GET['user']);
exec (VESTA_CMD."v-unsuspend-user ".$v_username, $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;
}
check_return_code($return_var,$output);
unset($output);
}

View file

@ -14,11 +14,7 @@ if ($_SESSION['user'] == 'admin') {
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-unsuspend-web-domain ".$v_username." ".$v_domain, $output, $return_var);
}
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}