diff --git a/bin/v_suspend_dns_domain b/bin/v_suspend_dns_domain
index 848bd3ae0..eb154e8a2 100755
--- a/bin/v_suspend_dns_domain
+++ b/bin/v_suspend_dns_domain
@@ -46,6 +46,7 @@ sed -i "/\/$domain.db\"/d" /etc/named.conf
# Adding suspend in config
update_object_value 'dns' 'DOMAIN' "$domain" '$SUSPENDED' 'yes'
+sed -i "s/SUSPENDED='no'/SUSPENDED='yes'/g" $USER_DATA/dns/$domain.conf
increase_user_value "$user" '$SUSPENDED_DNS'
# Restart named
diff --git a/bin/v_suspend_dns_domain_record b/bin/v_suspend_dns_domain_record
new file mode 100755
index 000000000..58f1028fb
--- /dev/null
+++ b/bin/v_suspend_dns_domain_record
@@ -0,0 +1,71 @@
+#!/bin/bash
+# info: suspend dns domain record
+# options: user domain id [restart]
+#
+# The function suspends a certain domain record.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$(idn -t --quiet -u "$2" )
+domain_idn=$(idn -t --quiet -a "$domain")
+id=$3
+restart="$4"
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/domain.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '3' "$#" 'user domain id [restart]'
+validate_format 'user' 'domain' 'id'
+is_system_enabled "$DNS_SYSTEM"
+is_object_valid 'user' 'USER' "$user"
+is_object_valid 'dns' 'DOMAIN' "$domain"
+is_object_unsuspended 'dns' 'DOMAIN' "$domain"
+is_object_valid "dns/$domain" 'ID' "$id"
+is_object_unsuspended "dns/$domain" 'ID' "$id"
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+line=$(grep "ID='$id'" $USER_DATA/dns/$domain.conf)
+eval $line
+sed -i "/^ID='$id'/d" $USER_DATA/dns/$domain.conf
+
+# Adding record
+dns_rec="ID='$id' RECORD='$RECORD' TYPE='$TYPE' PRIORITY='$PRIORITY'"
+dns_rec="$dns_rec VALUE='$VALUE' SUSPENDED='yes' TIME='$TIME' DATE='$DATE'"
+echo "$dns_rec" >> $USER_DATA/dns/$domain.conf
+
+# Sorting records
+sort_dns_records
+
+# Updating zone
+update_domain_zone
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+# Restart named
+if [ "$restart" != 'no' ]; then
+ $BIN/v_restart_dns "$EVENT"
+fi
+
+# Logging
+log_event "$OK" "$EVENT"
+
+exit
diff --git a/bin/v_unsuspend_dns_domain b/bin/v_unsuspend_dns_domain
index 5b9bf69c4..ce8b1d48c 100755
--- a/bin/v_unsuspend_dns_domain
+++ b/bin/v_unsuspend_dns_domain
@@ -47,6 +47,8 @@ echo "zone \"$domain\" { type master; file \"/etc/namedb/$domain.db\"; };" \
# Unsuspending domain in config
update_object_value 'dns' 'DOMAIN' "$domain" '$SUSPENDED' 'no'
decrease_user_value "$user" '$SUSPENDED_DNS'
+sed -i "s/SUSPENDED='yes'/SUSPENDED='no'/g" $USER_DATA/dns/$domain.conf
+
# Restart named
if [ "$restart" != 'no' ]; then
diff --git a/bin/v_unsuspend_dns_domain_record b/bin/v_unsuspend_dns_domain_record
new file mode 100755
index 000000000..19cf9ffba
--- /dev/null
+++ b/bin/v_unsuspend_dns_domain_record
@@ -0,0 +1,70 @@
+#!/bin/bash
+# info: unsuspend dns domain record
+# options: user domain id [restart]
+#
+# The function unsuspends a certain domain record.
+
+
+#----------------------------------------------------------#
+# Variable&Function #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$(idn -t --quiet -u "$2" )
+domain_idn=$(idn -t --quiet -a "$domain")
+id=$3
+restart="$4"
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/domain.sh
+
+
+#----------------------------------------------------------#
+# Verifications #
+#----------------------------------------------------------#
+
+check_args '3' "$#" 'user domain id [restart]'
+validate_format 'user' 'domain' 'id'
+is_system_enabled "$DNS_SYSTEM"
+is_object_valid 'user' 'USER' "$user"
+is_object_valid 'dns' 'DOMAIN' "$domain"
+is_object_unsuspended 'dns' 'DOMAIN' "$domain"
+is_object_valid "dns/$domain" 'ID' "$id"
+
+
+#----------------------------------------------------------#
+# Action #
+#----------------------------------------------------------#
+
+line=$(grep "ID='$id'" $USER_DATA/dns/$domain.conf)
+eval $line
+sed -i "/^ID='$id'/d" $USER_DATA/dns/$domain.conf
+
+# Adding record
+dns_rec="ID='$id' RECORD='$RECORD' TYPE='$TYPE' PRIORITY='$PRIORITY'"
+dns_rec="$dns_rec VALUE='$VALUE' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
+echo "$dns_rec" >> $USER_DATA/dns/$domain.conf
+
+# Sorting records
+sort_dns_records
+
+# Updating zone
+update_domain_zone
+
+
+#----------------------------------------------------------#
+# Vesta #
+#----------------------------------------------------------#
+
+# Restart named
+if [ "$restart" != 'no' ]; then
+ $BIN/v_restart_dns "$EVENT"
+fi
+
+# Logging
+log_event "$OK" "$EVENT"
+
+exit
diff --git a/data/templates/dns/default.tpl b/data/templates/dns/default.tpl
index e25c4c885..6d19ccca9 100644
--- a/data/templates/dns/default.tpl
+++ b/data/templates/dns/default.tpl
@@ -1,9 +1,9 @@
-ID='1' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns1%.' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='2' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns2%.' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='3' RECORD='@' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='4' RECORD='mail' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='5' RECORD='www' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='6' RECORD='pop' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='7' RECORD='ftp' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='8' RECORD='@' TYPE='MX' PRIORITY='10' VALUE='mail' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='9' RECORD='@' TYPE='TXT' PRIORITY='' VALUE='"v=spf1 a mx ip4:%ip% ?all"' SUSPEND='no' TIME='%time%' DATE='%date%'
+ID='1' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns1%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='2' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns2%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='3' RECORD='@' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='4' RECORD='mail' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='5' RECORD='www' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='6' RECORD='pop' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='7' RECORD='ftp' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='8' RECORD='@' TYPE='MX' PRIORITY='10' VALUE='mail' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='9' RECORD='@' TYPE='TXT' PRIORITY='' VALUE='"v=spf1 a mx ip4:%ip% ?all"' SUSPENDED='no' TIME='%time%' DATE='%date%'
diff --git a/data/templates/dns/gmail.tpl b/data/templates/dns/gmail.tpl
index 052bf6d67..950cfa456 100644
--- a/data/templates/dns/gmail.tpl
+++ b/data/templates/dns/gmail.tpl
@@ -1,14 +1,14 @@
-ID='1' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns1%.' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='2' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns2%.' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='3' RECORD='@' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='4' RECORD='ftp' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='5' RECORD='localhost' TYPE='A' PRIORITY='' VALUE='127.0.0.1' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='6' RECORD='mail' TYPE='CNAME' PRIORITY='' VALUE='ghs.google.com.' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='7' RECORD='pop' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='8' RECORD='www' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='9' RECORD='@' TYPE='MX' PRIORITY='1' VALUE='ASPMX.L.GOOGLE.COM.' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='10' RECORD='@' TYPE='MX' PRIORITY='5' VALUE='ALT1.ASPMX.L.GOOGLE.COM.' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='11' RECORD='@' TYPE='MX' PRIORITY='5' VALUE='ALT2.ASPMX.L.GOOGLE.COM.' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='12' RECORD='@' TYPE='MX' PRIORITY='10' VALUE='ASPMX2.GOOGLEMAIL.COM.' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='13' RECORD='@' TYPE='MX' PRIORITY='10' VALUE='ASPMX3.GOOGLEMAIL.COM.' SUSPEND='no' TIME='%time%' DATE='%date%'
-ID='14' RECORD='@' TYPE='TXT' PRIORITY='' VALUE='"v=spf1 a mx ip4:%ip% ?all"' SUSPEND='no' TIME='%time%' DATE='%date%'
+ID='1' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns1%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='2' RECORD='@' TYPE='NS' PRIORITY='' VALUE='%ns2%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='3' RECORD='@' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='4' RECORD='ftp' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='5' RECORD='localhost' TYPE='A' PRIORITY='' VALUE='127.0.0.1' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='6' RECORD='mail' TYPE='CNAME' PRIORITY='' VALUE='ghs.google.com.' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='7' RECORD='pop' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='8' RECORD='www' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='9' RECORD='@' TYPE='MX' PRIORITY='1' VALUE='ASPMX.L.GOOGLE.COM.' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='10' RECORD='@' TYPE='MX' PRIORITY='5' VALUE='ALT1.ASPMX.L.GOOGLE.COM.' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='11' RECORD='@' TYPE='MX' PRIORITY='5' VALUE='ALT2.ASPMX.L.GOOGLE.COM.' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='12' RECORD='@' TYPE='MX' PRIORITY='10' VALUE='ASPMX2.GOOGLEMAIL.COM.' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='13' RECORD='@' TYPE='MX' PRIORITY='10' VALUE='ASPMX3.GOOGLEMAIL.COM.' SUSPENDED='no' TIME='%time%' DATE='%date%'
+ID='14' RECORD='@' TYPE='TXT' PRIORITY='' VALUE='"v=spf1 a mx ip4:%ip% ?all"' SUSPENDED='no' TIME='%time%' DATE='%date%'
diff --git a/func/domain.sh b/func/domain.sh
index 7a1e58697..a33614344 100644
--- a/func/domain.sh
+++ b/func/domain.sh
@@ -114,7 +114,9 @@ update_domain_zone() {
done
RECORD=$(idn --quiet -a -t "$RECORD")
- eval echo -e "\"$fields\""|sed -e "s/%quote%/'/g" >> $conf
+ if [ "$SUSPENDED" != 'yes' ]; then
+ eval echo -e "\"$fields\""|sed -e "s/%quote%/'/g" >> $conf
+ fi
done < $USER_DATA/dns/$domain.conf
}
diff --git a/web/suspend/dns/index.php b/web/suspend/dns/index.php
new file mode 100644
index 000000000..aa4bb4819
--- /dev/null
+++ b/web/suspend/dns/index.php
@@ -0,0 +1,69 @@
+', $output);
+ if (empty($error)) $error = 'Error: vesta did not return any output.';
+ $_SESSION['error_msg'] = $error;
+ } else {
+ $_SESSION['ok_msg'] = "OK: dns domain ".$_GET['domain']." has been suspended.";
+ unset($v_lname);
+ }
+ unset($output);
+
+ include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_dns.html');
+ include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_dns.html');
+ unset($_SESSION['error_msg']);
+ unset($_SESSION['ok_msg']);
+ }
+
+ // 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_suspend_dns_domain_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;
+ } else {
+ $_SESSION['ok_msg'] = "OK: dns record has been suspended.";
+ unset($v_lname);
+ }
+ unset($output);
+
+ include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_dns_rec.html');
+ include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_dns_rec.html');
+ unset($_SESSION['error_msg']);
+ unset($_SESSION['ok_msg']);
+ }
+
+}
+
+// Footer
+include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
diff --git a/web/templates/admin/list_dns.html b/web/templates/admin/list_dns.html
index 9b6aaff64..2c7b00e77 100644
--- a/web/templates/admin/list_dns.html
+++ b/web/templates/admin/list_dns.html
@@ -5,12 +5,51 @@ foreach ($data as $key => $value) {
++$i;
if ($data[$key]['SUSPENDED'] == 'yes') {
$status = 'suspended';
- $spnd_action = 'ususpend' ;
+ $spnd_action = 'unsuspend' ;
} else {
$status = 'active';
$spnd_action = 'suspend' ;
}
?>
+
@@ -27,7 +66,13 @@ foreach ($data as $key => $value) {
| list records |
add record |
edit |
- |
+
+
+ ">
+ " title="Confirmation">
+ Are you sure you want to domain?
+
+ |
delete |
diff --git a/web/templates/admin/list_dns_rec.html b/web/templates/admin/list_dns_rec.html
index 1c29c0094..fde585e5d 100644
--- a/web/templates/admin/list_dns_rec.html
+++ b/web/templates/admin/list_dns_rec.html
@@ -5,12 +5,51 @@ foreach ($data as $key => $value) {
++$i;
if ($data[$key]['SUSPENDED'] == 'yes') {
$status = 'suspended';
- $spnd_action = 'ususpend' ;
+ $spnd_action = 'unsuspend' ;
} else {
$status = 'active';
$spnd_action = 'suspend' ;
}
?>
+
@@ -24,7 +63,14 @@ foreach ($data as $key => $value) {
|
edit |
- |
+
+
+ ">
+ " title="Confirmation">
+ Are you sure you want to record?
+
+ |
+
delete |
diff --git a/web/templates/admin/menu_suspend_dns.html b/web/templates/admin/menu_suspend_dns.html
new file mode 100644
index 000000000..199a7e01f
--- /dev/null
+++ b/web/templates/admin/menu_suspend_dns.html
@@ -0,0 +1,15 @@
+
diff --git a/web/templates/admin/menu_suspend_dns_rec.html b/web/templates/admin/menu_suspend_dns_rec.html
new file mode 100644
index 000000000..199a7e01f
--- /dev/null
+++ b/web/templates/admin/menu_suspend_dns_rec.html
@@ -0,0 +1,15 @@
+
diff --git a/web/templates/admin/menu_unsuspend_dns.html b/web/templates/admin/menu_unsuspend_dns.html
new file mode 100644
index 000000000..199a7e01f
--- /dev/null
+++ b/web/templates/admin/menu_unsuspend_dns.html
@@ -0,0 +1,15 @@
+
diff --git a/web/templates/admin/menu_unsuspend_dns_rec.html b/web/templates/admin/menu_unsuspend_dns_rec.html
new file mode 100644
index 000000000..199a7e01f
--- /dev/null
+++ b/web/templates/admin/menu_unsuspend_dns_rec.html
@@ -0,0 +1,15 @@
+
diff --git a/web/templates/admin/suspend_dns.html b/web/templates/admin/suspend_dns.html
new file mode 100644
index 000000000..d48702161
--- /dev/null
+++ b/web/templates/admin/suspend_dns.html
@@ -0,0 +1,30 @@
+
diff --git a/web/templates/admin/suspend_dns_rec.html b/web/templates/admin/suspend_dns_rec.html
new file mode 100644
index 000000000..56ae798f8
--- /dev/null
+++ b/web/templates/admin/suspend_dns_rec.html
@@ -0,0 +1,31 @@
+
diff --git a/web/templates/admin/unsuspend_dns.html b/web/templates/admin/unsuspend_dns.html
new file mode 100644
index 000000000..2913d17d3
--- /dev/null
+++ b/web/templates/admin/unsuspend_dns.html
@@ -0,0 +1,30 @@
+
diff --git a/web/templates/admin/unsuspend_dns_rec.html b/web/templates/admin/unsuspend_dns_rec.html
new file mode 100644
index 000000000..f24c16550
--- /dev/null
+++ b/web/templates/admin/unsuspend_dns_rec.html
@@ -0,0 +1,31 @@
+
diff --git a/web/unsuspend/dns/index.php b/web/unsuspend/dns/index.php
new file mode 100644
index 000000000..8b6f4b2bb
--- /dev/null
+++ b/web/unsuspend/dns/index.php
@@ -0,0 +1,67 @@
+', $output);
+ if (empty($error)) $error = 'Error: vesta did not return any output.';
+ $_SESSION['error_msg'] = $error;
+ } else {
+ $_SESSION['ok_msg'] = "OK: dns domain ".$_GET['domain']." has been unsuspended.";
+ }
+ unset($output);
+
+ include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_unsuspend_dns.html');
+ include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/unsuspend_dns.html');
+ unset($_SESSION['error_msg']);
+ unset($_SESSION['ok_msg']);
+ }
+
+ // 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_unsuspend_dns_domain_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;
+ } else {
+ $_SESSION['ok_msg'] = "OK: dns record has been unsuspended.";
+ }
+ unset($output);
+
+ include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_unsuspend_dns_rec.html');
+ include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/unsuspend_dns_rec.html');
+ unset($_SESSION['error_msg']);
+ unset($_SESSION['ok_msg']);
+ }
+
+}
+
+// Footer
+include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');
|