diff --git a/web/delete/backup/index.php b/web/delete/backup/index.php
index d472e6c7..8524bd06 100644
--- a/web/delete/backup/index.php
+++ b/web/delete/backup/index.php
@@ -5,24 +5,17 @@ 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'];
- }
+if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
+ $user=$_GET['user'];
+}
- if (!empty($_GET['backup'])) {
- $v_username = escapeshellarg($user);
- $v_backup = escapeshellarg($_GET['backup']);
- exec (VESTA_CMD."v-delete-user-backup ".$v_username." ".$v_backup, $output, $return_var);
- }
- if ($return_var != 0) {
- $error = implode('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
- unset($output);
-
-//}
+if (!empty($_GET['backup'])) {
+ $v_username = escapeshellarg($user);
+ $v_backup = escapeshellarg($_GET['backup']);
+ exec (VESTA_CMD."v-delete-user-backup ".$v_username." ".$v_backup, $output, $return_var);
+}
+check_return_code($return_var,$output);
+unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
diff --git a/web/delete/cron/index.php b/web/delete/cron/index.php
index 9aac32aa..6cadb6ef 100644
--- a/web/delete/cron/index.php
+++ b/web/delete/cron/index.php
@@ -5,24 +5,17 @@ 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'];
- }
+if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
+ $user=$_GET['user'];
+}
- if (!empty($_GET['job'])) {
- $v_username = escapeshellarg($user);
- $v_job = escapeshellarg($_GET['job']);
- exec (VESTA_CMD."v-delete-cron-job ".$v_username." ".$v_job, $output, $return_var);
- }
- if ($return_var != 0) {
- $error = implode('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
- unset($output);
-
-//}
+if (!empty($_GET['job'])) {
+ $v_username = escapeshellarg($user);
+ $v_job = escapeshellarg($_GET['job']);
+ exec (VESTA_CMD."v-delete-cron-job ".$v_username." ".$v_job, $output, $return_var);
+}
+check_return_code($return_var,$output);
+unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
diff --git a/web/delete/db/index.php b/web/delete/db/index.php
index 5404a9f2..3ad256f7 100644
--- a/web/delete/db/index.php
+++ b/web/delete/db/index.php
@@ -5,24 +5,17 @@ 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'];
- }
+if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
+ $user=$_GET['user'];
+}
- if (!empty($_GET['database'])) {
- $v_username = escapeshellarg($user);
- $v_database = escapeshellarg($_GET['database']);
- exec (VESTA_CMD."v-delete-database ".$v_username." ".$v_database, $output, $return_var);
- }
- if ($return_var != 0) {
- $error = implode('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
- unset($output);
-
-//}
+if (!empty($_GET['database'])) {
+ $v_username = escapeshellarg($user);
+ $v_database = escapeshellarg($_GET['database']);
+ exec (VESTA_CMD."v-delete-database ".$v_username." ".$v_database, $output, $return_var);
+}
+check_return_code($return_var,$output);
+unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
diff --git a/web/delete/dns/index.php b/web/delete/dns/index.php
index 6b6798d8..4cd6b709 100644
--- a/web/delete/dns/index.php
+++ b/web/delete/dns/index.php
@@ -5,53 +5,44 @@ 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'];
- }
+// Delete as someone else?
+if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
+ $user=$_GET['user'];
+}
- // DNS domain
- if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
- $v_username = escapeshellarg($user);
- $v_domain = escapeshellarg($_GET['domain']);
- exec (VESTA_CMD."v-delete-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
- if ($return_var != 0) {
- $error = implode('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
- unset($output);
+// DNS domain
+if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
+ $v_username = escapeshellarg($user);
+ $v_domain = escapeshellarg($_GET['domain']);
+ exec (VESTA_CMD."v-delete-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
- $back = $_SESSION['back'];
- if (!empty($back)) {
- header("Location: ".$back);
- exit;
- }
- header("Location: /list/dns/");
+ $back = $_SESSION['back'];
+ if (!empty($back)) {
+ header("Location: ".$back);
exit;
}
+ header("Location: /list/dns/");
+ exit;
+}
- // DNS record
- if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
- $v_username = escapeshellarg($user);
- $v_domain = escapeshellarg($_GET['domain']);
- $v_record_id = escapeshellarg($_GET['record_id']);
- exec (VESTA_CMD."v-delete-dns-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
- if ($return_var != 0) {
- $error = implode('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
- unset($output);
- $back = $_SESSION['back'];
- if (!empty($back)) {
- header("Location: ".$back);
- exit;
- }
- header("Location: /list/dns/?domain=".$_GET['domain']);
+// DNS record
+if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
+ $v_username = escapeshellarg($user);
+ $v_domain = escapeshellarg($_GET['domain']);
+ $v_record_id = escapeshellarg($_GET['record_id']);
+ exec (VESTA_CMD."v-delete-dns-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
+ $back = $_SESSION['back'];
+ if (!empty($back)) {
+ header("Location: ".$back);
exit;
}
-//}
+ header("Location: /list/dns/?domain=".$_GET['domain']);
+ exit;
+}
$back = $_SESSION['back'];
if (!empty($back)) {
diff --git a/web/delete/ip/index.php b/web/delete/ip/index.php
index 60c4039d..dd0ac97f 100644
--- a/web/delete/ip/index.php
+++ b/web/delete/ip/index.php
@@ -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('
', $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);
}
diff --git a/web/delete/mail/index.php b/web/delete/mail/index.php
index 6f2a0df9..579dc57d 100644
--- a/web/delete/mail/index.php
+++ b/web/delete/mail/index.php
@@ -5,52 +5,43 @@ 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'];
- }
+// Delete as someone else?
+if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
+ $user=$_GET['user'];
+}
- // Mail domain
- if ((!empty($_GET['domain'])) && (empty($_GET['account']))) {
- $v_username = escapeshellarg($user);
- $v_domain = escapeshellarg($_GET['domain']);
- exec (VESTA_CMD."v-delete-mail-domain ".$v_username." ".$v_domain, $output, $return_var);
- if ($return_var != 0) {
- $error = implode('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
- unset($output);
- $back = $_SESSION['back'];
- if (!empty($back)) {
- header("Location: ".$back);
- exit;
- }
- header("Location: /list/mail/");
+// Mail domain
+if ((!empty($_GET['domain'])) && (empty($_GET['account']))) {
+ $v_username = escapeshellarg($user);
+ $v_domain = escapeshellarg($_GET['domain']);
+ exec (VESTA_CMD."v-delete-mail-domain ".$v_username." ".$v_domain, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
+ $back = $_SESSION['back'];
+ if (!empty($back)) {
+ header("Location: ".$back);
exit;
}
+ header("Location: /list/mail/");
+ exit;
+}
- // Mail account
- if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) {
- $v_username = escapeshellarg($user);
- $v_domain = escapeshellarg($_GET['domain']);
- $v_account = escapeshellarg($_GET['account']);
- exec (VESTA_CMD."v-delete-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var);
- if ($return_var != 0) {
- $error = implode('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
- unset($output);
- $back = $_SESSION['back'];
- if (!empty($back)) {
- header("Location: ".$back);
- exit;
- }
- header("Location: /list/mail/?domain=".$_GET['domain']);
+// Mail account
+if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) {
+ $v_username = escapeshellarg($user);
+ $v_domain = escapeshellarg($_GET['domain']);
+ $v_account = escapeshellarg($_GET['account']);
+ exec (VESTA_CMD."v-delete-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
+ $back = $_SESSION['back'];
+ if (!empty($back)) {
+ header("Location: ".$back);
exit;
}
-//}
+ header("Location: /list/mail/?domain=".$_GET['domain']);
+ exit;
+}
$back = $_SESSION['back'];
if (!empty($back)) {
diff --git a/web/delete/package/index.php b/web/delete/package/index.php
index 12f85bbc..7fc9d2e3 100644
--- a/web/delete/package/index.php
+++ b/web/delete/package/index.php
@@ -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('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
+ check_return_code($return_var,$output);
unset($output);
}
diff --git a/web/delete/user/index.php b/web/delete/user/index.php
index 49041e70..2d5c0edd 100644
--- a/web/delete/user/index.php
+++ b/web/delete/user/index.php
@@ -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('
', $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);
}
diff --git a/web/delete/web/index.php b/web/delete/web/index.php
index ee66335c..d110fe05 100644
--- a/web/delete/web/index.php
+++ b/web/delete/web/index.php
@@ -5,46 +5,34 @@ 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'];
- }
+// Delete as someone else?
+if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
+ $user=$_GET['user'];
+}
if (!empty($_GET['domain'])) {
$v_username = escapeshellarg($user);
$v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-delete-web-domain ".$v_username." ".$v_domain, $output, $return_var);
- if ($return_var != 0) {
- $error = implode('
', $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('
', $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('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
+ check_return_code($return_var,$output);
unset($output);
}
}
diff --git a/web/suspend/cron/index.php b/web/suspend/cron/index.php
index 2703547b..896456ba 100644
--- a/web/suspend/cron/index.php
+++ b/web/suspend/cron/index.php
@@ -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('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
+ check_return_code($return_var,$output);
unset($output);
}
diff --git a/web/suspend/db/index.php b/web/suspend/db/index.php
index e107f509..d9ef85f9 100644
--- a/web/suspend/db/index.php
+++ b/web/suspend/db/index.php
@@ -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('
', $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'];
diff --git a/web/suspend/dns/index.php b/web/suspend/dns/index.php
index 5e268a5f..5d183ca4 100644
--- a/web/suspend/dns/index.php
+++ b/web/suspend/dns/index.php
@@ -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('
', $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('
', $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)) {
diff --git a/web/suspend/mail/index.php b/web/suspend/mail/index.php
index 9dff6f85..60efa93c 100644
--- a/web/suspend/mail/index.php
+++ b/web/suspend/mail/index.php
@@ -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('
', $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,14 +32,10 @@ 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('
', $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)) {
+ $back = $_SESSION['back'];
+ if (!empty($back)) {
header("Location: ".$back);
exit;
}
diff --git a/web/suspend/user/index.php b/web/suspend/user/index.php
index 9b02ee4d..fe82446d 100644
--- a/web/suspend/user/index.php
+++ b/web/suspend/user/index.php
@@ -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('
', $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'];
diff --git a/web/suspend/web/index.php b/web/suspend/web/index.php
index 1e51f207..89384db8 100644
--- a/web/suspend/web/index.php
+++ b/web/suspend/web/index.php
@@ -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('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
+ check_return_code($return_var,$output);
unset($output);
}
diff --git a/web/unsuspend/cron/index.php b/web/unsuspend/cron/index.php
index 71b74534..5c383376 100644
--- a/web/unsuspend/cron/index.php
+++ b/web/unsuspend/cron/index.php
@@ -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('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
+ check_return_code($return_var,$output);
unset($output);
}
diff --git a/web/unsuspend/db/index.php b/web/unsuspend/db/index.php
index e5c89204..a3e947f3 100644
--- a/web/unsuspend/db/index.php
+++ b/web/unsuspend/db/index.php
@@ -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);
}
}
diff --git a/web/unsuspend/user/index.php b/web/unsuspend/user/index.php
index ea4c9a80..9ff30029 100644
--- a/web/unsuspend/user/index.php
+++ b/web/unsuspend/user/index.php
@@ -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('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
+ check_return_code($return_var,$output);
unset($output);
}
diff --git a/web/unsuspend/web/index.php b/web/unsuspend/web/index.php
index 57dc40df..a2239f00 100644
--- a/web/unsuspend/web/index.php
+++ b/web/unsuspend/web/index.php
@@ -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('
', $output);
- if (empty($error)) $error = __('Error: vesta did not return any output.');
- $_SESSION['error_msg'] = $error;
- }
+ check_return_code($return_var,$output);
unset($output);
}