Просмотр исходного кода

Merge branch 'master' into patch-2

dpeca 9 лет назад
Родитель
Сommit
cfa557b22c
100 измененных файлов с 564 добавлено и 569 удалено
  1. 16 23
      bin/v-add-dns-domain
  2. 6 9
      bin/v-add-dns-record
  3. 8 10
      bin/v-add-domain
  4. 7 4
      bin/v-add-mail-account
  5. 5 3
      bin/v-add-mail-account-alias
  6. 5 3
      bin/v-add-mail-account-autoreply
  7. 5 3
      bin/v-add-mail-account-forward
  8. 5 3
      bin/v-add-mail-account-fwd-only
  9. 6 10
      bin/v-add-mail-domain
  10. 5 3
      bin/v-add-mail-domain-antispam
  11. 5 3
      bin/v-add-mail-domain-antivirus
  12. 5 3
      bin/v-add-mail-domain-catchall
  13. 5 2
      bin/v-add-mail-domain-dkim
  14. 8 24
      bin/v-add-web-domain
  15. 17 19
      bin/v-add-web-domain-alias
  16. 2 4
      bin/v-add-web-domain-backend
  17. 5 2
      bin/v-add-web-domain-ftp
  18. 2 4
      bin/v-add-web-domain-proxy
  19. 10 11
      bin/v-add-web-domain-ssl
  20. 5 2
      bin/v-add-web-domain-stats
  21. 2 2
      bin/v-backup-user
  22. 5 2
      bin/v-change-dns-domain-exp
  23. 7 6
      bin/v-change-dns-domain-ip
  24. 7 6
      bin/v-change-dns-domain-soa
  25. 7 10
      bin/v-change-dns-domain-tpl
  26. 7 6
      bin/v-change-dns-domain-ttl
  27. 7 10
      bin/v-change-dns-record
  28. 7 7
      bin/v-change-dns-record-id
  29. 10 0
      bin/v-change-domain-owner
  30. 5 3
      bin/v-change-mail-account-password
  31. 5 3
      bin/v-change-mail-account-quota
  32. 6 5
      bin/v-change-mail-domain-catchall
  33. 2 4
      bin/v-change-sys-ip-nat
  34. 10 10
      bin/v-change-web-domain-backend-tpl
  35. 5 2
      bin/v-change-web-domain-ftp-password
  36. 5 2
      bin/v-change-web-domain-ftp-path
  37. 8 14
      bin/v-change-web-domain-ip
  38. 4 5
      bin/v-change-web-domain-name
  39. 7 7
      bin/v-change-web-domain-proxy-tpl
  40. 10 11
      bin/v-change-web-domain-sslcert
  41. 10 11
      bin/v-change-web-domain-sslhome
  42. 5 2
      bin/v-change-web-domain-stats
  43. 7 6
      bin/v-change-web-domain-tpl
  44. 2 4
      bin/v-delete-dns-domain
  45. 2 4
      bin/v-delete-dns-domains
  46. 2 4
      bin/v-delete-dns-domains-src
  47. 8 5
      bin/v-delete-dns-on-web-alias
  48. 7 6
      bin/v-delete-dns-record
  49. 8 10
      bin/v-delete-domain
  50. 5 3
      bin/v-delete-mail-account
  51. 5 3
      bin/v-delete-mail-account-alias
  52. 5 3
      bin/v-delete-mail-account-autoreply
  53. 6 6
      bin/v-delete-mail-account-forward
  54. 5 3
      bin/v-delete-mail-account-fwd-only
  55. 5 2
      bin/v-delete-mail-domain
  56. 5 3
      bin/v-delete-mail-domain-antispam
  57. 5 3
      bin/v-delete-mail-domain-antivirus
  58. 5 3
      bin/v-delete-mail-domain-catchall
  59. 10 14
      bin/v-delete-web-domain
  60. 4 8
      bin/v-delete-web-domain-alias
  61. 7 6
      bin/v-delete-web-domain-backend
  62. 5 2
      bin/v-delete-web-domain-ftp
  63. 7 6
      bin/v-delete-web-domain-proxy
  64. 10 11
      bin/v-delete-web-domain-ssl
  65. 5 2
      bin/v-delete-web-domain-stats
  66. 5 9
      bin/v-delete-web-domains
  67. 5 2
      bin/v-get-dns-domain-value
  68. 5 2
      bin/v-get-mail-account-value
  69. 5 2
      bin/v-get-mail-domain-value
  70. 2 4
      bin/v-insert-dns-domain
  71. 2 4
      bin/v-insert-dns-record
  72. 2 4
      bin/v-insert-dns-records
  73. 2 4
      bin/v-rebuild-cron-jobs
  74. 2 4
      bin/v-rebuild-dns-domain
  75. 2 4
      bin/v-rebuild-dns-domains
  76. 4 8
      bin/v-rebuild-web-domains
  77. 2 4
      bin/v-suspend-cron-job
  78. 2 4
      bin/v-suspend-cron-jobs
  79. 5 2
      bin/v-suspend-dns-domain
  80. 6 7
      bin/v-suspend-dns-record
  81. 8 10
      bin/v-suspend-domain
  82. 5 3
      bin/v-suspend-mail-account
  83. 4 3
      bin/v-suspend-mail-accounts
  84. 5 3
      bin/v-suspend-mail-domain
  85. 6 8
      bin/v-suspend-user
  86. 9 10
      bin/v-suspend-web-domain
  87. 5 9
      bin/v-suspend-web-domains
  88. 2 4
      bin/v-unsuspend-cron-job
  89. 2 4
      bin/v-unsuspend-cron-jobs
  90. 5 3
      bin/v-unsuspend-dns-domain
  91. 5 6
      bin/v-unsuspend-dns-record
  92. 8 10
      bin/v-unsuspend-domain
  93. 5 3
      bin/v-unsuspend-mail-account
  94. 5 3
      bin/v-unsuspend-mail-accounts
  95. 5 3
      bin/v-unsuspend-mail-domain
  96. 6 8
      bin/v-unsuspend-user
  97. 10 11
      bin/v-unsuspend-web-domain
  98. 5 9
      bin/v-unsuspend-web-domains
  99. 5 3
      bin/v-update-mail-domain-disk
  100. 5 2
      bin/v-update-web-domain-disk

+ 16 - 23
bin/v-add-dns-domain

@@ -15,15 +15,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | sed -e 's/\.*$//g' -e 's/^\.*//g')
-if [[ "$domain" =~ [[:upper:]] ]]; then
-    domain=$(echo "$domain" |tr '[:upper:]' '[:lower:]')
-fi
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
+domain=$2
+domain_idn=$2
 ip=$3
 ns1=$4
 ns2=$5
@@ -40,6 +33,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -56,37 +53,35 @@ template=$(get_user_value '$DNS_TEMPLATE')
 is_dns_template_valid $template
 
 if [ ! -z "$ns1" ]; then
-    ns1=$(echo $4 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns1=$(echo $4 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns1'
 fi
 if [ ! -z "$ns2" ]; then
-    ns2=$(echo $5 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns2=$(echo $5 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns2'
 fi
-
 if [ ! -z "$ns3" ]; then
-    ns3=$(echo $6 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns3=$(echo $6 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns3'
 fi
 if [ ! -z "$ns4" ]; then
-    ns4=$(echo $7 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns4=$(echo $7 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns4'
 fi
 if [ ! -z "$ns5" ]; then
-    ns5=$(echo $8 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns5=$(echo $8 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns5'
 fi
 if [ ! -z "$ns6" ]; then
-    ns6=$(echo $9 | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns6=$(echo $9 |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns6'
 fi
 if [ ! -z "$ns7" ]; then
-    ns7=$(echo ${10} | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns7=$(echo ${10} |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns7'
 fi
-
 if [ ! -z "$ns8" ]; then
-    ns8=$(echo ${11} | sed -e 's/\.*$//g' -e 's/^\.*//g')
+    ns8=$(echo ${11} |sed -e 's/\.*$//g' -e 's/^\.*//g')
     is_format_valid 'ns8'
 fi
 
@@ -203,10 +198,8 @@ increase_user_value "$user" '$U_DNS_DOMAINS'
 increase_user_value "$user" '$U_DNS_RECORDS' "$records"
 
 # Restart named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed"
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed"
 
 # Logging
 log_history "added dns domain $domain"

+ 6 - 9
bin/v-add-dns-record

@@ -26,11 +26,6 @@ if [ -z "$priority" ]; then
     priority=10
 fi
 
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
@@ -55,6 +50,10 @@ if [[ "$dvalue" =~ [\;[:space:]] ]]; then
     dvalue='"'"$dvalue"'"'
 fi
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -121,10 +120,8 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
 increase_user_value "$user" '$U_DNS_RECORDS'
 
 # Restart named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? $E_RESTART 'dns failed to restart'
-fi
+$BIN/v-restart-dns $restart
+check_result $? $E_RESTART 'dns failed to restart'
 
 # Logging
 log_history "added $rtype dns record $record for $domain"

+ 8 - 10
bin/v-add-domain

@@ -64,16 +64,14 @@ if [ ! -z "$MAIL_SYSTEM" ]; then
 fi
 
 # Restarting services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "can't restart web" > /dev/null
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "can't restart proxy" > /dev/null
-    fi
-    $BIN/v-restart-dns
-    check_result $? "can't restart dns" > /dev/null
-fi
+$BIN/v-restart-web $restart
+check_result $? "can't restart web" > /dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "can't restart proxy" > /dev/null
+
+$BIN/v-restart-dns $restart
+check_result $? "can't restart dns" > /dev/null
 
 
 #----------------------------------------------------------#

+ 7 - 4
bin/v-add-mail-account

@@ -11,10 +11,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
-account=$(echo $3 | tr '[:upper:]' '[:lower:]')
+domain=$2
+account=$3
 password=$4; HIDE=4
 quota=${5-unlimited}
 
@@ -23,6 +21,11 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+if [[ "$account" =~ [[:upper:]] ]]; then
+    account=$(echo "$account" |tr '[:upper:]' '[:lower:]')
+fi
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-account-alias

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 malias=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-account-autoreply

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 autoreply=$4
 
@@ -29,6 +27,10 @@ else
     MAIL_USER=exim
 fi
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-account-forward

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 forward=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-account-fwd-only

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 
 # Includes
@@ -28,6 +26,10 @@ else
     MAIL_USER=exim
 fi
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 6 - 10
bin/v-add-mail-domain

@@ -11,15 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | sed -e 's/\.*$//g' -e 's/^\.*//g')
-if [[ "$domain" =~ [[:upper:]] ]]; then
-    domain=$(echo "$domain" |tr '[:upper:]' '[:lower:]')
-fi
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
+domain=$2
 antispam=${3-yes}
 antivirus=${4-yes}
 dkim=${5-yes}
@@ -37,6 +29,10 @@ else
     MAIL_USER=exim
 fi
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -126,7 +122,7 @@ if [ ! -z "$DNS_SYSTEM" ] && [ "$dkim" = 'yes' ]; then
         $BIN/v-add-dns-record $user $domain $record TXT "$policy" '' '' 'no'
 
         record='mail._domainkey'
-        selector="\"k=rsa\; p=$p\""
+        selector="\"v=DKIM1\; k=rsa\; p=$p\""
         $BIN/v-add-dns-record $user $domain $record TXT "$selector"
     fi
 fi

+ 5 - 3
bin/v-add-mail-domain-antispam

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-domain-antivirus

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-add-mail-domain-catchall

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 email="$3"
 
 # Includes
@@ -21,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 2
bin/v-add-mail-domain-dkim

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
+domain=$2
 dkim_size=${3-1024}
 
 # Includes
@@ -27,6 +26,10 @@ else
     MAIL_USER=exim
 fi
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 8 - 24
bin/v-add-web-domain

@@ -18,37 +18,23 @@
 # Argument definition
 user=$1
 domain=$2
+domain_idn=$2
 ip=$3
 restart=$4      # will be moved to the end soon
 aliases=$5
 proxy_ext=$6
 
-# Additional argument formatting
-if [[ "$domain" =~ [[:upper:]] ]]; then
-    domain=$(echo "$domain" |tr '[:upper:]' '[:lower:]')
-fi
-if [[ "$domain" =~ ^www\..* ]]; then
-    domain=$(echo "$domain" |sed -e "s/^www.//")
-fi
-if [[ "$domain" =~ .*\.$ ]]; then
-    domain=$(echo "$domain" |sed -e "s/\.$//")
-fi
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
-if [ ! -z "$aliases" ] && [ "$aliases" != 'none' ]; then
-    aliases=$(echo $aliases |tr '[:upper:]' '[:lower:]' |tr ',' '\n')
-    aliases=$(echo "$aliases" |sed -e "s/\.$//" |sort -u |grep -v www.$domain)
-    aliases=$(echo "$aliases" |sed -e "/^$/d" |tr '\n' ',' |sed -e "s/,$//")
-fi
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+format_aliases
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -178,10 +164,8 @@ $BIN/v-restart-web $restart
 check_result $? "Web restart failed" >/dev/null
 
 # Restarting proxy server
-if [ ! -z "$PROXY_SYSTEM" ]; then
-    $BIN/v-restart-proxy $restart
-    check_result $? "Proxy restart failed" >/dev/null
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "added web domain $domain"

+ 17 - 19
bin/v-add-web-domain-alias

@@ -12,13 +12,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
-dom_alias=$(idn -t --quiet -u "$3" )
-dom_alias=$(echo $dom_alias | sed -e 's/\.*$//g' -e 's/^\.*//g')
-dom_alias=$(echo $dom_alias | tr '[:upper:]' '[:lower:]')
-dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
+domain=$2
+aliases=$3
 restart="$4"
 
 # Includes
@@ -27,6 +22,11 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+format_aliases
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -39,7 +39,7 @@ is_object_valid 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
 is_object_valid 'web' 'DOMAIN' "$domain"
 is_object_unsuspended 'web' 'DOMAIN' "$domain"
-is_domain_new 'web' "$dom_alias"
+is_domain_new 'web' "$aliases"
 is_package_full 'WEB_ALIASES'
 
 
@@ -53,9 +53,9 @@ get_domain_values 'web'
 # Preparing domain values for the template substitution
 local_ip=$(get_real_ip $IP)
 if [ -z "$ALIAS" ]; then
-    ALIAS="$dom_alias"
+    ALIAS="$aliases"
 else
-    ALIAS="$ALIAS,$dom_alias"
+    ALIAS="$ALIAS,$aliases"
 fi
 prepare_web_domain_values
 
@@ -87,17 +87,15 @@ update_object_value 'web' 'DOMAIN' "$domain" '$ALIAS' "$ALIAS"
 increase_user_value "$user" '$U_WEB_ALIASES'
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+# Restarting proxy server
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
 
-log_history "added $dom_alias as alias for $domain"
+log_history "added $aliases for $domain"
 log_event "$OK" "$ARGUMENTS"
 
 exit

+ 2 - 4
bin/v-add-web-domain-backend

@@ -67,10 +67,8 @@ cat $WEBTPL/$WEB_BACKEND/$template.tpl |\
 #----------------------------------------------------------#
 
 # Restart backend server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web-backend
-    check_result $? "Web backend restart failed" >/dev/null
-fi
+$BIN/v-restart-web-backend $restart
+check_result $? "Web backend restart failed" >/dev/null
 
 # Logging
 log_history "added $WEB_BACKEND backend configuration for $domain"

+ 5 - 2
bin/v-add-web-domain-ftp

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ftp_user=${1}_${3}
 password=$4; HIDE=4
 ftp_path=$5
@@ -22,6 +21,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 2 - 4
bin/v-add-web-domain-proxy

@@ -72,10 +72,8 @@ update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' "$template"
 update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' "$extentions"
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-proxy
-    check_result $? "Proxy restart failed" >/dev/null
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 log_history "enabled proxy support for $domain"
 log_event "$OK" "$ARGUMENTS"

+ 10 - 11
bin/v-add-web-domain-ssl

@@ -16,8 +16,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ssl_dir=$3
 ssl_home=${4-same}
 restart="$5"
@@ -28,6 +27,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -97,15 +100,11 @@ update_object_value 'web' 'DOMAIN' "$domain" '$SSL_HOME' "$SSL_HOME"
 update_object_value 'web' 'DOMAIN' "$domain" '$SSL' "yes"
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "enabled ssl support for $domain"

+ 5 - 2
bin/v-add-web-domain-stats

@@ -15,8 +15,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 type=$3
 
 # Includes
@@ -24,6 +23,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 2 - 2
bin/v-backup-user

@@ -137,7 +137,7 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
         mkdir -p $tmpdir/web/$domain/vesta
 
         # Get domain variables
-        domain_idn=$(idn -t --quiet -a "$domain")
+        format_domain_idn
         get_domain_values 'web'
 
         # Backup web.conf
@@ -286,7 +286,7 @@ if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL" != '*' ]; then
         echo -e "$(date "+%F %T") $domain" |tee -a $BACKUP/$user.log
         mkdir -p $tmpdir/mail/$domain/conf
         mkdir -p $tmpdir/mail/$domain/vesta
-        domain_idn=$(idn -t --quiet -a "$domain")
+        format_domain_idn
 
         # Backup exim config
         if [[ "$MAIL_SYSTEM" =~ exim ]]; then

+ 5 - 2
bin/v-change-dns-domain-exp

@@ -12,14 +12,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 exp=$3
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 7 - 6
bin/v-change-dns-domain-ip

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ip=$3
 restart=$4
 
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -71,10 +74,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed dns ip for $domain to $ip"

+ 7 - 6
bin/v-change-dns-domain-soa

@@ -12,8 +12,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 soa=$(echo $3 | sed -e 's/\.*$//g' -e 's/^\.*//g')
 restart=$4
 
@@ -22,6 +21,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -65,10 +68,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed soa record for $domain to $soa"

+ 7 - 10
bin/v-change-dns-domain-tpl

@@ -13,20 +13,19 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
+domain=$2
 template=$3
 restart=$4
 
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -121,10 +120,8 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$TPL' "$template"
 update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed dns template for $domain to $template" '' 'admin'

+ 7 - 6
bin/v-change-dns-domain-ttl

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ttl=$3
 restart=$4
 
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -64,10 +67,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed TTL for $domain to $ttl"

+ 7 - 10
bin/v-change-dns-record

@@ -11,22 +11,21 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
+domain=$2
 id=$3
 dvalue=$(idn -t --quiet -u "$4" )
 priority=$5
 restart=$6
 
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -105,10 +104,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed dns record on $domain to $dvalue"

+ 7 - 7
bin/v-change-dns-record-id

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 id=$3
 newid=$4
 restart=$5
@@ -23,6 +21,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -71,10 +73,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
 # Logging
 log_history "changed dns record id on $domain"

+ 10 - 0
bin/v-change-domain-owner

@@ -144,6 +144,16 @@ if [ ! -z "$mail_data" ]; then
     find $HOMEDIR/$user/mail/$domain -user $owner \
         -exec chown -h $user {} \;
 
+    # Checking exim username for later chowning
+    exim_user="exim";
+    check_exim_username=$(grep -c '^Debian-exim:' /etc/passwd)
+    if [ "$check_exim_username" -eq 1 ]; then
+        exim_user="Debian-exim"
+    fi
+    # Chowning mail conf files to exim user
+    find $HOMEDIR/$user/conf/mail/$domain -user root \
+        -exec chown $exim_user {} \;
+
     # Rebuild config
     $BIN/v-unsuspend-mail-domain $user $domain no >> /dev/null 2>&1
     $BIN/v-rebuild-mail-domains $owner no

+ 5 - 3
bin/v-change-mail-account-password

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 password=$4; HIDE=4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-change-mail-account-quota

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 quota=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 6 - 5
bin/v-change-mail-domain-catchall

@@ -11,16 +11,18 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
-email="$3"
+domain=$2
+email=$3
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -53,7 +55,6 @@ fi
 # Change catchall in config
 update_object_value 'mail' 'DOMAIN' "$domain" '$CATCHALL' "$email"
 
-
 # Logging
 log_history "changed catchall email for $domain to $email"
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-change-sys-ip-nat

@@ -73,10 +73,8 @@ fi
 #----------------------------------------------------------#
 
 # Restart ftp server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-ftp
-    check_result $? "FTP restart failed" >/dev/null
-fi
+$BIN/v-restart-ftp $restart
+check_result $? "FTP restart failed" >/dev/null
 
 # Logging
 log_history "changed associated nat address on $ip to $nat_ip" '' 'admin'

+ 10 - 10
bin/v-change-web-domain-backend-tpl

@@ -11,11 +11,9 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 template=$3
-restart="$4"
-
+restart=$4
 
 # Includes
 source $VESTA/func/main.sh
@@ -23,6 +21,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -143,13 +145,11 @@ fi
 
 
 # Restarting web
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    $BIN/v-restart-web-backend
-    check_result $? "Web backend restart failed" >/dev/null
-fi
+$BIN/v-restart-web-backend $restart
+check_result $? "Web backend restart failed" >/dev/null
 
 # Logging
 log_history "changed backend template for $domain to $template"

+ 5 - 2
bin/v-change-web-domain-ftp-password

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ftp_user=$3
 password=$4; HIDE=4
 
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 2
bin/v-change-web-domain-ftp-path

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ftp_user=$3
 ftp_path=$4
 
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 8 - 14
bin/v-change-web-domain-ip

@@ -21,6 +21,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -44,12 +48,6 @@ is_ip_valid "$ip" "$user"
 get_domain_values 'web'
 old=$(get_real_ip $IP)
 new=$ip
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-else
-    domain_idn=$domain
-fi
-
 
 # Replacing vhost
 replace_web_config "$WEB_SYSTEM" "$TPL.tpl"
@@ -78,15 +76,11 @@ decrease_ip_value "$old"
 update_object_value 'web' 'DOMAIN' "$domain" '$IP' "$3"
 
 # Restart web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "WEB restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "WEB restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "changed web domain $domain ip to $3"

+ 4 - 5
bin/v-change-web-domain-name

@@ -15,17 +15,16 @@ domain=$2
 new_domain=$3
 restart=$4
 
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 7 - 7
bin/v-change-web-domain-proxy-tpl

@@ -11,21 +11,23 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 template=$3
 default_extentions="jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,\
 exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm"
 extentions=${4-$default_extentions}
 restart="$5"
 
-
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -75,10 +77,8 @@ update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' "$PROXY"
 update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' "$extentions"
 
 # Restarting proxy
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-proxy
-    check_result $? "Proxy restart failed" >/dev/null
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "changed proxy template for $domain to $template"

+ 10 - 11
bin/v-change-web-domain-sslcert

@@ -12,8 +12,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ssl_dir=$3
 restart=$4
 
@@ -22,6 +21,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -71,15 +74,11 @@ fi
 #----------------------------------------------------------#
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "changed ssl certificate for $domain"

+ 10 - 11
bin/v-change-web-domain-sslhome

@@ -7,8 +7,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ssl_home=$3
 restart=$4
 
@@ -17,6 +16,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -67,15 +70,11 @@ fi
 update_object_value 'web' 'DOMAIN' "$domain" '$SSL_HOME' "$SSL_HOME"
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "changed ssl home for $domain to $ssl_home"

+ 5 - 2
bin/v-change-web-domain-stats

@@ -12,8 +12,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 type=$3
 
 # Includes
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 7 - 6
bin/v-change-web-domain-tpl

@@ -12,8 +12,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 template=$3
 restart=$4
 
@@ -23,6 +22,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -68,10 +71,8 @@ fi
 update_object_value 'web' 'DOMAIN' "$domain" '$TPL' "$template"
 
 # Restarting web
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
 # Logging
 log_history "changed web domain template for $domain to $template" '' 'admin'

+ 2 - 4
bin/v-delete-dns-domain

@@ -72,10 +72,8 @@ decrease_user_value "$user" '$U_DNS_DOMAINS'
 decrease_user_value "$user" '$U_DNS_RECORDS' "$records"
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns $restart
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_history "deleted dns domain $domain"

+ 2 - 4
bin/v-delete-dns-domains

@@ -43,10 +43,8 @@ done
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-delete-dns-domains-src

@@ -44,10 +44,8 @@ done
 #----------------------------------------------------------#
 
 # Restart named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 8 - 5
bin/v-delete-dns-on-web-alias

@@ -11,11 +11,10 @@
 
 # Argument definition
 user=$1
-domain=$(echo $2 | sed -e 's/\.*$//g' -e 's/^\.*//g')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 dom_alias=$(idn -t --quiet -u "$3" )
-dom_alias=$(echo $dom_alias | sed -e 's/\.*$//g' -e 's/^\.*//g')
-dom_alias=$(echo $dom_alias | tr '[:upper:]' '[:lower:]')
+dom_alias=$(echo $dom_alias |sed -e 's/\.*$//g' -e 's/^\.*//g')
+dom_alias=$(echo $dom_alias |tr '[:upper:]' '[:lower:]')
 dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
 restart="$4"
 
@@ -24,6 +23,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -63,7 +66,7 @@ else
         fi
         if [ ! -z "$rec" ]; then
             eval "$rec"
-            $BIN/v-delete-dns-record $user "$root" "$ID"
+            $BIN/v-delete-dns-record $user "$root" "$ID" $restart
         fi
     fi
 fi

+ 7 - 6
bin/v-delete-dns-record

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 id=$3
 restart=$4
 
@@ -21,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -70,10 +73,8 @@ update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
 decrease_user_value "$user" '$U_DNS_RECORDS'
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_history "deleted dns record $id on $domain"

+ 8 - 10
bin/v-delete-domain

@@ -69,16 +69,14 @@ if [ -z "$domain_found" ]; then
 fi
 
 # Restarting services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "can't restart web" > /dev/null
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "can't restart proxy" > /dev/null
-    fi
-    $BIN/v-restart-dns
-    check_result $? "can't restart dns" > /dev/null
-fi
+$BIN/v-restart-web $restart
+check_result $? "can't restart web" > /dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "can't restart proxy" > /dev/null
+
+$BIN/v-restart-dns $restart
+check_result $? "can't restart dns" > /dev/null
 
 
 #----------------------------------------------------------#

+ 5 - 3
bin/v-delete-mail-account

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 
 # Includes
@@ -21,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-delete-mail-account-alias

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 malias=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-delete-mail-account-autoreply

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 malias=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 6 - 6
bin/v-delete-mail-account-forward

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 forward=$4
 
@@ -22,6 +20,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -38,9 +40,7 @@ is_object_valid "mail/$domain" 'ACCOUNT' "$account"
 is_object_unsuspended "mail/$domain" 'ACCOUNT' "$account"
 fwd=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD')
 if [ -z "$(echo $fwd | grep -w $forward)" ]; then
-    echo "Error: forward $forward doesn't exist"
-    log_event "$E_NOTEXIST $ARGUMENTS"
-    exit $E_NOTEXIST
+    check_result $E_NOTEXIST "forward $forward doesn't exist"
 fi
 
 

+ 5 - 3
bin/v-delete-mail-account-fwd-only

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 
 # Includes
@@ -21,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 2
bin/v-delete-mail-domain

@@ -12,14 +12,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-delete-mail-domain-antispam

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-delete-mail-domain-antivirus

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-delete-mail-domain-catchall

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 10 - 14
bin/v-delete-web-domain

@@ -23,6 +23,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -48,10 +52,6 @@ fi
 
 # Parsing domain values
 get_domain_values 'web'
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
 local_ip=$(get_real_ip $IP)
 
 # Deleting domain from web.conf
@@ -121,16 +121,12 @@ if [ ! -z "$ALIAS" ]; then
 fi
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    # Restartinh proxy server
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+# Restartinh proxy server
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "deleted web domain $domain"

+ 4 - 8
bin/v-delete-web-domain-alias

@@ -81,15 +81,11 @@ update_object_value 'web' 'DOMAIN' "$domain" '$ALIAS' "$ALIAS"
 decrease_user_value "$user" '$U_WEB_ALIASES'
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "deleted alias $dom_alias on $domain"

+ 7 - 6
bin/v-delete-web-domain-backend

@@ -11,14 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -66,10 +69,8 @@ rm -f $pool/$backend_type.conf
 #----------------------------------------------------------#
 
 # Restarting backend server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web-backend
-    check_result $? "Backend restart failed" >/dev/null
-fi
+$BIN/v-restart-web-backend $restart
+check_result $? "Backend restart failed" >/dev/null
 
 # Logging
 log_history "deleting backend support for $domain"

+ 5 - 2
bin/v-delete-web-domain-ftp

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 ftp_user=$3
 
 # Includes
@@ -20,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 7 - 6
bin/v-delete-web-domain-proxy

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 restart=$3
 
 # Includes
@@ -20,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -58,10 +61,8 @@ update_object_value 'web' 'DOMAIN' "$domain" '$PROXY' ''
 update_object_value 'web' 'DOMAIN' "$domain" '$PROXY_EXT' ''
 
 # Restart proxy server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-proxy
-    check_result $? "Proxy restart failed" >/dev/null
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "disabled proxy support for $domain"

+ 10 - 11
bin/v-delete-web-domain-ssl

@@ -11,8 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 restart=$3
 
 # Includes
@@ -20,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -71,15 +74,11 @@ update_object_value 'web' 'DOMAIN' "$domain" '$SSL' 'no'
 decrease_user_value "$user" '$U_WEB_SSL'
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_history "disabled ssl support for $domain"

+ 5 - 2
bin/v-delete-web-domain-stats

@@ -12,14 +12,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 9
bin/v-delete-web-domains

@@ -43,15 +43,11 @@ done
 #----------------------------------------------------------#
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 5 - 2
bin/v-get-dns-domain-value

@@ -11,13 +11,16 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 key=$(echo "$3"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
 
 # Includes
 source $VESTA/func/main.sh
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 2
bin/v-get-mail-account-value

@@ -11,14 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 key=$(echo "$4"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
 
 # Includes
 source $VESTA/func/main.sh
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 2
bin/v-get-mail-domain-value

@@ -11,13 +11,16 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 key=$(echo "$3"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
 
 # Includes
 source $VESTA/func/main.sh
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 2 - 4
bin/v-insert-dns-domain

@@ -74,10 +74,8 @@ chmod 660 $USER_DATA/dns.conf
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns $restart
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-insert-dns-record

@@ -45,10 +45,8 @@ echo "$data" >> $USER_DATA/dns/$domain.conf
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns $restart
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-insert-dns-records

@@ -48,10 +48,8 @@ fi
 #----------------------------------------------------------#
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-rebuild-cron-jobs

@@ -41,10 +41,8 @@ sync_cron_jobs
 #----------------------------------------------------------#
 
 # Restarting crond
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-rebuild-dns-domain

@@ -82,10 +82,8 @@ update_user_value "$user" '$U_DNS_RECORDS' "$user_records"
 update_user_value "$user" '$SUSPENDED_DNS' "$suspended_dns"
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns "$restart"
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-rebuild-dns-domains

@@ -83,10 +83,8 @@ update_user_value "$user" '$U_DNS_RECORDS' "$user_records"
 update_user_value "$user" '$SUSPENDED_DNS' "$suspended_dns"
 
 # Restarting named
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-dns
-    check_result $? "Bind restart failed" >/dev/null
-fi
+$BIN/v-restart-dns $restart
+check_result $? "Bind restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 4 - 8
bin/v-rebuild-web-domains

@@ -75,15 +75,11 @@ done
 $BIN/v-update-user-counters $user
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-suspend-cron-job

@@ -47,10 +47,8 @@ sync_cron_jobs
 #----------------------------------------------------------#
 
 # Restarting crond
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-suspend-cron-jobs

@@ -42,10 +42,8 @@ done
 #----------------------------------------------------------#
 
 # Restarting crond
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 5 - 2
bin/v-suspend-dns-domain

@@ -11,14 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 restart="$3"
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 6 - 7
bin/v-suspend-dns-record

@@ -11,20 +11,19 @@
 
 # Argument definition
 user=$1
-domain="$2"
+domain=$2
 id=$3
-restart="$4"
-
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
+restart=$4
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 8 - 10
bin/v-suspend-domain

@@ -71,16 +71,14 @@ if [ -z "$domain_found" ]; then
 fi
 
 # Restarting services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "can't restart web" > /dev/null
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "can't restart proxy" > /dev/null
-    fi
-    $BIN/v-restart-dns
-    check_result $? "can't restart dns" > /dev/null
-fi
+$BIN/v-restart-web $restat
+check_result $? "can't restart web" > /dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "can't restart proxy" > /dev/null
+
+$BIN/v-restart-dns $restart
+check_result $? "can't restart dns" > /dev/null
 
 
 #----------------------------------------------------------#

+ 5 - 3
bin/v-suspend-mail-account

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 
 # Includes
@@ -21,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 4 - 3
bin/v-suspend-mail-accounts

@@ -11,14 +11,15 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-suspend-mail-domain

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 6 - 8
bin/v-suspend-user

@@ -74,16 +74,14 @@ fi
 #----------------------------------------------------------#
 
 # Restarting system services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Changing suspend value
 update_user_value "$user" '$SUSPENDED' 'yes'

+ 9 - 10
bin/v-suspend-web-domain

@@ -13,8 +13,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 restart=$3
 
 # Includes
@@ -23,6 +22,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -76,15 +79,11 @@ update_object_value 'web' 'DOMAIN' "$domain" '$SUSPENDED' 'yes'
 increase_user_value "$user" '$SUSPENDED_WEB'
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 5 - 9
bin/v-suspend-web-domains

@@ -43,15 +43,11 @@ done
 #----------------------------------------------------------#
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-unsuspend-cron-job

@@ -47,10 +47,8 @@ sync_cron_jobs
 #----------------------------------------------------------#
 
 # Restarting crond
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 2 - 4
bin/v-unsuspend-cron-jobs

@@ -42,10 +42,8 @@ done
 #----------------------------------------------------------#
 
 # Restarting crond
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 5 - 3
bin/v-unsuspend-dns-domain

@@ -11,14 +11,16 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
-restart="$3"
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 6
bin/v-unsuspend-dns-record

@@ -13,18 +13,17 @@
 user=$1
 domain=$2
 id=$3
-restart="$4"
-
-domain_idn="$domain"
-if [[ "$domain" = *[![:ascii:]]* ]]; then
-    domain_idn=$(idn -t --quiet -a $domain)
-fi
+restart=$4
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 8 - 10
bin/v-unsuspend-domain

@@ -70,16 +70,14 @@ if [ -z "$domain_found" ]; then
 fi
 
 # Restarting services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "can't restart web" > /dev/null
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "can't restart proxy" > /dev/null
-    fi
-    $BIN/v-restart-dns
-    check_result $? "can't restart dns" > /dev/null
-fi
+$BIN/v-restart-web $restart
+check_result $? "can't restart web" > /dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "can't restart proxy" > /dev/null
+
+$BIN/v-restart-dns $restart
+check_result $? "can't restart dns" > /dev/null
 
 
 #----------------------------------------------------------#

+ 5 - 3
bin/v-unsuspend-mail-account

@@ -11,9 +11,7 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 account=$3
 
 # Includes
@@ -21,6 +19,10 @@ source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-unsuspend-mail-accounts

@@ -11,14 +11,16 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 3
bin/v-unsuspend-mail-domain

@@ -11,15 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 6 - 8
bin/v-unsuspend-user

@@ -77,16 +77,14 @@ update_user_value "$user" '$SUSPENDED' 'no'
 decrease_user_value 'admin' '$SUSPENDED_USERS'
 
 # Restarting system services
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    $BIN/v-restart-dns
-    check_result $? "DNS restart failed" >/dev/null
+$BIN/v-restart-dns $restart
+check_result $? "DNS restart failed" >/dev/null
 
-    $BIN/v-restart-cron
-    check_result $? "Cron restart failed" >/dev/null
-fi
+$BIN/v-restart-cron $restart
+check_result $? "Cron restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 10 - 11
bin/v-unsuspend-web-domain

@@ -11,9 +11,8 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
-restart="$3"
+domain=$2
+restart=$3
 
 # Includes
 source $VESTA/func/main.sh
@@ -21,6 +20,10 @@ source $VESTA/func/domain.sh
 source $VESTA/func/ip.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -74,15 +77,11 @@ update_object_value 'web' 'DOMAIN' "$domain" '$SUSPENDED' 'no'
 decrease_user_value "$user" '$SUSPENDED_WEB'
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
 
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 5 - 9
bin/v-unsuspend-web-domains

@@ -44,15 +44,11 @@ done
 #----------------------------------------------------------#
 
 # Restarting web server
-if [ "$restart" != 'no' ]; then
-    $BIN/v-restart-web
-    check_result $? "Web restart failed" >/dev/null
-
-    if [ ! -z "$PROXY_SYSTEM" ]; then
-        $BIN/v-restart-proxy
-        check_result $? "Proxy restart failed" >/dev/null
-    fi
-fi
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
 
 # Logging
 log_event "$OK" "$ARGUMENTS"

+ 5 - 3
bin/v-update-mail-domain-disk

@@ -11,14 +11,16 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

+ 5 - 2
bin/v-update-web-domain-disk

@@ -11,14 +11,17 @@
 
 # Argument definition
 user=$1
-domain=$(idn -t --quiet -u "$2" )
-domain_idn=$(idn -t --quiet -a "$domain")
+domain=$2
 
 # Includes
 source $VESTA/func/main.sh
 source $VESTA/func/domain.sh
 source $VESTA/conf/vesta.conf
 
+# Additional argument formatting
+format_domain
+format_domain_idn
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #

Некоторые файлы не были показаны из-за большого количества измененных файлов