From 95df6666b18cad80593ed669a40997f109d39b51 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Sun, 19 May 2013 18:45:28 +0300 Subject: [PATCH] add dns only if there is dns support --- web/edit/web/index.php | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/web/edit/web/index.php b/web/edit/web/index.php index 7e7723bee..6d66bca74 100644 --- a/web/edit/web/index.php +++ b/web/edit/web/index.php @@ -167,15 +167,19 @@ if (!empty($_POST['save'])) { unset($output); if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-delete-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = __('Error code:',$return_var); - $_SESSION['error_msg'] = $error; + exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain, $output, $return_var); + unset($output); + if ($return_var == 0) { + exec (VESTA_CMD."v-delete-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = __('Error code:',$return_var); + $_SESSION['error_msg'] = $error; + } + $restart_dns = 'yes'; } - $restart_dns = 'yes'; + unset($output); } - unset($output); } } @@ -192,13 +196,17 @@ if (!empty($_POST['save'])) { } unset($output); if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = __('Error code:',$return_var); - $_SESSION['error_msg'] = $error; + exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain, $output, $return_var); + unset($output); + if ($return_var == 0) { + exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = __('Error code:',$return_var); + $_SESSION['error_msg'] = $error; + } + $restart_dns = 'yes'; } - $restart_dns = 'yes'; } unset($output); }