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

@ -24,11 +24,8 @@ if ($_SESSION['user'] == 'admin') {
$v_ip = escapeshellarg($_GET['ip']);
exec (VESTA_CMD."v-list-sys-ip ".$v_ip." 'json'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
} else {
check_return_code($return_var,$output);
if (empty($_SESSION['error_msg'])) {
$data = json_decode(implode('', $output), true);
unset($output);
$v_username = $user;
@ -61,21 +58,13 @@ if ($_SESSION['user'] == 'admin') {
// Change Status
if (($v_ipstatus == 'shared') && (empty($_POST['v_shared'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-change-sys-ip-status ".$v_ip." 'dedicated'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
$v_dedicated = 'yes';
}
if (($v_ipstatus == 'dedicated') && (!empty($_POST['v_shared'])) && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v-change-sys-ip-status ".$v_ip." 'shared'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
unset($v_dedicated);
}
@ -84,11 +73,7 @@ if ($_SESSION['user'] == 'admin') {
if (($v_owner != $_POST['v_owner']) && (empty($_SESSION['error_msg']))) {
$v_owner = escapeshellarg($_POST['v_owner']);
exec (VESTA_CMD."v-change-sys-ip-owner ".$v_ip." ".$v_owner, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
$v_owner = $_POST['v_owner'];
unset($output);
}
@ -97,11 +82,7 @@ if ($_SESSION['user'] == 'admin') {
if (($v_name != $_POST['v_name']) && (empty($_SESSION['error_msg']))) {
$v_name = escapeshellarg($_POST['v_name']);
exec (VESTA_CMD."v-change-sys-ip-name ".$v_ip." ".$v_name, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = __('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
check_return_code($return_var,$output);
unset($output);
}
@ -109,11 +90,7 @@ if ($_SESSION['user'] == 'admin') {
if (($v_nat != $_POST['v_nat']) && (empty($_SESSION['error_msg']))) {
$v_nat = escapeshellarg($_POST['v_nat']);
exec (VESTA_CMD."v-change-sys-ip-nat ".$v_ip." ".$v_nat, $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);
}