Serghey Rodin 14 лет назад
Родитель
Сommit
83196f310b
100 измененных файлов с 1516 добавлено и 1440 удалено
  1. 23 40
      bin/v_add_cron_job
  2. 13 21
      bin/v_add_cron_report
  3. 20 41
      bin/v_add_db_base
  4. 12 13
      bin/v_add_db_host
  5. 18 20
      bin/v_add_dns_domain
  6. 14 15
      bin/v_add_dns_domain_record
  7. 85 0
      bin/v_add_mail_account
  8. 85 0
      bin/v_add_mail_account_alias
  9. 68 0
      bin/v_add_mail_account_autoreply
  10. 36 37
      bin/v_add_mail_domain
  11. 10 11
      bin/v_add_mail_domain_antispam
  12. 10 11
      bin/v_add_mail_domain_antivirus
  13. 10 11
      bin/v_add_mail_domain_cactchall
  14. 18 19
      bin/v_add_mail_domain_dkim
  15. 11 12
      bin/v_add_sys_ip
  16. 61 61
      bin/v_add_user
  17. 6 7
      bin/v_add_user_backup
  18. 50 51
      bin/v_add_web_domain
  19. 17 18
      bin/v_add_web_domain_alias
  20. 13 14
      bin/v_add_web_domain_cgi
  21. 17 18
      bin/v_add_web_domain_elog
  22. 14 15
      bin/v_add_web_domain_nginx
  23. 26 27
      bin/v_add_web_domain_ssl
  24. 13 14
      bin/v_add_web_domain_stat
  25. 12 13
      bin/v_add_web_domain_stat_auth
  26. 71 72
      bin/v_backup_user
  27. 4 5
      bin/v_backup_users
  28. 19 34
      bin/v_change_cron_job
  29. 8 9
      bin/v_change_db_password
  30. 8 9
      bin/v_change_dns_domain_exp
  31. 10 11
      bin/v_change_dns_domain_ip
  32. 11 12
      bin/v_change_dns_domain_record
  33. 9 10
      bin/v_change_dns_domain_soa
  34. 13 14
      bin/v_change_dns_domain_tpl
  35. 9 10
      bin/v_change_dns_domain_ttl
  36. 10 11
      bin/v_change_mail_domain_cactchall
  37. 7 8
      bin/v_change_sys_config_value
  38. 5 6
      bin/v_change_sys_ip_name
  39. 7 8
      bin/v_change_sys_ip_owner
  40. 7 8
      bin/v_change_sys_ip_status
  41. 7 8
      bin/v_change_user_contact
  42. 7 8
      bin/v_change_user_name
  43. 13 14
      bin/v_change_user_ns
  44. 11 12
      bin/v_change_user_package
  45. 8 9
      bin/v_change_user_password
  46. 7 8
      bin/v_change_user_shell
  47. 18 19
      bin/v_change_web_domain_ip
  48. 22 23
      bin/v_change_web_domain_sslcert
  49. 17 18
      bin/v_change_web_domain_sslhome
  50. 33 34
      bin/v_change_web_domain_tpl
  51. 14 22
      bin/v_delete_cron_job
  52. 13 21
      bin/v_delete_cron_reports
  53. 7 8
      bin/v_delete_db_base
  54. 9 10
      bin/v_delete_db_bases
  55. 6 7
      bin/v_delete_db_host
  56. 14 15
      bin/v_delete_dns_domain
  57. 10 11
      bin/v_delete_dns_domain_record
  58. 9 10
      bin/v_delete_dns_domains
  59. 15 16
      bin/v_delete_mail_domain
  60. 9 10
      bin/v_delete_mail_domain_antispam
  61. 9 10
      bin/v_delete_mail_domain_antivirus
  62. 9 10
      bin/v_delete_mail_domain_cactchall
  63. 13 14
      bin/v_delete_mail_domain_dkim
  64. 9 10
      bin/v_delete_sys_ip
  65. 23 42
      bin/v_delete_user
  66. 9 10
      bin/v_delete_user_ips
  67. 32 33
      bin/v_delete_web_domain
  68. 19 20
      bin/v_delete_web_domain_alias
  69. 13 14
      bin/v_delete_web_domain_cgi
  70. 17 18
      bin/v_delete_web_domain_elog
  71. 16 17
      bin/v_delete_web_domain_nginx
  72. 20 21
      bin/v_delete_web_domain_ssl
  73. 10 11
      bin/v_delete_web_domain_stat
  74. 11 12
      bin/v_delete_web_domain_stat_auth
  75. 9 10
      bin/v_delete_web_domains
  76. 6 7
      bin/v_get_dns_domain_value
  77. 6 7
      bin/v_get_user_value
  78. 6 7
      bin/v_get_web_domain_value
  79. 11 41
      bin/v_list_cron_jobs
  80. 5 6
      bin/v_list_db_base
  81. 4 5
      bin/v_list_db_bases
  82. 5 6
      bin/v_list_db_host
  83. 4 8
      bin/v_list_db_hosts
  84. 3 5
      bin/v_list_dns_domain
  85. 4 6
      bin/v_list_dns_domain_records
  86. 4 5
      bin/v_list_dns_domains
  87. 5 6
      bin/v_list_dns_template
  88. 5 6
      bin/v_list_dns_templates
  89. 62 0
      bin/v_list_mail_accounts
  90. 3 5
      bin/v_list_mail_domain
  91. 6 8
      bin/v_list_mail_domain_dkim
  92. 5 6
      bin/v_list_mail_domains
  93. 3 6
      bin/v_list_sys_config
  94. 1 2
      bin/v_list_sys_interfaces
  95. 6 7
      bin/v_list_sys_ip
  96. 6 7
      bin/v_list_sys_ips
  97. 5 7
      bin/v_list_sys_rrd
  98. 11 12
      bin/v_list_user
  99. 4 5
      bin/v_list_user_backups
  100. 8 9
      bin/v_list_user_ips

+ 23 - 40
bin/v_add_cron_job

@@ -20,42 +20,24 @@ wday=$6
 command=$7
 command=$7
 job=$8
 job=$8
 
 
-# Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/cron.func
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                    Verifications                         #
 #                    Verifications                         #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Checking arg number
 check_args '7' "$#" 'user min hour day month wday command [job]'
 check_args '7' "$#" 'user min hour day month wday command [job]'
-
-# Checking argument format
-format_validation 'user' 'min' 'hour' 'day' 'month' 'wday' 'command'
-
-# Checking cron system
-is_system_enabled 'CRON_SYSTEM'
-
-# Checking user
-is_user_valid
-
-# Checking package
+validate_format 'user' 'min' 'hour' 'day' 'month' 'wday' 'command'
+is_system_enabled $CRON_SYSTEM
+is_object_valid 'user' 'USER' "$user"
+is_object_suspended 'user' 'USER' "$user"
 is_package_full 'CRON_JOBS'
 is_package_full 'CRON_JOBS'
-
-# Get str position
-if [ -z "$job" ]; then
-    job=$(get_next_cron_string)
-fi
-
-# Checking id format
-format_validation 'job'
-
-# Checking job id
-is_cron_job_free
+get_next_cronjob
+validate_format 'job'
+is_object_free 'cron' 'JOB' "$job"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -63,19 +45,20 @@ is_cron_job_free
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Concatenating cron string
 # Concatenating cron string
-command=$(echo $command|sed -e "s/'/%quote%/g" -e "s/:/%dots%/g")
-v_str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month"
-v_str="$v_str' WDAY='$wday' CMD='$command' SUSPENDED='no' DATE='$V_DATE'"
+command=$(echo $command | sed -e "s/'/%quote%/g" -e "s/:/%dots%/g")
+str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month WDAY='$wday'"
+str="$v_str' CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
 
 
 # Adding to crontab
 # Adding to crontab
-echo "$v_str">>$V_USERS/$user/cron.conf
+echo "$str" >> $VESTA/data/users/$user/cron.conf
 
 
-chmod 660 $V_USERS/$user/cron.conf
+# Chaning permissions
+chmod 660 $VESTA/data/users/$user/cron.conf
 
 
-# Sorting jobs by id
+# Sort jobs by id number
 sort_cron_jobs
 sort_cron_jobs
 
 
-# Sync system cron with user
+# Sync cronjobs with system crond
 sync_cron_jobs
 sync_cron_jobs
 
 
 
 
@@ -84,13 +67,13 @@ sync_cron_jobs
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Increasing cron value
 # Increasing cron value
-increase_user_value "$user" '$U_CRON_JOBS'
+increase_user_value $user '$U_CRON_JOBS'
 
 
-# Adding task to the vesta pipe
-restart_schedule 'cron'
+# Restart crond
+$BIN/v_restart_cron
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_cron_job $user $job"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 13 - 21
bin/v_add_user_reports → bin/v_add_cron_report

@@ -1,5 +1,5 @@
 #!/bin/bash
 #!/bin/bash
-# info: add user reports
+# info: add cron reports
 # opions: user
 # opions: user
 #
 #
 # The script for enabling reports on cron tasks and administrative
 # The script for enabling reports on cron tasks and administrative
@@ -13,28 +13,20 @@
 # Argument defenition
 # Argument defenition
 user=$1
 user=$1
 
 
-# Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/cron.func
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                    Verifications                         #
 #                    Verifications                         #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Checking arg number
 check_args '1' "$#" 'user'
 check_args '1' "$#" 'user'
-
-# Checking argument format
-format_validation 'user'
-
-# Checking user
-is_user_valid
-
-# Checking user is active
-is_user_suspended
+validate_format 'user'
+is_system_enabled "$CRON_SYSTEM"
+is_object_valid 'user' 'USER' "$user"
+is_object_suspended 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -42,7 +34,7 @@ is_user_suspended
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Changing user report value
 # Changing user report value
-update_user_value "$user" '$REPORTS' 'yes'
+update_user_value "$user" '$CRON_REPORTS' 'yes'
 
 
 # Sync system cron with user
 # Sync system cron with user
 sync_cron_jobs
 sync_cron_jobs
@@ -52,11 +44,11 @@ sync_cron_jobs
 #                       Vesta                              #
 #                       Vesta                              #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Adding task to the vesta pipe
-restart_schedule 'cron'
+# Restart crond
+$BIN/v_restart_cron
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_user_reports $user"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 20 - 41
bin/v_add_db_base

@@ -24,45 +24,26 @@ type=$5
 host=$6
 host=$6
 encoding=${7-UTF8}
 encoding=${7-UTF8}
 encoding=$(echo "$encoding" |tr '[:lower:]' '[:upper:]')
 encoding=$(echo "$encoding" |tr '[:lower:]' '[:upper:]')
+
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/db.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/db.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                    Verifications                         #
 #                    Verifications                         #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Checking arg number
 check_args '5' "$#" 'user db db_user db_password type [host] [encoding]'
 check_args '5' "$#" 'user db db_user db_password type [host] [encoding]'
-
-# Checking argument format
-format_validation 'user' 'database' 'db_user' 'db_password' 'encoding'
-
-# Checking db system is enabled
+validate_format 'user' 'database' 'db_user' 'db_password' 'encoding'
 is_system_enabled 'DB_SYSTEM'
 is_system_enabled 'DB_SYSTEM'
-
-# Checking db type
-is_type_valid 'db' "$type"
-
-# Checking user
-is_user_valid
-
-# Checking user is active
-is_user_suspended
-
-# Checking db existance
-is_db_new
-
-# Checking db host
-if [ -z "$host" ]; then
-    host=$(get_next_db_host)
-fi
-is_db_host_valid
-
-# Checking package
+is_type_valid "$DB_SYSTEM" "$type"
+is_object_valid 'user' 'USER' "$user"
+is_object_suspended 'user' 'USER' "$user"
+is_object_free 'db' 'DB' "$database"
+get_next_dbhost
+is_object_valid "$type" 'DBHOST' "$host"
 is_package_full 'DATABASES'
 is_package_full 'DATABASES'
 
 
 
 
@@ -81,24 +62,22 @@ esac
 #                       Vesta                              #
 #                       Vesta                              #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Increasing db value
-increase_db_value
-
-# Increasing domain value
+# Increasing counters
+increase_dbhost_values
 increase_user_value "$user" '$U_DATABASES'
 increase_user_value "$user" '$U_DATABASES'
 
 
 # Adding db to db conf
 # Adding db to db conf
 v_str="DB='$database' USER='$db_user' HOST='$host' TYPE='$type'"
 v_str="DB='$database' USER='$db_user' HOST='$host' TYPE='$type'"
-v_str="$v_str CHARSET='$encoding' U_DISK='0' SUSPENDED='no' DATE='$V_DATE'"
-echo "$v_str" >> $V_USERS/$user/db.conf
-chmod 660 $V_USERS/$user/db.conf
+v_str="$v_str CHARSET='$encoding' U_DISK='0' SUSPENDED='no' DATE='$DATE'"
+echo "$v_str" >> $USER_DATA/db.conf
+chmod 660 $USER_DATA/db.conf
 
 
 # Hiding password
 # Hiding password
-V_EVENT="$V_DATE $V_SCRIPT $user $database $db_user ***** $type $host"
-V_EVENT="$V_EVENT $encoding"
+EVENT="$DATE $SCRIPT $user $database $db_user ***** $type $host"
+EVENT="$EVENT $encoding"
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_db_base $user $database"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_db_base $user $database"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 12 - 13
bin/v_add_db_host

@@ -24,10 +24,9 @@ template=${7-template1}
 
 
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/db.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/db.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -39,14 +38,14 @@ args_usage='type host port db_user db_password [max_db] [tpl]'
 check_args '5' "$#" "$args_usage"
 check_args '5' "$#" "$args_usage"
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'host' 'port' 'db_user' 'db_password' 'max_db'
-format_validation 'template'
+validate_format 'host' 'port' 'db_user' 'db_password' 'max_db'
+validate_format 'template'
 
 
 # Checking db system is enabled
 # Checking db system is enabled
 is_system_enabled 'DB_SYSTEM'
 is_system_enabled 'DB_SYSTEM'
 
 
 # Checking db type
 # Checking db type
-is_type_valid 'db' "$type"
+is_type_valid "$DB_SYSTEM" "$type"
 
 
 # Checking host existance
 # Checking host existance
 is_db_host_new
 is_db_host_new
@@ -66,16 +65,16 @@ esac
 case $type in
 case $type in
     mysql) new_str="HOST='$host' USER='$db_user' PASSWORD='$db_password'";
     mysql) new_str="HOST='$host' USER='$db_user' PASSWORD='$db_password'";
             new_str="$new_str PORT='$port' MAX_DB='$max_db' U_SYS_USERS=''";
             new_str="$new_str PORT='$port' MAX_DB='$max_db' U_SYS_USERS=''";
-            new_str="$new_str U_DB_BASES='0'  ACTIVE='yes' DATE='$V_DATE'";;
+            new_str="$new_str U_DB_BASES='0'  ACTIVE='yes' DATE='$DATE'";;
     pgsql) new_str="HOST='$host' USER='$db_user' PASSWORD='$db_password'";
     pgsql) new_str="HOST='$host' USER='$db_user' PASSWORD='$db_password'";
             new_str="$new_str PORT='$port' TPL='$template'";
             new_str="$new_str PORT='$port' TPL='$template'";
             new_str="$new_str MAX_DB='$max_db' U_SYS_USERS=''";
             new_str="$new_str MAX_DB='$max_db' U_SYS_USERS=''";
-            new_str="$new_str U_DB_BASES='0' ACTIVE='yes' DATE='$V_DATE'";;
+            new_str="$new_str U_DB_BASES='0' ACTIVE='yes' DATE='$DATE'";;
 esac
 esac
 
 
 # Adding host to conf
 # Adding host to conf
-echo "$new_str" >> $V_DB/$type.conf
-chmod 660 $V_DB/$type.conf
+echo "$new_str" >> $VESTA/conf/$type.conf
+chmod 660 $VESTA/conf/$type.conf
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -83,9 +82,9 @@ chmod 660 $V_DB/$type.conf
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Hidding db pass
 # Hidding db pass
-V_EVENT=$(echo $V_EVENT | sed -e "s/$db_password/xxxxxx/g")
+EVENT=$(echo $EVENT | sed -e "s/$db_password/xxxxxx/g")
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 18 - 20
bin/v_add_dns_domain

@@ -26,10 +26,9 @@ soa=$6
 ttl=${7-14400}
 ttl=${7-14400}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -40,16 +39,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain ip [template] [exp] [soa] [ttl]'
 check_args '3' "$#" 'user domain ip [template] [exp] [soa] [ttl]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'ip' 'template' 'exp' 'ttl'
+validate_format 'user' 'domain' 'ip' 'template' 'exp' 'ttl'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'DNS_SYSTEM'
 is_system_enabled 'DNS_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_new 'dns'
 is_domain_new 'dns'
@@ -58,8 +57,7 @@ is_domain_new 'dns'
 is_package_full 'DNS_DOMAINS'
 is_package_full 'DNS_DOMAINS'
 
 
 # Checking template
 # Checking template
-is_template_valid 'dns'
-
+is_dns_template_valid
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                       Action                             #
 #                       Action                             #
@@ -78,7 +76,7 @@ if [ -z "$soa" ]; then
 fi
 fi
 
 
 # Adding zone to dns dir
 # Adding zone to dns dir
-cat $V_DNSTPL/$template.tpl |\
+cat $DNSTPL/$template.tpl |\
     sed -e "s/%ip%/$ip/g" \
     sed -e "s/%ip%/$ip/g" \
         -e "s/%domain_idn%/$domain_idn/g" \
         -e "s/%domain_idn%/$domain_idn/g" \
         -e "s/%domain%/$domain/g" \
         -e "s/%domain%/$domain/g" \
@@ -90,23 +88,23 @@ cat $V_DNSTPL/$template.tpl |\
         -e "s/%ns6%/$ns6/g" \
         -e "s/%ns6%/$ns6/g" \
         -e "s/%ns7%/$ns7/g" \
         -e "s/%ns7%/$ns7/g" \
         -e "s/%ns8%/$ns8/g" \
         -e "s/%ns8%/$ns8/g" \
-        -e "s/%date%/$V_DATE/g" > $V_USERS/$user/dns/$domain
+        -e "s/%date%/$DATE/g" > $USER_DATA/dns/$domain
 
 
-records="$(wc -l $V_USERS/$user/dns/$domain)"
+records="$(wc -l $USER_DATA/dns/$domain)"
 
 
 # Adding dns.conf record
 # Adding dns.conf record
 dns_rec="DOMAIN='$domain' IP='$ip' TPL='$template' TTL='$ttl' EXP='$exp'"
 dns_rec="DOMAIN='$domain' IP='$ip' TPL='$template' TTL='$ttl' EXP='$exp'"
-dns_rec="$dns_rec SOA='$soa' RECORDS='$records' SUSPENDED='no' DATE='$V_DATE'"
-echo "$dns_rec" >> $V_USERS/$user/dns.conf
-chmod 660 $V_USERS/$user/dns.conf
+dns_rec="$dns_rec SOA='$soa' RECORDS='$records' SUSPENDED='no' DATE='$DATE'"
+echo "$dns_rec" >> $USER_DATA/dns.conf
+chmod 660 $USER_DATA/dns.conf
 
 
 # Adding zone in named.conf
 # Adding zone in named.conf
 named="zone \"$domain_idn\" {type master; file"
 named="zone \"$domain_idn\" {type master; file"
-named="$named \"$V_HOME/$user/conf/dns/$domain.db\";};"
+named="$named \"$HOMEDIR/$user/conf/dns/$domain.db\";};"
 echo "$named" >> /etc/named.conf
 echo "$named" >> /etc/named.conf
 
 
 # Updating domain dns zone
 # Updating domain dns zone
-conf="$V_HOME/$user/conf/dns/$domain.db"
+conf="$HOMEDIR/$user/conf/dns/$domain.db"
 update_domain_zone
 update_domain_zone
 
 
 chmod 640 $conf
 chmod 640 $conf
@@ -122,10 +120,10 @@ increase_user_value "$user" '$U_DNS_DOMAINS'
 increase_user_value "$user" '$U_DNS_RECORDS' "$records"
 increase_user_value "$user" '$U_DNS_RECORDS' "$records"
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'dns'
+$BIN/v_restart_dns
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_dns_domain $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_dns_domain $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 14 - 15
bin/v_add_dns_domain_record

@@ -25,10 +25,9 @@ dvalue=$(echo $dvalue | tr '[:upper:]' '[:lower:]')
 id=$6
 id=$6
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -39,16 +38,16 @@ source $V_FUNC/domain.func
 check_args '5' "$#" 'user domain record type value [id]'
 check_args '5' "$#" 'user domain record type value [id]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'record' 'rtype' 'dvalue'
+validate_format 'user' 'domain' 'record' 'rtype' 'dvalue'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'DNS_SYSTEM'
 is_system_enabled 'DNS_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -65,7 +64,7 @@ if [ -z "$id"] ; then
 fi
 fi
 
 
 # Checking id format
 # Checking id format
-format_validation 'id'
+validate_format 'id'
 
 
 # Checking id
 # Checking id
 is_dns_record_free
 is_dns_record_free
@@ -76,18 +75,18 @@ is_dns_record_free
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining zone path
 # Defining zone path
-zone="$V_USERS/$user/dns/$domain"
+zone="$USER_DATA/dns/$domain"
 
 
 # Adding record
 # Adding record
 dns_rec="ID='$id' RECORD='$record' TYPE='$rtype' VALUE='$dvalue'"
 dns_rec="ID='$id' RECORD='$record' TYPE='$rtype' VALUE='$dvalue'"
-dns_rec="$dns_rec SUSPENDED='no' DATE='$V_DATE'"
+dns_rec="$dns_rec SUSPENDED='no' DATE='$DATE'"
 echo "$dns_rec" >> $zone 
 echo "$dns_rec" >> $zone 
 
 
 # Sorting records
 # Sorting records
 sort_dns_records 
 sort_dns_records 
 
 
 # Updating zone
 # Updating zone
-conf="$V_HOME/$user/conf/dns/$domain.db"
+conf="$HOMEDIR/$user/conf/dns/$domain.db"
 update_domain_zone
 update_domain_zone
 
 
 
 
@@ -96,17 +95,17 @@ update_domain_zone
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Updating dns domain values
 # Updating dns domain values
-records="$(wc -l $V_USERS/$user/dns/$domain)"
+records="$(wc -l $USER_DATA/dns/$domain)"
 update_domain_value 'dns' '$RECORDS' "$records"
 update_domain_value 'dns' '$RECORDS' "$records"
 
 
 # Updating user counters
 # Updating user counters
 increase_user_value "$user" '$U_DNS_RECORDS'
 increase_user_value "$user" '$U_DNS_RECORDS'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'dns'
+$BIN/v_restart_dns
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_dns_domain_record $user $domain $id"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_dns_domain_record $user $domain $id"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 85 - 0
bin/v_add_mail_account

@@ -0,0 +1,85 @@
+#!/bin/bash
+# info: add mail domain account
+# options: user domain account password [quota]
+#
+# The function add new email account.
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$(idn -t --quiet -u "$2" )
+domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
+domain_idn=$(idn -t --quiet -a "$domain")
+account=$3
+password=$4
+quota=${5-0}
+
+# Importing variables
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+# Checking arg number
+check_args '4' "$#" 'user domain account password quota'
+
+# Checking argument format
+validate_format 'user' 'domain' 'account' 'password' 'quota'
+
+# Checking dns system is enabled
+is_system_enabled 'MAIL_SYSTEM'
+
+# Checking user
+is_object_valid 'user' 'USER' "$user"
+
+# Checking user is active
+is_object_suspended 'user' 'USER' "$user"
+
+# Checking domain
+is_domain_valid 'mail'
+
+# Checking domain is not suspened
+is_domain_suspended 'mail'
+
+# Checking package
+is_package_full 'MAIL_ACCOUNTS'
+
+# Checking account
+is_mail_account_free
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+password=$(/usr/sbin/dovecotpw -s md5 -p "$password")
+str="$account:$password:$user:mail::$HOMEDIR/$user:$quota"
+echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd
+
+
+#----------------------------------------------------------#
+#                       Vesta                              #
+#----------------------------------------------------------#
+
+str="ACCOUNT='$account' ALIAS='' QUOTA='$quota' AUTOREPLY='no' FWD=''"
+str="$str U_DISK='0' SUSPENDED='no' DATE='$DATE'"
+echo "$str" >> $USER_DATA/mail/$domain.conf
+
+# Increase mail accounts counter
+accounts=$(wc -l $USER_DATA/mail/$domain.conf|cut -f 1 -d ' ')
+increase_user_value "$user" '$U_MAIL_ACCOUNTS'
+update_domain_value 'mail' '$ACCOUNTS' "$accounts"
+
+# Logging
+EVENT="$DATE $SCRIPT $user $domain ***** $quota"
+log_history "$EVENT" "v_delete_mail_account $user $domain $account"
+log_event "$OK" "$EVENT"
+
+exit

+ 85 - 0
bin/v_add_mail_account_alias

@@ -0,0 +1,85 @@
+#!/bin/bash
+# info: add mail account alias aka nickname
+# options: user domain account alias
+#
+# The function add new email account.
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$(idn -t --quiet -u "$2" )
+domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
+domain_idn=$(idn -t --quiet -a "$domain")
+account=$3
+malias=$4
+
+# Importing variables
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+# Checking arg number
+check_args '4' "$#" 'user domain account alias'
+
+# Checking argument format
+validate_format 'user' 'domain' 'account' 'malias'
+
+# Checking dns system is enabled
+is_system_enabled 'MAIL_SYSTEM'
+
+# Checking user
+is_object_valid 'user' 'USER' "$user"
+
+# Checking user is active
+is_object_suspended 'user' 'USER' "$user"
+
+# Checking domain
+is_domain_valid 'mail'
+
+# Checking domain is not suspened
+is_domain_suspended 'mail'
+
+# Checking account
+is_mail_account_valid
+
+# Checking account
+is_mail_account_free "$malias"
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Adding exim alias
+str="$mailas@$domain:$account@$domain"
+echo "$str" >> $HOMEDIR/$user/conf/mail/$domain/aliases
+
+
+#----------------------------------------------------------#
+#                       Vesta                              #
+#----------------------------------------------------------#
+
+# Adding vesta alias
+aliases=$(get_domain_value "mail/$domain" '$ALIAS' "ACCOUNT='$account'")
+if [ -z "$aliases" ]; then
+    aliases="$malias"
+else
+    aliases="$aliases,$malias"
+fi
+update_domain_value "mail/$domain" '$ALIAS' "$aliases" "ACCOUNT='$account'"
+
+# Logging
+cmd='v_delete_mail_account_alias'
+log_history "$EVENT" "$cmd $user $domain $account $malias"
+log_event "$OK" "$EVENT"
+
+exit

+ 68 - 0
bin/v_add_mail_account_autoreply

@@ -0,0 +1,68 @@
+#!/bin/bash
+# info: add mail account alias aka nickname
+# options: user domain account alias
+#
+# The function add new email account.
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$(idn -t --quiet -u "$2" )
+domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
+domain_idn=$(idn -t --quiet -a "$domain")
+account=$3
+malias=$4
+
+# Importing variables
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+check_args '4' "$#" 'user domain account alias'
+validate_format 'user' 'domain' 'account' 'malias'
+is_system_enabled 'MAIL_SYSTEM'
+is_object_valid 'user' 'USER' "$user"
+is_object_suspended 'user' 'USER' "$user"
+is_object_valid 'mail' 'DOMAIN' "$domain"
+is_object_suspended 'mail' 'DOMAIN' "$domain"
+is_object_valid "mail/$domain" 'ACCOUNT' "$account"
+is_object_suspended "mail/$domain" 'ACCOUNT' "$account"
+is_key_empty "mail/$domain" '' '$AUTOREPLY'
+exit
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+exit
+# Adding exim alias
+str="$mailas@$domain:$account@$domain"
+echo "$str" >> $HOMEDIR/$user/conf/mail/$domain/aliases
+
+
+#----------------------------------------------------------#
+#                       Vesta                              #
+#----------------------------------------------------------#
+
+# Adding vesta alias
+aliases=$(get_domain_value "mail/$domain" '$ALIAS' "ACCOUNT='$account'")
+if [ -z "$aliases" ]; then
+    aliases="$malias"
+else
+    aliases="$aliases,$malias"
+fi
+update_domain_value "mail/$domain" '$ALIAS' "$aliases" "ACCOUNT='$account'"
+
+# Logging
+cmd='v_delete_mail_account_alias'
+log_history "$EVENT" "$cmd $user $domain $account $malias"
+log_event "$OK" "$EVENT"
+
+exit

+ 36 - 37
bin/v_add_mail_domain

@@ -20,10 +20,9 @@ dkim=${5-yes}
 dkim_size=${6-512}
 dkim_size=${6-512}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -34,16 +33,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain [antispam] [antivirus] [dkim] [dkim_size]'
 check_args '2' "$#" 'user domain [antispam] [antivirus] [dkim] [dkim_size]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'antispam' 'antivirus' 'dkim' 'dkim_size'
+validate_format 'user' 'domain' 'antispam' 'antivirus' 'dkim' 'dkim_size'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_new 'mail'
 is_domain_new 'mail'
@@ -57,62 +56,62 @@ is_package_full 'MAIL_DOMAINS'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding domain directory
 # Adding domain directory
-mkdir $V_HOME/$user/conf/mail/$domain
-touch $V_HOME/$user/conf/mail/$domain/aliases
-touch $V_HOME/$user/conf/mail/$domain/protection
-touch $V_HOME/$user/conf/mail/$domain/passwd
-chown -R root:mail $V_HOME/$user/conf/mail/$domain
-chmod 770 $V_HOME/$user/conf/mail/$domain
-chmod 660 $V_HOME/$user/conf/mail/$domain*
-mkdir $V_HOME/$user/mail/$domain
-chown $user:mail $V_HOME/$user/mail/$domain
-chmod 770 $V_HOME/$user/mail/$domain
+mkdir $HOMEDIR/$user/conf/mail/$domain
+touch $HOMEDIR/$user/conf/mail/$domain/aliases
+touch $HOMEDIR/$user/conf/mail/$domain/protection
+touch $HOMEDIR/$user/conf/mail/$domain/passwd
+chown -R root:mail $HOMEDIR/$user/conf/mail/$domain
+chmod 770 $HOMEDIR/$user/conf/mail/$domain
+chmod 660 $HOMEDIR/$user/conf/mail/$domain/*
+mkdir $HOMEDIR/$user/mail/$domain
+chown $user:mail $HOMEDIR/$user/mail/$domain
+chmod 770 $HOMEDIR/$user/mail/$domain
 
 
 # Adding symlink
 # Adding symlink
-ln -s $V_HOME/$user/conf/mail/$domain /etc/exim/domains/
+ln -s $HOMEDIR/$user/conf/mail/$domain /etc/exim/domains/
 
 
 # Adding antispam protection
 # Adding antispam protection
 if [ "$antispam" = 'yes' ]; then
 if [ "$antispam" = 'yes' ]; then
-    echo 'antispam' >> $V_HOME/$user/conf/mail/$domain/protection
+    echo 'antispam' >> $HOMEDIR/$user/conf/mail/$domain/protection
 fi
 fi
 
 
 # Adding antivirus protection
 # Adding antivirus protection
 if [ "$antivirus" = 'yes' ]; then
 if [ "$antivirus" = 'yes' ]; then
-    echo 'antivirus' >> $V_HOME/$user/conf/mail/$domain/protection
+    echo 'antivirus' >> $HOMEDIR/$user/conf/mail/$domain/protection
 fi
 fi
 
 
 # Adding dkim
 # Adding dkim
 if [ "$dkim" = 'yes' ]; then
 if [ "$dkim" = 'yes' ]; then
-    openssl genrsa -out $V_USERS/$user/mail/$domain.pem $dkim_size 2>/dev/null
-    openssl rsa -pubout -in $V_USERS/$user/mail/$domain.pem \
-        -out $V_USERS/$user/mail/$domain.pub 2>/dev/null
-    chmod 660 $V_USERS/$user/mail/$domain.*
+    openssl genrsa -out $USER_DATA/mail/$domain.pem $dkim_size &>/dev/null
+    openssl rsa -pubout -in $USER_DATA/mail/$domain.pem \
+        -out $USER_DATA/mail/$domain.pub &>/dev/null
+    chmod 660 $USER_DATA/mail/$domain.*
 
 
-    cp $V_USERS/$user/mail/$domain.pem $V_HOME/$user/conf/mail/$domain/dkim.pem
-    chown root:mail $V_HOME/$user/conf/mail/$domain/dkim.pem
-    chmod 660 $V_HOME/$user/conf/mail/$domain/dkim.pem
+    cp $USER_DATA/mail/$domain.pem $HOMEDIR/$user/conf/mail/$domain/dkim.pem
+    chown root:mail $HOMEDIR/$user/conf/mail/$domain/dkim.pem
+    chmod 660 $HOMEDIR/$user/conf/mail/$domain/dkim.pem
 
 
     # Adding dkim dns records
     # Adding dkim dns records
     check_dns_domain=$(is_domain_valid 'dns')
     check_dns_domain=$(is_domain_valid 'dns')
     if [ "$?" -eq 0 ]; then
     if [ "$?" -eq 0 ]; then
-        p=$(cat $V_USERS/$user/mail/$domain.pub|grep -v ' KEY---'|tr -d '\n')
+        p=$(cat $USER_DATA/mail/$domain.pub|grep -v ' KEY---'|tr -d '\n')
         record='_domainkey'
         record='_domainkey'
         policy="\"t=y; o=~;\""
         policy="\"t=y; o=~;\""
-        $V_BIN/v_add_dns_domain_record $user $domain $record TXT "$policy"
+        $BIN/v_add_dns_domain_record $user $domain $record TXT "$policy"
 
 
         record='mail._domainkey'
         record='mail._domainkey'
         selector="\"k=rsa\; p=$p\""
         selector="\"k=rsa\; p=$p\""
-        $V_BIN/v_add_dns_domain_record $user $domain $record TXT "$selector"
+        $BIN/v_add_dns_domain_record $user $domain $record TXT "$selector"
     fi
     fi
 fi
 fi
 
 
 # Adding domain to vesta db
 # Adding domain to vesta db
 s="DOMAIN='$domain' ANTIVIRUS='$antivirus' ANTISPAM='$antispam' DKIM='$dkim'"
 s="DOMAIN='$domain' ANTIVIRUS='$antivirus' ANTISPAM='$antispam' DKIM='$dkim'"
-s="$s ACCOUNTS='0' U_DISK='0' CATCHALL='' SUSPENDED='no' DATE='$V_DATE'"
-echo $s >> $V_USERS/$user/mail.conf
-touch $V_USERS/$user/mail/$domain
-chmod 660 $V_USERS/$user/mail.conf
-chmod 660 $V_USERS/$user/mail/$domain
+s="$s ACCOUNTS='0' U_DISK='0' CATCHALL='' SUSPENDED='no' DATE='$DATE'"
+echo $s >> $USER_DATA/mail.conf
+touch $USER_DATA/mail/$domain.conf
+chmod 660 $USER_DATA/mail.conf
+chmod 660 $USER_DATA/mail/$domain.conf
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -123,7 +122,7 @@ chmod 660 $V_USERS/$user/mail/$domain
 increase_user_value "$user" '$U_MAIL_DOMAINS'
 increase_user_value "$user" '$U_MAIL_DOMAINS'
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_mail_domain $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_mail_domain $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 10 - 11
bin/v_add_mail_domain_antispam

@@ -16,10 +16,9 @@ domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,16 +29,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -56,8 +55,8 @@ is_domain_key_empty 'mail' '$ANTISPAM'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding antispam key to config
 # Adding antispam key to config
-if [ -z "$(grep 'antispam' $V_HOME/$user/conf/mail/$domain/protection)" ]; then
-    echo 'antispam' >> $V_HOME/$user/conf/mail/$domain/protection
+if [ -z "$(grep 'antispam' $HOMEDIR/$user/conf/mail/$domain/protection)" ]; then
+    echo 'antispam' >> $HOMEDIR/$user/conf/mail/$domain/protection
 fi
 fi
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -68,7 +67,7 @@ fi
 update_domain_value 'mail' '$ANTISPAM' 'yes'
 update_domain_value 'mail' '$ANTISPAM' 'yes'
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_mail_domain_antispam $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_mail_domain_antispam $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 10 - 11
bin/v_add_mail_domain_antivirus

@@ -16,10 +16,9 @@ domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,16 +29,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -56,8 +55,8 @@ is_domain_key_empty 'mail' '$ANTIVIRUS'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding antivirus key to config
 # Adding antivirus key to config
-if [ -z "$(grep 'virus' $V_HOME/$user/conf/mail/$domain/protection)" ]; then
-    echo 'antivirus' >> $V_HOME/$user/conf/mail/$domain/protection
+if [ -z "$(grep 'virus' $HOMEDIR/$user/conf/mail/$domain/protection)" ]; then
+    echo 'antivirus' >> $HOMEDIR/$user/conf/mail/$domain/protection
 fi
 fi
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -68,7 +67,7 @@ fi
 update_domain_value 'mail' '$ANTIVIRUS' 'yes'
 update_domain_value 'mail' '$ANTIVIRUS' 'yes'
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_mail_domain_antivirus $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_mail_domain_antivirus $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 10 - 11
bin/v_add_mail_domain_cactchall

@@ -17,10 +17,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 email="$3"
 email="$3"
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -31,16 +30,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain email'
 check_args '3' "$#" 'user domain email'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'email'
+validate_format 'user' 'domain' 'email'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -57,8 +56,8 @@ is_domain_key_empty 'mail' '$CATCHALL'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding catchall alias
 # Adding catchall alias
-sed -i "/*@demo.vestacp.com:/d" $V_HOME/$user/conf/mail/$domain/aliases
-echo "*@demo.vestacp.com:$email" >> $V_HOME/$user/conf/mail/$domain/aliases
+sed -i "/*@demo.vestacp.com:/d" $HOMEDIR/$user/conf/mail/$domain/aliases
+echo "*@demo.vestacp.com:$email" >> $HOMEDIR/$user/conf/mail/$domain/aliases
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -69,7 +68,7 @@ echo "*@demo.vestacp.com:$email" >> $V_HOME/$user/conf/mail/$domain/aliases
 update_domain_value 'mail' '$CATCHALL' "$email"
 update_domain_value 'mail' '$CATCHALL' "$email"
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_mail_domain_catchall $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_mail_domain_catchall $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 18 - 19
bin/v_add_mail_domain_dkim

@@ -17,10 +17,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 dkim_size=${3-512}
 dkim_size=${3-512}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -31,16 +30,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain [dkim_size]'
 check_args '2' "$#" 'user domain [dkim_size]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'dkim_size'
+validate_format 'user' 'domain' 'dkim_size'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -57,28 +56,28 @@ is_domain_key_empty 'mail' '$DKIM'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Generating dkim
 # Generating dkim
-openssl genrsa -out $V_USERS/$user/mail/$domain.pem $dkim_size 2>/dev/null
-openssl rsa -pubout -in $V_USERS/$user/mail/$domain.pem \
-    -out $V_USERS/$user/mail/$domain.pub 2>/dev/null
-chmod 660 $V_USERS/$user/mail/$domain.*
+openssl genrsa -out $USER_DATA/mail/$domain.pem $dkim_size &>/dev/null
+openssl rsa -pubout -in $USER_DATA/mail/$domain.pem \
+    -out $USER_DATA/mail/$domain.pub &>/dev/null
+chmod 660 $USER_DATA/mail/$domain.*
 
 
 # Adding dkim to config
 # Adding dkim to config
-cp $V_USERS/$user/mail/$domain.pem $V_HOME/$user/conf/mail/$domain/dkim.pem
-chown root:mail $V_HOME/$user/conf/mail/$domain/dkim.pem
-chmod 660 $V_HOME/$user/conf/mail/$domain/dkim.pem
+cp $USER_DATA/mail/$domain.pem $HOMEDIR/$user/conf/mail/$domain/dkim.pem
+chown root:mail $HOMEDIR/$user/conf/mail/$domain/dkim.pem
+chmod 660 $HOMEDIR/$user/conf/mail/$domain/dkim.pem
 
 
 # Checking dns domain
 # Checking dns domain
 check_dns_domain=$(is_domain_valid 'dns')
 check_dns_domain=$(is_domain_valid 'dns')
 if [ "$?" -eq 0 ]; then
 if [ "$?" -eq 0 ]; then
     # Adding dkim dns records
     # Adding dkim dns records
-    p=$(cat $V_USERS/$user/mail/$domain.pub|grep -v ' KEY---'|tr -d '\n')
+    p=$(cat $USER_DATA/mail/$domain.pub|grep -v ' KEY---'|tr -d '\n')
     record='_domainkey'
     record='_domainkey'
     policy="\"t=y; o=~;\""
     policy="\"t=y; o=~;\""
-    $V_BIN/v_add_dns_domain_record $user $domain $record TXT "$policy"
+    $BIN/v_add_dns_domain_record $user $domain $record TXT "$policy"
 
 
     record='mail._domainkey'
     record='mail._domainkey'
     selector="\"k=rsa\; p=$p\""
     selector="\"k=rsa\; p=$p\""
-    $V_BIN/v_add_dns_domain_record $user $domain $record TXT "$selector"
+    $BIN/v_add_dns_domain_record $user $domain $record TXT "$selector"
 fi
 fi
 
 
 
 
@@ -90,7 +89,7 @@ fi
 update_domain_value 'mail' '$DKIM' 'yes'
 update_domain_value 'mail' '$DKIM' 'yes'
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_mail_domain_dkim $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_mail_domain_dkim $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 11 - 12
bin/v_add_sys_ip

@@ -23,11 +23,10 @@ ip_status="${5-shared}"
 ip_name=$6
 ip_name=$6
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/ip.func
-source $V_FUNC/domain.func    # for namehosting
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/ip.sh
+source $VESTA/func/domain.sh    # for namehosting
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                    Verifications                         #
 #                    Verifications                         #
@@ -37,22 +36,22 @@ source $V_FUNC/domain.func    # for namehosting
 check_args '2' "$#" 'ip mask [interface] [user] [ip_status] [ip_name]'
 check_args '2' "$#" 'ip mask [interface] [user] [ip_status] [ip_name]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'ip' 'mask' 'interface' 'user'
+validate_format 'ip' 'mask' 'interface' 'user'
 
 
 # Checking system ip
 # Checking system ip
 is_sys_ip_free
 is_sys_ip_free
 
 
 # Checking user
 # Checking user
-is_user_valid "$user"
+is_object_valid 'user' 'USER' "$user" "$user"
 
 
 # Checking ip_status
 # Checking ip_status
 if [ ! -z "$ip_status" ]; then
 if [ ! -z "$ip_status" ]; then
-    format_validation 'ip_status'
+    validate_format 'ip_status'
 fi
 fi
 
 
 # Checking ip_name
 # Checking ip_name
 if [ ! -z "$ip_name" ] ; then
 if [ ! -z "$ip_name" ] ; then
-    format_validation 'ip_name'
+    validate_format 'ip_name'
 fi
 fi
 
 
 
 
@@ -80,7 +79,7 @@ ip_add_startup
 ip_add_vesta
 ip_add_vesta
 
 
 # Importing main config
 # Importing main config
-source $V_CONF/vesta.conf
+source $VESTA/conf/vesta.conf
 
 
 # Adding namehosting support
 # Adding namehosting support
 namehost_ip_support
 namehost_ip_support
@@ -107,10 +106,10 @@ fi
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
 if [ "$web_restart" = 'yes' ]; then
 if [ "$web_restart" = 'yes' ]; then
-    restart_schedule 'web'
+    $BIN/v_restart_web
 fi
 fi
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 61 - 61
bin/v_add_user

@@ -18,18 +18,17 @@ fname=$5
 lname=$6
 lname=$6
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 is_user_free() {
 is_user_free() {
     # Parsing domain values
     # Parsing domain values
     check_sysuser=$(cut -f 1 -d : /etc/passwd | grep -w "$user" )
     check_sysuser=$(cut -f 1 -d : /etc/passwd | grep -w "$user" )
 
 
     # Checking result
     # Checking result
-    if [ ! -z "$check_sysuser" ] || [ -e "$V_USERS/$user" ]; then
+    if [ ! -z "$check_sysuser" ] || [ -e "$USER_DATA" ]; then
         echo "Error: user $user exist"
         echo "Error: user $user exist"
-        log_event 'debug' "$E_EXISTS $V_EVENT"
+        log_event "$E_EXISTS" "$EVENT"
         exit $E_EXISTS
         exit $E_EXISTS
     fi
     fi
 }
 }
@@ -43,7 +42,7 @@ is_user_free() {
 check_args '3' "$#" 'user password email [package] [fname] [lname]'
 check_args '3' "$#" 'user password email [package] [fname] [lname]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'password' 'email' 'package' 'fname' 'lname'
+validate_format 'user' 'password' 'email' 'package' 'fname' 'lname'
 
 
 # Checking user
 # Checking user
 is_user_free "$user"
 is_user_free "$user"
@@ -57,7 +56,7 @@ is_package_valid "$package"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing package data
 # Parsing package data
-package_data=$(cat $V_PKG/$package.pkg)
+package_data=$(cat $VESTA/data/packages/$package.pkg)
 
 
 # Checking shell
 # Checking shell
 shell_conf=$(echo "$package_data" | grep 'SHELL' | cut -f 2 -d \')
 shell_conf=$(echo "$package_data" | grep 'SHELL' | cut -f 2 -d \')
@@ -69,45 +68,45 @@ case $shell_conf in
 esac
 esac
 
 
 # Adding user
 # Adding user
-/usr/sbin/adduser "$user" -s "$shell" -c "$email" -m -d "$V_HOME/$user"
+/usr/sbin/adduser "$user" -s "$shell" -c "$email" -m -d "$HOMEDIR/$user"
 
 
 # Adding password
 # Adding password
-echo "$password" | /usr/bin/passwd "$user" --stdin >/dev/null 2>&1
+echo "$password" | /usr/bin/passwd "$user" --stdin &>/dev/null
 
 
 # Building directory tree
 # Building directory tree
-mkdir $V_HOME/$user/conf
-chmod 751 $V_HOME/$user/conf/web
+mkdir $HOMEDIR/$user/conf
+chmod 751 $HOMEDIR/$user/conf/web
 
 
 if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
 if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
-    mkdir $V_HOME/$user/conf/web
-    mkdir $V_HOME/$user/web
-    mkdir $V_HOME/$user/tmp
-    chmod 751 $V_HOME/$user/conf/web
-    chmod 751 $V_HOME/$user/web
-    chmod 777 $V_HOME/$user/tmp
-    chown $user:$user $V_HOME/$user/web
+    mkdir $HOMEDIR/$user/conf/web
+    mkdir $HOMEDIR/$user/web
+    mkdir $HOMEDIR/$user/tmp
+    chmod 751 $HOMEDIR/$user/conf/web
+    chmod 751 $HOMEDIR/$user/web
+    chmod 777 $HOMEDIR/$user/tmp
+    chown $user:$user $HOMEDIR/$user/web
 fi
 fi
 
 
 if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then
 if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then
-    mkdir $V_HOME/$user/conf/mail
-    mkdir $V_HOME/$user/mail
-    chmod 751 $V_HOME/$user/mail
-    chmod 751 $V_HOME/$user/conf/mail
+    mkdir $HOMEDIR/$user/conf/mail
+    mkdir $HOMEDIR/$user/mail
+    chmod 751 $HOMEDIR/$user/mail
+    chmod 751 $HOMEDIR/$user/conf/mail
 fi
 fi
 
 
 if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
 if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
-    mkdir $V_HOME/$user/conf/dns
-    chmod 751 $V_HOME/$user/conf/dns
+    mkdir $HOMEDIR/$user/conf/dns
+    chmod 751 $HOMEDIR/$user/conf/dns
 fi 
 fi 
 
 
 
 
 # Set permissions
 # Set permissions
-chmod -R a+x $V_HOME/$user
+chmod -R a+x $HOMEDIR/$user
 
 
 # Checking quota
 # Checking quota
 if [ ! -z "$DISK_QUOTA" ] && [ "$DISK_QUOTA" != 'no' ]; then
 if [ ! -z "$DISK_QUOTA" ] && [ "$DISK_QUOTA" != 'no' ]; then
     DISK_QUOTA=$(echo "$package_data" | grep 'DISK_QUOTA' | cut -f 2 -d \')
     DISK_QUOTA=$(echo "$package_data" | grep 'DISK_QUOTA' | cut -f 2 -d \')
-    #$V_BIN/v_add_user_quota "$user" "$DISK_QUOTA"
+    #$BIN/v_add_user_quota "$user" "$DISK_QUOTA"
 fi
 fi
 
 
 
 
@@ -116,57 +115,58 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding user dir
 # Adding user dir
-mkdir $V_USERS/$user
-chmod 770 $V_USERS/$user
+mkdir $USER_DATA
+chmod 770 $USER_DATA
 
 
 # Creating configuration files and pipes
 # Creating configuration files and pipes
-touch $V_USERS/$user/backup.conf
-chmod 660 $V_USERS/$user/backup.conf
-touch $V_USERS/$user/history.log
-chmod 660 $V_USERS/$user/history.log
-touch $V_USERS/$user/stats.log
-chmod 660 $V_USERS/$user/stats.log
+touch $USER_DATA/backup.conf
+chmod 660 $USER_DATA/backup.conf
+touch $USER_DATA/history.log
+chmod 660 $USER_DATA/history.log
+touch $USER_DATA/stats.log
+chmod 660 $USER_DATA/stats.log
 
 
-echo "v_update_user_disk $user" >> $V_QUEUE/disk.pipe
+echo "v_update_user_disk $user" >> $VESTA/data/queue/disk.pipe
 
 
 if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
 if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
-    mkdir $V_USERS/$user/ssl
-    chmod 770 $V_USERS/$user/ssl
-    touch $V_USERS/$user/web.conf
-    chmod 660 $V_USERS/$user/web.conf
-    echo "$V_BIN/v_update_web_domains_traff $user" >> $V_QUEUE/traffic.pipe
-    echo "v_update_web_domains_disk $user" >> $V_QUEUE/disk.pipe
+    mkdir $USER_DATA/ssl
+    chmod 770 $USER_DATA/ssl
+    touch $USER_DATA/web.conf
+    chmod 660 $USER_DATA/web.conf
+    echo "$BIN/v_update_web_domains_traff $user" \
+        >> $VESTA/data/queue/traffic.pipe
+    echo "v_update_web_domains_disk $user" >> $VESTA/data/queue/disk.pipe
 fi
 fi
 
 
 if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
 if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
-    mkdir $V_USERS/$user/dns
-    chmod 770 $V_USERS/$user/dns
-    touch $V_USERS/$user/dns.conf
-    chmod 660 $V_USERS/$user/dns.conf
+    mkdir $USER_DATA/dns
+    chmod 770 $USER_DATA/dns
+    touch $USER_DATA/dns.conf
+    chmod 660 $USER_DATA/dns.conf
 fi
 fi
 
 
 if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then
 if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then
-    mkdir $V_USERS/$user/mail
-    chmod 770 $V_USERS/$user/mail
-    touch $V_USERS/$user/mail.conf
-    chmod 660 $V_USERS/$user/mail.conf
-    echo "v_upd_mail_domains_disk $user" >> $V_QUEUE/disk.pipe
+    mkdir $USER_DATA/mail
+    chmod 770 $USER_DATA/mail
+    touch $USER_DATA/mail.conf
+    chmod 660 $USER_DATA/mail.conf
+    echo "v_upd_mail_domains_disk $user" >> $VESTA/data/queue/disk.pipe
 fi
 fi
 
 
 if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
 if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
-    touch $V_USERS/$user/db.conf
-    chmod 660 $V_USERS/$user/db.conf
-    echo "v_update_db_bases_disk $user" >> $V_QUEUE/disk.pipe
+    touch $USER_DATA/db.conf
+    chmod 660 $USER_DATA/db.conf
+    echo "v_update_db_bases_disk $user" >> $VESTA/data/queue/disk.pipe
 fi
 fi
 
 
 if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ]; then
 if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ]; then
-    touch $V_USERS/$user/cron.conf
-    chmod 660 $V_USERS/$user/cron.conf
+    touch $USER_DATA/cron.conf
+    chmod 660 $USER_DATA/cron.conf
 fi
 fi
 
 
 # Filling user config
 # Filling user config
 if [ "$user" != 'admin' ]; then
 if [ "$user" != 'admin' ]; then
-    ip_avail=$($V_BIN/v_list_user_ips admin plain |grep -w shared|wc -l)
+    ip_avail=$($BIN/v_list_user_ips admin plain |grep -w shared|wc -l)
     u_users=0
     u_users=0
 else
 else
     ip_avail=0
     ip_avail=0
@@ -178,7 +178,7 @@ LNAME='$lname'
 PACKAGE='$package'
 PACKAGE='$package'
 $package_data
 $package_data
 CONTACT='$email'
 CONTACT='$email'
-REPORTS='yes'
+CRON_REPORTS='yes'
 RKEY='$(gen_password)'
 RKEY='$(gen_password)'
 SUSPENDED='no'
 SUSPENDED='no'
 SUSPENDED_USERS='0'
 SUSPENDED_USERS='0'
@@ -206,8 +206,8 @@ U_MAIL_ACCOUNTS='0'
 U_DATABASES='0'
 U_DATABASES='0'
 U_CRON_JOBS='0'
 U_CRON_JOBS='0'
 U_BACKUPS='0'
 U_BACKUPS='0'
-DATE='$V_DATE'" > $V_USERS/$user/user.conf
-chmod 660 $V_USERS/$user/user.conf
+DATE='$DATE'" > $USER_DATA/user.conf
+chmod 660 $USER_DATA/user.conf
 
 
 # Updating admin counter
 # Updating admin counter
 if [ "$user" != 'admin' ]; then
 if [ "$user" != 'admin' ]; then
@@ -215,9 +215,9 @@ if [ "$user" != 'admin' ]; then
 fi
 fi
 
 
 # Hiding password
 # Hiding password
-V_EVENT="$V_DATE $V_SCRIPT $user ***** $email $package $fname $lname"
+EVENT="$DATE $SCRIPT $user ***** $email $package $fname $lname"
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 6 - 7
bin/v_add_user_backup

@@ -13,9 +13,8 @@
 user=$1
 user=$1
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -26,13 +25,13 @@ source $V_FUNC/shared.func
 check_args '1' "$#" 'user'
 check_args '1' "$#" 'user'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking backup system is enabled
 # Checking backup system is enabled
 is_system_enabled 'BACKUP_SYSTEM'
 is_system_enabled 'BACKUP_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user backups
 # Checking user backups
 is_backup_enabled
 is_backup_enabled
@@ -43,7 +42,7 @@ is_backup_enabled
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding backup to pipe
 # Adding backup to pipe
-echo "$user" >> $V_QUEUE/backup.pipe
+echo "$user" >> $VESTA/data/queue/backup.pipe
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -51,6 +50,6 @@ echo "$user" >> $V_QUEUE/backup.pipe
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 50 - 51
bin/v_add_web_domain

@@ -23,11 +23,10 @@ ip=$3
 template=${4-default}
 template=${4-default}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
-source $V_FUNC/ip.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
+source $VESTA/func/ip.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -38,16 +37,16 @@ source $V_FUNC/ip.func
 check_args '3' "$#" 'user domain ip [template]'
 check_args '3' "$#" 'user domain ip [template]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'ip' 'template'
+validate_format 'user' 'domain' 'ip' 'template'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_new 'dns'
 is_domain_new 'dns'
@@ -60,7 +59,7 @@ is_package_full 'WEB_DOMAINS'
 
 
 # Checking template
 # Checking template
 templates=$(get_user_value '$WEB_TPL')
 templates=$(get_user_value '$WEB_TPL')
-is_template_valid "web"
+is_apache_template_valid
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -88,14 +87,14 @@ fi
 # Defining vars for add_config function
 # Defining vars for add_config function
 group="$user"
 group="$user"
 email="$user@$domain"
 email="$user@$domain"
-docroot="$V_HOME/$user/web/$domain/public_html"
+docroot="$HOMEDIR/$user/web/$domain/public_html"
 docroot_string="DocumentRoot $docroot"
 docroot_string="DocumentRoot $docroot"
 
 
-conf="$V_HOME/$user/conf/web/httpd.conf"
-tpl_file="$V_WEBTPL/apache_$template.tpl"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
+tpl_file="$WEBTPL/apache_$template.tpl"
 
 
 # Parsing template keys
 # Parsing template keys
-template_data=$(cat $V_WEBTPL/apache_$template.descr|grep -v '#')
+template_data=$(cat $WEBTPL/apache_$template.descr|grep -v '#')
 for keys in $template_data; do
 for keys in $template_data; do
     eval ${keys%%=*}=${keys#*=}
     eval ${keys%%=*}=${keys#*=}
 done
 done
@@ -120,14 +119,14 @@ fi
 add_web_config
 add_web_config
 
 
 # Building directory tree
 # Building directory tree
-mkdir $V_HOME/$user/web/$domain \
-      $V_HOME/$user/web/$domain/public_html \
-      $V_HOME/$user/web/$domain/public_shtml \
-      $V_HOME/$user/web/$domain/document_errors \
-      $V_HOME/$user/web/$domain/cgi-bin \
-      $V_HOME/$user/web/$domain/private \
-      $V_HOME/$user/web/$domain/stats \
-      $V_HOME/$user/web/$domain/logs
+mkdir $HOMEDIR/$user/web/$domain \
+      $HOMEDIR/$user/web/$domain/public_html \
+      $HOMEDIR/$user/web/$domain/public_shtml \
+      $HOMEDIR/$user/web/$domain/document_errors \
+      $HOMEDIR/$user/web/$domain/cgi-bin \
+      $HOMEDIR/$user/web/$domain/private \
+      $HOMEDIR/$user/web/$domain/stats \
+      $HOMEDIR/$user/web/$domain/logs
 
 
 # Adding domain logs
 # Adding domain logs
 touch /var/log/httpd/domains/$domain.bytes \
 touch /var/log/httpd/domains/$domain.bytes \
@@ -135,50 +134,50 @@ touch /var/log/httpd/domains/$domain.bytes \
       /var/log/httpd/domains/$domain.error.log
       /var/log/httpd/domains/$domain.error.log
 
 
 # Adding symlink for logs
 # Adding symlink for logs
-ln -s /var/log/httpd/domains/$domain.*log $V_HOME/$user/web/$domain/logs/
+ln -s /var/log/httpd/domains/$domain.*log $HOMEDIR/$user/web/$domain/logs/
 
 
 # Adding domain skeleton
 # Adding domain skeleton
-if [ -e "$V_WEBTPL/skel/public_html/" ]; then
-    cp -r $V_WEBTPL/skel/public_html/ $V_HOME/$user/web/$domain/
+if [ -e "$WEBTPL/skel/public_html/" ]; then
+    cp -r $WEBTPL/skel/public_html/ $HOMEDIR/$user/web/$domain/
 fi
 fi
-if [ -e "$V_WEBTPL/skel/public_shtml/" ]; then
-    cp -r $V_WEBTPL/skel/public_shtml/ $V_HOME/$user/web/$domain/
+if [ -e "$WEBTPL/skel/public_shtml/" ]; then
+    cp -r $WEBTPL/skel/public_shtml/ $HOMEDIR/$user/web/$domain/
 fi
 fi
-if [ -e "$V_WEBTPL/skel/document_errors/" ]; then
-    cp -r $V_WEBTPL/skel/document_errors/ $V_HOME/$user/web/$domain/
+if [ -e "$WEBTPL/skel/document_errors/" ]; then
+    cp -r $WEBTPL/skel/document_errors/ $HOMEDIR/$user/web/$domain/
 fi
 fi
-if [ -e "$V_WEBTPL/skel/cgi-bin/" ]; then
-    cp -r $V_WEBTPL/skel/cgi-bin/ $V_HOME/$user/web/$domain/
+if [ -e "$WEBTPL/skel/cgi-bin/" ]; then
+    cp -r $WEBTPL/skel/cgi-bin/ $HOMEDIR/$user/web/$domain/
 fi
 fi
 
 
 # Changing tpl values
 # Changing tpl values
-for file in $(find "$V_HOME/$user/web/$domain/" -type f); do
+for file in $(find "$HOMEDIR/$user/web/$domain/" -type f); do
     sed -i "s/%domain%/$domain/g" $file
     sed -i "s/%domain%/$domain/g" $file
 done
 done
 
 
 # Changing file owner
 # Changing file owner
-chown -R $user:$user $V_HOME/$user/web/$domain
+chown -R $user:$user $HOMEDIR/$user/web/$domain
 chown root:$user /var/log/httpd/domains/$domain.*
 chown root:$user /var/log/httpd/domains/$domain.*
 chown root:apache $conf
 chown root:apache $conf
 
 
 # Changing file permissions
 # Changing file permissions
 chmod 660 $conf
 chmod 660 $conf
-chmod 551 $V_HOME/$user/web/$domain
-chmod 751 $V_HOME/$user/web/$domain/private
-chmod 751 $V_HOME/$user/web/$domain/cgi-bin
-chmod 751 $V_HOME/$user/web/$domain/public_html
-chmod 751 $V_HOME/$user/web/$domain/public_shtml
-chmod 751 $V_HOME/$user/web/$domain/document_errors
-chmod -f -R 775 $V_HOME/$user/web/$domain/cgi-bin/*
-chmod -f -R 775 $V_HOME/$user/web/$domain/public_html/*
-chmod -f -R 775 $V_HOME/$user/web/$domain/document_errors/*
-chmod 551 $V_HOME/$user/web/$domain/stats
-chmod 551 $V_HOME/$user/web/$domain/logs
+chmod 551 $HOMEDIR/$user/web/$domain
+chmod 751 $HOMEDIR/$user/web/$domain/private
+chmod 751 $HOMEDIR/$user/web/$domain/cgi-bin
+chmod 751 $HOMEDIR/$user/web/$domain/public_html
+chmod 751 $HOMEDIR/$user/web/$domain/public_shtml
+chmod 751 $HOMEDIR/$user/web/$domain/document_errors
+chmod -f -R 775 $HOMEDIR/$user/web/$domain/cgi-bin/*
+chmod -f -R 775 $HOMEDIR/$user/web/$domain/public_html/*
+chmod -f -R 775 $HOMEDIR/$user/web/$domain/document_errors/*
+chmod 551 $HOMEDIR/$user/web/$domain/stats
+chmod 551 $HOMEDIR/$user/web/$domain/logs
 chmod 640 /var/log/httpd/domains/$domain.*
 chmod 640 /var/log/httpd/domains/$domain.*
 
 
 # Running template trigger
 # Running template trigger
-if [ -x $V_WEBTPL/apache_$template.sh ]; then
-    $V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot
+if [ -x $WEBTPL/apache_$template.sh ]; then
+    $WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $docroot
 fi
 fi
 
 
 # Checking main vesta httpd config
 # Checking main vesta httpd config
@@ -210,17 +209,17 @@ v_str="$v_str ALIAS='$aliases'"
 v_str="$v_str $template_data"    # Inserting PHP, CGI and ELOG keys
 v_str="$v_str $template_data"    # Inserting PHP, CGI and ELOG keys
 v_str="$v_str STATS='' STATS_AUTH=''"
 v_str="$v_str STATS='' STATS_AUTH=''"
 v_str="$v_str SSL='no' SSL_HOME='single'"
 v_str="$v_str SSL='no' SSL_HOME='single'"
-v_str="$v_str NGINX='' NGINX_EXT='' SUSPENDED='no' DATE='$V_DATE'"
+v_str="$v_str NGINX='' NGINX_EXT='' SUSPENDED='no' DATE='$DATE'"
 
 
 # Registering domain
 # Registering domain
-echo "$v_str" >> $V_USERS/$user/web.conf
-chmod 660 $V_USERS/$user/web.conf
+echo "$v_str" >> $USER_DATA/web.conf
+chmod 660 $USER_DATA/web.conf
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_web_domain $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_web_domain $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 17 - 18
bin/v_add_web_domain_alias

@@ -20,10 +20,9 @@ dom_alias=$(echo $dom_alias | tr '[:upper:]' '[:lower:]')
 dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
 dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -34,16 +33,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain dom_alias'
 check_args '3' "$#" 'user domain dom_alias'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'dom_alias'
+validate_format 'user' 'domain' 'dom_alias'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -64,8 +63,8 @@ is_package_full 'WEB_ALIASES'
 
 
 # Parsing domain values
 # Parsing domain values
 get_domain_values 'web'
 get_domain_values 'web'
-tpl_file="$V_WEBTPL/apache_$TPL.tpl"
-conf="$V_HOME/$user/conf/web/httpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.tpl"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
 
 
 # Parsing domain aliases
 # Parsing domain aliases
 if [ -z "$ALIAS" ]; then
 if [ -z "$ALIAS" ]; then
@@ -82,23 +81,23 @@ del_web_config
 add_web_config
 add_web_config
 
 
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-    conf="$V_HOME/$user/conf/web/shttpd.conf"
+    tpl_file="$WEBTPL/apache_$TPL.stpl"
+    conf="$HOMEDIR/$user/conf/web/shttpd.conf"
     del_web_config
     del_web_config
     add_web_config
     add_web_config
 fi
 fi
 
 
 # Checking nginx
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
-    conf="$V_HOME/$user/conf/web/nginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
+    conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     del_web_config
     add_web_config
     add_web_config
 
 
     if [ "$SSL" = 'yes' ]; then
     if [ "$SSL" = 'yes' ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
-        tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-        conf="$V_HOME/$user/conf/web/snginx.conf"
+        tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+        conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         del_web_config
         add_web_config
         add_web_config
     fi
     fi
@@ -116,9 +115,9 @@ update_domain_value 'web' '$ALIAS' "$ALIAS"
 increase_user_value "$user" '$U_WEB_ALIASES'
 increase_user_value "$user" '$U_WEB_ALIASES'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
-log_history "$V_EVENT" "v_delete_web_domain_alias $user $domain $dom_alias"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_web_domain_alias $user $domain $dom_alias"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 13 - 14
bin/v_add_web_domain_cgi

@@ -18,10 +18,9 @@ domain=$(idn -t --quiet -u "$2" )
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -32,16 +31,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -59,8 +58,8 @@ is_domain_key_empty 'web' '$CGI'
 
 
 # Parsing domain values
 # Parsing domain values
 get_domain_values 'web'
 get_domain_values 'web'
-tpl_file="$V_WEBTPL/apache_$TPL.tpl"
-conf="$V_HOME/$user/conf/web/httpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.tpl"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
 CGI='yes'
 CGI='yes'
 
 
 # Preparing domain values for the template substitution
 # Preparing domain values for the template substitution
@@ -72,8 +71,8 @@ add_web_config
 
 
 # Checking ssl
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-    conf="$V_HOME/$user/conf/web/shttpd.conf"
+    tpl_file="$WEBTPL/apache_$TPL.stpl"
+    conf="$HOMEDIR/$user/conf/web/shttpd.conf"
     del_web_config
     del_web_config
     add_web_config
     add_web_config
 fi
 fi
@@ -87,10 +86,10 @@ fi
 update_domain_value 'web' '$CGI' 'yes'
 update_domain_value 'web' '$CGI' 'yes'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_web_domain_cgi $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_web_domain_cgi $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 17 - 18
bin/v_add_web_domain_elog

@@ -16,10 +16,9 @@ domain=$(idn -t --quiet -u "$2" )
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,16 +29,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -57,8 +56,8 @@ is_domain_key_empty 'web' '$ELOG'
 
 
 # Parsing domain values
 # Parsing domain values
 get_domain_values 'web'
 get_domain_values 'web'
-tpl_file="$V_WEBTPL/apache_$TPL.tpl"
-conf="$V_HOME/$user/conf/web/httpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.tpl"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
 ELOG='yes'
 ELOG='yes'
 
 
 # Preparing domain values for the template substitution
 # Preparing domain values for the template substitution
@@ -70,23 +69,23 @@ add_web_config
 
 
 # Checking ssl
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-    conf="$V_HOME/$user/conf/web/shttpd.conf"
+    tpl_file="$WEBTPL/apache_$TPL.stpl"
+    conf="$HOMEDIR/$user/conf/web/shttpd.conf"
     del_web_config
     del_web_config
     add_web_config
     add_web_config
 fi
 fi
 
 
 # Checking nginx
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
-    conf="$V_HOME/$user/conf/web/nginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
+    conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     del_web_config
     add_web_config
     add_web_config
 
 
     if [ "$SSL" = 'yes' ]; then
     if [ "$SSL" = 'yes' ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
-        tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-        conf="$V_HOME/$user/conf/web/snginx.conf"
+        tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+        conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         del_web_config
         add_web_config
         add_web_config
     fi
     fi
@@ -101,10 +100,10 @@ fi
 update_domain_value 'web' '$ELOG' 'yes'
 update_domain_value 'web' '$ELOG' 'yes'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_web_domain_elog $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_web_domain_elog $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 14 - 15
bin/v_add_web_domain_nginx

@@ -20,10 +20,9 @@ pdf,ppt,txt,tar,wav,bmp,rtf,js,mp3,avi,mpeg,html,htm"
 extentions=${4-$default_extentions}
 extentions=${4-$default_extentions}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -34,16 +33,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain [template] [extentions]'
 check_args '2' "$#" 'user domain [template] [extentions]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'template' 'extentions'
+validate_format 'user' 'domain' 'template' 'extentions'
 
 
 # Checking proxy system is enabled
 # Checking proxy system is enabled
 is_system_enabled 'proxy'
 is_system_enabled 'proxy'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -55,7 +54,7 @@ is_domain_suspended 'web'
 is_domain_key_empty 'web' '$NGINX'
 is_domain_key_empty 'web' '$NGINX'
 
 
 # Checking template
 # Checking template
-is_template_valid "proxy"
+is_nginx_template_valid
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -66,8 +65,8 @@ is_template_valid "proxy"
 get_domain_values 'web'
 get_domain_values 'web'
 NGINX="$template"
 NGINX="$template"
 NGINX_EXT="$extentions"
 NGINX_EXT="$extentions"
-tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
-conf="$V_HOME/$user/conf/web/nginx.conf"
+tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
+conf="$HOMEDIR/$user/conf/web/nginx.conf"
 
 
 # Preparing domain values for the template substitution
 # Preparing domain values for the template substitution
 upd_web_domain_values
 upd_web_domain_values
@@ -87,8 +86,8 @@ fi
 # Checking ssl
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
     proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
     proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-    conf="$V_HOME/$user/conf/web/snginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+    conf="$HOMEDIR/$user/conf/web/snginx.conf"
     add_web_config
     add_web_config
 
 
     chown root:nginx $conf
     chown root:nginx $conf
@@ -112,9 +111,9 @@ update_domain_value 'web' '$NGINX' "$NGINX"
 update_domain_value 'web' '$NGINX_EXT' "$extentions"
 update_domain_value 'web' '$NGINX_EXT' "$extentions"
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
-log_history "$V_EVENT" "v_delete_web_domain_nginx $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_web_domain_nginx $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 26 - 27
bin/v_add_web_domain_ssl

@@ -22,11 +22,10 @@ ssl_dir=$3
 ssl_home=${4-single}
 ssl_home=${4-single}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
-source $V_FUNC/ip.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
+source $VESTA/func/ip.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -37,16 +36,16 @@ source $V_FUNC/ip.func
 check_args '3' "$#" 'user domain ssl_dir [ssl_home]'
 check_args '3' "$#" 'user domain ssl_dir [ssl_home]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'ssl_dir'
+validate_format 'user' 'domain' 'ssl_dir'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -66,19 +65,19 @@ is_web_domain_cert_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding certificate to user data directory
 # Adding certificate to user data directory
-cp -f $ssl_dir/$domain.crt $V_USERS/$user/ssl/$domain.crt
-cp -f $ssl_dir/$domain.key $V_USERS/$user/ssl/$domain.key
-cp -f $ssl_dir/$domain.crt $V_USERS/$user/ssl/$domain.pem
+cp -f $ssl_dir/$domain.crt $USER_DATA/ssl/$domain.crt
+cp -f $ssl_dir/$domain.key $USER_DATA/ssl/$domain.key
+cp -f $ssl_dir/$domain.crt $USER_DATA/ssl/$domain.pem
 if [ -e "$ssl_dir/$domain.ca" ]; then
 if [ -e "$ssl_dir/$domain.ca" ]; then
-    cp -f $ssl_dir/$domain.ca $V_USERS/$user/ssl/$domain.ca
-    cat $V_USERS/$user/ssl/$domain.ca >> $V_USERS/$user/ssl/$domain.pem
+    cp -f $ssl_dir/$domain.ca $USER_DATA/ssl/$domain.ca
+    cat $USER_DATA/ssl/$domain.ca >> $USER_DATA/ssl/$domain.pem
 fi
 fi
-chmod 660 $V_USERS/$user/ssl/$domain.*
+chmod 660 $USER_DATA/ssl/$domain.*
 
 
 # Parsing domain values
 # Parsing domain values
 get_domain_values 'web'
 get_domain_values 'web'
-conf="$V_HOME/$user/conf/web/shttpd.conf"
-tpl_file="$V_WEBTPL/apache_$TPL.stpl"
+conf="$HOMEDIR/$user/conf/web/shttpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.stpl"
 SSL_HOME="$ssl_home"
 SSL_HOME="$ssl_home"
 
 
 # Checking ip ownership
 # Checking ip ownership
@@ -94,16 +93,16 @@ chown root:apache $conf
 chmod 640 $conf
 chmod 640 $conf
 
 
 # Adding certificate to user dir
 # Adding certificate to user dir
-cp -f $V_USERS/$user/ssl/$domain.crt $V_HOME/$user/conf/web/ssl.$domain.crt
-cp -f $V_USERS/$user/ssl/$domain.key $V_HOME/$user/conf/web/ssl.$domain.key
-cp -f $V_USERS/$user/ssl/$domain.pem $V_HOME/$user/conf/web/ssl.$domain.pem
-if [ -e "$V_USERS/$user/ssl/$domain.ca" ]; then
-    cp -f $V_USERS/$user/ssl/$domain.ca $V_HOME/$user/conf/web/ssl.$domain.ca
+cp -f $USER_DATA/ssl/$domain.crt $HOMEDIR/$user/conf/web/ssl.$domain.crt
+cp -f $USER_DATA/ssl/$domain.key $HOMEDIR/$user/conf/web/ssl.$domain.key
+cp -f $USER_DATA/ssl/$domain.pem $HOMEDIR/$user/conf/web/ssl.$domain.pem
+if [ -e "$USER_DATA/ssl/$domain.ca" ]; then
+    cp -f $USER_DATA/ssl/$domain.ca $HOMEDIR/$user/conf/web/ssl.$domain.ca
 fi
 fi
 
 
 # Running template trigger
 # Running template trigger
-if [ -x $V_WEBTPL/apache_$template.sh ]; then
-    $V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot
+if [ -x $WEBTPL/apache_$template.sh ]; then
+    $WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $docroot
 fi
 fi
 
 
 # Checking main vesta httpd config
 # Checking main vesta httpd config
@@ -116,8 +115,8 @@ fi
 # Checking  nginx
 # Checking  nginx
 if [ ! -z "$NGINX" ]; then
 if [ ! -z "$NGINX" ]; then
     # Adding domain to the snginx.conf
     # Adding domain to the snginx.conf
-    conf="$V_HOME/$user/conf/web/snginx.conf"
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
+    conf="$HOMEDIR/$user/conf/web/snginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
     add_web_config
     add_web_config
 
 
     chown root:nginx $conf
     chown root:nginx $conf
@@ -144,7 +143,7 @@ update_domain_value 'web' '$SSL_HOME' "$SSL_HOME"
 update_domain_value 'web' '$SSL' 'yes'
 update_domain_value 'web' '$SSL' 'yes'
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_web_domain_ssl $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_web_domain_ssl $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 13 - 14
bin/v_add_web_domain_stat

@@ -20,10 +20,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 type=$3
 type=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -34,16 +33,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain type'
 check_args '3' "$#" 'user domain type'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid "$user"
+is_object_valid 'user' 'USER' "$user" "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -52,7 +51,7 @@ is_domain_valid 'web'
 is_domain_suspended 'web'
 is_domain_suspended 'web'
 
 
 # Checking statistic type
 # Checking statistic type
-is_type_valid 'stat' "$type"
+is_type_valid "$STATS_SYSTEM" "$type"
 
 
 # Check statistic is not added
 # Check statistic is not added
 is_domain_key_empty 'web' '$STATS'
 is_domain_key_empty 'web' '$STATS'
@@ -69,7 +68,7 @@ get_domain_values 'web'
 upd_web_domain_values
 upd_web_domain_values
 
 
 # Adding statistic config
 # Adding statistic config
-cat $V_WEBTPL/$type.tpl |\
+cat $WEBTPL/$type.tpl |\
     sed -e "s/%ip%/$ip/g" \
     sed -e "s/%ip%/$ip/g" \
         -e "s/%web_port%/$WEB_PORT/g" \
         -e "s/%web_port%/$WEB_PORT/g" \
         -e "s/%web_ssl_port%/$WEB_SSL_PORT/g" \
         -e "s/%web_ssl_port%/$WEB_SSL_PORT/g" \
@@ -78,10 +77,10 @@ cat $V_WEBTPL/$type.tpl |\
         -e "s/%domain_idn%/$domain_idn/g" \
         -e "s/%domain_idn%/$domain_idn/g" \
         -e "s/%domain%/$domain/g" \
         -e "s/%domain%/$domain/g" \
         -e "s/%user%/$user/g" \
         -e "s/%user%/$user/g" \
-        -e "s/%home%/${V_HOME////\/}/g" \
+        -e "s/%home%/${HOMEDIR////\/}/g" \
         -e "s/%alias%/${aliases//,/ }/g" \
         -e "s/%alias%/${aliases//,/ }/g" \
         -e "s/%alias_idn%/${aliases_idn//,/ }/g" \
         -e "s/%alias_idn%/${aliases_idn//,/ }/g" \
-    > $V_HOME/$user/conf/web/$type.$domain.conf
+    > $HOMEDIR/$user/conf/web/$type.$domain.conf
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -89,13 +88,13 @@ cat $V_WEBTPL/$type.tpl |\
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding command to pipe
 # Adding command to pipe
-echo "$V_BIN/v_update_web_domain_stat $user $domain" >> $V_QUEUE/stats.pipe
+echo "$BIN/v_update_web_domain_stat $user $domain" >> $V_QUEUE/stats.pipe
 
 
 # Adding stats in config
 # Adding stats in config
 update_domain_value 'web' '$STATS' "$type"
 update_domain_value 'web' '$STATS' "$type"
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_web_domain_stat $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_web_domain_stat $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 12 - 13
bin/v_add_web_domain_stat_auth

@@ -16,10 +16,9 @@ auth_user=$3
 auth_pass=$4
 auth_pass=$4
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,16 +29,16 @@ source $V_FUNC/domain.func
 check_args '4' "$#" 'user domain auth_user auth_password'
 check_args '4' "$#" 'user domain auth_user auth_password'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'auth_user' 'auth_pass'
+validate_format 'user' 'domain' 'auth_user' 'auth_pass'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -53,7 +52,7 @@ is_domain_suspended 'web'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Definining statistic dir
 # Definining statistic dir
-stat_dir="$V_HOME/$user/web/$domain/stats"
+stat_dir="$HOMEDIR/$user/web/$domain/stats"
 
 
 # Adding htaccess file
 # Adding htaccess file
 if [ ! -e "$stat_dir/.htaccess" ]; then
 if [ ! -e "$stat_dir/.htaccess" ]; then
@@ -66,9 +65,9 @@ fi
 
 
 # Generating htaccess user and password
 # Generating htaccess user and password
 if [ ! -e "$stat_dir/.htpasswd" ]; then
 if [ ! -e "$stat_dir/.htpasswd" ]; then
-    htpasswd -bc $stat_dir/.htpasswd "$auth_user" "$auth_pass" >/dev/null 2>&1
+    htpasswd -bc $stat_dir/.htpasswd "$auth_user" "$auth_pass" &>/dev/null
 else
 else
-    htpasswd -b $stat_dir/.htpasswd "$auth_user" "$auth_pass" >/dev/null 2>&1
+    htpasswd -b $stat_dir/.htpasswd "$auth_user" "$auth_pass" &>/dev/null
 fi
 fi
 
 
 
 
@@ -95,10 +94,10 @@ fi
 update_domain_value 'web' '$STATS_AUTH' "$a_users"
 update_domain_value 'web' '$STATS_AUTH' "$a_users"
 
 
 # Hiding password
 # Hiding password
-V_EVENT="$V_DATE $V_SCRIPT $user $domain $auth_user *****"
+EVENT="$DATE $SCRIPT $user $domain $auth_user *****"
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_delete_web_domain_stat_auth $user $domain $auth_user"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_delete_web_domain_stat_auth $user $domain $auth_user"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 71 - 72
bin/v_backup_user

@@ -13,11 +13,10 @@
 user=$1
 user=$1
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
-source $V_FUNC/db.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
+source $VESTA/func/db.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -28,13 +27,13 @@ source $V_FUNC/db.func
 check_args '1' "$#" 'user'
 check_args '1' "$#" 'user'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking backup system is enabled
 # Checking backup system is enabled
 is_system_enabled 'BACKUP_SYSTEM'
 is_system_enabled 'BACKUP_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user backups
 # Checking user backups
 is_backup_enabled
 is_backup_enabled
@@ -42,7 +41,7 @@ is_backup_enabled
 # Checking load averages
 # Checking load averages
 la=$(cat /proc/loadavg |cut -f 1 -d ' '|cut -f 1 -d '.')
 la=$(cat /proc/loadavg |cut -f 1 -d ' '|cut -f 1 -d '.')
 i=0
 i=0
-while [ "$la" -ge "$V_BACKUP_LA_LIMIT" ]; do
+while [ "$la" -ge "$BACKUP_LA_LIMIT" ]; do
     echo "$(date "+%F %T") Load Average $la"
     echo "$(date "+%F %T") Load Average $la"
     echo
     echo
 
 
@@ -50,7 +49,7 @@ while [ "$la" -ge "$V_BACKUP_LA_LIMIT" ]; do
 
 
     if [ "$i" -ge "15" ]; then
     if [ "$i" -ge "15" ]; then
         echo "Error: LA is too high"
         echo "Error: LA is too high"
-        log_event 'debug' "$E_LA $V_EVENT"
+        log_event 'debug' "$E_LA $EVENT"
         exit $E_LA
         exit $E_LA
     fi
     fi
 
 
@@ -66,7 +65,7 @@ done
 start_time=$(date '+%s')
 start_time=$(date '+%s')
 
 
 # Creating temporary random directory
 # Creating temporary random directory
-tmpdir=$(mktemp -p $V_BACKUP -d)
+tmpdir=$(mktemp -p $BACKUP -d)
 
 
 # Prinitng status
 # Prinitng status
 echo "$(date "+%F %T") System backup for user $user"
 echo "$(date "+%F %T") System backup for user $user"
@@ -87,21 +86,21 @@ mkdir $tmpdir/vesta
 # Backingup vesta configs
 # Backingup vesta configs
 echo -e "$(date "+%F %T") user.conf"
 echo -e "$(date "+%F %T") user.conf"
 
 
-cp -r $V_USERS/$user/user.conf $tmpdir/vesta/
+cp -r $USER_DATA/user.conf $tmpdir/vesta/
 
 
-if [ -e "$V_USERS/$user/stats.log" ]; then
+if [ -e "$USER_DATA/stats.log" ]; then
     echo -e "$(date "+%F %T") stats.log"
     echo -e "$(date "+%F %T") stats.log"
-    cp -r $V_USERS/$user/stats.log $tmpdir/vesta/
+    cp -r $USER_DATA/stats.log $tmpdir/vesta/
 fi
 fi
 
 
-if [ -e "$V_USERS/$user/history.log" ]; then
+if [ -e "$USER_DATA/history.log" ]; then
     echo -e "$(date "+%F %T") history.log"
     echo -e "$(date "+%F %T") history.log"
-    cp -r $V_USERS/$user/history.log $tmpdir/vesta/
+    cp -r $USER_DATA/history.log $tmpdir/vesta/
 fi
 fi
 
 
-if [ -e "$V_USERS/$user/backup.excludes" ]; then
+if [ -e "$USER_DATA/backup.excludes" ]; then
     echo -e "$(date "+%F %T") backup.excludes"
     echo -e "$(date "+%F %T") backup.excludes"
-    cp -r $V_USERS/$user/backup.excludes $tmpdir/vesta/
+    cp -r $USER_DATA/backup.excludes $tmpdir/vesta/
 fi
 fi
 
 
 
 
@@ -120,10 +119,10 @@ echo
 # Checking excludes
 # Checking excludes
 OLD_IFS="$IFS"
 OLD_IFS="$IFS"
 IFS=$'\n'
 IFS=$'\n'
-if [ -e "$V_USERS/$user/backup.excludes" ]; then
+if [ -e "$USER_DATA/backup.excludes" ]; then
     echo "-- Excludes --"
     echo "-- Excludes --"
 
 
-    for exclude in $(cat $V_USERS/$user/backup.excludes); do
+    for exclude in $(cat $USER_DATA/backup.excludes); do
         echo -e "$exclude"
         echo -e "$exclude"
         # Indirect variable references (a bit of black magic)
         # Indirect variable references (a bit of black magic)
         eval ${exclude%%=*}=${exclude#*=}
         eval ${exclude%%=*}=${exclude#*=}
@@ -139,7 +138,7 @@ then
     mkdir $tmpdir/web/
     mkdir $tmpdir/web/
 
 
     # Parsing unsuspeneded domains
     # Parsing unsuspeneded domains
-    conf="$V_USERS/$user/web.conf"
+    conf="$USER_DATA/web.conf"
     field='$DOMAIN'
     field='$DOMAIN'
     search_string='DOMAIN='
     search_string='DOMAIN='
     domains=$(dom_clear_search)
     domains=$(dom_clear_search)
@@ -163,27 +162,27 @@ then
         get_domain_values 'web'
         get_domain_values 'web'
 
 
         # Packing data folders
         # Packing data folders
-        cd $V_HOME/$user/web/$domain
+        cd $HOMEDIR/$user/web/$domain
         tar -cf $tmpdir/web/$domain/$domain.tar \
         tar -cf $tmpdir/web/$domain/$domain.tar \
             public_html public_shtml private document_errors cgi-bin stats
             public_html public_shtml private document_errors cgi-bin stats
 
 
         # Creating web.config
         # Creating web.config
         cd $tmpdir/web/$domain/
         cd $tmpdir/web/$domain/
-        conf="$V_USERS/$user/web.conf"
+        conf="$USER_DATA/web.conf"
         grep "DOMAIN='$domain'" $conf > conf/vesta.conf
         grep "DOMAIN='$domain'" $conf > conf/vesta.conf
 
 
         # Apache config
         # Apache config
         if [ "$WEB_SYSTEM" = 'apache' ]; then
         if [ "$WEB_SYSTEM" = 'apache' ]; then
             # Parsing httpd.conf
             # Parsing httpd.conf
-            tpl_file="$V_WEBTPL/apache_$TPL.tpl"
-            conf="$V_HOME/$user/conf/web/httpd.conf"
+            tpl_file="$WEBTPL/apache_$TPL.tpl"
+            conf="$HOMEDIR/$user/conf/web/httpd.conf"
             get_web_config_brds
             get_web_config_brds
             sed -n "$top_line,$bottom_line p" $conf > conf/httpd.conf
             sed -n "$top_line,$bottom_line p" $conf > conf/httpd.conf
 
 
             # SSL check
             # SSL check
             if [ "$SSL" = 'yes' ]; then
             if [ "$SSL" = 'yes' ]; then
-                tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-                conf="$V_HOME/$user/conf/web/shttpd.conf"
+                tpl_file="$WEBTPL/apache_$TPL.stpl"
+                conf="$HOMEDIR/$user/conf/web/shttpd.conf"
                 get_web_config_brds
                 get_web_config_brds
                 sed -n "$top_line,$bottom_line p" $conf > conf/shttpd.conf
                 sed -n "$top_line,$bottom_line p" $conf > conf/shttpd.conf
             fi
             fi
@@ -191,36 +190,36 @@ then
 
 
         # Nginx config
         # Nginx config
         if [ ! -z "$NGINX" ] ; then
         if [ ! -z "$NGINX" ] ; then
-            tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
-            conf="$V_HOME/$user/conf/web/nginx.conf"
+            tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
+            conf="$HOMEDIR/$user/conf/web/nginx.conf"
             get_web_config_brds
             get_web_config_brds
             sed -n "$top_line,$bottom_line p" $conf > conf/nginx.conf
             sed -n "$top_line,$bottom_line p" $conf > conf/nginx.conf
 
 
             # SSL check
             # SSL check
             if [ "$SSL" = 'yes' ] ; then
             if [ "$SSL" = 'yes' ] ; then
-                tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-                conf="$V_HOME/$user/conf/web/snginx.conf"
+                tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+                conf="$HOMEDIR/$user/conf/web/snginx.conf"
                 get_web_config_brds
                 get_web_config_brds
                 sed -n "$top_line,$bottom_line p" $conf > conf/snginx.conf
                 sed -n "$top_line,$bottom_line p" $conf > conf/snginx.conf
             fi
             fi
         fi
         fi
 
 
         # Suplemental configs
         # Suplemental configs
-        for sconfig in $(ls $V_HOME/$user/conf/web/|grep ".$domain.conf"); do
-            cp $V_HOME/$user/conf/web/$sconfig conf/
+        for sconfig in $(ls $HOMEDIR/$user/conf/web/|grep ".$domain.conf"); do
+            cp $HOMEDIR/$user/conf/web/$sconfig conf/
         done
         done
 
 
         # SSL Certificates
         # SSL Certificates
         if [ "$SSL" = 'yes' ] ; then
         if [ "$SSL" = 'yes' ] ; then
-            cp $V_HOME/$user/conf/web/ssl.$domain.* conf/
+            cp $HOMEDIR/$user/conf/web/ssl.$domain.* conf/
         fi
         fi
 
 
         tar -rf $tmpdir/web/$domain/$domain.tar conf
         tar -rf $tmpdir/web/$domain/$domain.tar conf
         mv $tmpdir/web/$domain/$domain.tar $tmpdir/web/
         mv $tmpdir/web/$domain/$domain.tar $tmpdir/web/
         rm -rf $tmpdir/web/$domain
         rm -rf $tmpdir/web/$domain
 
 
-        if [ ! -z "$V_BACKUP_GZIP" ]; then 
-            gzip -$V_BACKUP_GZIP $tmpdir/web/$domain.tar
+        if [ ! -z "$BACKUP_GZIP" ]; then 
+            gzip -$BACKUP_GZIP $tmpdir/web/$domain.tar
         fi
         fi
 
 
     done
     done
@@ -234,7 +233,7 @@ then
     mkdir $tmpdir/dns/
     mkdir $tmpdir/dns/
 
 
     # Parsing unsuspeneded domains
     # Parsing unsuspeneded domains
-    conf="$V_USERS/$user/dns.conf"
+    conf="$USER_DATA/dns.conf"
     field='$DOMAIN'
     field='$DOMAIN'
     search_string='DOMAIN='
     search_string='DOMAIN='
     domains=$(dom_clear_search)
     domains=$(dom_clear_search)
@@ -255,12 +254,12 @@ then
 
 
         # Creating dns_domains config
         # Creating dns_domains config
         cd $tmpdir/dns/$domain/
         cd $tmpdir/dns/$domain/
-        conf="$V_USERS/$user/dns.conf"
+        conf="$USER_DATA/dns.conf"
         grep "DOMAIN='$domain'" $conf > dns.conf
         grep "DOMAIN='$domain'" $conf > dns.conf
 
 
         # Backingup dns recods
         # Backingup dns recods
-        cp $V_USERS/$user/dns/$domain $domain
-        cp $V_USERS/$user/conf/dns/$domain.db $domain.db
+        cp $USER_DATA/dns/$domain $domain
+        cp $USER_DATA/conf/dns/$domain.db $domain.db
     done
     done
     echo
     echo
 fi
 fi
@@ -275,7 +274,7 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ] && [ "$DB" != '*' ]; then
     mkdir $tmpdir/db/
     mkdir $tmpdir/db/
 
 
     # Parsing unsuspeneded domains
     # Parsing unsuspeneded domains
-    conf="$V_USERS/$user/db.conf"
+    conf="$USER_DATA/db.conf"
     field='$DB'
     field='$DB'
     search_string='DB='
     search_string='DB='
     dbs=$(dom_clear_search)
     dbs=$(dom_clear_search)
@@ -303,8 +302,8 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ] && [ "$DB" != '*' ]; then
             pgsql) dump_db_pgsql ;;
             pgsql) dump_db_pgsql ;;
         esac
         esac
 
 
-        if [ ! -z "$V_BACKUP_GZIP" ]; then 
-            gzip -$V_BACKUP_GZIP $dump
+        if [ ! -z "$BACKUP_GZIP" ]; then 
+            gzip -$BACKUP_GZIP $dump
         fi
         fi
 
 
     done
     done
@@ -319,7 +318,7 @@ then
 
 
     # Backingup cron recods
     # Backingup cron recods
     echo -e "$(date "+%F %T") cron.conf"
     echo -e "$(date "+%F %T") cron.conf"
-    cp $V_USERS/$user/cron.conf $tmpdir/cron/
+    cp $USER_DATA/cron.conf $tmpdir/cron/
     echo -e "$(date "+%F %T") system cron"
     echo -e "$(date "+%F %T") system cron"
 
 
     if [ -e "/var/spool/cron/$user" ]; then
     if [ -e "/var/spool/cron/$user" ]; then
@@ -338,17 +337,17 @@ end_time=$(date '+%s')
 # Defining local storage function
 # Defining local storage function
 local_backup(){
 local_backup(){
     echo "-- STORAGE --"
     echo "-- STORAGE --"
-    echo -e "$(date "+%F %T") ARCHIVE $V_BACKUP/$user.$V_DATE.tar"
+    echo -e "$(date "+%F %T") ARCHIVE $BACKUP/$user.$DATE.tar"
 
 
     # Removing dublicate for this day
     # Removing dublicate for this day
-    if [ -e "$V_BACKUP/$user.$V_DATE.tar" ]; then
-        deprecated="$V_DATE"
-        echo -e "Deleting old backup for $V_DATE"
-        rm -f $V_BACKUP/$user.$V_DATE.tar
+    if [ -e "$BACKUP/$user.$DATE.tar" ]; then
+        deprecated="$DATE"
+        echo -e "Deleting old backup for $DATE"
+        rm -f $BACKUP/$user.$DATE.tar
     fi
     fi
 
 
     # Checking retention
     # Checking retention
-    backup_list=$(ls -lrt $V_BACKUP/ | awk '{print $9}' |grep "^$user\.")
+    backup_list=$(ls -lrt $BACKUP/ | awk '{print $9}' |grep "^$user\.")
     backups_count=$(echo "$backup_list" | wc -l)
     backups_count=$(echo "$backup_list" | wc -l)
 
 
     if [ "$BACKUPS" -le "$backups_count" ]; then
     if [ "$BACKUPS" -le "$backups_count" ]; then
@@ -360,23 +359,23 @@ local_backup(){
             backup_date=$(echo $backup | sed -e "s/$user.//" -e "s/.tar$//")
             backup_date=$(echo $backup | sed -e "s/$user.//" -e "s/.tar$//")
             deprecated="$deprecated $backup_date"
             deprecated="$deprecated $backup_date"
             echo -e "\tDeleteing old backup for $backup_date"
             echo -e "\tDeleteing old backup for $backup_date"
-            rm -f $V_BACKUP/$backup
+            rm -f $BACKUP/$backup
         done
         done
     fi
     fi
 
 
     # Checking disk space
     # Checking disk space
-    disk_usage=$(df $V_BACKUP | awk '{print $5}'|tail -n1|cut -f 1 -d '%')
-    if [ "$disk_usage" -ge "$V_BACKUP_DISK_LIMIT" ]; then
+    disk_usage=$(df $BACKUP | awk '{print $5}'|tail -n1|cut -f 1 -d '%')
+    if [ "$disk_usage" -ge "$BACKUP_DISK_LIMIT" ]; then
         echo "Error: Not enough disk space"
         echo "Error: Not enough disk space"
-        log_event 'debug' "$E_DISK $V_EVENT"
+        log_event 'debug' "$E_DISK $EVENT"
         exit $E_DISK
         exit $E_DISK
     fi
     fi
 
 
     # Creating final tarball
     # Creating final tarball
     cd $tmpdir
     cd $tmpdir
-    tar -cf $V_BACKUP/$user.$V_DATE.tar .
-    chmod 640 $V_BACKUP/$user.$V_DATE.tar
-    chown nginx:$user $V_BACKUP/$user.$V_DATE.tar
+    tar -cf $BACKUP/$user.$DATE.tar .
+    chmod 640 $BACKUP/$user.$DATE.tar
+    chown nginx:$user $BACKUP/$user.$DATE.tar
     localbackup='yes'
     localbackup='yes'
     echo
     echo
 }
 }
@@ -399,17 +398,17 @@ ftp_backup(){
     echo "-- FTP --"
     echo "-- FTP --"
 
 
     # Checking config
     # Checking config
-    source $V_CONF/ftp.backup.conf
+    source $VESTA/conf/ftp.backup.conf
     if [ -z "$HOST" ] || [ -z "$USERNAME" ] || [ -z "$PASSWORD" ] ||\
     if [ -z "$HOST" ] || [ -z "$USERNAME" ] || [ -z "$PASSWORD" ] ||\
         [ -z "$BPATH" ]; then
         [ -z "$BPATH" ]; then
         echo "Error: Parsing error"
         echo "Error: Parsing error"
-        log_event 'debug' "$E_PARSING $V_EVENT"
+        log_event 'debug' "$E_PARSING $EVENT"
         exit $E_PARSING
         exit $E_PARSING
     fi
     fi
 
 
     # Debug info
     # Debug info
     echo -ne "$(date "+%F %T") "
     echo -ne "$(date "+%F %T") "
-    echo -e "ftp://$USERNAME@$HOST$BPATH/$user.$V_DATE.tar"
+    echo -e "ftp://$USERNAME@$HOST$BPATH/$user.$DATE.tar"
 
 
     # Checking ftp permission
     # Checking ftp permission
     ftmpdir=$(mktemp -u -p $BPATH)
     ftmpdir=$(mktemp -u -p $BPATH)
@@ -418,7 +417,7 @@ ftp_backup(){
              rm $ftmpdir"
              rm $ftmpdir"
     if [ ! -z "$(ftpc "$command")" ] ; then
     if [ ! -z "$(ftpc "$command")" ] ; then
         echo "Error: FTP error"
         echo "Error: FTP error"
-        log_event 'debug' "$E_FTP $V_EVENT"
+        log_event 'debug' "$E_FTP $EVENT"
         exit $E_FTP
         exit $E_FTP
     fi
     fi
 
 
@@ -437,14 +436,14 @@ ftp_backup(){
 
 
     # Uploading backup archive
     # Uploading backup archive
     if [ "$localbackup" = 'yes' ]; then
     if [ "$localbackup" = 'yes' ]; then
-        cd $V_BACKUP
-	ftpc "put $user.$V_DATE.tar"
+        cd $BACKUP
+	ftpc "put $user.$DATE.tar"
     else
     else
 	cd $tmpdir
 	cd $tmpdir
-        tar -cf $V_BACKUP/$user.$V_DATE.tar .
-        cd $V_BACKUP/
-	ftpc "put $user.$V_DATE.tar"
-        rm -f $user.$V_DATE.tar
+        tar -cf $BACKUP/$user.$DATE.tar .
+        cd $BACKUP/
+	ftpc "put $user.$DATE.tar"
+        rm -f $user.$DATE.tar
     fi
     fi
     echo
     echo
 }
 }
@@ -484,13 +483,13 @@ echo
 
 
 # Deleting old backup records
 # Deleting old backup records
 for backup_record in $deprecated; do
 for backup_record in $deprecated; do
-    if [ -e "$V_USERS/$user/backup.conf" ]; then
-        sed -i "/DATE='$backup_record/d" $V_USERS/$user/backup.conf
+    if [ -e "$USER_DATA/backup.conf" ]; then
+        sed -i "/DATE='$backup_record/d" $USER_DATA/backup.conf
     fi
     fi
 done
 done
 
 
 # Concatenating string
 # Concatenating string
-backup_str="DATE='$V_DATE' TIME='$current_time' RUNTIME='$run_time'"
+backup_str="DATE='$DATE' TIME='$current_time' RUNTIME='$run_time'"
 backup_str="$backup_str TYPE='$BACKUP_SYSTEM' SIZE='$size'"
 backup_str="$backup_str TYPE='$BACKUP_SYSTEM' SIZE='$size'"
 backup_str="$backup_str VESTA='$vst'"
 backup_str="$backup_str VESTA='$vst'"
 backup_str="$backup_str PAM='$pam'"
 backup_str="$backup_str PAM='$pam'"
@@ -499,10 +498,10 @@ backup_str="$backup_str DNS='${dns_list// /,}'"
 backup_str="$backup_str MAIL='${mail_list// /,}'"
 backup_str="$backup_str MAIL='${mail_list// /,}'"
 backup_str="$backup_str DB='${db_list// /,}'"
 backup_str="$backup_str DB='${db_list// /,}'"
 backup_str="$backup_str CRON='$cron_list'"
 backup_str="$backup_str CRON='$cron_list'"
-echo "$backup_str" >> $V_USERS/$user/backup.conf
-chmod 660 $V_USERS/$user/backup.conf
+echo "$backup_str" >> $USER_DATA/backup.conf
+chmod 660 $USER_DATA/backup.conf
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 4 - 5
bin/v_backup_users

@@ -14,9 +14,8 @@
 source /etc/profile.d/vesta.sh
 source /etc/profile.d/vesta.sh
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -27,7 +26,7 @@ user_list=$(ls $V_USERS/)
 
 
 # Updating user billing
 # Updating user billing
 for user in $user_list; do 
 for user in $user_list; do 
-    $V_BIN/v_backup_user $user >> $V_LOG/backup.log 2>> $V_LOG/backup.log
+    $BIN/v_backup_user $user &>> $VESTA/logs/backup.log 
 done
 done
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -35,6 +34,6 @@ done
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 19 - 34
bin/v_change_cron_job

@@ -20,52 +20,37 @@ month=$6
 wday=$7
 wday=$7
 command=$8
 command=$8
 
 
-# Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/cron.func
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                    Verifications                         #
 #                    Verifications                         #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Checking arg number
 check_args '7' "$#" 'user job min hour day month wday command'
 check_args '7' "$#" 'user job min hour day month wday command'
+validate_format 'user' 'job' 'min' 'hour' 'day' 'month' 'wday' 'command' 
+is_system_enabled $CRON_SYSTEM
+is_object_valid 'user' 'USER' "$user"
+is_object_suspended 'user' 'USER' "$user"
+is_object_valid 'cron' 'JOB' "$job"
 
 
-# Checking argument format
-format_validation 'user' 'job' 'min' 'hour' 'day' 'month' 'wday' 'command' 
-
-# Checking cron system
-is_system_enabled 'CRON_SYSTEM'
-
-# Checking user
-is_user_valid
-
-# Checking user is active
-is_user_suspended
-
-# Checking cron job
-is_job_valid
-
-# Checking job is active
-# is_job_suspended
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                       Action                             #
 #                       Action                             #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Concatenating cron string
 # Concatenating cron string
-command=$(echo $command|sed -e "s/'/%quote%/g" -e "s/:/%dots%/g")
-v_str="JOB='$job' MIN='$min' HOUR='$hour' WDAY='$wday'"
-v_str="$v_str MONTH='$month' DAY='$day' CMD='$command' SUSPENDED='no'"
+command=$(echo $command | sed -e "s/'/%quote%/g" -e "s/:/%dots%/g")
+str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month WDAY='$wday'"
+str="$v_str' CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
 
 
-# Deleting job
-del_cron_job
+# Deleting old job
+sed -i "/JOB='$job' /d" $USER_DATA/cron.conf
 
 
-# Adding to crontab
-echo "$v_str">>$V_USERS/$user/cron.conf
+# Adding new
+echo "$v_str" >> $USER_DATA/cron.conf
 
 
 # Sorting jobs by id
 # Sorting jobs by id
 sort_cron_jobs
 sort_cron_jobs
@@ -78,11 +63,11 @@ sync_cron_jobs
 #                       Vesta                              #
 #                       Vesta                              #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Adding task to the vesta pipe
-restart_schedule 'cron'
+# Restart crond
+$BIN/v_restart_cron
 
 
 # Logging
 # Logging
-log_history "$V_EVENT"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 8 - 9
bin/v_change_db_password

@@ -16,10 +16,9 @@ database=$2
 db_password=$3
 db_password=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/db.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/db.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,16 +29,16 @@ source $V_FUNC/db.func
 check_args '3' "$#" 'user db_name db_password'
 check_args '3' "$#" 'user db_name db_password'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'database' 'db_password'
+validate_format 'user' 'database' 'db_password'
 
 
 # Checking db system is enabled
 # Checking db system is enabled
 is_system_enabled 'DB_SYSTEM'
 is_system_enabled 'DB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking db existance
 # Checking db existance
 is_db_valid
 is_db_valid
@@ -69,9 +68,9 @@ esac
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Hiding password
 # Hiding password
-V_EVENT="$V_DATE $V_SCRIPT $user $database *****"
+EVENT="$DATE $SCRIPT $user $database *****"
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 8 - 9
bin/v_change_dns_domain_exp

@@ -17,10 +17,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 exp=$3
 exp=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -31,16 +30,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain exp'
 check_args '3' "$#" 'user domain exp'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'exp'
+validate_format 'user' 'domain' 'exp'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'DNS_SYSTEM'
 is_system_enabled 'DNS_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -65,7 +64,7 @@ update_domain_value 'dns' '$EXP' "$exp"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_exp"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user $domain $old_exp"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 10 - 11
bin/v_change_dns_domain_ip

@@ -16,10 +16,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 ip=$3
 ip=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                    Verifications                         #
 #                    Verifications                         #
@@ -29,16 +28,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain ip'
 check_args '3' "$#" 'user domain ip'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'ip'
+validate_format 'user' 'domain' 'ip'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'DNS_SYSTEM'
 is_system_enabled 'DNS_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -58,7 +57,7 @@ old_ip=$(get_domain_value 'dns' '$IP')
 update_domain_value 'dns' '$IP' "$ip"
 update_domain_value 'dns' '$IP' "$ip"
 
 
 # Changing records
 # Changing records
-sed -i "s/$old_ip/$ip/g" $V_USERS/$user/dns/$domain
+sed -i "s/$old_ip/$ip/g" $USER_DATA/dns/$domain
 
 
 # Updating zone
 # Updating zone
 update_domain_zone
 update_domain_zone
@@ -69,10 +68,10 @@ update_domain_zone
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'dns'
+$BIN/v_restart_dns
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ip"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user $domain $old_ip"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 11 - 12
bin/v_change_dns_domain_record

@@ -19,10 +19,9 @@ rtype=$(echo "$5"| tr '[:lower:]' '[:upper:]')
 value=$(idn -t --quiet -u "$6" )
 value=$(idn -t --quiet -u "$6" )
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -33,16 +32,16 @@ source $V_FUNC/domain.func
 check_args '5' "$#" 'user domain id record type value'
 check_args '5' "$#" 'user domain id record type value'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'id' 'record' 'rtype'
+validate_format 'user' 'domain' 'id' 'record' 'rtype'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'DNS_SYSTEM'
 is_system_enabled 'DNS_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -58,7 +57,7 @@ is_dns_record_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining zone path
 # Defining zone path
-zone="$V_USERS/$user/dns/$domain"
+zone="$USER_DATA/dns/$domain"
 
 
 # Deleting old record
 # Deleting old record
 rm_string=$(grep -n "^ID='$id'" $zone|cut -d : -f 1)
 rm_string=$(grep -n "^ID='$id'" $zone|cut -d : -f 1)
@@ -68,7 +67,7 @@ fi
 
 
 # Adding record
 # Adding record
 dns_rec="ID='$id' RECORD='$record' TYPE='$rtype' VALUE='$value'"
 dns_rec="ID='$id' RECORD='$record' TYPE='$rtype' VALUE='$value'"
-dns_rec="$dns_rec SUSPENDED='no' DATE='$V_DATE'"
+dns_rec="$dns_rec SUSPENDED='no' DATE='$DATE'"
 echo "$dns_rec" >> $zone 
 echo "$dns_rec" >> $zone 
 
 
 # Sorting records
 # Sorting records
@@ -83,10 +82,10 @@ update_domain_zone
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'dns'
+$BIN/v_restart_dns
 
 
 # Logging
 # Logging
-log_history "$V_EVENT"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 9 - 10
bin/v_change_dns_domain_soa

@@ -17,10 +17,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 soa=$3
 soa=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                    Verifications                         #
 #                    Verifications                         #
@@ -30,16 +29,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain soa'
 check_args '3' "$#" 'user domain soa'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'soa'
+validate_format 'user' 'domain' 'soa'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'DNS_SYSTEM'
 is_system_enabled 'DNS_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -67,10 +66,10 @@ update_domain_zone
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'dns'
+$BIN/v_restart_dns
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_soa"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user $domain $old_soa"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 13 - 14
bin/v_change_dns_domain_tpl

@@ -18,10 +18,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 template=$3
 template=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -32,16 +31,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain template'
 check_args '3' "$#" 'user domain template'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'template'
+validate_format 'user' 'domain' 'template'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'DNS_SYSTEM'
 is_system_enabled 'DNS_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -50,7 +49,7 @@ is_domain_valid 'dns'
 is_domain_suspended 'dns'
 is_domain_suspended 'dns'
 
 
 # Checking template
 # Checking template
-is_template_valid 'dns'
+is_dns_template_valid
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -65,7 +64,7 @@ ns2=$(get_user_value '$NS2')
 
 
 # Changing tpl
 # Changing tpl
 update_domain_value 'dns' '$TPL' "$template"
 update_domain_value 'dns' '$TPL' "$template"
-cat $V_DNSTPL/$template.tpl |\
+cat $DNSTPL/$template.tpl |\
     sed -e "s/%ip%/$ip/g" \
     sed -e "s/%ip%/$ip/g" \
         -e "s/%domain_idn%/$domain_idn/g" \
         -e "s/%domain_idn%/$domain_idn/g" \
         -e "s/%domain%/$domain/g" \
         -e "s/%domain%/$domain/g" \
@@ -77,10 +76,10 @@ cat $V_DNSTPL/$template.tpl |\
         -e "s/%ns6%/$ns6/g" \
         -e "s/%ns6%/$ns6/g" \
         -e "s/%ns7%/$ns7/g" \
         -e "s/%ns7%/$ns7/g" \
         -e "s/%ns8%/$ns8/g" \
         -e "s/%ns8%/$ns8/g" \
-        -e "s/%date%/$V_DATE/g" > $V_USERS/$user/dns/$domain
+        -e "s/%date%/$DATE/g" > $USER_DATA/dns/$domain
 
 
 # Updating zone
 # Updating zone
-conf="$V_HOME/$user/conf/dns/$domain.db"
+conf="$HOMEDIR/$user/conf/dns/$domain.db"
 update_domain_zone
 update_domain_zone
 
 
 
 
@@ -89,10 +88,10 @@ update_domain_zone
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'dns'
+$BIN/v_restart_dns
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_tpl"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user $domain $old_tpl"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 9 - 10
bin/v_change_dns_domain_ttl

@@ -16,10 +16,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 ttl=$3
 ttl=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,16 +29,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain ttl'
 check_args '3' "$#" 'user domain ttl'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'ttl'
+validate_format 'user' 'domain' 'ttl'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'DNS_SYSTEM'
 is_system_enabled 'DNS_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -67,10 +66,10 @@ update_domain_zone
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'dns'
+$BIN/v_restart_dns
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ttl"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user $domain $old_ttl"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 10 - 11
bin/v_change_mail_domain_cactchall

@@ -17,10 +17,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 email="$3"
 email="$3"
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -31,16 +30,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain email'
 check_args '3' "$#" 'user domain email'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'email'
+validate_format 'user' 'domain' 'email'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -57,8 +56,8 @@ is_domain_suspended 'mail'
 catchall=$(get_domain_value 'mail' '$CATCHALL')
 catchall=$(get_domain_value 'mail' '$CATCHALL')
 
 
 # Change cathcall alias
 # Change cathcall alias
-sed -i "/*@demo.vestacp.com:/d" $V_HOME/$user/conf/mail/$domain/aliases
-echo "*@demo.vestacp.com:$email" >> $V_HOME/$user/conf/mail/$domain/aliases
+sed -i "/*@demo.vestacp.com:/d" $HOMEDIR/$user/conf/mail/$domain/aliases
+echo "*@demo.vestacp.com:$email" >> $HOMEDIR/$user/conf/mail/$domain/aliases
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -69,7 +68,7 @@ echo "*@demo.vestacp.com:$email" >> $V_HOME/$user/conf/mail/$domain/aliases
 update_domain_value 'mail' '$CATCHALL' "$email"
 update_domain_value 'mail' '$CATCHALL' "$email"
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_change_mail_domain_catchall $user $domain $catchall"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_change_mail_domain_catchall $user $domain $catchall"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 7 - 8
bin/v_change_sys_config_value

@@ -15,9 +15,8 @@ key=$(echo "$1" | tr '[:lower:]' '[:upper:]' )
 value=$2
 value=$2
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -28,13 +27,13 @@ source $V_FUNC/shared.func
 check_args '2' "$#" 'key value'
 check_args '2' "$#" 'key value'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'key'
+validate_format 'key'
 
 
 # Checking key existance
 # Checking key existance
-check_ckey=$(grep "^$key='" $V_CONF/vesta.conf)
+check_ckey=$(grep "^$key='" $VESTA/conf/vesta.conf)
 if [ -z "$check_ckey" ]; then
 if [ -z "$check_ckey" ]; then
     echo "Error: key not found"
     echo "Error: key not found"
-    log_event 'debug' "$E_INVALID $V_EVENT"
+    log_event 'debug' "$E_INVALID $EVENT"
     exit $E_INVALID
     exit $E_INVALID
 fi
 fi
 
 
@@ -44,7 +43,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Updating conf
 # Updating conf
-sed -i "s/$key=.*/$key='$value'/g" $V_CONF/vesta.conf
+sed -i "s/$key=.*/$key='$value'/g" $VESTA/conf/vesta.conf
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -52,6 +51,6 @@ sed -i "s/$key=.*/$key='$value'/g" $V_CONF/vesta.conf
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 5 - 6
bin/v_change_sys_ip_name

@@ -14,10 +14,9 @@ ip=$1
 ip_name=$2
 ip_name=$2
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/ip.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/ip.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -28,7 +27,7 @@ source $V_FUNC/ip.func
 check_args '2' "$#" 'ip ip_name'
 check_args '2' "$#" 'ip ip_name'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'ip' 'ip_name'
+validate_format 'ip' 'ip_name'
 
 
 # Checking system ip
 # Checking system ip
 is_sys_ip_valid
 is_sys_ip_valid
@@ -47,6 +46,6 @@ update_sys_ip_value '$NAME' "$ip_name"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 7 - 8
bin/v_change_sys_ip_owner

@@ -14,10 +14,9 @@ ip=$1
 user=$2
 user=$2
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/ip.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/ip.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -28,13 +27,13 @@ source $V_FUNC/ip.func
 check_args '2' "$#" 'ip user'
 check_args '2' "$#" 'ip user'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'ip' 'user'
+validate_format 'ip' 'user'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking system ip
 # Checking system ip
 is_sys_ip_valid
 is_sys_ip_valid
@@ -90,6 +89,6 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 7 - 8
bin/v_change_sys_ip_status

@@ -14,10 +14,9 @@ ip=$1
 ip_status=$2
 ip_status=$2
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/ip.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/ip.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -28,7 +27,7 @@ source $V_FUNC/ip.func
 check_args '2' "$#" 'ip ip_status'
 check_args '2' "$#" 'ip ip_status'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'ip' 'ip_status'
+validate_format 'ip' 'ip_status'
 
 
 # Checking system ip
 # Checking system ip
 is_sys_ip_valid
 is_sys_ip_valid
@@ -37,7 +36,7 @@ is_sys_ip_valid
 current_status=$(get_sys_ip_value '$STATUS')
 current_status=$(get_sys_ip_value '$STATUS')
 if [ "$ip_status" = "$current_status" ]; then
 if [ "$ip_status" = "$current_status" ]; then
     echo "Error: status is already set"
     echo "Error: status is already set"
-    log_event 'debug' "$E_EXISTS $V_EVENT"
+    log_event 'debug' "$E_EXISTS $EVENT"
     exit $E_EXISTS
     exit $E_EXISTS
 fi
 fi
 
 
@@ -49,7 +48,7 @@ ip_owner=$(get_sys_ip_value '$OWNER')
 # Checking condition
 # Checking condition
 if [ "$web_domains" -ne '0' ] && [ "$sys_user" != "$ip_owner" ]; then
 if [ "$web_domains" -ne '0' ] && [ "$sys_user" != "$ip_owner" ]; then
     echo "Error: ip is used"
     echo "Error: ip is used"
-    log_event 'debug' "$E_INUSE $V_EVENT"
+    log_event 'debug' "$E_INUSE $EVENT"
     exit $E_INUSE
     exit $E_INUSE
 fi
 fi
 
 
@@ -67,6 +66,6 @@ update_sys_ip_value '$STATUS' "$ip_status"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 7 - 8
bin/v_change_user_contact

@@ -14,9 +14,8 @@ user=$1
 email=$2
 email=$2
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -27,13 +26,13 @@ source $V_FUNC/shared.func
 check_args '2' "$#" 'user email'
 check_args '2' "$#" 'user email'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'email'
+validate_format 'user' 'email'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -57,7 +56,7 @@ sed -i "$str s/$old_email/$email/g" /etc/passwd
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user $old_email"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user $old_email"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 7 - 8
bin/v_change_user_name

@@ -15,9 +15,8 @@ fname=$2
 lname=$3
 lname=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -28,13 +27,13 @@ source $V_FUNC/shared.func
 check_args '3' "$#" 'user fname lname'
 check_args '3' "$#" 'user fname lname'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'fname' 'lname'
+validate_format 'user' 'fname' 'lname'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -55,7 +54,7 @@ update_user_value "$user" '$LNAME' "$lname"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user $old_fname $old_lname"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user $old_fname $old_lname"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 13 - 14
bin/v_change_user_ns

@@ -21,9 +21,8 @@ ns7=$8
 ns8=$9
 ns8=$9
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -34,36 +33,36 @@ source $V_FUNC/shared.func
 check_args '3' "$#" 'user ns1 ns2 [ns3] [ns4] [ns5] [ns6] [ns7] [ns8]'
 check_args '3' "$#" 'user ns1 ns2 [ns3] [ns4] [ns5] [ns6] [ns7] [ns8]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'ns1' 'ns2' 
+validate_format 'user' 'ns1' 'ns2' 
 if [ ! -z "$ns3" ]; then
 if [ ! -z "$ns3" ]; then
-    format_validation 'ns3'
+    validate_format 'ns3'
 fi
 fi
 
 
 if [ ! -z "$ns4" ]; then
 if [ ! -z "$ns4" ]; then
-    format_validation 'ns4'
+    validate_format 'ns4'
 fi
 fi
 
 
 if [ ! -z "$ns5" ]; then
 if [ ! -z "$ns5" ]; then
-    format_validation 'ns5'
+    validate_format 'ns5'
 fi
 fi
 
 
 if [ ! -z "$ns6" ]; then
 if [ ! -z "$ns6" ]; then
-    format_validation 'ns6'
+    validate_format 'ns6'
 fi
 fi
 
 
 if [ ! -z "$ns7" ]; then
 if [ ! -z "$ns7" ]; then
-    format_validation 'ns7'
+    validate_format 'ns7'
 fi
 fi
 
 
 if [ ! -z "$ns8" ]; then
 if [ ! -z "$ns8" ]; then
-    format_validation 'ns8'
+    validate_format 'ns8'
 fi
 fi
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -86,7 +85,7 @@ update_user_value "$user" '$NS' "$ns"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user ${old_ns//,/ }"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user ${old_ns//,/ }"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 11 - 12
bin/v_change_user_package

@@ -14,13 +14,12 @@ user=$1
 package=$2
 package=$2
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 is_package_avalable() {
 is_package_avalable() {
     # Parsing user data
     # Parsing user data
-    usr_data=$(cat $V_USERS/$user/user.conf)
+    usr_data=$(cat $USER_DATA/user.conf)
     IFS=$'\n'
     IFS=$'\n'
     for key in $usr_data; do
     for key in $usr_data; do
         eval ${key%%=*}=${key#*=}
         eval ${key%%=*}=${key#*=}
@@ -35,7 +34,7 @@ is_package_avalable() {
     BANDWIDTH='0'
     BANDWIDTH='0'
 
 
     # Parsing package
     # Parsing package
-    pkg_data=$(cat $V_PKG/$package.pkg)
+    pkg_data=$(cat $VESTA/data/packages/$package.pkg)
     for key in $pkg_data; do
     for key in $pkg_data; do
         eval ${key%%=*}=${key#*=}
         eval ${key%%=*}=${key#*=}
     done
     done
@@ -56,11 +55,11 @@ is_package_avalable() {
 
 
 change_user_package() {
 change_user_package() {
     # Parsing user data
     # Parsing user data
-    usr_data=$(cat $V_USERS/$user/user.conf)
+    usr_data=$(cat $USER_DATA/user.conf)
     eval $usr_data
     eval $usr_data
 
 
     # Parsing package
     # Parsing package
-    pkg_data=$(cat $V_PKG/$package.pkg)
+    pkg_data=$(cat $VESTA/data/packages/$package.pkg)
     eval $pkg_data
     eval $pkg_data
 
 
     echo "FNAME='$FNAME'
     echo "FNAME='$FNAME'
@@ -81,7 +80,7 @@ NS='$NS'
 SHELL='$SHELL'
 SHELL='$SHELL'
 BACKUPS='$BACKUPS'
 BACKUPS='$BACKUPS'
 CONTACT='$CONTACT'
 CONTACT='$CONTACT'
-REPORTS='$REPORTS'
+CRON_REPORTS='$CRON_REPORTS'
 RKEY='$RKEY'
 RKEY='$RKEY'
 SUSPENDED='$SUSPENDED'
 SUSPENDED='$SUSPENDED'
 SUSPENDED_USERS='$SUSPENDED_USERS'
 SUSPENDED_USERS='$SUSPENDED_USERS'
@@ -109,7 +108,7 @@ U_MAIL_ACCOUNTS='$U_MAIL_ACCOUNTS'
 U_DATABASES='$U_DATABASES'
 U_DATABASES='$U_DATABASES'
 U_CRON_JOBS='$U_CRON_JOBS'
 U_CRON_JOBS='$U_CRON_JOBS'
 U_BACKUPS='$U_BACKUPS'
 U_BACKUPS='$U_BACKUPS'
-DATE='$DATE'" > $V_USERS/$user/user.conf
+DATE='$DATE'" > $USER_DATA/user.conf
 }
 }
 
 
 
 
@@ -121,10 +120,10 @@ DATE='$DATE'" > $V_USERS/$user/user.conf
 check_args '2' "$#" 'user package'
 check_args '2' "$#" 'user package'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'package'
+validate_format 'user' 'package'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking package
 # Checking package
 is_package_valid
 is_package_valid
@@ -146,6 +145,6 @@ change_user_package
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 8 - 9
bin/v_change_user_password

@@ -14,9 +14,8 @@ user=$1
 password=$2
 password=$2
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -27,13 +26,13 @@ source $V_FUNC/shared.func
 check_args '2' "$#" 'user password'
 check_args '2' "$#" 'user password'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'password'
+validate_format 'user' 'password'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -41,7 +40,7 @@ is_user_suspended
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Changing user password
 # Changing user password
-echo "$password" | /usr/bin/passwd "$user" --stdin >/dev/null 2>&1
+echo "$password" | /usr/bin/passwd "$user" --stdin &>/dev/null
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -52,9 +51,9 @@ echo "$password" | /usr/bin/passwd "$user" --stdin >/dev/null 2>&1
 update_user_value "$user" '$RKEY' "$(gen_password)"
 update_user_value "$user" '$RKEY' "$(gen_password)"
 
 
 # Hiding password
 # Hiding password
-V_EVENT="$V_DATE $V_SCRIPT $user *****"
+EVENT="$DATE $SCRIPT $user *****"
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 7 - 8
bin/v_change_user_shell

@@ -14,9 +14,8 @@ user=$1
 shell=$2
 shell=$2
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -27,13 +26,13 @@ source $V_FUNC/shared.func
 check_args '2' "$#" 'user shell'
 check_args '2' "$#" 'user shell'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'shell'
+validate_format 'user' 'shell'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -44,7 +43,7 @@ is_user_suspended
 shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
 shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
 
 
 # Changing passwd file
 # Changing passwd file
-/usr/bin/chsh -s "$shell_path" "$user" >/dev/null 2>&1
+/usr/bin/chsh -s "$shell_path" "$user" &>/dev/null
 
 
 
 
 
 
@@ -56,6 +55,6 @@ shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
 update_user_value "$user" '$SHELL' "$shell"
 update_user_value "$user" '$SHELL' "$shell"
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 18 - 19
bin/v_change_web_domain_ip

@@ -17,11 +17,10 @@ domain_idn=$(idn -t --quiet -a "$domain")
 ip=$3
 ip=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
-source $V_FUNC/ip.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
+source $VESTA/func/ip.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -32,16 +31,16 @@ source $V_FUNC/ip.func
 check_args '3' "$#" 'user domain ip'
 check_args '3' "$#" 'user domain ip'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'ip'
+validate_format 'user' 'domain' 'ip'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -59,30 +58,30 @@ is_ip_avalable
 
 
 # Define variable for replace
 # Define variable for replace
 get_domain_values 'web'
 get_domain_values 'web'
-tpl_file="$V_WEBTPL/apache_$TPL.tpl"
-conf="$V_HOME/$user/conf/web/httpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.tpl"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
 old=$IP
 old=$IP
 new=$ip
 new=$ip
 replace_web_config
 replace_web_config
 
 
 # Checking ssl
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-    conf="$V_HOME/$user/conf/web/shttpd.conf"
+    tpl_file="$WEBTPL/apache_$TPL.stpl"
+    conf="$HOMEDIR/$user/conf/web/shttpd.conf"
     replace_web_config
     replace_web_config
 fi
 fi
 
 
 # Checking nginx
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
-    conf="$V_HOME/$user/conf/web/nginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
+    conf="$HOMEDIR/$user/conf/web/nginx.conf"
     replace_web_config
     replace_web_config
 fi
 fi
 
 
 # Checking nginx
 # Checking nginx
 if [ "$SSL" = 'yes' ] && [ ! -z "$NGINX" ]; then 
 if [ "$SSL" = 'yes' ] && [ ! -z "$NGINX" ]; then 
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-    conf="$V_HOME/$user/conf/web/snginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+    conf="$HOMEDIR/$user/conf/web/snginx.conf"
     replace_web_config
     replace_web_config
 fi
 fi
 
 
@@ -101,10 +100,10 @@ decrease_ip_value "$old"
 update_domain_value 'web' '$IP' "$new"
 update_domain_value 'web' '$IP' "$new"
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ip"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user $domain $old_ip"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 22 - 23
bin/v_change_web_domain_sslcert

@@ -17,10 +17,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 ssl_dir=$3
 ssl_dir=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -31,16 +30,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain ssl_dir'
 check_args '3' "$#" 'user domain ssl_dir'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'ssl_dir'
+validate_format 'user' 'domain' 'ssl_dir'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -60,26 +59,26 @@ is_web_domain_cert_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Deleting old certificate
 # Deleting old certificate
-tmpdir=$(mktemp -p $V_HOME/$user/web/$domain/private -d)
-rm -f $V_HOME/$user/conf/ssl.$domain.*
-mv $V_USERS/$user/ssl/$domain.* $tmpdir
+tmpdir=$(mktemp -p $HOMEDIR/$user/web/$domain/private -d)
+rm -f $HOMEDIR/$user/conf/ssl.$domain.*
+mv $USER_DATA/ssl/$domain.* $tmpdir
 chown -R $user:$user $tmpdir
 chown -R $user:$user $tmpdir
 
 
 # Adding new certificate to user data directory
 # Adding new certificate to user data directory
-cp -f $ssl_dir/$domain.crt $V_USERS/$user/ssl/$domain.crt
-cp -f $ssl_dir/$domain.key $V_USERS/$user/ssl/$domain.key
-cp -f $ssl_dir/$domain.crt $V_USERS/$user/ssl/$domain.pem
+cp -f $ssl_dir/$domain.crt $USER_DATA/ssl/$domain.crt
+cp -f $ssl_dir/$domain.key $USER_DATA/ssl/$domain.key
+cp -f $ssl_dir/$domain.crt $USER_DATA/ssl/$domain.pem
 if [ -e "$ssl_dir/$domain.ca" ]; then
 if [ -e "$ssl_dir/$domain.ca" ]; then
-    cp -f $ssl_dir/$domain.ca $V_USERS/$user/ssl/$domain.ca
-    cat $V_USERS/$user/ssl/$domain.ca >> $V_USERS/$user/ssl/$domain.pem
+    cp -f $ssl_dir/$domain.ca $USER_DATA/ssl/$domain.ca
+    cat $USER_DATA/ssl/$domain.ca >> $USER_DATA/ssl/$domain.pem
 fi
 fi
 
 
 # Adding new certificate to user dir
 # Adding new certificate to user dir
-cp -f $V_USERS/$user/ssl/$domain.crt $V_HOME/$user/conf/ssl.$domain.crt
-cp -f $V_USERS/$user/ssl/$domain.key $V_HOME/$user/conf/ssl.$domain.key
-cp -f $V_USERS/$user/ssl/$domain.pem $V_HOME/$user/conf/ssl.$domain.pem
-if [ -e "$V_USERS/$user/ssl/$domain.ca" ]; then
-    cp -f $V_USERS/$user/ssl/$domain.ca $V_HOME/$user/conf/ssl.$domain.ca
+cp -f $USER_DATA/ssl/$domain.crt $HOMEDIR/$user/conf/ssl.$domain.crt
+cp -f $USER_DATA/ssl/$domain.key $HOMEDIR/$user/conf/ssl.$domain.key
+cp -f $USER_DATA/ssl/$domain.pem $HOMEDIR/$user/conf/ssl.$domain.pem
+if [ -e "$USER_DATA/ssl/$domain.ca" ]; then
+    cp -f $USER_DATA/ssl/$domain.ca $HOMEDIR/$user/conf/ssl.$domain.ca
 fi
 fi
 
 
 
 
@@ -88,10 +87,10 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user $domain $tmpdir"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user $domain $tmpdir"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 17 - 18
bin/v_change_web_domain_sslhome

@@ -12,10 +12,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 ssl_home=$3
 ssl_home=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -26,16 +25,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain ssl_home'
 check_args '3' "$#" 'user domain ssl_home'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -55,15 +54,15 @@ is_domain_value_exist 'web' '$SSL'
 get_domain_values 'web'
 get_domain_values 'web'
 old_ssl_home=$SSL_HOME
 old_ssl_home=$SSL_HOME
 SSL_HOME=$ssl_home
 SSL_HOME=$ssl_home
-tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-conf="$V_HOME/$user/conf/shttpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.stpl"
+conf="$HOMEDIR/$user/conf/shttpd.conf"
 
 
 # Parsing tpl_option
 # Parsing tpl_option
 case $SSL_HOME in
 case $SSL_HOME in
-    single) new="$V_HOME/$user/web/$domain/public_shtml" ;
-            old="$V_HOME/$user/web/$domain/public_html" ;;
-    same)   new="$V_HOME/$user/web/$domain/public_html" ;
-            old="$V_HOME/$user/web/$domain/public_shtml" ;;
+    single) new="$HOMEDIR/$user/web/$domain/public_shtml" ;
+            old="$HOMEDIR/$user/web/$domain/public_html" ;;
+    same)   new="$HOMEDIR/$user/web/$domain/public_html" ;
+            old="$HOMEDIR/$user/web/$domain/public_shtml" ;;
     *)      check_args '3' "2" 'user domain sslhome'
     *)      check_args '3' "2" 'user domain sslhome'
 esac
 esac
 
 
@@ -72,8 +71,8 @@ replace_web_config
 
 
 # Checking nginx config
 # Checking nginx config
 if [ ! -z "$NGINX" ]; then
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-    conf="$V_HOME/$user/conf/snginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+    conf="$HOMEDIR/$user/conf/snginx.conf"
     replace_web_config
     replace_web_config
 fi
 fi
 
 
@@ -86,10 +85,10 @@ fi
 update_domain_value 'web' '$SSL_HOME' "$SSL_HOME"
 update_domain_value 'web' '$SSL_HOME' "$SSL_HOME"
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "$V_SCRIPT $user $domain $old_ssl_home"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$SCRIPT $user $domain $old_ssl_home"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 33 - 34
bin/v_change_web_domain_tpl

@@ -17,10 +17,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 template=$3
 template=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -31,16 +30,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain template'
 check_args '3' "$#" 'user domain template'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'template'
+validate_format 'user' 'domain' 'template'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -50,7 +49,7 @@ is_domain_suspended 'web'
 
 
 # Checking template
 # Checking template
 templates=$(get_user_value '$WEB_TPL')
 templates=$(get_user_value '$WEB_TPL')
-is_template_valid "web"
+is_apache_template_valid
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -61,15 +60,15 @@ is_template_valid "web"
 get_domain_values 'web'
 get_domain_values 'web'
 
 
 # Deleting domain
 # Deleting domain
-tpl_file="$V_WEBTPL/apache_$TPL.tpl"
+tpl_file="$WEBTPL/apache_$TPL.tpl"
 old_tpl=$TPL
 old_tpl=$TPL
-conf="$V_HOME/$user/conf/web/httpd.conf"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
 del_web_config
 del_web_config
 
 
 # Deleting ssl vhost
 # Deleting ssl vhost
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-    conf="$V_HOME/$user/conf/web/shttpd.conf"
+    tpl_file="$WEBTPL/apache_$TPL.stpl"
+    conf="$HOMEDIR/$user/conf/web/shttpd.conf"
     del_web_config
     del_web_config
 fi
 fi
 
 
@@ -77,10 +76,10 @@ fi
 ip=$IP
 ip=$IP
 email="$user@$domain"
 email="$user@$domain"
 group="$user"
 group="$user"
-docroot="$V_HOME/$user/web/$domain/public_html"
+docroot="$HOMEDIR/$user/web/$domain/public_html"
 docroot_string="DocumentRoot $docroot"
 docroot_string="DocumentRoot $docroot"
-conf="$V_HOME/$user/conf/web/httpd.conf"
-tpl_file="$V_WEBTPL/apache_$template.tpl"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
+tpl_file="$WEBTPL/apache_$template.tpl"
 
 
 
 
 # Parsing domain aliases
 # Parsing domain aliases
@@ -124,7 +123,7 @@ IFS=$OLD_IFS
 
 
 
 
 # Parsing new template
 # Parsing new template
-template_data=$(cat $V_WEBTPL/apache_$template.descr | grep -v '#')
+template_data=$(cat $WEBTPL/apache_$template.descr | grep -v '#')
 for keys in $template_data; do
 for keys in $template_data; do
     eval ${keys%%=*}=${keys#*=}
     eval ${keys%%=*}=${keys#*=}
 done
 done
@@ -140,34 +139,34 @@ fi
 add_web_config
 add_web_config
 
 
 # Running template trigger
 # Running template trigger
-if [ -x $V_WEBTPL/apache_$template.sh ]; then
-    $V_WEBTPL/apache_$template.sh $user $domain $ip $V_HOME $docroot
+if [ -x $WEBTPL/apache_$template.sh ]; then
+    $WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $docroot
 fi
 fi
 
 
 # Checking ssl
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
     # Defining SSL vars
     # Defining SSL vars
-    ssl_crt="$V_HOME/$user/conf/web/ssl.$domain.crt"
-    ssl_key="$V_HOME/$user/conf/web/ssl.$domain.key"
-    ssl_pem="$V_HOME/$user/conf/web/ssl.$domain.pem"
-    ssl_ca="$V_HOME/$user/conf/web/ssl.$domain.ca"
-    if [ ! -e "$V_USERS/$user/web/ssl/$domain.ca" ]; then
+    ssl_crt="$HOMEDIR/$user/conf/web/ssl.$domain.crt"
+    ssl_key="$HOMEDIR/$user/conf/web/ssl.$domain.key"
+    ssl_pem="$HOMEDIR/$user/conf/web/ssl.$domain.pem"
+    ssl_ca="$HOMEDIR/$user/conf/web/ssl.$domain.ca"
+    if [ ! -e "$USER_DATA/web/ssl/$domain.ca" ]; then
         ssl_ca_str='#'
         ssl_ca_str='#'
     fi
     fi
     case $SSL_HOME in
     case $SSL_HOME in
-        single) docroot="$V_HOME/$user/web/$domain/public_shtml" ;;
-        same)   docroot="$V_HOME/$user/web/$domain/public_html" ;;
+        single) docroot="$HOMEDIR/$user/web/$domain/public_shtml" ;;
+        same)   docroot="$HOMEDIR/$user/web/$domain/public_html" ;;
     esac
     esac
-    conf="$V_HOME/$user/conf/web/shttpd.conf"
-    tpl_file="$V_WEBTPL/apache_$template.stpl"
+    conf="$HOMEDIR/$user/conf/web/shttpd.conf"
+    tpl_file="$WEBTPL/apache_$template.stpl"
 
 
     # Adding domain to the httpd.conf
     # Adding domain to the httpd.conf
     add_web_config
     add_web_config
 
 
     # Running template trigger
     # Running template trigger
-    if [ -x $V_WEBTPL/apache_$template.sh ]; then
-        $V_WEBTPL/apache_$template.sh \
-            "$user" "$domain" "$ip" "$V_HOME" "$docroot"
+    if [ -x $WEBTPL/apache_$template.sh ]; then
+        $WEBTPL/apache_$template.sh \
+            "$user" "$domain" "$ip" "$HOMEDIR" "$docroot"
     fi
     fi
 fi
 fi
 
 
@@ -180,17 +179,17 @@ fi
 update_domain_value 'web' '$TPL' "$template"
 update_domain_value 'web' '$TPL' "$template"
 
 
 # Updating db keys
 # Updating db keys
-for keys in $(cat $V_WEBTPL/apache_$template.descr|grep -v '#'); do
+for keys in $(cat $WEBTPL/apache_$template.descr|grep -v '#'); do
     key=$(echo "$keys"| cut -f 1 -d '=' |sed -e "s/^/\$/g")
     key=$(echo "$keys"| cut -f 1 -d '=' |sed -e "s/^/\$/g")
     value=$(echo "$keys" |cut -f 2 -d \')
     value=$(echo "$keys" |cut -f 2 -d \')
     update_domain_value 'web' "$key" "$value"
     update_domain_value 'web' "$key" "$value"
 done
 done
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_change_web_domain_tpl $user $domain $old_tpl"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_change_web_domain_tpl $user $domain $old_tpl"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 14 - 22
bin/v_delete_cron_job

@@ -13,31 +13,22 @@
 user=$1
 user=$1
 job=$2
 job=$2
 
 
-# Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/cron.func
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                    Verifications                         #
 #                    Verifications                         #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Checking arg number
 check_args '2' "$#" 'user job'
 check_args '2' "$#" 'user job'
-
-# Checking argument format
-format_validation 'user' 'job'
-
-# Checking user
-is_user_valid
-
-# Checking user is active
-is_user_suspended
-
-# Checking cron job
-is_job_valid
+validate_format 'user' 'job'
+is_system_enabled "$CRON_SYSTEM"
+is_object_valid 'user' 'USER' "$user"
+is_object_suspended 'user' 'USER' "$user"
+is_object_valid 'cron' 'JOB' "$job"
+is_object_suspended 'cron' 'JOB' "$job"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -45,7 +36,7 @@ is_job_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Deleting job
 # Deleting job
-del_cron_job
+sed -i "/JOB='$job' /d" $USER_DATA/cron.conf
 
 
 # Sorting jobs by id
 # Sorting jobs by id
 sort_cron_jobs
 sort_cron_jobs
@@ -61,10 +52,11 @@ sync_cron_jobs
 # Decreasing cron value
 # Decreasing cron value
 decrease_user_value "$user" '$U_CRON_JOBS'
 decrease_user_value "$user" '$U_CRON_JOBS'
 
 
-# Adding task to the vesta pipe
-restart_schedule 'cron'
+# Restart crond
+$BIN/v_restart_cron
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_history "$EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 13 - 21
bin/v_delete_user_reports → bin/v_delete_cron_reports

@@ -1,5 +1,5 @@
 #!/bin/bash
 #!/bin/bash
-# info: delete user reports
+# info: delete cron reports
 # options: user
 # options: user
 #
 #
 # The script for disabling reports on cron tasks and administrative
 # The script for disabling reports on cron tasks and administrative
@@ -13,28 +13,20 @@
 # Argument defenition
 # Argument defenition
 user=$1
 user=$1
 
 
-# Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/cron.func
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                    Verifications                         #
 #                    Verifications                         #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Checking arg number
 check_args '1' "$#" 'user'
 check_args '1' "$#" 'user'
-
-# Checking argument format
-format_validation 'user'
-
-# Checking user
-is_user_valid
-
-# Checking user is active
-is_user_suspended
+validate_format 'user'
+is_system_enabled "$CRON_SYSTEM"
+is_object_valid 'user' 'USER' "$user"
+is_object_suspended 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -42,7 +34,7 @@ is_user_suspended
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Changing user report value
 # Changing user report value
-update_user_value "$user" '$REPORTS' 'no'
+update_user_value "$user" '$CRON_REPORTS' 'no'
 
 
 # Sync system cron with user
 # Sync system cron with user
 sync_cron_jobs
 sync_cron_jobs
@@ -52,11 +44,11 @@ sync_cron_jobs
 #                       Vesta                              #
 #                       Vesta                              #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Adding task to the vesta pipe
-restart_schedule 'cron'
+# Restart crond
+$BIN/v_restart_cron
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_user_reports $user"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 7 - 8
bin/v_delete_db_base

@@ -15,10 +15,9 @@ user=$1
 database=$2
 database=$2
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/db.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/db.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -29,16 +28,16 @@ source $V_FUNC/db.func
 check_args '2' "$#" 'user db_name'
 check_args '2' "$#" 'user db_name'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'database'
+validate_format 'user' 'database'
 
 
 # Checking db system is enabled
 # Checking db system is enabled
 is_system_enabled 'DB_SYSTEM'
 is_system_enabled 'DB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking db existance
 # Checking db existance
 is_db_valid
 is_db_valid
@@ -77,6 +76,6 @@ decrease_user_value "$user" '$U_DATABASES'
 del_db_vesta
 del_db_vesta
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 9 - 10
bin/v_delete_db_bases

@@ -13,10 +13,9 @@
 user=$1
 user=$1
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/db.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/db.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -27,13 +26,13 @@ source $V_FUNC/db.func
 check_args '1' "$#" 'user'
 check_args '1' "$#" 'user'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'DB_SYSTEM'
 is_system_enabled 'DB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -41,7 +40,7 @@ is_user_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf="$V_USERS/$user/db.conf"
+conf="$USER_DATA/db.conf"
 
 
 # Defining fileds to select
 # Defining fileds to select
 field='$DB'
 field='$DB'
@@ -54,10 +53,10 @@ databases=$(db_clear_search)
 
 
 # Starting delete loop
 # Starting delete loop
 for database in $databases; do
 for database in $databases; do
-    $V_BIN/v_delete_db_base "$user" "$database"
+    $BIN/v_delete_db_base "$user" "$database"
     rv="$?"
     rv="$?"
     if [ "$rv" -ne '0' ]; then
     if [ "$rv" -ne '0' ]; then
-        log_event 'debug' "$rv $V_EVENT"
+        log_event 'debug' "$rv $EVENT"
         exit $rv
         exit $rv
     fi
     fi
 done
 done
@@ -68,6 +67,6 @@ done
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 6 - 7
bin/v_delete_db_host

@@ -15,10 +15,9 @@ type=$1
 host=$2
 host=$2
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/db.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/db.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -29,13 +28,13 @@ source $V_FUNC/db.func
 check_args '2' "$#" 'type host'
 check_args '2' "$#" 'type host'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'host'
+validate_format 'host'
 
 
 # Checking db system is enabled
 # Checking db system is enabled
 is_system_enabled 'DB_SYSTEM'
 is_system_enabled 'DB_SYSTEM'
 
 
 # Checking db type
 # Checking db type
-is_type_valid 'db' "$type"
+is_type_valid "$DB_SYSTEM" "$type"
 
 
 # Checking host existance
 # Checking host existance
 is_db_host_valid
 is_db_host_valid
@@ -57,6 +56,6 @@ del_dbhost_vesta
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 14 - 15
bin/v_delete_dns_domain

@@ -16,10 +16,9 @@ domain=$(idn -t --quiet -u "$2" )
 named_conf=/etc/named.conf
 named_conf=/etc/named.conf
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,16 +29,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'DNS_SYSTEM'
 is_system_enabled 'DNS_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -52,7 +51,7 @@ is_domain_valid 'dns'
 # Get domain values
 # Get domain values
 tpl_name=$(get_domain_value 'dns' '$TPL')
 tpl_name=$(get_domain_value 'dns' '$TPL')
 old_ip=$(get_domain_value 'dns' '$IP')
 old_ip=$(get_domain_value 'dns' '$IP')
-records=$(wc -l $V_USERS/$user/dns/$domain|cut -f 1 -d ' ')
+records=$(wc -l $USER_DATA/dns/$domain|cut -f 1 -d ' ')
 
 
 # Deleting domain in named.conf
 # Deleting domain in named.conf
 rm_string=$(grep -n /conf/dns/$domain.db $named_conf |cut -d : -f 1)
 rm_string=$(grep -n /conf/dns/$domain.db $named_conf |cut -d : -f 1)
@@ -60,8 +59,8 @@ if [ ! -z "$rm_string" ]; then
     sed -i "$rm_string d" $named_conf
     sed -i "$rm_string d" $named_conf
 fi
 fi
 
 
-if [ -e "$V_HOME/$user/conf/dns/$domain.db" ]; then
-    rm -f $V_HOME/$user/conf/dns/$domain.db
+if [ -e "$HOMEDIR/$user/conf/dns/$domain.db" ]; then
+    rm -f $HOMEDIR/$user/conf/dns/$domain.db
 fi
 fi
 
 
 
 
@@ -70,18 +69,18 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Deleting domain
 # Deleting domain
-sed -i "/DOMAIN='$domain'/ d" $V_USERS/$user/dns.conf
-rm -f $V_USERS/$user/dns/$domain
+sed -i "/DOMAIN='$domain'/ d" $USER_DATA/dns.conf
+rm -f $USER_DATA/dns/$domain
 
 
 # Decreasing domain value
 # Decreasing domain value
 decrease_user_value "$user" '$U_DNS_DOMAINS'
 decrease_user_value "$user" '$U_DNS_DOMAINS'
 decrease_user_value "$user" '$U_DNS_RECORDS' "$records"
 decrease_user_value "$user" '$U_DNS_RECORDS' "$records"
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'dns'
+$BIN/v_restart_dns
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_dns_domain $user $domain $old_ip $tpl_name"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_dns_domain $user $domain $old_ip $tpl_name"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 10 - 11
bin/v_delete_dns_domain_record

@@ -16,10 +16,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 id=$3
 id=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,13 +29,13 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain id'
 check_args '3' "$#" 'user domain id'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'id'
+validate_format 'user' 'domain' 'id'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -53,7 +52,7 @@ is_dns_record_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Deleting record
 # Deleting record
-conf="$V_USERS/$user/dns/$domain"
+conf="$USER_DATA/dns/$domain"
 rm_string=$(grep -n "^ID='$id'" $conf|cut -d : -f 1)
 rm_string=$(grep -n "^ID='$id'" $conf|cut -d : -f 1)
 if [ ! -z "$rm_string" ]; then
 if [ ! -z "$rm_string" ]; then
     sed -i "$rm_string d" $conf
     sed -i "$rm_string d" $conf
@@ -63,7 +62,7 @@ fi
 sort_dns_records
 sort_dns_records
 
 
 # Updating zone
 # Updating zone
-conf="$V_HOME/$user/conf/dns/$domain.db"
+conf="$HOMEDIR/$user/conf/dns/$domain.db"
 update_domain_zone
 update_domain_zone
 
 
 
 
@@ -72,9 +71,9 @@ update_domain_zone
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'dns'
+$BIN/v_restart_dns
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 9 - 10
bin/v_delete_dns_domains

@@ -13,10 +13,9 @@
 user=$1
 user=$1
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -27,13 +26,13 @@ source $V_FUNC/domain.func
 check_args '1' "$#" 'user'
 check_args '1' "$#" 'user'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'DNS_SYSTEM'
 is_system_enabled 'DNS_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -41,7 +40,7 @@ is_user_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf="$V_USERS/$user/dns.conf"
+conf="$USER_DATA/dns.conf"
 
 
 # Defining fileds to select
 # Defining fileds to select
 field='$DOMAIN'
 field='$DOMAIN'
@@ -54,10 +53,10 @@ domains=$(dom_clear_search)
 
 
 # Starting delete loop
 # Starting delete loop
 for domain in $domains; do
 for domain in $domains; do
-    $V_BIN/v_delete_dns_domain "$user" "$domain"
+    $BIN/v_delete_dns_domain "$user" "$domain"
     rv="$?"
     rv="$?"
     if [ "$rv" -ne '0' ]; then
     if [ "$rv" -ne '0' ]; then
-        log_event 'debug' "$rv $V_EVENT"
+        log_event 'debug' "$rv $EVENT"
         exit $rv
         exit $rv
     fi
     fi
 done
 done
@@ -68,6 +67,6 @@ done
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 15 - 16
bin/v_delete_mail_domain

@@ -15,10 +15,9 @@ user=$1
 domain=$(idn -t --quiet -u "$2" )
 domain=$(idn -t --quiet -u "$2" )
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -29,16 +28,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -50,11 +49,11 @@ is_domain_valid 'mail'
 
 
 # Get domain values
 # Get domain values
 get_domain_values 'mail'
 get_domain_values 'mail'
-accounts=$(wc -l $V_USERS/$user/mail/$domain|cut -f 1 -d ' ')
+accounts=$(wc -l $USER_DATA/mail/$domain.conf|cut -f 1 -d ' ')
 
 
 rm -f /etc/exim/domains/$domain
 rm -f /etc/exim/domains/$domain
-rm -rf $V_HOME/$user/conf/$domain
-rm -rf $V_HOME/$user/mail/$domain
+rm -rf $HOMEDIR/$user/conf/$domain
+rm -rf $HOMEDIR/$user/mail/$domain
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -62,10 +61,10 @@ rm -rf $V_HOME/$user/mail/$domain
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Delete domain config
 # Delete domain config
-sed -i "/DOMAIN='$domain'/ d" $V_USERS/$user/mail.conf
-rm -f $V_USERS/$user/mail/$domain
-rm -f $V_USERS/$user/mail/$domain.pem
-rm -f $V_USERS/$user/mail/$domain.pub
+sed -i "/DOMAIN='$domain'/ d" $USER_DATA/mail.conf
+rm -f $USER_DATA/mail/$domain.conf
+rm -f $USER_DATA/mail/$domain.pem
+rm -f $USER_DATA/mail/$domain.pub
 # autoreply
 # autoreply
 
 
 # Decreasing domain value
 # Decreasing domain value
@@ -74,7 +73,7 @@ decrease_user_value "$user" '$U_MAIL_ACCOUNTS' "$accounts"
 
 
 # Logging
 # Logging
 cmd='"v_add_mail_domain'
 cmd='"v_add_mail_domain'
-log_history "$V_EVENT" "$cmd $user $domain $ANTISPAM $ANTIVIRUS $DKIM"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "$cmd $user $domain $ANTISPAM $ANTIVIRUS $DKIM"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 9 - 10
bin/v_delete_mail_domain_antispam

@@ -16,10 +16,9 @@ domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,16 +29,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -56,7 +55,7 @@ is_domain_value_exist 'mail' '$ANTISPAM'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Delete antispam key
 # Delete antispam key
-sed -i "/antispam/d" $V_HOME/$user/conf/mail/$domain/protection
+sed -i "/antispam/d" $HOMEDIR/$user/conf/mail/$domain/protection
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -67,7 +66,7 @@ sed -i "/antispam/d" $V_HOME/$user/conf/mail/$domain/protection
 update_domain_value 'mail' '$ANTISPAM' 'no'
 update_domain_value 'mail' '$ANTISPAM' 'no'
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_mail_domain_antispam $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_mail_domain_antispam $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 9 - 10
bin/v_delete_mail_domain_antivirus

@@ -16,10 +16,9 @@ domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,16 +29,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -56,7 +55,7 @@ is_domain_value_exist 'mail' '$ANTIVIRUS'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Delete antivirus key
 # Delete antivirus key
-sed -i "/antivirus/d" $V_HOME/$user/conf/mail/$domain/protection
+sed -i "/antivirus/d" $HOMEDIR/$user/conf/mail/$domain/protection
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -67,7 +66,7 @@ sed -i "/antivirus/d" $V_HOME/$user/conf/mail/$domain/protection
 update_domain_value 'mail' '$ANTIVIRUS' 'no'
 update_domain_value 'mail' '$ANTIVIRUS' 'no'
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_mail_domain_antivirus $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_mail_domain_antivirus $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 9 - 10
bin/v_delete_mail_domain_cactchall

@@ -16,10 +16,9 @@ domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,16 +29,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -59,7 +58,7 @@ is_domain_value_exist 'mail' '$CATCHALL'
 email=$(get_domain_value 'mail' '$CATCHALL')
 email=$(get_domain_value 'mail' '$CATCHALL')
 
 
 # Delete cathcall alias
 # Delete cathcall alias
-sed -i "/*@demo.vestacp.com:/d" $V_HOME/$user/conf/mail/$domain/aliases
+sed -i "/*@demo.vestacp.com:/d" $HOMEDIR/$user/conf/mail/$domain/aliases
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -70,7 +69,7 @@ sed -i "/*@demo.vestacp.com:/d" $V_HOME/$user/conf/mail/$domain/aliases
 update_domain_value 'mail' '$CATCHALL' ''
 update_domain_value 'mail' '$CATCHALL' ''
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_mail_domain_catchall $user $domain $email"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_mail_domain_catchall $user $domain $email"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 13 - 14
bin/v_delete_mail_domain_dkim

@@ -15,10 +15,9 @@ domain=$(idn -t --quiet -u "$2" )
 domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
 domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -29,16 +28,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 is_system_enabled 'MAIL_SYSTEM'
 is_system_enabled 'MAIL_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain
 # Checking domain
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -55,17 +54,17 @@ is_domain_value_exist 'mail' '$DKIM'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Generating dkim
 # Generating dkim
-rm -f $V_USERS/$user/mail/$domain.pem
-rm -f $V_USERS/$user/mail/$domain.pub
-rm -f $V_HOME/$user/conf/mail/$domain/dkim.pem
+rm -f $USER_DATA/mail/$domain.pem
+rm -f $USER_DATA/mail/$domain.pub
+rm -f $HOMEDIR/$user/conf/mail/$domain/dkim.pem
 
 
 # Checking dns domain
 # Checking dns domain
 check_dns_domain=$(is_domain_valid 'dns')
 check_dns_domain=$(is_domain_valid 'dns')
 if [ "$?" -eq 0 ]; then
 if [ "$?" -eq 0 ]; then
-    records=$($V_BIN/v_list_dns_domain_records $user $domain plain)
+    records=$($BIN/v_list_dns_domain_records $user $domain plain)
     dkim_records=$(echo "$records" |grep -w '_domainkey'|cut -f 1 -d ' ')
     dkim_records=$(echo "$records" |grep -w '_domainkey'|cut -f 1 -d ' ')
     for id in $dkim_records; do
     for id in $dkim_records; do
-        $V_BIN/v_delete_dns_domain_record $user $domain $id
+        $BIN/v_delete_dns_domain_record $user $domain $id
     done
     done
 fi
 fi
 
 
@@ -78,7 +77,7 @@ fi
 update_domain_value 'mail' '$DKIM' 'no'
 update_domain_value 'mail' '$DKIM' 'no'
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_mail_domain_dkim $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_mail_domain_dkim $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 9 - 10
bin/v_delete_sys_ip

@@ -14,11 +14,10 @@
 ip=$1
 ip=$1
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/ip.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/ip.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -29,7 +28,7 @@ source $V_FUNC/domain.func
 check_args '1' "$#" 'ip'
 check_args '1' "$#" 'ip'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'ip'
+validate_format 'ip'
 
 
 # Checking system ip
 # Checking system ip
 is_sys_ip_valid "$ip"
 is_sys_ip_valid "$ip"
@@ -65,10 +64,10 @@ ip_status="$(get_sys_ip_value '$STATUS')"
 rm -f $iconf-$interface
 rm -f $iconf-$interface
 
 
 # Deleting vesta ip
 # Deleting vesta ip
-rm -f $V_IPS/$ip
+rm -f $VESTA/data/ips/$ip
 
 
 # Importing main config
 # Importing main config
-source $V_CONF/vesta.conf
+source $VESTA/conf/vesta.conf
 
 
 # Deleting namehosting support
 # Deleting namehosting support
 namehost_ip_disable
 namehost_ip_disable
@@ -99,10 +98,10 @@ fi
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
 if [ "$web_restart" = 'yes' ]; then
 if [ "$web_restart" = 'yes' ]; then
-    restart_schedule 'web'
+    $BIN/v_restart_web
 fi
 fi
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 23 - 42
bin/v_delete_user

@@ -14,12 +14,11 @@
 user=$1
 user=$1
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
-source $V_FUNC/db.func
-source $V_FUNC/ip.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
+source $VESTA/func/db.sh
+source $VESTA/func/ip.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,13 +29,13 @@ source $V_FUNC/ip.func
 check_args '1' "$#" 'user'
 check_args '1' "$#" 'user'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking user admin
 # Checking user admin
 if [ "$user" = 'admin' ]; then
 if [ "$user" = 'admin' ]; then
@@ -49,8 +48,8 @@ fi
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
 if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ]; then
-    $V_BIN/v_unsuspend_web_domains $user
-    $V_BIN/v_delete_web_domains $user
+    $BIN/v_unsuspend_web_domains $user
+    $BIN/v_delete_web_domains $user
     rv="$?"
     rv="$?"
     if [ "$rv" -ne '0' ]; then
     if [ "$rv" -ne '0' ]; then
         exit $rv
         exit $rv
@@ -59,8 +58,8 @@ fi
 
 
 # Checking dns system is enabled
 # Checking dns system is enabled
 if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
 if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ]; then
-    $V_BIN/v_unsuspend_dns_domains $user
-    $V_BIN/v_delete_dns_domains $user
+    $BIN/v_unsuspend_dns_domains $user
+    $BIN/v_delete_dns_domains $user
     rv="$?"
     rv="$?"
     if [ "$rv" -ne '0' ]; then
     if [ "$rv" -ne '0' ]; then
         exit $rv
         exit $rv
@@ -69,8 +68,8 @@ fi
 
 
 # Checking mail system is enabled
 # Checking mail system is enabled
 if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then
 if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL_SYSTEM" != 'no' ]; then
-    $V_BIN/v_unsuspend_mail_domains $user
-    $V_BIN/v_del_mail_domains $user
+    $BIN/v_unsuspend_mail_domains $user
+    $BIN/v_del_mail_domains $user
     rv="$?"
     rv="$?"
     if [ "$rv" -ne '0' ]; then
     if [ "$rv" -ne '0' ]; then
         exit $rv
         exit $rv
@@ -79,8 +78,8 @@ fi
 
 
 # Checking db system is enabled
 # Checking db system is enabled
 if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
 if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
-    $V_BIN/v_unsuspend_db_bases $user
-    $V_BIN/v_delete_db_dbases $user
+    $BIN/v_unsuspend_db_bases $user
+    $BIN/v_delete_db_dbases $user
     rv="$?"
     rv="$?"
     if [ "$rv" -ne '0' ]; then
     if [ "$rv" -ne '0' ]; then
         exit $rv
         exit $rv
@@ -88,41 +87,23 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ]; then
 fi
 fi
 
 
 # Checking ip
 # Checking ip
-$V_BIN/v_delete_user_ips "$user"
+$BIN/v_delete_user_ips "$user"
 rv="$?"
 rv="$?"
 if [ "$rv" -ne '0' ]; then
 if [ "$rv" -ne '0' ]; then
     exit $rv
     exit $rv
 fi
 fi
 
 
 # Deleteing user pipes
 # Deleteing user pipes
-diskp=$(grep -n " $user$" $V_QUEUE/disk.pipe|cut -d : -f 1|sort -n -r)
-trafp=$(grep -n " $user$" $V_QUEUE/traffic.pipe|cut -d : -f 1|sort -n -r)
-statp=$(grep -n "/$user/" $V_QUEUE/stats.pipe|cut -d : -f 1|sort -n -r)
-
-if [ ! -z "$diskp" ]; then
-    for str in $diskp; do
-        sed -i "$str d" $V_QUEUE/disk.pipe
-    done
-fi
-
-if [ ! -z "$trafp" ]; then
-    for str in $trafp; do
-        sed -i "$str d" $V_QUEUE/traffic.pipe
-    done
-fi
-
-if [ ! -z "$statp" ]; then
-    for str in $statp; do
-        sed -i "$str d" $V_QUEUE/stats.pipe
-    done
-fi
+sed -i "/v_update_db_bases_disk $user$/d" $VESTA/data/queue/disk.pipe
+sed -i "/v_update_web_domains_traff $user$/d" $VESTA/data/queue/traffic.pipe
+sed -i "/v_update_web_domain_stat $user /d" $VESTA/data/queue/stats.pipe
 
 
 # Removing system user
 # Removing system user
 /usr/sbin/userdel -f $user
 /usr/sbin/userdel -f $user
-rm -rf $V_HOME/$user
+rm -rf $HOMEDIR/$user
 rm -f /var/spool/mail/$user
 rm -f /var/spool/mail/$user
 rm -f /var/spool/cron/$user
 rm -f /var/spool/cron/$user
-rm -rf $V_USERS/$user
+rm -rf $USER_DATA
 
 
 # Updating admin counter
 # Updating admin counter
 if [ "$user" != 'admin' ]; then
 if [ "$user" != 'admin' ]; then
@@ -135,6 +116,6 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 9 - 10
bin/v_delete_user_ips

@@ -13,10 +13,9 @@
 user=$1
 user=$1
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/ip.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/ip.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -27,13 +26,13 @@ source $V_FUNC/ip.func
 check_args '1' "$#" 'user'
 check_args '1' "$#" 'user'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking user vesta
 # Checking user vesta
 if [ "$user" = 'admin' ]; then
 if [ "$user" = 'admin' ]; then
@@ -45,7 +44,7 @@ fi
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Parsing user ips
 # Parsing user ips
-ip_list=$(grep -H "OWNER='$user'" $V_IPS/* | cut -f 1 -d:)
+ip_list=$(grep -H "OWNER='$user'" $VESTA/data/ips/* | cut -f 1 -d:)
 
 
 for ip in $ip_list; do 
 for ip in $ip_list; do 
     ip=$(basename $ip)
     ip=$(basename $ip)
@@ -56,7 +55,7 @@ for ip in $ip_list; do
 
 
     # Assig ip to main account
     # Assig ip to main account
     update_sys_ip_value '$OWNER' 'admin'
     update_sys_ip_value '$OWNER' 'admin'
-    update_sys_ip_value '$STATUS' 'exclusive'
+    update_sys_ip_value '$STATUS' 'dedicated'
     increase_user_value 'admin' '$IP_OWNED'
     increase_user_value 'admin' '$IP_OWNED'
     increase_user_value 'admin' '$IP_AVAIL'
     increase_user_value 'admin' '$IP_AVAIL'
 done
 done
@@ -67,6 +66,6 @@ done
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 32 - 33
bin/v_delete_web_domain

@@ -18,11 +18,10 @@ domain=$(idn -t --quiet -u "$2" )
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
-source $V_FUNC/ip.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
+source $VESTA/func/ip.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -33,16 +32,16 @@ source $V_FUNC/ip.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -57,8 +56,8 @@ is_domain_suspended 'web'
 
 
 # Get template name
 # Get template name
 get_domain_values 'web'
 get_domain_values 'web'
-tpl_file="$V_WEBTPL/apache_$TPL.tpl"
-conf="$V_HOME/$user/conf/web/httpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.tpl"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
 
 
 # Deleting domain
 # Deleting domain
 del_web_config
 del_web_config
@@ -72,25 +71,25 @@ fi
 
 
 # Checking ssl
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-    conf="$V_HOME/$user/conf/web/shttpd.conf"
+    tpl_file="$WEBTPL/apache_$TPL.stpl"
+    conf="$HOMEDIR/$user/conf/web/shttpd.conf"
     del_web_config
     del_web_config
 
 
     # Deleting certificates
     # Deleting certificates
-    rm -f $V_HOME/$user/conf/web/ssl.$domain.*
-    rm -f $V_USERS/$user/ssl/$domain.*
+    rm -f $HOMEDIR/$user/conf/web/ssl.$domain.*
+    rm -f $USER_DATA/ssl/$domain.*
 fi
 fi
 
 
 # Checking nginx
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
-    conf="$V_HOME/$user/conf/web/nginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
+    conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     del_web_config
 
 
     if [ "$SSL" = 'yes' ]; then
     if [ "$SSL" = 'yes' ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
-        tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-        conf="$V_HOME/$user/conf/web/snginx.conf"
+        tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+        conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         del_web_config
     fi
     fi
 fi
 fi
@@ -98,11 +97,11 @@ fi
 # Checking stats
 # Checking stats
 if [ ! -z "$STATS" ] && [ "$STATS" != 'no' ]; then
 if [ ! -z "$STATS" ] && [ "$STATS" != 'no' ]; then
     sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
     sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
-    rm -f $V_HOME/$user/conf/web/$STATS.$domain.conf
+    rm -f $HOMEDIR/$user/conf/web/$STATS.$domain.conf
 fi
 fi
 
 
 # Deleting directory
 # Deleting directory
-rm -rf $V_HOME/$user/web/$domain
+rm -rf $HOMEDIR/$user/web/$domain
 
 
 # Deleting logs
 # Deleting logs
 rm -f /var/log/httpd/domains/$domain.log*
 rm -f /var/log/httpd/domains/$domain.log*
@@ -115,19 +114,19 @@ rm -f /var/log/httpd/domains/$domain.error*
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Deleting domain
 # Deleting domain
-sed -i "/DOMAIN='$domain'/ d" $V_USERS/$user/web.conf
+sed -i "/DOMAIN='$domain'/ d" $USER_DATA/web.conf
 
 
 # Checking last ssl domain
 # Checking last ssl domain
-ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web.conf | wc -l)
+ssl_dom=$(grep "SSL='yes'" $USER_DATA/web.conf | wc -l)
 if [ "$ssl_dom" -eq '0' ]; then
 if [ "$ssl_dom" -eq '0' ]; then
-    sed -i "s/ Include /#Include /"  $V_HOME/$user/conf/web/httpd.conf
+    sed -i "s/ Include /#Include /"  $HOMEDIR/$user/conf/web/httpd.conf
 fi
 fi
 
 
 # Checking last domain
 # Checking last domain
-domains=$(wc -l $V_USERS/$user/web.conf|cut -f 1 -d ' ')
+domains=$(wc -l $USER_DATA/web.conf|cut -f 1 -d ' ')
 if [ "$domains" -eq '0' ]; then
 if [ "$domains" -eq '0' ]; then
     conf='/etc/httpd/conf.d/vesta.conf'
     conf='/etc/httpd/conf.d/vesta.conf'
-    line=$(grep -n "$V_HOME/$user/conf/web/httpd.conf" $conf | cut -f 1 -d : )
+    line=$(grep -n "$HOMEDIR/$user/conf/web/httpd.conf" $conf | cut -f 1 -d : )
     if [ ! -z "$line" ]; then
     if [ ! -z "$line" ]; then
         sed -i "$line d" $conf
         sed -i "$line d" $conf
     fi
     fi
@@ -135,22 +134,22 @@ fi
 
 
 # Checking last nginx domain
 # Checking last nginx domain
 conf='/etc/nginx/conf.d/vesta_users.conf'
 conf='/etc/nginx/conf.d/vesta_users.conf'
-last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
+last_nginx=$(grep -v "NGINX=''" $USER_DATA/web.conf)
 last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
 last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
 if [ -z "$last_snginx" ]; then
 if [ -z "$last_snginx" ]; then
-    sline=$(grep -n "$V_HOME/$user/conf/web/snginx.conf" $conf |cut -f 1 -d :)
+    sline=$(grep -n "$HOMEDIR/$user/conf/web/snginx.conf" $conf |cut -f 1 -d :)
     if [ ! -z "$sline" ]; then
     if [ ! -z "$sline" ]; then
         sed -i "$sline d" $conf
         sed -i "$sline d" $conf
     fi
     fi
-    rm -f $V_HOME/$user/conf/web/snginx.conf
+    rm -f $HOMEDIR/$user/conf/web/snginx.conf
 fi
 fi
 
 
 if [ -z "$last_nginx" ]; then
 if [ -z "$last_nginx" ]; then
-    line=$(grep -n "$V_HOME/$user/conf/web/nginx.conf" $conf | cut -f 1 -d : )
+    line=$(grep -n "$HOMEDIR/$user/conf/web/nginx.conf" $conf | cut -f 1 -d : )
     if [ ! -z "$line" ]; then
     if [ ! -z "$line" ]; then
         sed -i "$line d" $conf
         sed -i "$line d" $conf
     fi
     fi
-    rm -f $V_HOME/$user/conf/web/nginx.conf
+    rm -f $HOMEDIR/$user/conf/web/nginx.conf
 fi
 fi
 
 
 # Decreasing ip value
 # Decreasing ip value
@@ -168,10 +167,10 @@ if [ "$SSL" = 'yes' ]; then
 fi
 fi
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 19 - 20
bin/v_delete_web_domain_alias

@@ -1,6 +1,6 @@
 #!/bin/bash
 #!/bin/bash
 # info: delete web domain alias
 # info: delete web domain alias
-# options user domain alias
+# options: user domain alias
 #
 #
 # The function of deleting the alias domain (parked domain). By this call
 # The function of deleting the alias domain (parked domain). By this call
 # default www aliase can be removed as well.
 # default www aliase can be removed as well.
@@ -18,10 +18,9 @@ dom_alias=$(idn -t --quiet -u "$3" )
 dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
 dom_alias_idn=$(idn -t --quiet -a "$dom_alias" )
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -32,16 +31,16 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain dom_alias'
 check_args '3' "$#" 'user domain dom_alias'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain' 'dom_alias'
+validate_format 'user' 'domain' 'dom_alias'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -54,7 +53,7 @@ get_domain_values 'web'
 check_alias=$(echo ${ALIAS//,/ }|grep -w "$dom_alias")
 check_alias=$(echo ${ALIAS//,/ }|grep -w "$dom_alias")
 if [ -z "$check_alias" ]; then
 if [ -z "$check_alias" ]; then
     echo "Error: alias not exist"
     echo "Error: alias not exist"
-    log_event 'debug' "$E_NOTEXIST $V_EVENT"
+    log_event 'debug' "$E_NOTEXIST $EVENT"
     exit $E_NOTEXIST
     exit $E_NOTEXIST
 fi
 fi
 
 
@@ -68,8 +67,8 @@ ALIAS=$(echo "$ALIAS" |\
     sed -e "s/^$dom_alias$//g"|\
     sed -e "s/^$dom_alias$//g"|\
     sed -e "/^$/d"|\
     sed -e "/^$/d"|\
     sed -e ':a;N;$!ba;s/\n/,/g')
     sed -e ':a;N;$!ba;s/\n/,/g')
-tpl_file="$V_WEBTPL/apache_$TPL.tpl"
-conf="$V_HOME/$user/conf/web/httpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.tpl"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
 
 
 # Preparing domain values for the template substitution
 # Preparing domain values for the template substitution
 upd_web_domain_values
 upd_web_domain_values
@@ -79,23 +78,23 @@ del_web_config
 add_web_config
 add_web_config
 
 
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-    conf="$V_HOME/$user/conf/web/shttpd.conf"
+    tpl_file="$WEBTPL/apache_$TPL.stpl"
+    conf="$HOMEDIR/$user/conf/web/shttpd.conf"
     del_web_config
     del_web_config
     add_web_config
     add_web_config
 fi
 fi
 
 
 # Checking nginx
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
-    conf="$V_HOME/$user/conf/web/nginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
+    conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     del_web_config
     add_web_config
     add_web_config
 
 
     if [ "$SSL" = 'yes' ]; then
     if [ "$SSL" = 'yes' ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
-        tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-        conf="$V_HOME/$user/conf/web/snginx.conf"
+        tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+        conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         del_web_config
         add_web_config
         add_web_config
     fi
     fi
@@ -113,10 +112,10 @@ update_domain_value 'web' '$ALIAS' "$ALIAS"
 decrease_user_value "$user" '$U_WEB_ALIASES'
 decrease_user_value "$user" '$U_WEB_ALIASES'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_web_domain_alias $user $domain $dom_alias"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_web_domain_alias $user $domain $dom_alias"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 13 - 14
bin/v_delete_web_domain_cgi

@@ -18,10 +18,9 @@ domain=$(idn -t --quiet -u "$2" )
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -32,16 +31,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -58,8 +57,8 @@ is_domain_value_exist 'web' '$CGI'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 get_domain_values 'web'
 get_domain_values 'web'
-tpl_file="$V_WEBTPL/apache_$TPL.tpl"
-conf="$V_HOME/$user/conf/web/httpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.tpl"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
 CGI='no'
 CGI='no'
 
 
 # Preparing domain values for the template substitution
 # Preparing domain values for the template substitution
@@ -71,8 +70,8 @@ add_web_config
 
 
 # Checking ssl
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-    conf="$V_HOME/$user/conf/web/shttpd.conf"
+    tpl_file="$WEBTPL/apache_$TPL.stpl"
+    conf="$HOMEDIR/$user/conf/web/shttpd.conf"
     del_web_config
     del_web_config
     add_web_config
     add_web_config
 fi
 fi
@@ -86,10 +85,10 @@ fi
 update_domain_value 'web' '$CGI' 'no'
 update_domain_value 'web' '$CGI' 'no'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_web_domain_cgi $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_web_domain_cgi $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 17 - 18
bin/v_delete_web_domain_elog

@@ -17,10 +17,9 @@ domain=$(idn -t --quiet -u "$2" )
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -31,16 +30,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid "$user"
+is_object_valid 'user' 'USER' "$user" "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -58,8 +57,8 @@ is_domain_value_exist 'web' '$ELOG'
 
 
 # Parsing domain values
 # Parsing domain values
 get_domain_values 'web'
 get_domain_values 'web'
-tpl_file="$V_WEBTPL/apache_$TPL.tpl"
-conf="$V_HOME/$user/conf/web/httpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.tpl"
+conf="$HOMEDIR/$user/conf/web/httpd.conf"
 ELOG='no'
 ELOG='no'
 
 
 # Preparing domain values for the template substitution
 # Preparing domain values for the template substitution
@@ -71,23 +70,23 @@ add_web_config
 
 
 # Checking ssl
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$V_WEBTPL/apache_$TPL.stpl"
-    conf="$V_HOME/$user/conf/web/shttpd.conf"
+    tpl_file="$WEBTPL/apache_$TPL.stpl"
+    conf="$HOMEDIR/$user/conf/web/shttpd.conf"
     del_web_config
     del_web_config
     add_web_config
     add_web_config
 fi
 fi
 
 
 # Checking nginx
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
-    conf="$V_HOME/$user/conf/web/nginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
+    conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     del_web_config
     add_web_config
     add_web_config
 
 
     if [ "$SSL" = 'yes' ]; then
     if [ "$SSL" = 'yes' ]; then
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
         proxy_string="proxy_pass     https://$ip:$WEB_SSL_PORT;"
-        tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-        conf="$V_HOME/$user/conf/web/snginx.conf"
+        tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+        conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         del_web_config
         add_web_config
         add_web_config
     fi
     fi
@@ -102,10 +101,10 @@ fi
 update_domain_value 'web' '$ELOG' 'no'
 update_domain_value 'web' '$ELOG' 'no'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_web_domain_elog $user $domain"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_web_domain_elog $user $domain"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 16 - 17
bin/v_delete_web_domain_nginx

@@ -15,10 +15,9 @@ domain=$(idn -t --quiet -u "$2" )
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -29,16 +28,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -56,14 +55,14 @@ is_domain_value_exist 'web' '$NGINX'
 
 
 # Defining domain parameters
 # Defining domain parameters
 get_domain_values 'web'
 get_domain_values 'web'
-tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.tpl"
-conf="$V_HOME/$user/conf/nginx.conf"
+tpl_file="$WEBTPL/ngingx_vhost_$NGINX.tpl"
+conf="$HOMEDIR/$user/conf/nginx.conf"
 del_web_config
 del_web_config
 
 
 # Checking ssl
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-    conf="$V_HOME/$user/conf/snginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+    conf="$HOMEDIR/$user/conf/snginx.conf"
     del_web_config
     del_web_config
 fi
 fi
 
 
@@ -78,23 +77,23 @@ update_domain_value 'web' '$NGINX_EXT' ''
 
 
 # Checking last nginx domain
 # Checking last nginx domain
 conf='/etc/nginx/conf.d/vesta_users.conf'
 conf='/etc/nginx/conf.d/vesta_users.conf'
-last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
+last_nginx=$(grep -v "NGINX=''" $USER_DATA/web.conf)
 last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
 last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
 if [ -z "$last_snginx" ]; then
 if [ -z "$last_snginx" ]; then
     sed -i "/$user\/conf\/web\/snginx.conf/d" $conf
     sed -i "/$user\/conf\/web\/snginx.conf/d" $conf
-    rm -f $V_HOME/$user/conf/web/snginx.conf
+    rm -f $HOMEDIR/$user/conf/web/snginx.conf
 fi
 fi
 
 
 if [ -z "$last_nginx" ]; then
 if [ -z "$last_nginx" ]; then
     sed -i "/$user\/conf\/web\/nginx.conf/d" $conf
     sed -i "/$user\/conf\/web\/nginx.conf/d" $conf
-    rm -f $V_HOME/$user/conf/web/nginx.conf
+    rm -f $HOMEDIR/$user/conf/web/nginx.conf
 fi
 fi
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_web_domain_nginx $user $domain $NGINX $NGINX_EXT"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_web_domain_nginx $user $domain $NGINX $NGINX_EXT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 20 - 21
bin/v_delete_web_domain_ssl

@@ -15,10 +15,9 @@ domain=$(idn -t --quiet -u "$2" )
 domain_idn=$(idn -t --quiet -a "$domain")
 domain_idn=$(idn -t --quiet -a "$domain")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -29,16 +28,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -56,23 +55,23 @@ is_domain_value_exist 'web' '$SSL'
 
 
 # Parsing domain values
 # Parsing domain values
 get_domain_values 'web'
 get_domain_values 'web'
-conf="$V_HOME/$user/conf/web/shttpd.conf"
-tpl_file="$V_WEBTPL/apache_$TPL.stpl"
+conf="$HOMEDIR/$user/conf/web/shttpd.conf"
+tpl_file="$WEBTPL/apache_$TPL.stpl"
 
 
 # Deleting domain
 # Deleting domain
 del_web_config
 del_web_config
 
 
 # Checking nginx
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$V_WEBTPL/ngingx_vhost_$NGINX.stpl"
-    conf="$V_HOME/$user/conf/web/snginx.conf"
+    tpl_file="$WEBTPL/ngingx_vhost_$NGINX.stpl"
+    conf="$HOMEDIR/$user/conf/web/snginx.conf"
     del_web_config
     del_web_config
 fi
 fi
 
 
 # Deleting old certificate
 # Deleting old certificate
-tmpdir=$(mktemp -p $V_HOME/$user/web/$domain/private -d)
-rm -f $V_HOME/$user/conf/ssl.$domain.*
-mv $V_USERS/$user/ssl/$domain.* $tmpdir
+tmpdir=$(mktemp -p $HOMEDIR/$user/web/$domain/private -d)
+rm -f $HOMEDIR/$user/conf/ssl.$domain.*
+mv $USER_DATA/ssl/$domain.* $tmpdir
 chown -R $user:$user $tmpdir
 chown -R $user:$user $tmpdir
 
 
 
 
@@ -84,9 +83,9 @@ chown -R $user:$user $tmpdir
 update_domain_value 'web' '$SSL' 'no'
 update_domain_value 'web' '$SSL' 'no'
 
 
 # Checking last ssl domain
 # Checking last ssl domain
-ssl_dom=$(grep "SSL='yes'" $V_USERS/$user/web.conf)
+ssl_dom=$(grep "SSL='yes'" $USER_DATA/web.conf)
 main_conf='/etc/httpd/conf.d/vesta.conf'
 main_conf='/etc/httpd/conf.d/vesta.conf'
-conf="$V_HOME/$user/conf/shttpd.conf"
+conf="$HOMEDIR/$user/conf/shttpd.conf"
 if [ -z "$ssl_dom" ]; then
 if [ -z "$ssl_dom" ]; then
     sed -i "/Include ${conf////\/}/d" $main_conf
     sed -i "/Include ${conf////\/}/d" $main_conf
     rm -f $conf
     rm -f $conf
@@ -94,22 +93,22 @@ fi
 
 
 # Checking last nginx domain
 # Checking last nginx domain
 conf='/etc/nginx/conf.d/vesta_users.conf'
 conf='/etc/nginx/conf.d/vesta_users.conf'
-last_nginx=$(grep -v "NGINX=''" $V_USERS/$user/web.conf)
+last_nginx=$(grep -v "NGINX=''" $USER_DATA/web.conf)
 last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
 last_snginx=$(echo "$last_nginx" | grep "SSL='yes'")
 if [ -z "$last_snginx" ]; then
 if [ -z "$last_snginx" ]; then
 if [ -z "$last_nginx" ]; then
 if [ -z "$last_nginx" ]; then
     sed -i "/$user\/conf\/snginx.conf/d" $conf
     sed -i "/$user\/conf\/snginx.conf/d" $conf
-    rm -f $V_HOME/$user/conf/snginx.conf
+    rm -f $HOMEDIR/$user/conf/snginx.conf
 fi
 fi
 
 
 # Decreasing domain value
 # Decreasing domain value
 decrease_user_value "$user" '$U_WEB_SSL'
 decrease_user_value "$user" '$U_WEB_SSL'
 
 
 # Adding task to the vesta pipe
 # Adding task to the vesta pipe
-restart_schedule 'web'
+$BIN/v_restart_web
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_web_domain_ssl $user $domain $tmpdir $SSL_HOME"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_web_domain_ssl $user $domain $tmpdir $SSL_HOME"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 10 - 11
bin/v_delete_web_domain_stat

@@ -15,10 +15,9 @@ user=$1
 domain=$(idn -t --quiet -u "$2" )
 domain=$(idn -t --quiet -u "$2" )
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -29,16 +28,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain'
 check_args '2' "$#" 'user domain'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -58,13 +57,13 @@ is_domain_value_exist 'web' '$STATS'
 type=$(get_domain_value 'web' '$STATS')
 type=$(get_domain_value 'web' '$STATS')
 
 
 # Defining statistic dir
 # Defining statistic dir
-stat_dir="$V_HOME/$user/web/$domain/stats"
+stat_dir="$HOMEDIR/$user/web/$domain/stats"
 
 
 # Deleting dir content
 # Deleting dir content
 rm -rf $stat_dir/*
 rm -rf $stat_dir/*
 
 
 # Deleting config
 # Deleting config
-rm -f $V_HOME/$user/conf/$type.$domain.conf
+rm -f $HOMEDIR/$user/conf/$type.$domain.conf
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -78,7 +77,7 @@ sed -i "/ $domain$/d" $V_QUEUE/stats.pipe
 update_domain_value 'web' '$STATS' ''
 update_domain_value 'web' '$STATS' ''
 
 
 # Logging
 # Logging
-log_history "$V_EVENT" "v_add_web_domain_stat $user $doman $type"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT" "v_add_web_domain_stat $user $doman $type"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 11 - 12
bin/v_delete_web_domain_stat_auth

@@ -18,10 +18,9 @@ domain=$(idn -t --quiet -u "$2" )
 auth_user=$3
 auth_user=$3
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -32,16 +31,16 @@ source $V_FUNC/domain.func
 check_args '2' "$#" 'user domain [auth_user]'
 check_args '2' "$#" 'user domain [auth_user]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'
@@ -58,12 +57,12 @@ is_domain_value_exist 'web' '$STATS_AUTH'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Definining statistic dir
 # Definining statistic dir
-stat_dir="$V_HOME/$user/web/$domain/stats"
+stat_dir="$HOMEDIR/$user/web/$domain/stats"
 
 
 # Checking auth_user
 # Checking auth_user
 if [ ! -z "$auth_user" ]; then
 if [ ! -z "$auth_user" ]; then
-    format_validation 'auth_user'
-    htpasswd -D $stat_dir/.htpasswd "$auth_user" >/dev/null 2>&1
+    validate_format 'auth_user'
+    htpasswd -D $stat_dir/.htpasswd "$auth_user" &>/dev/null
 fi
 fi
 
 
 # Checking htpasswd current users
 # Checking htpasswd current users
@@ -104,7 +103,7 @@ fi
 update_domain_value 'web' '$STATS_AUTH' "$new_val"
 update_domain_value 'web' '$STATS_AUTH' "$new_val"
 
 
 # Logging
 # Logging
-log_history "$V_EVENT"
-log_event 'system' "$V_EVENT"
+log_history "$EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 9 - 10
bin/v_delete_web_domains

@@ -13,10 +13,9 @@
 user=$1
 user=$1
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -27,13 +26,13 @@ source $V_FUNC/domain.func
 check_args '1' "$#" 'user'
 check_args '1' "$#" 'user'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking web system is enabled
 # Checking web system is enabled
 is_system_enabled 'WEB_SYSTEM'
 is_system_enabled 'WEB_SYSTEM'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -41,7 +40,7 @@ is_user_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf="$V_USERS/$user/web.conf"
+conf="$USER_DATA/web.conf"
 
 
 # Defining fileds to select
 # Defining fileds to select
 field='$DOMAIN'
 field='$DOMAIN'
@@ -54,10 +53,10 @@ domains=$(dom_clear_search)
 
 
 # Starting delete loop
 # Starting delete loop
 for domain in $domains; do
 for domain in $domains; do
-    $V_BIN/v_delete_web_domain "$user" "$domain"
+    $BIN/v_delete_web_domain "$user" "$domain"
     rv="$?"
     rv="$?"
     if [ "$rv" -ne '0' ]; then
     if [ "$rv" -ne '0' ]; then
-        log_event 'debug' "$rv $V_EVENT"
+        log_event 'debug' "$rv $EVENT"
         exit $rv
         exit $rv
     fi
     fi
 done
 done
@@ -68,6 +67,6 @@ done
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 6 - 7
bin/v_get_dns_domain_value

@@ -16,10 +16,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 key=$(echo "$3"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
 key=$(echo "$3"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -30,10 +29,10 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain key'
 check_args '3' "$#" 'user domain key'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -58,6 +57,6 @@ echo "$value"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit 
 exit 

+ 6 - 7
bin/v_get_user_value

@@ -14,9 +14,8 @@ user=$1
 key=$(echo "$2"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
 key=$(echo "$2"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -27,13 +26,13 @@ source $V_FUNC/shared.func
 check_args '2' "$#" 'user key'
 check_args '2' "$#" 'user key'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking domain is not suspened
 # Checking domain is not suspened
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -52,6 +51,6 @@ echo "$value"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Logging
 # Logging
-log_event 'system' "$V_EVENT"
+log_event "$OK" "$EVENT"
 
 
 exit
 exit

+ 6 - 7
bin/v_get_web_domain_value

@@ -18,10 +18,9 @@ domain_idn=$(idn -t --quiet -a "$domain")
 key=$(echo "$3"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
 key=$(echo "$3"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/conf/vesta.conf
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -32,13 +31,13 @@ source $V_FUNC/domain.func
 check_args '3' "$#" 'user domain key'
 check_args '3' "$#" 'user domain key'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking user is active
 # Checking user is active
-is_user_suspended
+is_object_suspended 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'web'
 is_domain_valid 'web'

+ 11 - 41
bin/v_list_cron_jobs

@@ -13,27 +13,15 @@
 user=$1
 user=$1
 format=${2-shell}
 format=${2-shell}
 
 
-# Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+# Includes
+source $VESTA/func/shared.sh
 
 
-# Json function
+# Json list function
 json_list_cron() {
 json_list_cron() {
-    # Print top bracket
     echo '{'
     echo '{'
-
-    # Count fields
     fileds_count=$(echo $fields| wc -w )
     fileds_count=$(echo $fields| wc -w )
-
-    # Reading file line by line
     while read line; do
     while read line; do
-        # New delimeter
-        IFS=$'\n'
-
-        # Assing key=value pair
         eval $line
         eval $line
-
-        # Closing bracket if there already was output
         if [ -n "$data" ]; then
         if [ -n "$data" ]; then
             echo -e '        },'
             echo -e '        },'
         fi
         fi
@@ -42,13 +30,10 @@ json_list_cron() {
         for field in $fields; do
         for field in $fields; do
             eval value=\"$field\"
             eval value=\"$field\"
             value=$(echo "$value"|sed -e 's/"/\\"/g' -e "s/%quote%/'/g")
             value=$(echo "$value"|sed -e 's/"/\\"/g' -e "s/%quote%/'/g")
-
             if [ $i -eq 1 ]; then
             if [ $i -eq 1 ]; then
-                # Printing parrent
                 (( ++i))
                 (( ++i))
                 echo -e "\t\"$value\": {"
                 echo -e "\t\"$value\": {"
             else
             else
-                # Printing child
                 if [ $i -lt $fileds_count ]; then
                 if [ $i -lt $fileds_count ]; then
                     (( ++i))
                     (( ++i))
                     echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
                     echo -e "\t\t\"${field//$/}\": \"${value//,/, }\","
@@ -59,34 +44,23 @@ json_list_cron() {
             fi
             fi
         done
         done
     done < $conf
     done < $conf
-
-    # Closing bracket if there was output
     if [ -n "$data" ]; then
     if [ -n "$data" ]; then
         echo -e '        }'
         echo -e '        }'
     fi
     fi
-
-    # Printing bottom bracket
     echo -e '}'
     echo -e '}'
 }
 }
 
 
-# Shell function
+# Shell list function
 shell_list_cron() {
 shell_list_cron() {
-
     if [ -z "$nohead" ] ; then
     if [ -z "$nohead" ] ; then
-        # Print brief info
         echo "${fields//$/}"
         echo "${fields//$/}"
         for a in $fields; do
         for a in $fields; do
             echo -e "------ \c"
             echo -e "------ \c"
         done
         done
         echo
         echo
     fi
     fi
-
-    # Reading file line by line
     while read line ; do
     while read line ; do
-        # Assing key=value pair
         eval $line
         eval $line
-
-        # Print result
         eval echo "$fields" | sed -e "s/%quote%/'/g"
         eval echo "$fields" | sed -e "s/%quote%/'/g"
     done < $conf
     done < $conf
 }
 }
@@ -96,14 +70,9 @@ shell_list_cron() {
 #                    Verifications                         #
 #                    Verifications                         #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Checking args
 check_args '1' "$#" 'user [format]'
 check_args '1' "$#" 'user [format]'
-
-# Checking argument format
-format_validation 'user'
-
-# Checking user
-is_user_valid
+validate_format 'user'
+is_object_valid 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -111,19 +80,20 @@ is_user_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf=$V_USERS/$user/cron.conf
+conf=$USER_DATA/cron.conf
 
 
 # Defining fileds to select
 # Defining fileds to select
-fields='$JOB $MIN $HOUR $DAY $MONTH $WDAY $CMD $SUSPENDED $DATE'
+fields='$JOB $MIN $HOUR $DAY $MONTH $WDAY $CMD $SUSPENDED $TIME $DATE'
 
 
 # Listing domains
 # Listing domains
 case $format in 
 case $format in 
     json)   json_list_cron ;;
     json)   json_list_cron ;;
     plain)  nohead=1;
     plain)  nohead=1;
             fields="\"\$JOB\" \"\$SUSPENDED\" \"\$MIN\" \"\$HOUR\" \"\$DAY\""
             fields="\"\$JOB\" \"\$SUSPENDED\" \"\$MIN\" \"\$HOUR\" \"\$DAY\""
-            fields="$fields \"\$MONTH\" \"\$WDAY\" \"\$CMD\"";
+            fields="$fields \"\$MONTH\" \"\$WDAY\" \"\$CMD\" ";
+            fields="$fields \"\$TIME\" \"\$DATE\""
             shell_list_cron ;;
             shell_list_cron ;;
-    shell)  fields='$JOB~$SUSPEND~$MIN~$HOUR~$DAY~$MONTH~$WDAY~$CMD';
+    shell)  fields='$JOB~$SUSPENDED~$MIN~$HOUR~$DAY~$MONTH~$WDAY~$CMD';
             shell_list_cron |column -t -s '~';;
             shell_list_cron |column -t -s '~';;
     *)      check_args '1' '0' 'user [format]' ;;
     *)      check_args '1' '0' 'user [format]' ;;
 esac
 esac

+ 5 - 6
bin/v_list_db_base

@@ -15,9 +15,8 @@ database=$2
 format=${3-shell}
 format=${3-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
-source $V_FUNC/db.func
+source $VESTA/func/shared.sh
+source $VESTA/func/db.sh
 
 
 # Json function
 # Json function
 json_list_db() {
 json_list_db() {
@@ -90,10 +89,10 @@ shell_list_db() {
 check_args '2' "$#" 'user db_name [format]'
 check_args '2' "$#" 'user db_name [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'database'
+validate_format 'user' 'database'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking database exist
 # Checking database exist
 is_db_valid
 is_db_valid
@@ -104,7 +103,7 @@ is_db_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf=$V_USERS/$user/db.conf
+conf=$USER_DATA/db.conf
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$DB $USER $HOST $TYPE $CHARSET $U_DISK $SUSPENDED $DATE'
 fields='$DB $USER $HOST $TYPE $CHARSET $U_DISK $SUSPENDED $DATE'

+ 4 - 5
bin/v_list_db_bases

@@ -14,8 +14,7 @@ user=$1
 format=${2-shell}
 format=${2-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -26,10 +25,10 @@ source $V_FUNC/shared.func
 check_args '1' "$#" 'user [format]'
 check_args '1' "$#" 'user [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -37,7 +36,7 @@ is_user_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf=$V_USERS/$user/db.conf
+conf=$USER_DATA/db.conf
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$DB $USER $HOST $TYPE $CHARSET $U_DISK $SUSPENDED $DATE'
 fields='$DB $USER $HOST $TYPE $CHARSET $U_DISK $SUSPENDED $DATE'

+ 5 - 6
bin/v_list_db_host

@@ -15,9 +15,8 @@ host=$2
 format=${3-shell}
 format=${3-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
-source $V_FUNC/db.func
+source $VESTA/func/shared.sh
+source $VESTA/func/db.sh
 
 
 # Json function
 # Json function
 json_list_dbhost() {
 json_list_dbhost() {
@@ -88,10 +87,10 @@ shell_list_dbhost() {
 check_args '2' "$#" 'type host [format]'
 check_args '2' "$#" 'type host [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'host'
+validate_format 'host'
 
 
 # Checking db type
 # Checking db type
-is_type_valid 'db' "$type"
+is_type_valid "$DB_SYSTEM" "$type"
 
 
 # Checking db host
 # Checking db host
 is_db_host_valid
 is_db_host_valid
@@ -102,7 +101,7 @@ is_db_host_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config type
 # Defining config type
-conf=$V_DB/$type.conf
+conf=$VESTA/conf/$type.conf
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$HOST $PORT $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE'
 fields='$HOST $PORT $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE'

+ 4 - 8
bin/v_list_db_hosts

@@ -14,8 +14,7 @@ type=$1
 format=${2-shell}
 format=${2-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -23,13 +22,10 @@ source $V_FUNC/shared.func
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Checking args
 # Checking args
-check_args '1' "$#" 'type [format] [limit] [offset]'
-
-# Checking argument format
-format_validation 'limit' 'offset'
+check_args '1' "$#" 'type [format]'
 
 
 # Checking db type
 # Checking db type
-is_type_valid 'db' "$type"
+is_type_valid "$DB_SYSTEM" "$type"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -37,7 +33,7 @@ is_type_valid 'db' "$type"
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config type
 # Defining config type
-conf=$V_DB/$type.conf
+conf=$VESTA/conf/$type.conf
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$HOST $PORT $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE'
 fields='$HOST $PORT $MAX_DB $U_SYS_USERS $U_DB_BASES $ACTIVE $DATE'

+ 3 - 5
bin/v_list_dns_domain

@@ -16,9 +16,7 @@ domain=$2
 format=${3-shell}
 format=${3-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/func/shared.sh
 
 
 # Json function
 # Json function
 json_list_domain() {
 json_list_domain() {
@@ -82,7 +80,7 @@ shell_list_domain() {
 check_args '2' "$#" 'user domain [format]'
 check_args '2' "$#" 'user domain [format]'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -93,7 +91,7 @@ is_domain_valid 'dns'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf=$V_USERS/$user/dns.conf
+conf=$USER_DATA/dns.conf
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $RECORDS $SUSPENDED $DATE'
 fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $RECORDS $SUSPENDED $DATE'

+ 4 - 6
bin/v_list_dns_domain_records

@@ -15,9 +15,7 @@ domain=$2
 format=${3-shell}
 format=${3-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/func/shared.sh
 
 
 # Json func
 # Json func
 json_list_dns() {
 json_list_dns() {
@@ -104,10 +102,10 @@ shell_list_dns() {
 check_args '2' "$#" 'user domain [format]'
 check_args '2' "$#" 'user domain [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user' 'domain'
+validate_format 'user' 'domain'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'dns'
 is_domain_valid 'dns'
@@ -118,7 +116,7 @@ is_domain_valid 'dns'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf=$V_USERS/$user/dns/$domain
+conf=$USER_DATA/dns/$domain
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$ID $RECORD $TYPE $VALUE $SUSPENDED $DATE'
 fields='$ID $RECORD $TYPE $VALUE $SUSPENDED $DATE'

+ 4 - 5
bin/v_list_dns_domains

@@ -14,8 +14,7 @@ user=$1
 format=${2-shell}
 format=${2-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -26,10 +25,10 @@ source $V_FUNC/shared.func
 check_args '1' "$#" 'user [format]'
 check_args '1' "$#" 'user [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -37,7 +36,7 @@ is_user_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf=$V_USERS/$user/dns.conf
+conf=$USER_DATA/dns.conf
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $RECORDS $SUSPENDED $DATE'
 fields='$DOMAIN $IP $TPL $TTL $EXP $SOA $RECORDS $SUSPENDED $DATE'

+ 5 - 6
bin/v_list_dns_template

@@ -14,9 +14,8 @@ template=$1
 format=${2-shell}
 format=${2-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/func/shared.sh
+source $VESTA/func/domain.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -27,10 +26,10 @@ source $V_FUNC/domain.func
 check_args '1' "$#" 'template [format]'
 check_args '1' "$#" 'template [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'template'
+validate_format 'template'
 
 
 # Checking template
 # Checking template
-is_template_valid 'dns'
+is_dns_template_valid
 
 
 # Json func
 # Json func
 json_list_dns() {
 json_list_dns() {
@@ -112,7 +111,7 @@ shell_list_dns() {
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf=$V_DNSTPL/$template.tpl
+conf=$DNSTPL/$template.tpl
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$RECORD $TYPE $VALUE'
 fields='$RECORD $TYPE $VALUE'

+ 5 - 6
bin/v_list_dns_templates

@@ -13,8 +13,7 @@
 format=${1-shell}
 format=${1-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+source $VESTA/func/shared.sh
 
 
 # Json function
 # Json function
 json_list_dnstpl() {
 json_list_dnstpl() {
@@ -22,13 +21,13 @@ json_list_dnstpl() {
     echo '{'
     echo '{'
 
 
     # Count fields
     # Count fields
-    for template in $(ls $V_DNSTPL/| grep '.descr'); do
+    for template in $(ls $DNSTPL/| grep '.descr'); do
         # Closing bracket if there already was output
         # Closing bracket if there already was output
         if [ -n "$data" ]; then
         if [ -n "$data" ]; then
             echo -e '        },'
             echo -e '        },'
         fi
         fi
 
 
-        tpl_descr=$(cat $V_DNSTPL/$template |grep '#'|tr -d '\n')
+        tpl_descr=$(cat $DNSTPL/$template |grep '#'|tr -d '\n')
         tpl_name="${template//.descr/}"
         tpl_name="${template//.descr/}"
         echo -e  "\t\"$tpl_name\": {"
         echo -e  "\t\"$tpl_name\": {"
         echo -e "\t\t\"DESCR\": \"${tpl_descr//# /}\""
         echo -e "\t\t\"DESCR\": \"${tpl_descr//# /}\""
@@ -47,9 +46,9 @@ json_list_dnstpl() {
 
 
 # Shell function
 # Shell function
 shell_list_dnstpl() {
 shell_list_dnstpl() {
-    for template in $(ls $V_DNSTPL/| grep '.descr'); do
+    for template in $(ls $DNSTPL/| grep '.descr'); do
         tpl_name="${template//.descr/}"
         tpl_name="${template//.descr/}"
-        tpl_descr=$(cat $V_DNSTPL/$template |grep '#')
+        tpl_descr=$(cat $DNSTPL/$template |grep '#')
 
 
         # Print result
         # Print result
         if [ -z "$nohead" ] ; then
         if [ -z "$nohead" ] ; then

+ 62 - 0
bin/v_list_mail_accounts

@@ -0,0 +1,62 @@
+#!/bin/bash
+# info: list mail domain accounts
+# options: user domain [format]
+#
+# The function of obtaining the list of all user domains.
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+domain=$2
+format=${3-shell}
+
+# Importing variables
+source $VESTA/func/shared.sh
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+# Checking args
+check_args '2' "$#" 'user domain [format]'
+
+# Checking argument format
+validate_format 'user' 'domain'
+
+# Checking user
+is_object_valid 'user' 'USER' "$user"
+
+# Checking domain
+is_domain_valid 'mail'
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Defining config
+conf=$USER_DATA/mail/$domain.conf
+
+# Defining fileds to select
+fields="\$ACCOUNT \$ALIAS \$FWD \$AUTOREPLY \$U_DISK \$SUSPENDED \$DATE"
+
+# Listing domain accounts
+case $format in 
+    json)  json_list ;;
+    plain) nohead=1; shell_list ;;
+    shell) fields='$ACCOUNT $ALIAS $FWD $AUTOREPLY $U_DISK $DATE';
+           shell_list | column -t ;;
+    *)     check_args '1' '0' 'user [format]'
+esac
+
+
+#----------------------------------------------------------#
+#                       Vesta                              #
+#----------------------------------------------------------#
+
+exit

+ 3 - 5
bin/v_list_mail_domain

@@ -16,9 +16,7 @@ domain=$2
 format=${3-shell}
 format=${3-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/func/shared.sh
 
 
 # Json function
 # Json function
 json_list_domain() {
 json_list_domain() {
@@ -82,7 +80,7 @@ shell_list_domain() {
 check_args '2' "$#" 'user domain [format]'
 check_args '2' "$#" 'user domain [format]'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -93,7 +91,7 @@ is_domain_valid 'mail'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf=$V_USERS/$user/mail.conf
+conf=$USER_DATA/mail.conf
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$DOMAIN $ANTIVIRUS $ANTISPAM $DKIM $ACCOUNTS $U_DISK $CATCHALL
 fields='$DOMAIN $ANTIVIRUS $ANTISPAM $DKIM $ACCOUNTS $U_DISK $CATCHALL

+ 6 - 8
bin/v_list_mail_domain_dkim

@@ -15,9 +15,7 @@ domain=$2
 format=${3-shell}
 format=${3-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
-source $V_FUNC/domain.func
+source $VESTA/func/shared.sh
 
 
 # Json function
 # Json function
 json_list_ssl() {
 json_list_ssl() {
@@ -47,7 +45,7 @@ shell_list_ssl() {
 check_args '2' "$#" 'user domain [format]'
 check_args '2' "$#" 'user domain [format]'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 # Checking domain exist
 # Checking domain exist
 is_domain_valid 'mail'
 is_domain_valid 'mail'
@@ -56,12 +54,12 @@ is_domain_valid 'mail'
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                       Action                             #
 #                       Action                             #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
-if [ -e "$V_USERS/$user/mail/$domain.pem" ]; then
-    pem=$(cat $V_USERS/$user/mail/$domain.pem |sed -e ':a;N;$!ba;s/\n/\\n/g')
+if [ -e "$USER_DATA/mail/$domain.pem" ]; then
+    pem=$(cat $USER_DATA/mail/$domain.pem |sed -e ':a;N;$!ba;s/\n/\\n/g')
 fi
 fi
 
 
-if [ -e "$V_USERS/$user/mail/$domain.pub" ]; then
-    pub=$(cat $V_USERS/$user/mail/$domain.pub |sed -e ':a;N;$!ba;s/\n/\\n/g')
+if [ -e "$USER_DATA/mail/$domain.pub" ]; then
+    pub=$(cat $USER_DATA/mail/$domain.pub |sed -e ':a;N;$!ba;s/\n/\\n/g')
 fi
 fi
 
 
 # Listing domains
 # Listing domains

+ 5 - 6
bin/v_list_mail_domains

@@ -1,6 +1,6 @@
 #!/bin/bash
 #!/bin/bash
 # info: list mail domains
 # info: list mail domains
-# options user [format]
+# options: user [format]
 #
 #
 # The function of obtaining the list of all user domains.
 # The function of obtaining the list of all user domains.
 
 
@@ -14,8 +14,7 @@ user=$1
 format=${2-shell}
 format=${2-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+source $VESTA/func/shared.sh
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -26,10 +25,10 @@ source $V_FUNC/shared.func
 check_args '1' "$#" 'user [format]'
 check_args '1' "$#" 'user [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -37,7 +36,7 @@ is_user_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf=$V_USERS/$user/mail.conf
+conf=$USER_DATA/mail.conf
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields="\$DOMAIN \$ANTIVIRUS \$ANTISPAM \$DKIM \$ACCOUNTS \$U_DISK \$CATCHALL"
 fields="\$DOMAIN \$ANTIVIRUS \$ANTISPAM \$DKIM \$ACCOUNTS \$U_DISK \$CATCHALL"

+ 3 - 6
bin/v_list_sys_config

@@ -12,16 +12,13 @@
 # Argument defenition
 # Argument defenition
 format=${1-shell}
 format=${1-shell}
 
 
-# Importing variables
-source $VESTA/conf/vars.conf
-
 # Json function
 # Json function
 json_list_conf() {
 json_list_conf() {
-    lines=$(wc -l $V_CONF/vesta.conf | cut -f 1 -d ' ')
+    lines=$(wc -l $VESTA/conf/vesta.conf | cut -f 1 -d ' ')
     i='0'
     i='0'
     IFS=$'\n'
     IFS=$'\n'
     echo -e "{\n\t\"config\": {"
     echo -e "{\n\t\"config\": {"
-    for str in $(cat $V_CONF/vesta.conf); do
+    for str in $(cat $VESTA/conf/vesta.conf); do
         (( ++i))
         (( ++i))
         key=${str%%=*}
         key=${str%%=*}
         value=${str#*=}
         value=${str#*=}
@@ -37,7 +34,7 @@ json_list_conf() {
 # Shell function
 # Shell function
 shell_list_conf() {
 shell_list_conf() {
     IFS=$'\n'
     IFS=$'\n'
-    for str in $(cat $V_CONF/vesta.conf); do
+    for str in $(cat $VESTA/conf/vesta.conf); do
         key=${str%%=*}
         key=${str%%=*}
         value=${str#*=}
         value=${str#*=}
         echo "$key: ${value//\'/}"
         echo "$key: ${value//\'/}"

+ 1 - 2
bin/v_list_sys_interfaces

@@ -13,8 +13,7 @@
 format=${1-shell}
 format=${1-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+source $VESTA/func/shared.sh
 
 
 # Json function
 # Json function
 json_list_iface() {
 json_list_iface() {

+ 6 - 7
bin/v_list_sys_ip

@@ -15,15 +15,14 @@ IP=$ip
 format=${2-shell}
 format=${2-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
-source $V_FUNC/ip.func
+source $VESTA/func/shared.sh
+source $VESTA/func/ip.sh
 
 
 # Json function
 # Json function
 json_list_ip() {
 json_list_ip() {
     i=1
     i=1
     fileds_count=$(echo "$fields" | wc -w)
     fileds_count=$(echo "$fields" | wc -w)
-    ip_data=$(cat $V_IPS/$IP)
+    ip_data=$(cat $VESTA/data/ips/$IP)
 
 
     # Print top bracket
     # Print top bracket
     echo '{'
     echo '{'
@@ -58,7 +57,7 @@ json_list_ip() {
 
 
 # Shell function
 # Shell function
 shell_list_ip() {
 shell_list_ip() {
-    line=$(cat $V_IPS/$IP)
+    line=$(cat $VESTA/data/ips/$IP)
 
 
     # Assing key=value
     # Assing key=value
     eval $line
     eval $line
@@ -79,7 +78,7 @@ shell_list_ip() {
 check_args '1' "$#" 'ip [format]'
 check_args '1' "$#" 'ip [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'ip'
+validate_format 'ip'
 
 
 # Checking ip
 # Checking ip
 is_sys_ip_valid
 is_sys_ip_valid
@@ -87,7 +86,7 @@ is_sys_ip_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                       Action                             #
 #                       Action                             #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
-conf=$V_IPS/$IP
+conf=$VESTA/data/ips/$IP
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS
 fields='$IP $OWNER $STATUS $NAME $U_SYS_USERS $U_WEB_DOMAINS

+ 6 - 7
bin/v_list_sys_ips

@@ -13,8 +13,7 @@
 format=${1-shell}
 format=${1-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+source $VESTA/func/shared.sh
 
 
 # Json function
 # Json function
 json_list_ips() {
 json_list_ips() {
@@ -22,14 +21,14 @@ json_list_ips() {
     echo '{'
     echo '{'
 
 
     # Definining ip list
     # Definining ip list
-    ip_list=$(ls $V_IPS/)
+    ip_list=$(ls $VESTA/data/ips/)
 
 
     fileds_count=$(echo "$fields" | wc -w)
     fileds_count=$(echo "$fields" | wc -w)
 
 
     # Starting main loop
     # Starting main loop
     for IP in $ip_list; do
     for IP in $ip_list; do
         # Assing key=value
         # Assing key=value
-        ip_data=$(cat $V_IPS/$IP)
+        ip_data=$(cat $VESTA/data/ips/$IP)
         eval $ip_data
         eval $ip_data
 
 
         # Closing bracket if there already was output
         # Closing bracket if there already was output
@@ -68,7 +67,7 @@ json_list_ips() {
 
 
 # Shell function
 # Shell function
 shell_list_ips() {
 shell_list_ips() {
-    ip_list=$(ls $V_IPS/)
+    ip_list=$(ls $VESTA/data/ips/)
 
 
     if [ -z "$nohead" ]; then
     if [ -z "$nohead" ]; then
         # Print brief info
         # Print brief info
@@ -82,7 +81,7 @@ shell_list_ips() {
     # Starting main loop
     # Starting main loop
     for IP in $ip_list; do
     for IP in $ip_list; do
         # Reading user data
         # Reading user data
-        ip_data=$(cat $V_IPS/$IP)
+        ip_data=$(cat $VESTA/data/ips/$IP)
 
 
         # Assign key/value config
         # Assign key/value config
         eval $ip_data
         eval $ip_data
@@ -96,7 +95,7 @@ shell_list_ips() {
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                       Action                             #
 #                       Action                             #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
-conf=$V_IPS/*
+conf=$VESTA/data/ips/*
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields="\$IP \$OWNER \$STATUS \$NAME \$U_SYS_USERS \$U_WEB_DOMAINS"
 fields="\$IP \$OWNER \$STATUS \$NAME \$U_SYS_USERS \$U_WEB_DOMAINS"

+ 5 - 7
bin/v_list_sys_rrd

@@ -10,17 +10,15 @@
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 format=${1-shell}
 format=${1-shell}
-
-# Importing variables
-source $VESTA/conf/vars.conf
-source $V_CONF/vesta.conf
+source $VESTA/conf/vesta.conf
+RRD=$VESTA/web/rrd
 
 
 # Define json function
 # Define json function
 json_list_rrd() {
 json_list_rrd() {
     i=1
     i=1
     echo "{"
     echo "{"
     for type in $rrd_types; do
     for type in $rrd_types; do
-        for rrd in $(ls $V_RRD/$type |grep rrd$ |sed "s/\.rrd$//g"); do
+        for rrd in $(ls $RRD/$type |grep rrd$ |sed "s/\.rrd$//g"); do
             if [ "$i" -ne 1 ]; then
             if [ "$i" -ne 1 ]; then
                 echo -e "\t},"
                 echo -e "\t},"
             fi
             fi
@@ -73,8 +71,8 @@ shell_list_rrd() {
     fi
     fi
 
 
     for type in $rrd_types; do
     for type in $rrd_types; do
-        for rrd in $(ls $V_RRD/$type |grep rrd$ |sed "s/\.rrd$//g"); do
-            echo "$V_RRD/$type/$rrd.rrd"
+        for rrd in $(ls $RRD/$type |grep rrd$ |sed "s/\.rrd$//g"); do
+            echo "$RRD/$type/$rrd.rrd"
         done
         done
     done
     done
 }
 }

+ 11 - 12
bin/v_list_user

@@ -15,8 +15,7 @@ USER="$user"
 format=${2-shell}
 format=${2-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+source $VESTA/func/shared.sh
 
 
 # Json function
 # Json function
 json_list_user() {
 json_list_user() {
@@ -73,10 +72,10 @@ shell_list_user() {
 check_args '1' "$#" 'user [format]'
 check_args '1' "$#" 'user [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -84,18 +83,18 @@ is_user_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Defining config
 # Defining config
-conf=$V_USERS/$user/user.conf
+conf=$USER_DATA/user.conf
 
 
 # Defining fileds to select
 # Defining fileds to select
 fields='$USER $FNAME $LNAME $PACKAGE $WEB_DOMAINS $WEB_ALIASES $WEB_TPL 
 fields='$USER $FNAME $LNAME $PACKAGE $WEB_DOMAINS $WEB_ALIASES $WEB_TPL 
     $DNS_DOMAINS $DNS_RECORDS $MAIL_DOMAINS $MAIL_ACCOUNTS $DATABASES
     $DNS_DOMAINS $DNS_RECORDS $MAIL_DOMAINS $MAIL_ACCOUNTS $DATABASES
-    $CRON_JOBS $DISK_QUOTA $BANDWIDTH $NS $SHELL $BACKUPS $CONTACT $REPORTS
-    $RKEY $SUSPENDED $SUSPENDED_USERS $SUSPENDED_WEB $SUSPENDED_DNS
-    $SUSPENDED_MAIL $SUSPENDED_DB $SUSPENDED_CRON $IP_AVAIL $IP_OWNED $U_USERS
-    $U_DISK $U_DISK_DIRS $U_DISK_WEB $U_DISK_MAIL $U_DISK_DB $U_BANDWIDTH
-    $U_WEB_DOMAINS $U_WEB_SSL $U_WEB_ALIASES $U_DNS_DOMAINS $U_DNS_RECORDS
-    $U_MAIL_DOMAINS $U_MAIL_ACCOUNTS $U_DATABASES $U_CRON_JOBS $U_BACKUPS
-    $DATE'
+    $CRON_JOBS $DISK_QUOTA $BANDWIDTH $NS $SHELL $BACKUPS $CONTACT
+    $CRON_REPORTS $RKEY $SUSPENDED $SUSPENDED_USERS $SUSPENDED_WEB
+    $SUSPENDED_DNS $SUSPENDED_MAIL $SUSPENDED_DB $SUSPENDED_CRON $IP_AVAIL
+    $IP_OWNED $U_USERS $U_DISK $U_DISK_DIRS $U_DISK_WEB $U_DISK_MAIL $U_DISK_DB
+    $U_BANDWIDTH $U_WEB_DOMAINS $U_WEB_SSL $U_WEB_ALIASES $U_DNS_DOMAINS
+    $U_DNS_RECORDS $U_MAIL_DOMAINS $U_MAIL_ACCOUNTS $U_DATABASES $U_CRON_JOBS
+    $U_BACKUPS $TIME $DATE'
 
 
 # Listing user
 # Listing user
 case $format in 
 case $format in 

+ 4 - 5
bin/v_list_user_backups

@@ -14,8 +14,7 @@ user=$1
 format=${2-shell}
 format=${2-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+source $VESTA/func/shared.sh
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                    Verifications                         #
 #                    Verifications                         #
@@ -25,10 +24,10 @@ source $V_FUNC/shared.func
 check_args '1' "$#" 'user [format]'
 check_args '1' "$#" 'user [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
@@ -36,7 +35,7 @@ is_user_valid
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
 # Checking config
 # Checking config
-conf=$V_USERS/$user/backup.conf
+conf=$USER_DATA/backup.conf
 if [ ! -e "$conf" ]; then
 if [ ! -e "$conf" ]; then
     touch $conf
     touch $conf
 fi
 fi

+ 8 - 9
bin/v_list_user_ips

@@ -1,6 +1,6 @@
 #!/bin/bash
 #!/bin/bash
 # info: list user ips
 # info: list user ips
-# options user [format]
+# options: user [format]
 #
 #
 # The function for obtainig the list of available ip addresses.
 # The function for obtainig the list of available ip addresses.
 
 
@@ -14,16 +14,15 @@ user=$1
 format=${2-shell}
 format=${2-shell}
 
 
 # Importing variables
 # Importing variables
-source $VESTA/conf/vars.conf
-source $V_FUNC/shared.func
+source $VESTA/func/shared.sh
 
 
 # Json function
 # Json function
 json_list_user_ips() {
 json_list_user_ips() {
     # Print top bracket
     # Print top bracket
     echo '{'
     echo '{'
     fileds_count=$(echo "$fields" | wc -w)
     fileds_count=$(echo "$fields" | wc -w)
-    for IP in $(ls $V_IPS/); do
-        source $V_IPS/$IP
+    for IP in $(ls $VESTA/data/ips/); do
+        source $VESTA/data/ips/$IP
         if [ "$OWNER" = "$user" ]; then
         if [ "$OWNER" = "$user" ]; then
             # Closing bracket if there already was output
             # Closing bracket if there already was output
             if [ -n "$data" ]; then
             if [ -n "$data" ]; then
@@ -83,8 +82,8 @@ json_list_user_ips() {
 
 
 # Shell function
 # Shell function
 shell_list_user_ips() {
 shell_list_user_ips() {
-    for IP in $(ls $V_IPS/); do
-        source $V_IPS/$IP
+    for IP in $(ls $VESTA/data/ips/); do
+        source $VESTA/data/ips/$IP
         if [ "$OWNER" = "$user" ]; then
         if [ "$OWNER" = "$user" ]; then
             eval echo "$fields"
             eval echo "$fields"
         else
         else
@@ -104,10 +103,10 @@ shell_list_user_ips() {
 check_args '1' "$#" 'user [format]'
 check_args '1' "$#" 'user [format]'
 
 
 # Checking argument format
 # Checking argument format
-format_validation 'user'
+validate_format 'user'
 
 
 # Checking user
 # Checking user
-is_user_valid
+is_object_valid 'user' 'USER' "$user"
 
 
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#

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