add dns zones when editing webaliases

This commit is contained in:
Serghey Rodin 2012-07-25 10:43:25 +03:00
commit 530fc3b63d
6 changed files with 142 additions and 44 deletions

View file

@ -100,15 +100,15 @@ top_panel($user,$TAB);
}
}
unset($output);
}
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
exec (VESTA_CMD."v_add_dns_on_web_alias ".$user." ".$v_domain." 'no'", $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;
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: vesta did not return any output.';
$_SESSION['error_msg'] = $error;
}
unset($output);
}
unset($output);
}
}
@ -182,6 +182,16 @@ top_panel($user,$TAB);
unset($output);
}
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: vesta did not return any output.';
$_SESSION['error_msg'] = $error;
}
unset($output);
}
if (empty($_SESSION['error_msg'])) {
exec (VESTA_CMD."v_restart_web", $output, $return_var);
if ($return_var != 0) {
@ -205,6 +215,10 @@ top_panel($user,$TAB);
$ips = json_decode(implode('', $output), true);
unset($output);
exec (VESTA_CMD."v_get_user_value ".$user." 'TEMPLATE'", $output, $return_var);
$template = $output[0] ;
unset($output);
exec (VESTA_CMD."v_list_web_templates json", $output, $return_var);
$templates = json_decode(implode('', $output), true);
unset($output);

View file

@ -142,7 +142,7 @@ top_panel($user,$TAB);
$v_aliases = str_replace(' ', "\n", $waliases);
$result = array_diff($valiases, $aliases);
foreach ($result as $alias) {
if (empty($_SESSION['error_msg'])) {
if ((empty($_SESSION['error_msg'])) && (!empty($alias))) {
$restart_web = 'yes';
$v_template = escapeshellarg($_POST['v_template']);
exec (VESTA_CMD."v_delete_web_domain_alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
@ -152,9 +152,9 @@ top_panel($user,$TAB);
$_SESSION['error_msg'] = $error;
}
unset($output);
exec (VESTA_CMD."v_list_dns_domain ".$v_username." '".$alias."' json", $output, $return_var);
if ((empty($_SESSION['error_msg'])) && ($return_var == 0 )) {
exec (VESTA_CMD."v_delete_dns_domain ".$v_username." '".$alias."'", $output, $return_var);
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('<br>', $output);
if (empty($error)) $error = 'Error: vesta did not return any output.';
@ -168,7 +168,7 @@ top_panel($user,$TAB);
$result = array_diff($aliases, $valiases);
foreach ($result as $alias) {
if (empty($_SESSION['error_msg'])) {
if ((empty($_SESSION['error_msg'])) && (!empty($alias))) {
$restart_web = 'yes';
$v_template = escapeshellarg($_POST['v_template']);
exec (VESTA_CMD."v_add_web_domain_alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
@ -178,9 +178,8 @@ top_panel($user,$TAB);
$_SESSION['error_msg'] = $error;
}
unset($output);
exec (VESTA_CMD."v_list_dns_domain ".$v_username." '".$alias."' json", $output, $return_var);
if ((empty($_SESSION['error_msg'])) && ($return_var == 0 )) {
exec (VESTA_CMD."v_add_dns_domain ".$v_username." '".$alias."' ".$v_ip, $output, $return_var);
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('<br>', $output);
if (empty($error)) $error = 'Error: vesta did not return any output.';

View file

@ -41,7 +41,6 @@
<tr><td class="add-text" style="padding: 10px 0 0 2px;">DNS support</td></tr>
<tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_dns" <?php if (empty($v_dns)) echo "checked=yes"; ?>></tr>
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Mail support</td></tr>
<tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_mail" <?php if (empty($v_mail)) echo "checked=yes"; ?>></tr>
<tr><td class="add-text" style="padding: 10px 0 0 2px;"><a href="javascript:elementHideShow('advtable');" class="add-advanced">Advanced Options ⇢</a></td></tr>
@ -52,14 +51,15 @@
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Apache Template</td></tr>
<tr><td><select class="add-list" name="v_template">
<?php
echo "<option value=''></option>";
foreach ($templates as $key => $value) {
echo "\t\t\t\t<option value=\"".$value."\"";
if ((!empty($v_template)) && ( $key == $_POST['v_template'])){
if ((!empty($v_template)) && ( $value == $_POST['v_template'])){
echo ' selected' ;
}
echo ">".$value."</option>\n";
if ((empty($v_template)) && ( $value == $template)){
echo ' selected' ;
}
echo "> ".$value." </option>\n";
}
?>
</select></td></tr>